Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL at Glasgow Haskell Compiler / GHC Commits: 0192cafe by Sven Tennie at 2026-06-15T09:12:41+00:00 haddock-test: add --ghc-pkg-path flag to fix cross testsuite GHCJS cross builds now run the haddock testsuite (no longer skipped via --docs=none), so the test binaries need an explicit ghc-pkg path. Previously Nothing was passed to Cabal's configure, causing it to search $PATH for a bare ghc-pkg that is absent in cross install directories, failing all four tests with exit code 2. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> - - - - - 2 changed files: - testsuite/tests/haddock/haddock_testsuite/Makefile - utils/haddock/haddock-test/src/Test/Haddock/Config.hs Changes: ===================================== testsuite/tests/haddock/haddock_testsuite/Makefile ===================================== @@ -26,6 +26,7 @@ htmlTest: ./html-test \ $(ACCEPT) \ --ghc-path='$(TEST_HC)' \ + --ghc-pkg-path='$(GHC_PKG)' \ --haddock-path='$(HADDOCK)' \ # Corresponds to the `latex-test` testsuite @@ -41,6 +42,7 @@ latexTest: ./latex-test \ $(ACCEPT) \ --ghc-path='$(TEST_HC)' \ + --ghc-pkg-path='$(GHC_PKG)' \ --haddock-path='$(HADDOCK)' \ # Corresponds to the `hoogle-test` testsuite @@ -56,6 +58,7 @@ hoogleTest: ./hoogle-test \ $(ACCEPT) \ --ghc-path='$(TEST_HC)' \ + --ghc-pkg-path='$(GHC_PKG)' \ --haddock-path='$(HADDOCK)' \ # Corresponds to the `hypsrc-test` testsuite @@ -71,6 +74,7 @@ hypsrcTest: ./hypsrc-test \ $(ACCEPT) \ --ghc-path='$(TEST_HC)' \ + --ghc-pkg-path='$(GHC_PKG)' \ --haddock-path='$(HADDOCK)' \ .PHONY: haddockForeignTest ===================================== utils/haddock/haddock-test/src/Test/Haddock/Config.hs ===================================== @@ -110,6 +110,7 @@ data Flag = FlagHaddockPath FilePath | FlagHaddockOptions String | FlagGhcPath FilePath + | FlagGhcPkgPath FilePath | FlagDiffTool FilePath | FlagNoDiff | FlagAccept @@ -123,6 +124,9 @@ flagsHaddockPath flags = mlast [ path | FlagHaddockPath path <- flags ] flagsGhcPath :: [Flag] -> Maybe FilePath flagsGhcPath flags = mlast [ path | FlagGhcPath path <- flags ] +flagsGhcPkgPath :: [Flag] -> Maybe FilePath +flagsGhcPkgPath flags = mlast [ path | FlagGhcPkgPath path <- flags ] + flagsHaddockOptions :: [Flag] -> [String] flagsHaddockOptions flags = concat [ words opts | FlagHaddockOptions opts <- flags ] @@ -140,6 +144,8 @@ options = "additional options to run Haddock with" , Option [] ["ghc-path"] (ReqArg FlagGhcPath "FILE") "path ghc executable" + , Option [] ["ghc-pkg-path"] (ReqArg FlagGhcPkgPath "FILE") + "path to ghc-pkg executable" , Option [] ["diff-tool"] (ReqArg FlagDiffTool "PATH") "diff tool to use when printing failed cases" , Option ['a'] ["accept"] (NoArg FlagAccept) @@ -217,7 +223,7 @@ loadConfig ccfg dcfg flags files = do , pure ["--optghc=-w"] , pure ["--optghc=-hide-all-packages"] , pure $ flagsHaddockOptions flags - , baseDependencies cfgGhcPath + , baseDependencies cfgGhcPath (flagsGhcPkgPath flags) ] cfgDiffTool <- if FlagNoDiff `elem` flags @@ -248,14 +254,14 @@ printVersions env haddockPath = do void $ waitForSuccess "Failed to run `haddock --ghc-version`" stderr handleGhc -baseDependencies :: FilePath -> IO [String] -baseDependencies ghcPath = do +baseDependencies :: FilePath -> Maybe FilePath -> IO [String] +baseDependencies ghcPath ghcPkgPath = do -- The 'getInstalledPackages' crashes if used when "GHC_PACKAGE_PATH" is -- set to some value. I am not sure why is that happening and what are the -- consequences of unsetting it - but looks like it works (for now). unsetEnv "GHC_PACKAGE_PATH" - (comp, _, cfg) <- configure normal (Just ghcPath) Nothing + (comp, _, cfg) <- configure normal (Just ghcPath) ghcPkgPath defaultProgramDb pkgIndex <- getInstalledPackages normal comp Nothing [GlobalPackageDB] cfg let View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0192cafe4afb31a125290b4231a4fcad... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0192cafe4afb31a125290b4231a4fcad... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Sven Tennie (@supersven)