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