Skip to content

Commit 2fe558f

Browse files
committed
Don't reuse Compiler from ScriptEnv0 to determine the TestCompiler
In the testsuite we generate a module `ScriptEnv0.hs` which records information about the compiler used to build the testsuite, the packages etc so that the test runner can then use this information to However, this is very fragile because * `ScriptEnv0.hs` is generated by a module compiled against `Cabal-3.10` * The file is compiled against `Cabal-3.11` So if any definition changes between 3.10 and 3.11 then the new version will fail to read the generated file. Really we should record the information which needs to be persisted in a more generic way (ie only depending on `base`) so that you can be sure the serialisation/deserialisation will work. This seems to have worked for a while because these data types never change.. but now `compilerAbiTag` is populated by `3.11` but not by `3.10`, which leads to bugs like haskell#9725 See haskell#9730
1 parent 125cd2d commit 2fe558f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cabal-testsuite/src/Test/Cabal/Monad.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,12 @@ runTestM mode m = withSystemTempDirectory "cabal-testsuite" $ \tmp_dir -> do
248248
-- Reconfigure according to user flags
249249
let cargs = testCommonArgs args
250250

251+
let ghc_path = case argGhcPath cargs of
252+
Just p -> p
253+
Nothing -> programPath (fromJust $ lookupProgram ghcProgram program_db0)
254+
251255
-- Reconfigure GHC
252-
(comp, platform, program_db2) <- case argGhcPath cargs of
253-
Nothing -> return (runnerCompiler senv, runnerPlatform senv, program_db0)
254-
Just ghc_path -> do
256+
(comp, platform, program_db2) <- do
255257
-- All the things that get updated paths from
256258
-- configCompilerEx. The point is to make sure
257259
-- we reconfigure these when we need them.

0 commit comments

Comments
 (0)