[Git][ghc/ghc][master] Hadrian: use the testsuite driver's config.haddock arg more correctly

Marge Bot gitlab at gitlab.haskell.org
Mon Apr 22 18:50:15 UTC 2019



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
51655fd8 by Alp Mestanogullari at 2019-04-22T18:44:11Z
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.

- - - - -


2 changed files:

- .gitlab-ci.yml
- hadrian/src/Settings/Builders/RunTest.hs


Changes:

=====================================
.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


=====================================
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"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/51655fd8a4422fd840abd449444eb1505022f5d5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/51655fd8a4422fd840abd449444eb1505022f5d5
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190422/2c453f48/attachment-0001.html>


More information about the ghc-commits mailing list