diff options
author | Alp Mestanogullari <alpmestan@gmail.com> | 2019-04-10 15:35:40 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-04-12 14:46:54 -0400 |
commit | 3c759ced1c894da2358d12fa91e20f12adf0e5bd (patch) | |
tree | a615ab03f98320b69dd10011aa4a735e91ccee8e /hadrian/src/CommandLine.hs | |
parent | 885d2e04854f038fbb899ab545df2b57d9b8bba4 (diff) | |
download | haskell-3c759ced1c894da2358d12fa91e20f12adf0e5bd.tar.gz |
Hadrian: add a --test-accept/-a flag, to mimic 'make accept'
When -a or --test-accept is passed, and if one runs the 'test' target, then
any test failing because of mismatching output and which is not expected to
fail will have its expected output adjusted by the test driver, effectively
considering the new output correct from now on.
When this flag is passed, hadrian's 'test' target becomes sensitive to the
PLATFORM and OS environment variable, just like the Make build system:
- when the PLATFORM env var is set to "YES", when accepting a result, accept it
for the current platform;
- when the OS env var is set to "YES", when accepting a result, accept it
for all wordsizes of the current operating system.
This can all be combined with `--only="..."` and `TEST="..." to only accept
the new output of a subset of tests.
Diffstat (limited to 'hadrian/src/CommandLine.hs')
-rw-r--r-- | hadrian/src/CommandLine.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/hadrian/src/CommandLine.hs b/hadrian/src/CommandLine.hs index 9c9cf9f5d2..37d6607a24 100644 --- a/hadrian/src/CommandLine.hs +++ b/hadrian/src/CommandLine.hs @@ -56,7 +56,8 @@ data TestArgs = TestArgs , testSpeed :: TestSpeed , testSummary :: Maybe FilePath , testVerbosity :: Maybe String - , testWays :: [String] } + , testWays :: [String] + , testAccept :: Bool} deriving (Eq, Show) -- | Default value for `TestArgs`. @@ -73,7 +74,8 @@ defaultTestArgs = TestArgs , testSpeed = TestNormal , testSummary = Nothing , testVerbosity = Nothing - , testWays = [] } + , testWays = [] + , testAccept = False } readConfigure :: Either String (CommandLineArgs -> CommandLineArgs) readConfigure = Right $ \flags -> flags { configure = True } @@ -124,6 +126,9 @@ readProgressInfo ms = readTestKeepFiles :: Either String (CommandLineArgs -> CommandLineArgs) readTestKeepFiles = Right $ \flags -> flags { testArgs = (testArgs flags) { testKeepFiles = True } } +readTestAccept :: Either String (CommandLineArgs -> CommandLineArgs) +readTestAccept = Right $ \flags -> flags { testArgs = (testArgs flags) { testAccept = True } } + readTestCompiler :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) readTestCompiler compiler = maybe (Left "Cannot parse compiler") (Right . set) compiler where @@ -245,7 +250,8 @@ optDescrs = , Option [] ["test-verbose"] (OptArg readTestVerbose "TEST_VERBOSE") "A verbosity value between 0 and 5. 0 is silent, 4 and higher activates extra output." , Option [] ["test-way"] (OptArg readTestWay "TEST_WAY") - "only run these ways" ] + "only run these ways" + , Option ['a'] ["test-accept"] (NoArg readTestAccept) "Accept new output of tests" ] -- | A type-indexed map containing Hadrian command line arguments to be passed -- to Shake via 'shakeExtra'. |