on master help sign in
Skipped tests
commit037fef688089b46c6ac45dc79538a135296a83fa authorMichael Snoyman <michael@snoyman.com> dateSun 2 Jun 2013, 14:51 (13 years ago) parent0e7fcd5
5 files changed+25−8
Stackage/BuildPlan.hs+4−1 Stackage/LoadDatabase.hs+12−6 Stackage/Select.hs+2 Stackage/Test.hs+3−1 Stackage/Types.hs+4
Stackage/BuildPlan.hs+4−1
@@ -31,19 +31,22 @@ instance AsString BuildPlan where
3131 , makeSection "packages" $ Map.toList bpPackages
3232 , makeSection "core" $ Set.toList bpCore
3333 , makeSection "optional-core" $ Map.toList bpOptionalCore
34+ , makeSection "skipped-tests" $ Set.toList bpSkippedTests
3435 ]
3536 fromString s1 = do
3637 (tools, s2) <- getSection "tools" s1
3738 (packages, s3) <- getSection "packages" s2
3839 (core, s4) <- getSection "core" s3
3940 (optionalCore, s5) <- getSection "optional-core" s4
41+ (skipped, s6) <- getSection "skipped-tests" s5
4042 let bp = BuildPlan
4143 { bpTools = tools
4244 , bpPackages = Map.fromList packages
4345 , bpCore = Set.fromList core
4446 , bpOptionalCore = Map.fromList optionalCore
47+ , bpSkippedTests = Set.fromList skipped
4548 }
46− return (bp, s5)
49+ return (bp, s6)
4750
4851makeSection :: AsString a => String -> [a] -> String
4952makeSection title contents = unlines
Stackage/LoadDatabase.hs+12−6
@@ -80,7 +80,7 @@ loadPackageDB settings coreMap core deps = do
8080 _ ->
8181 case Tar.entryContent e of
8282 Tar.NormalFile bs _ -> do
83− let (deps', hasTests, buildTools', mgpd, execs, mgithub) = parseDeps bs
83+ let (deps', hasTests, buildTools', mgpd, execs, mgithub) = parseDeps p bs
8484 return $ mappend pdb $ PackageDB $ Map.singleton p PackageInfo
8585 { piVersion = v
8686 , piDeps = deps'
@@ -92,15 +92,19 @@ loadPackageDB settings coreMap core deps = do
9292 }
9393 _ -> return pdb
9494
95− parseDeps lbs =
95+ skipTests p = p `Set.member` skippedTests settings
96+
97+ parseDeps p lbs =
9698 case parsePackageDescription $ L8.unpack lbs of
9799 ParseOk _ gpd -> (mconcat
98100 [ maybe mempty (go gpd) $ condLibrary gpd
99101 , mconcat $ map (go gpd . snd) $ condExecutables gpd
100− , mconcat $ map (go gpd . snd) $ condTestSuites gpd
102+ , if skipTests p
103+ then mempty
104+ else mconcat $ map (go gpd . snd) $ condTestSuites gpd
101105 , mconcat $ map (go gpd . snd) $ condBenchmarks gpd
102106 ], not $ null $ condTestSuites gpd
103− , Set.fromList $ map depName $ allBuildInfo gpd
107+ , Set.fromList $ map depName $ allBuildInfo p gpd
104108 , Just gpd
105109 , Set.fromList $ map (Executable . fst) $ condExecutables gpd
106110 , listToMaybe $ catMaybes
@@ -109,10 +113,12 @@ loadPackageDB settings coreMap core deps = do
109113 )
110114 _ -> (mempty, defaultHasTestSuites, Set.empty, Nothing, Set.empty, Nothing)
111115 where
112− allBuildInfo gpd = concat
116+ allBuildInfo p gpd = concat
113117 [ maybe mempty (goBI libBuildInfo) $ condLibrary gpd
114118 , concat $ map (goBI buildInfo . snd) $ condExecutables gpd
115− , concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
119+ , if skipTests p
120+ then []
121+ else concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
116122 , concat $ map (goBI benchmarkBuildInfo . snd) $ condBenchmarks gpd
117123 ]
118124 where
Stackage/Select.hs+2
@@ -41,6 +41,7 @@ defaultSelectSettings = SelectSettings
4141 , disabledFlags = Set.fromList $ words "bytestring-in-base"
4242 , allowedPackage = const $ Right ()
4343 , useGlobalDatabase = False
44+ , skippedTests = empty
4445 }
4546
4647select :: SelectSettings -> IO BuildPlan
@@ -57,6 +58,7 @@ select settings' = do
5758 , bpPackages = iiPackages ii
5859 , bpOptionalCore = iiOptionalCore ii
5960 , bpCore = iiCore ii
61+ , bpSkippedTests = skippedTests settings'
6062 }
6163
6264-- | Get all of the build tools required.
Stackage/Test.hs+3−1
@@ -22,13 +22,15 @@ import System.Process (runProcess, waitForProcess)
2222runTestSuites :: BuildSettings -> BuildPlan -> IO ()
2323runTestSuites settings' bp = do
2424 settings <- fixBuildSettings settings'
25− let selected = bpPackages bp
25+ let selected = Map.filterWithKey notSkipped $ bpPackages bp
2626 putStrLn "Running test suites"
2727 let testdir = "runtests"
2828 rm_r testdir
2929 createDirectory testdir
3030 allPass <- parFoldM (testWorkerThreads settings) (runTestSuite settings testdir) (&&) True $ Map.toList selected
3131 unless allPass $ error $ "There were failures, please see the logs in " ++ testdir
32+ where
33+ notSkipped p _ = p `Set.notMember` bpSkippedTests bp
3234
3335parFoldM :: Int -- ^ number of threads
3436 -> (b -> IO c)
Stackage/Types.hs+4
@@ -83,6 +83,7 @@ data BuildPlan = BuildPlan
8383 , bpCore :: Set PackageName
8484 , bpOptionalCore :: Map PackageName Version
8585 -- ^ See 'iiOptionalCore'
86+ , bpSkippedTests :: Set PackageName
8687 }
8788
8889-- | Email address of a Stackage maintainer.
@@ -115,6 +116,9 @@ data SelectSettings = SelectSettings
115116 -- ^ Instead of checking the Haskell Platform file for core packages, query
116117 -- the global database. For this to be reliable, you should only have
117118 -- default packages in your global database. Default is @False@.
119+ , skippedTests :: Set PackageName
120+ -- ^ Do not build or run test suites, usually in order to avoid a
121+ -- dependency.
118122 }
119123
120124data BuildStage = BSBuild | BSTest