Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chitrak7 committed Jun 19, 2018
1 parent bd6ab61 commit 29ea70b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/Oracles/TestSettings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Base
testConfigFile :: Action FilePath
testConfigFile = buildRoot <&> (-/- "test/ghcconfig")

-- | Test settings obtained from
-- | Test settings obtained from ghcConfig
data TestSetting = TestHostOS
| TestWORDSIZE
| TestTARGETPLATFORM
Expand All @@ -32,6 +32,7 @@ data TestSetting = TestHostOS
| TestMinGhcVersion801
deriving (Show)

-- | Lookup for testsettings in ghcconfig file
testSetting :: TestSetting -> Action String
testSetting key = do
file <- testConfigFile
Expand Down Expand Up @@ -59,6 +60,7 @@ testSetting key = do
TestMinGhcVersion801 -> "MinGhcVersion801"


-- | Get the RTS ways of the test compiler
testRTSSettings :: Action [String]
testRTSSettings = do
file <- testConfigFile
Expand Down
19 changes: 11 additions & 8 deletions src/Settings/Builders/RunTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ oneZero lbl True = lbl ++ "=1"
stringToBool :: String -> Bool
stringToBool "YES" = True
stringToBool "NO" = False

-- | An abstraction to get boolean value of some settings
getBooleanSetting :: TestSetting -> Action Bool
getBooleanSetting key = fmap stringToBool $ testSetting key

-- Arguments to send to the runtest.py script.
--
-- A lot of this mirrors what's achieved at testsuite/mk/test.mk.
Expand All @@ -33,14 +38,12 @@ runTestBuilderArgs = builder RunTest ? do
let hasRtsWay w = elem w rtsways
hasLibWay w = elem w libways
debugged = ghcDebugged flav
hasProfiling <- expr $ fmap stringToBool (testSetting TestGhcProfiled)
hasDynamic <- expr $ fmap stringToBool (testSetting TestGhcDynamic)
hasDebugged <- expr $ fmap stringToBool (testSetting TestGhcDebugged)
hasDynamicByDefault <- expr $ fmap stringToBool (testSetting TestGhcDynamicByDefault)
withNativeCodeGen <- expr $ fmap stringToBool (testSetting TestGhcWithNativeCodeGen)
withInterpreter <- expr $ fmap stringToBool (testSetting TestGhcWithInterpreter)
unregisterised <- expr $ fmap stringToBool (testSetting TestGhcUnregisterised)
withSMP <- expr $ fmap stringToBool (testSetting TestGhcWithSMP)
hasDynamic <- expr $ getBooleanSetting TestGhcDynamic
hasDynamicByDefault <- expr $ getBooleanSetting TestGhcDynamicByDefault
withNativeCodeGen <- expr $ getBooleanSetting TestGhcWithNativeCodeGen
withInterpreter <- expr $ getBooleanSetting TestGhcWithInterpreter
unregisterised <- expr $ getBooleanSetting TestGhcUnregisterised
withSMP <- expr $ getBooleanSetting TestGhcWithSMP

windows <- expr windowsHost
darwin <- expr osxHost
Expand Down

0 comments on commit 29ea70b

Please sign in to comment.