[Git][ghc/ghc][wip/isInTreeCompiler] testsuite: Implement `isInTreeCompiler` in a more robust way

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Thu Jan 18 12:06:20 UTC 2024



Matthew Pickering pushed to branch wip/isInTreeCompiler at Glasgow Haskell Compiler / GHC


Commits:
651b4a6a by Matthew Pickering at 2024-01-18T12:06:10+00:00
testsuite: Implement `isInTreeCompiler` in a more robust way

Just a small refactoring to avoid redundantly specifying the same
strings in two different places.

- - - - -


2 changed files:

- hadrian/src/Oracles/TestSettings.hs
- hadrian/src/Rules/Test.hs


Changes:

=====================================
hadrian/src/Oracles/TestSettings.hs
=====================================
@@ -111,7 +111,7 @@ getCompilerPath "stage-cabal" = do
 getCompilerPath compiler = pure compiler
 
 isInTreeCompiler :: String -> Bool
-isInTreeCompiler c = c `elem` ["stage1","stage2","stage3"]
+isInTreeCompiler c = isJust (stageOfTestCompiler c)
 
 -- | Get the full path to the given program.
 fullPath :: Stage -> Package -> Action FilePath


=====================================
hadrian/src/Rules/Test.hs
=====================================
@@ -304,7 +304,7 @@ testRules = do
 -- We should have built them already by this point, but
 isOkToBuild :: TestArgs -> String -> Bool
 isOkToBuild args target
-   = isJust (stageOf (testCompiler args))
+   = isInTreeCompiler (testCompiler args)
   || testHasInTreeFiles args
   || target `elem` map cp_target checkPrograms
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/651b4a6a4e93eb0d93524c1de42d819637173a38

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/651b4a6a4e93eb0d93524c1de42d819637173a38
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/20240118/2c2bf821/attachment-0001.html>


More information about the ghc-commits mailing list