summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlp Mestanogullari <alpmestan@gmail.com>2019-04-17 17:14:08 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-22 14:44:11 -0400
commit51655fd8a4422fd840abd449444eb1505022f5d5 (patch)
treedaeac7e640d2be5823c46323a2e20d998785f6a0
parent1a7a329b983fa03f4115b769ede5c2e148abaad0 (diff)
downloadhaskell-51655fd8a4422fd840abd449444eb1505022f5d5.tar.gz
Hadrian: use the testsuite driver's config.haddock arg more correctly
4 haddock tests assume that .haddock files have been produced, by using the 'req_haddock' modifier. The testsuite driver assumes that this condition is satisfied if 'config.haddock' is non-empty, but before this patch Hadrian was always passing the path to where the haddock executable should be, regardless of whether it is actually there or not. Instead, we now pass an empty config.haddock when we can't find all of <build root>/docs/html/libraries/<pkg>/<pkg>.haddock>, where <pkg> ranges over array, base, ghc-prim, process and template-haskell, and pass the path to haddock when all those file exists. This has the (desired) effect of skipping the 4 tests (marked as 'missing library') when the docs haven't been built, and running the haddock tests when they have.
-rw-r--r--.gitlab-ci.yml1
-rw-r--r--hadrian/src/Settings/Builders/RunTest.hs16
2 files changed, 16 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b6fc39f150..d0f57017ad 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -144,6 +144,7 @@ lint-release-changelogs:
- ./boot
- ./configure $CONFIGURE_ARGS
- hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --docs=no-sphinx binary-dist
+ - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --docs=no-sphinx test
- mv _build/bindist/ghc*.tar.xz ghc.tar.xz
cache:
key: hadrian
diff --git a/hadrian/src/Settings/Builders/RunTest.hs b/hadrian/src/Settings/Builders/RunTest.hs
index 932b497b0f..21796478a7 100644
--- a/hadrian/src/Settings/Builders/RunTest.hs
+++ b/hadrian/src/Settings/Builders/RunTest.hs
@@ -147,6 +147,7 @@ getTestArgs = do
bindir <- expr $ getBinaryDirectory (testCompiler args)
compiler <- expr $ getCompilerPath (testCompiler args)
globalVerbosity <- shakeVerbosity <$> expr getShakeOptions
+ haveDocs <- areDocsPresent
let configFileArg= ["--config-file=" ++ (testConfigFile args)]
testOnlyArg = map ("--only=" ++) (testOnly args ++ testEnvTargets)
onlyPerfArg = if testOnlyPerf args
@@ -169,7 +170,9 @@ getTestArgs = do
wayArgs = map ("--way=" ++) (testWays args)
compilerArg = ["--config", "compiler=" ++ show (compiler)]
ghcPkgArg = ["--config", "ghc_pkg=" ++ show (bindir -/- "ghc-pkg")]
- haddockArg = ["--config", "haddock=" ++ show (bindir -/- "haddock")]
+ haddockArg = if haveDocs
+ then [ "--config", "haddock=" ++ show (bindir -/- "haddock") ]
+ else [ "--config", "haddock=" ]
hp2psArg = ["--config", "hp2ps=" ++ show (bindir -/- "hp2ps")]
hpcArg = ["--config", "hpc=" ++ show (bindir -/- "hpc")]
inTreeArg = [ "-e", "config.in_tree_compiler=" ++
@@ -181,6 +184,17 @@ getTestArgs = do
++ configArgs ++ wayArgs ++ compilerArg ++ ghcPkgArg
++ haddockArg ++ hp2psArg ++ hpcArg ++ inTreeArg
+ where areDocsPresent = expr $ do
+ root <- buildRoot
+ and <$> traverse doesFileExist (docFiles root)
+
+ docFiles root =
+ [ root -/- "docs" -/- "html" -/- "libraries" -/- p -/- (p ++ ".haddock")
+ -- list of packages from
+ -- utils/haddock/haddock-test/src/Test/Haddock/Config.hs
+ | p <- [ "array", "base", "ghc-prim", "process", "template-haskell" ]
+ ]
+
-- | Set speed for test
setTestSpeed :: TestSpeed -> String
setTestSpeed TestSlow = "0"