From 8731ac1d24a148160e3bd8121f0f238b844dd1cc Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 21 Oct 2014 11:54:00 +0300 Subject: [PATCH] Include expected test failures in build-plan.txt Pinging @manny-fp. This change was necessary since the list of expected failures will change over time, but old build plans should *not* depend on updates to the list. This breaks the file format of build-plan.txt slightly, though it is easy to fix old files. As an example: -- BEGIN expected-failures GLUT HTF HTTP Octree ... -- END expected-failures --- Stackage/Build.hs | 5 ----- Stackage/BuildPlan.hs | 5 ++++- Stackage/InstallInfo.hs | 2 +- Stackage/Select.hs | 3 ++- Stackage/Test.hs | 7 ++++--- Stackage/Types.hs | 6 ++++-- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Stackage/Build.hs b/Stackage/Build.hs index 1b7710db..7443fbdb 100644 --- a/Stackage/Build.hs +++ b/Stackage/Build.hs @@ -26,11 +26,6 @@ defaultBuildSettings :: Maybe Int -- ^ argument to -j -> BuildSettings defaultBuildSettings cores version = BuildSettings { sandboxRoot = "sandbox" - , expectedFailuresBuild = defaultExpectedFailures version - -- FIXME This is a hack. In fact, this whole thing is a hack. The - -- expected failures should be written to the build-plan.txt file and - -- read from there. - False , extraArgs = \bs -> "-fnetwork23" : "-fhttps" : case bs of BSTest -> [] diff --git a/Stackage/BuildPlan.hs b/Stackage/BuildPlan.hs index 86034984..d9ea81b9 100644 --- a/Stackage/BuildPlan.hs +++ b/Stackage/BuildPlan.hs @@ -36,6 +36,7 @@ instance AsString BuildPlan where , makeSection "core" $ Map.toList bpCore , makeSection "optional-core" $ Map.toList bpOptionalCore , makeSection "skipped-tests" $ Set.toList bpSkippedTests + , makeSection "expected-failures" $ Set.toList bpExpectedFailures ] fromString s1 = do (tools, s2) <- getSection "tools" s1 @@ -43,14 +44,16 @@ instance AsString BuildPlan where (core, s4) <- getSection "core" s3 (optionalCore, s5) <- getSection "optional-core" s4 (skipped, s6) <- getSection "skipped-tests" s5 + (failures, s7) <- getSection "expected-failures" s6 let bp = BuildPlan { bpTools = tools , bpPackages = Map.fromList packages , bpCore = Map.fromList core , bpOptionalCore = Map.fromList optionalCore , bpSkippedTests = Set.fromList skipped + , bpExpectedFailures = Set.fromList failures } - return (bp, s6) + return (bp, s7) makeSection :: AsString a => String -> [a] -> String makeSection title contents = unlines diff --git a/Stackage/InstallInfo.hs b/Stackage/InstallInfo.hs index 9895fdf6..8f17290b 100644 --- a/Stackage/InstallInfo.hs +++ b/Stackage/InstallInfo.hs @@ -170,7 +170,7 @@ checkBadVersions :: SelectSettings checkBadVersions settings core (PackageDB pdb) buildPlan = Map.unions $ map getBadVersions $ Map.toList $ Map.filterWithKey unexpectedFailure buildPlan where - unexpectedFailure name _ = name `Set.notMember` expectedFailuresSelect settings + unexpectedFailure name _ = name `Set.notMember` expectedFailures settings getBadVersions :: (PackageName, BuildInfo) -> Map String (Map PackageName (Version, VersionRange)) getBadVersions (name, bi) diff --git a/Stackage/Select.hs b/Stackage/Select.hs index 4e816bc8..53b1a93d 100644 --- a/Stackage/Select.hs +++ b/Stackage/Select.hs @@ -23,7 +23,7 @@ defaultSelectSettings :: GhcMajorVersion -> SelectSettings defaultSelectSettings version requireHP = SelectSettings { extraCore = defaultExtraCore version - , expectedFailuresSelect = defaultExpectedFailures version requireHP + , expectedFailures = defaultExpectedFailures version requireHP , stablePackages = defaultStablePackages version , haskellPlatformDir = "hp" , requireHaskellPlatform = True @@ -82,6 +82,7 @@ select settings' = do , bpOptionalCore = iiOptionalCore ii , bpCore = iiCore ii , bpSkippedTests = skippedTests settings' + , bpExpectedFailures = expectedFailures settings' } -- | Get all of the build tools required. diff --git a/Stackage/Test.hs b/Stackage/Test.hs index 23665132..8ed58c6c 100644 --- a/Stackage/Test.hs +++ b/Stackage/Test.hs @@ -40,7 +40,7 @@ runTestSuites settings' bp = do copyBuiltInHaddocks docdir cabalVersion <- getCabalVersion - allPass <- parFoldM (testWorkerThreads settings) (runTestSuite cabalVersion settings testdir docdir) (&&) True $ Map.toList selected + allPass <- parFoldM (testWorkerThreads settings) (runTestSuite cabalVersion settings testdir docdir bp) (&&) True $ Map.toList selected unless allPass $ error $ "There were failures, please see the logs in " ++ testdir where notSkipped p _ = p `Set.notMember` bpSkippedTests bp @@ -107,9 +107,10 @@ runTestSuite :: CabalVersion -> BuildSettings -> FilePath -- ^ testdir -> FilePath -- ^ docdir + -> BuildPlan -> (PackageName, SelectedPackageInfo) -> IO Bool -runTestSuite cabalVersion settings testdir docdir (packageName, SelectedPackageInfo {..}) = do +runTestSuite cabalVersion settings testdir docdir bp (packageName, SelectedPackageInfo {..}) = do -- Set up a new environment that includes the sandboxed bin folder in PATH. env' <- getModifiedEnv settings let menv = Just $ addSandbox env' @@ -154,7 +155,7 @@ runTestSuite cabalVersion settings testdir docdir (packageName, SelectedPackageI (dir "dist" "doc" "html" packageName') (docdir package) return True - let expectedFailure = packageName `Set.member` expectedFailuresBuild settings + let expectedFailure = packageName `Set.member` bpExpectedFailures bp if passed then do removeFile logfile diff --git a/Stackage/Types.hs b/Stackage/Types.hs index 1af91f4c..0a32cb06 100644 --- a/Stackage/Types.hs +++ b/Stackage/Types.hs @@ -85,6 +85,9 @@ data BuildPlan = BuildPlan , bpOptionalCore :: Map PackageName Version -- ^ See 'iiOptionalCore' , bpSkippedTests :: Set PackageName + , bpExpectedFailures :: Set PackageName + -- ^ Expected test failures. Unlike SkippedTests, we should still try to + -- build them. } -- | Email address of a Stackage maintainer. @@ -109,7 +112,7 @@ data SelectSettings = SelectSettings -- -- Returns a reason for stripping in Left, or Right if the package is -- allowed. - , expectedFailuresSelect :: Set PackageName + , expectedFailures :: Set PackageName , excludedPackages :: Set PackageName -- ^ Packages which should be dropped from the list of stable packages, -- even if present via the Haskell Platform or @stablePackages@. If these @@ -135,7 +138,6 @@ data BuildStage = BSTools | BSBuild | BSTest data BuildSettings = BuildSettings { sandboxRoot :: FilePath , extraArgs :: BuildStage -> [String] - , expectedFailuresBuild :: Set PackageName , testWorkerThreads :: Int -- ^ How many threads to spawn for running test suites. , buildDocs :: Bool