on master help sign in
Skipped tests
037fef6Michael Snoyman
Stackage/BuildPlan.hs+4−1
@@ -31,19 +31,22 @@ instance AsString BuildPlan where
31 , makeSection "packages" $ Map.toList bpPackages
31 , makeSection "packages" $ Map.toList bpPackages
32 , makeSection "core" $ Set.toList bpCore
32 , makeSection "core" $ Set.toList bpCore
33 , makeSection "optional-core" $ Map.toList bpOptionalCore
33 , makeSection "optional-core" $ Map.toList bpOptionalCore
34+ , makeSection "skipped-tests" $ Set.toList bpSkippedTests
34 ]
35 ]
35 fromString s1 = do
36 fromString s1 = do
36 (tools, s2) <- getSection "tools" s1
37 (tools, s2) <- getSection "tools" s1
37 (packages, s3) <- getSection "packages" s2
38 (packages, s3) <- getSection "packages" s2
38 (core, s4) <- getSection "core" s3
39 (core, s4) <- getSection "core" s3
39 (optionalCore, s5) <- getSection "optional-core" s4
40 (optionalCore, s5) <- getSection "optional-core" s4
41+ (skipped, s6) <- getSection "skipped-tests" s5
40 let bp = BuildPlan
42 let bp = BuildPlan
41 { bpTools = tools
43 { bpTools = tools
42 , bpPackages = Map.fromList packages
44 , bpPackages = Map.fromList packages
43 , bpCore = Set.fromList core
45 , bpCore = Set.fromList core
44 , bpOptionalCore = Map.fromList optionalCore
46 , bpOptionalCore = Map.fromList optionalCore
47+ , bpSkippedTests = Set.fromList skipped
45 }
48 }
46− return (bp, s5)
49+ return (bp, s6)
47
50
48makeSection :: AsString a => String -> [a] -> String
51makeSection :: AsString a => String -> [a] -> String
49makeSection title contents = unlines
52makeSection title contents = unlines
Stackage/LoadDatabase.hs+12−6
@@ -80,7 +80,7 @@ loadPackageDB settings coreMap core deps = do
80 _ ->
80 _ ->
81 case Tar.entryContent e of
81 case Tar.entryContent e of
82 Tar.NormalFile bs _ -> do
82 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
84 return $ mappend pdb $ PackageDB $ Map.singleton p PackageInfo
84 return $ mappend pdb $ PackageDB $ Map.singleton p PackageInfo
85 { piVersion = v
85 { piVersion = v
86 , piDeps = deps'
86 , piDeps = deps'
@@ -92,15 +92,19 @@ loadPackageDB settings coreMap core deps = do
92 }
92 }
93 _ -> return pdb
93 _ -> return pdb
94
94
95+ skipTests p = p `Set.member` skippedTests settings
96+
95− parseDeps lbs =
97+ parseDeps p lbs =
96 case parsePackageDescription $ L8.unpack lbs of
98 case parsePackageDescription $ L8.unpack lbs of
97 ParseOk _ gpd -> (mconcat
99 ParseOk _ gpd -> (mconcat
98 [ maybe mempty (go gpd) $ condLibrary gpd
100 [ maybe mempty (go gpd) $ condLibrary gpd
99 , mconcat $ map (go gpd . snd) $ condExecutables gpd
101 , mconcat $ map (go gpd . snd) $ condExecutables gpd
102+ , if skipTests p
103+ then mempty
100− , mconcat $ map (go gpd . snd) $ condTestSuites gpd
104+ else mconcat $ map (go gpd . snd) $ condTestSuites gpd
101 , mconcat $ map (go gpd . snd) $ condBenchmarks gpd
105 , mconcat $ map (go gpd . snd) $ condBenchmarks gpd
102 ], not $ null $ condTestSuites gpd
106 ], not $ null $ condTestSuites gpd
103− , Set.fromList $ map depName $ allBuildInfo gpd
107+ , Set.fromList $ map depName $ allBuildInfo p gpd
104 , Just gpd
108 , Just gpd
105 , Set.fromList $ map (Executable . fst) $ condExecutables gpd
109 , Set.fromList $ map (Executable . fst) $ condExecutables gpd
106 , listToMaybe $ catMaybes
110 , listToMaybe $ catMaybes
@@ -109,10 +113,12 @@ loadPackageDB settings coreMap core deps = do
109 )
113 )
110 _ -> (mempty, defaultHasTestSuites, Set.empty, Nothing, Set.empty, Nothing)
114 _ -> (mempty, defaultHasTestSuites, Set.empty, Nothing, Set.empty, Nothing)
111 where
115 where
112− allBuildInfo gpd = concat
116+ allBuildInfo p gpd = concat
113 [ maybe mempty (goBI libBuildInfo) $ condLibrary gpd
117 [ maybe mempty (goBI libBuildInfo) $ condLibrary gpd
114 , concat $ map (goBI buildInfo . snd) $ condExecutables gpd
118 , concat $ map (goBI buildInfo . snd) $ condExecutables gpd
119+ , if skipTests p
120+ then []
115− , concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
121+ else concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
116 , concat $ map (goBI benchmarkBuildInfo . snd) $ condBenchmarks gpd
122 , concat $ map (goBI benchmarkBuildInfo . snd) $ condBenchmarks gpd
117 ]
123 ]
118 where
124 where
Stackage/Select.hs+2
@@ -41,6 +41,7 @@ defaultSelectSettings = SelectSettings
41 , disabledFlags = Set.fromList $ words "bytestring-in-base"
41 , disabledFlags = Set.fromList $ words "bytestring-in-base"
42 , allowedPackage = const $ Right ()
42 , allowedPackage = const $ Right ()
43 , useGlobalDatabase = False
43 , useGlobalDatabase = False
44+ , skippedTests = empty
44 }
45 }
45
46
46select :: SelectSettings -> IO BuildPlan
47select :: SelectSettings -> IO BuildPlan
@@ -57,6 +58,7 @@ select settings' = do
57 , bpPackages = iiPackages ii
58 , bpPackages = iiPackages ii
58 , bpOptionalCore = iiOptionalCore ii
59 , bpOptionalCore = iiOptionalCore ii
59 , bpCore = iiCore ii
60 , bpCore = iiCore ii
61+ , bpSkippedTests = skippedTests settings'
60 }
62 }
61
63
62-- | Get all of the build tools required.
64-- | Get all of the build tools required.
Stackage/Test.hs+3−1
@@ -22,13 +22,15 @@ import System.Process (runProcess, waitForProcess)
22runTestSuites :: BuildSettings -> BuildPlan -> IO ()
22runTestSuites :: BuildSettings -> BuildPlan -> IO ()
23runTestSuites settings' bp = do
23runTestSuites settings' bp = do
24 settings <- fixBuildSettings settings'
24 settings <- fixBuildSettings settings'
25− let selected = bpPackages bp
25+ let selected = Map.filterWithKey notSkipped $ bpPackages bp
26 putStrLn "Running test suites"
26 putStrLn "Running test suites"
27 let testdir = "runtests"
27 let testdir = "runtests"
28 rm_r testdir
28 rm_r testdir
29 createDirectory testdir
29 createDirectory testdir
30 allPass <- parFoldM (testWorkerThreads settings) (runTestSuite settings testdir) (&&) True $ Map.toList selected
30 allPass <- parFoldM (testWorkerThreads settings) (runTestSuite settings testdir) (&&) True $ Map.toList selected
31 unless allPass $ error $ "There were failures, please see the logs in " ++ testdir
31 unless allPass $ error $ "There were failures, please see the logs in " ++ testdir
32+ where
33+ notSkipped p _ = p `Set.notMember` bpSkippedTests bp
32
34
33parFoldM :: Int -- ^ number of threads
35parFoldM :: Int -- ^ number of threads
34 -> (b -> IO c)
36 -> (b -> IO c)
Stackage/Types.hs+4
@@ -83,6 +83,7 @@ data BuildPlan = BuildPlan
83 , bpCore :: Set PackageName
83 , bpCore :: Set PackageName
84 , bpOptionalCore :: Map PackageName Version
84 , bpOptionalCore :: Map PackageName Version
85 -- ^ See 'iiOptionalCore'
85 -- ^ See 'iiOptionalCore'
86+ , bpSkippedTests :: Set PackageName
86 }
87 }
87
88
88-- | Email address of a Stackage maintainer.
89-- | Email address of a Stackage maintainer.
@@ -115,6 +116,9 @@ data SelectSettings = SelectSettings
115 -- ^ Instead of checking the Haskell Platform file for core packages, query
116 -- ^ Instead of checking the Haskell Platform file for core packages, query
116 -- the global database. For this to be reliable, you should only have
117 -- the global database. For this to be reliable, you should only have
117 -- default packages in your global database. Default is @False@.
118 -- 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.
118 }
122 }
119
123
120data BuildStage = BSBuild | BSTest
124data BuildStage = BSBuild | BSTest