mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-01-12 23:38:29 +01:00
Skipped tests
This commit is contained in:
parent
0e7fcd5852
commit
037fef6880
@ -31,19 +31,22 @@ instance AsString BuildPlan where
|
||||
, makeSection "packages" $ Map.toList bpPackages
|
||||
, makeSection "core" $ Set.toList bpCore
|
||||
, makeSection "optional-core" $ Map.toList bpOptionalCore
|
||||
, makeSection "skipped-tests" $ Set.toList bpSkippedTests
|
||||
]
|
||||
fromString s1 = do
|
||||
(tools, s2) <- getSection "tools" s1
|
||||
(packages, s3) <- getSection "packages" s2
|
||||
(core, s4) <- getSection "core" s3
|
||||
(optionalCore, s5) <- getSection "optional-core" s4
|
||||
(skipped, s6) <- getSection "skipped-tests" s5
|
||||
let bp = BuildPlan
|
||||
{ bpTools = tools
|
||||
, bpPackages = Map.fromList packages
|
||||
, bpCore = Set.fromList core
|
||||
, bpOptionalCore = Map.fromList optionalCore
|
||||
, bpSkippedTests = Set.fromList skipped
|
||||
}
|
||||
return (bp, s5)
|
||||
return (bp, s6)
|
||||
|
||||
makeSection :: AsString a => String -> [a] -> String
|
||||
makeSection title contents = unlines
|
||||
|
||||
@ -80,7 +80,7 @@ loadPackageDB settings coreMap core deps = do
|
||||
_ ->
|
||||
case Tar.entryContent e of
|
||||
Tar.NormalFile bs _ -> do
|
||||
let (deps', hasTests, buildTools', mgpd, execs, mgithub) = parseDeps bs
|
||||
let (deps', hasTests, buildTools', mgpd, execs, mgithub) = parseDeps p bs
|
||||
return $ mappend pdb $ PackageDB $ Map.singleton p PackageInfo
|
||||
{ piVersion = v
|
||||
, piDeps = deps'
|
||||
@ -92,15 +92,19 @@ loadPackageDB settings coreMap core deps = do
|
||||
}
|
||||
_ -> return pdb
|
||||
|
||||
parseDeps lbs =
|
||||
skipTests p = p `Set.member` skippedTests settings
|
||||
|
||||
parseDeps p lbs =
|
||||
case parsePackageDescription $ L8.unpack lbs of
|
||||
ParseOk _ gpd -> (mconcat
|
||||
[ maybe mempty (go gpd) $ condLibrary gpd
|
||||
, mconcat $ map (go gpd . snd) $ condExecutables gpd
|
||||
, mconcat $ map (go gpd . snd) $ condTestSuites gpd
|
||||
, if skipTests p
|
||||
then mempty
|
||||
else mconcat $ map (go gpd . snd) $ condTestSuites gpd
|
||||
, mconcat $ map (go gpd . snd) $ condBenchmarks gpd
|
||||
], not $ null $ condTestSuites gpd
|
||||
, Set.fromList $ map depName $ allBuildInfo gpd
|
||||
, Set.fromList $ map depName $ allBuildInfo p gpd
|
||||
, Just gpd
|
||||
, Set.fromList $ map (Executable . fst) $ condExecutables gpd
|
||||
, listToMaybe $ catMaybes
|
||||
@ -109,10 +113,12 @@ loadPackageDB settings coreMap core deps = do
|
||||
)
|
||||
_ -> (mempty, defaultHasTestSuites, Set.empty, Nothing, Set.empty, Nothing)
|
||||
where
|
||||
allBuildInfo gpd = concat
|
||||
allBuildInfo p gpd = concat
|
||||
[ maybe mempty (goBI libBuildInfo) $ condLibrary gpd
|
||||
, concat $ map (goBI buildInfo . snd) $ condExecutables gpd
|
||||
, concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
|
||||
, if skipTests p
|
||||
then []
|
||||
else concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
|
||||
, concat $ map (goBI benchmarkBuildInfo . snd) $ condBenchmarks gpd
|
||||
]
|
||||
where
|
||||
|
||||
@ -41,6 +41,7 @@ defaultSelectSettings = SelectSettings
|
||||
, disabledFlags = Set.fromList $ words "bytestring-in-base"
|
||||
, allowedPackage = const $ Right ()
|
||||
, useGlobalDatabase = False
|
||||
, skippedTests = empty
|
||||
}
|
||||
|
||||
select :: SelectSettings -> IO BuildPlan
|
||||
@ -57,6 +58,7 @@ select settings' = do
|
||||
, bpPackages = iiPackages ii
|
||||
, bpOptionalCore = iiOptionalCore ii
|
||||
, bpCore = iiCore ii
|
||||
, bpSkippedTests = skippedTests settings'
|
||||
}
|
||||
|
||||
-- | Get all of the build tools required.
|
||||
|
||||
@ -22,13 +22,15 @@ import System.Process (runProcess, waitForProcess)
|
||||
runTestSuites :: BuildSettings -> BuildPlan -> IO ()
|
||||
runTestSuites settings' bp = do
|
||||
settings <- fixBuildSettings settings'
|
||||
let selected = bpPackages bp
|
||||
let selected = Map.filterWithKey notSkipped $ bpPackages bp
|
||||
putStrLn "Running test suites"
|
||||
let testdir = "runtests"
|
||||
rm_r testdir
|
||||
createDirectory testdir
|
||||
allPass <- parFoldM (testWorkerThreads settings) (runTestSuite settings testdir) (&&) True $ Map.toList selected
|
||||
unless allPass $ error $ "There were failures, please see the logs in " ++ testdir
|
||||
where
|
||||
notSkipped p _ = p `Set.notMember` bpSkippedTests bp
|
||||
|
||||
parFoldM :: Int -- ^ number of threads
|
||||
-> (b -> IO c)
|
||||
|
||||
@ -83,6 +83,7 @@ data BuildPlan = BuildPlan
|
||||
, bpCore :: Set PackageName
|
||||
, bpOptionalCore :: Map PackageName Version
|
||||
-- ^ See 'iiOptionalCore'
|
||||
, bpSkippedTests :: Set PackageName
|
||||
}
|
||||
|
||||
-- | Email address of a Stackage maintainer.
|
||||
@ -115,6 +116,9 @@ data SelectSettings = SelectSettings
|
||||
-- ^ Instead of checking the Haskell Platform file for core packages, query
|
||||
-- the global database. For this to be reliable, you should only have
|
||||
-- default packages in your global database. Default is @False@.
|
||||
, skippedTests :: Set PackageName
|
||||
-- ^ Do not build or run test suites, usually in order to avoid a
|
||||
-- dependency.
|
||||
}
|
||||
|
||||
data BuildStage = BSBuild | BSTest
|
||||
|
||||
Loading…
Reference in New Issue
Block a user