[Git][ghc/ghc][wip/hadrian-cross-stage2] Move predicates to --info rather than +RTS --info
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Wed Oct 4 09:58:01 UTC 2023
Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC
Commits:
66da8fae by Matthew Pickering at 2023-10-04T10:56:43+01:00
Move predicates to --info rather than +RTS --info
- - - - -
3 changed files:
- hadrian/src/Oracles/TestSettings.hs
- hadrian/src/Settings/Builders/RunTest.hs
- testsuite/ghc-config/ghc-config.hs
Changes:
=====================================
hadrian/src/Oracles/TestSettings.hs
=====================================
@@ -23,8 +23,8 @@ testConfigFile = buildRoot <&> (-/- "test/ghcconfig")
data TestSetting = TestHostOS
| TestWORDSIZE
| TestTARGETPLATFORM
- | TestTargetOS_CPP
- | TestTargetARCH_CPP
+ | TestTargetOS
+ | TestTargetARCH
| TestRTSWay
| TestGhcStage
| TestGhcDebugAssertions
@@ -55,8 +55,8 @@ testSetting key = do
TestHostOS -> "HostOS"
TestWORDSIZE -> "WORDSIZE"
TestTARGETPLATFORM -> "TARGETPLATFORM"
- TestTargetOS_CPP -> "TargetOS_CPP"
- TestTargetARCH_CPP -> "TargetARCH_CPP"
+ TestTargetOS -> "TargetOS"
+ TestTargetARCH -> "TargetARCH"
TestRTSWay -> "RTSWay"
TestGhcStage -> "GhcStage"
TestGhcDebugAssertions -> "GhcDebugAssertions"
=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -21,6 +21,8 @@ import Settings.Program
import qualified Context.Type
import GHC.Toolchain.Target
+import Text.Read
+import GHC.Platform.ArchOS
getTestSetting :: TestSetting -> Action String
getTestSetting key = testSetting key
@@ -167,10 +169,13 @@ outOfTreeCompilerArgs = do
debugAssertions <- getBooleanSetting TestGhcDebugAssertions
+ let readArch :: String -> Maybe Arch
+ readArch = readMaybe
+
os <- getTestSetting TestHostOS
- arch <- getTestSetting TestTargetARCH_CPP
+ arch <- maybe "unknown" stringEncodeArch . readArch <$> getTestSetting TestTargetARCH
platform <- getTestSetting TestTARGETPLATFORM
- wordsize <- getTestSetting TestWORDSIZE
+ wordsize <- show . ((8 :: Int) *) . read <$> getTestSetting TestWORDSIZE
rtsWay <- getTestSetting TestRTSWay
let debugged = "debug" `isInfixOf` rtsWay
=====================================
testsuite/ghc-config/ghc-config.hs
=====================================
@@ -9,15 +9,16 @@ main = do
info <- readProcess ghc ["+RTS", "--info"] ""
let fields = read info :: [(String,String)]
getGhcFieldOrFail fields "HostOS" "Host OS"
- getGhcFieldOrFail fields "WORDSIZE" "Word size"
- getGhcFieldOrFail fields "TARGETPLATFORM" "Target platform"
- getGhcFieldOrFail fields "TargetOS_CPP" "Target OS"
- getGhcFieldOrFail fields "TargetARCH_CPP" "Target architecture"
getGhcFieldOrFail fields "RTSWay" "RTS way"
info <- readProcess ghc ["--info"] ""
let fields = read info :: [(String,String)]
+ getGhcFieldOrFail fields "TARGETPLATFORM" "Target platform"
+ getGhcFieldOrFail fields "WORDSIZE" "target word size"
+ getGhcFieldOrFail fields "TargetOS" "target os"
+ getGhcFieldOrFail fields "TargetARCH" "target arch"
+
getGhcFieldOrFail fields "GhcStage" "Stage"
getGhcFieldOrFail fields "GhcDebugAssertions" "Debug on"
getGhcFieldOrFail fields "GhcWithNativeCodeGen" "Have native code generator"
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66da8fae4614fcbfc7ed7a6802addb2ba2c724a1
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66da8fae4614fcbfc7ed7a6802addb2ba2c724a1
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/20231004/c10c1d37/attachment-0001.html>
More information about the ghc-commits
mailing list