summaryrefslogtreecommitdiff
path: root/hadrian/src/CommandLine.hs
diff options
context:
space:
mode:
authorAlp Mestanogullari <alpmestan@gmail.com>2018-12-11 13:11:32 -0500
committerBen Gamari <ben@smart-cactus.org>2018-12-11 13:11:33 -0500
commita5e76a073afc8ffdde274a4cb3d09847f2d35be9 (patch)
tree6d8ddb41c55240ae285118f18e431b4c34052e72 /hadrian/src/CommandLine.hs
parent7491cedb20d15a54e905205c51aea72a13ac73aa (diff)
downloadhaskell-a5e76a073afc8ffdde274a4cb3d09847f2d35be9.tar.gz
Hadrian: ability to run a subset of the testsuite
This was supposed to be working already but didn't work when we specified several tests with --only. This patch not only fixes this but also makes it possible to specify a subset of tests to run with the TEST environment variable, like the make build system. Here are some examples: hadrian/build.sh test --only=plugins01 hadrian/build.sh test --only="plugins01 plugins02" TEST="plugins01 plugins02" hadrian/build.sh test TEST=plugins03 hadrian/build.sh test --only="plugins01 plugins02" When both the TEST environment variable and the --only flag are used, we simply concatenate the list of tests from both sources and ask the testsuite driver to run them all. This patch addresses #16026. Test Plan: hadrian/build.sh test --only="plugins01 plugins02" Reviewers: bgamari, snowleopard Reviewed By: bgamari, snowleopard Subscribers: rwbarton, carter GHC Trac Issues: #16026 Differential Revision: https://phabricator.haskell.org/D5431
Diffstat (limited to 'hadrian/src/CommandLine.hs')
-rw-r--r--hadrian/src/CommandLine.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/hadrian/src/CommandLine.hs b/hadrian/src/CommandLine.hs
index 36f3818d1d..1f940f2152 100644
--- a/hadrian/src/CommandLine.hs
+++ b/hadrian/src/CommandLine.hs
@@ -46,7 +46,7 @@ data TestArgs = TestArgs
, testConfigFile :: String
, testConfigs :: [String]
, testJUnit :: Maybe FilePath
- , testOnly :: Maybe String
+ , testOnly :: [String]
, testOnlyPerf :: Bool
, testSkipPerf :: Bool
, testSpeed :: TestSpeed
@@ -62,7 +62,7 @@ defaultTestArgs = TestArgs
, testConfigFile = "testsuite/config/ghc"
, testConfigs = []
, testJUnit = Nothing
- , testOnly = Nothing
+ , testOnly = []
, testOnlyPerf = False
, testSkipPerf = False
, testSpeed = Fast
@@ -142,7 +142,10 @@ readTestJUnit :: Maybe String -> Either String (CommandLineArgs -> CommandLineAr
readTestJUnit filepath = Right $ \flags -> flags { testArgs = (testArgs flags) { testJUnit = filepath } }
readTestOnly :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
-readTestOnly tests = Right $ \flags -> flags { testArgs = (testArgs flags) { testOnly = tests } }
+readTestOnly tests = Right $ \flags ->
+ flags { testArgs = (testArgs flags) { testOnly = tests' } }
+
+ where tests' = maybe [] words tests
readTestOnlyPerf :: Either String (CommandLineArgs -> CommandLineArgs)
readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testOnlyPerf = True } }