diff options
author | Alp Mestanogullari <alpmestan@gmail.com> | 2019-05-14 18:16:52 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-05-22 16:52:22 -0400 |
commit | 2c15b85eb2541a64df0cdf3705fb9aa068634004 (patch) | |
tree | b3d784084788fc29cc09f4115c9048bc00f44640 /hadrian/src/CommandLine.hs | |
parent | ecc9366a0e0db107c286935130837b2222e2dd82 (diff) | |
download | haskell-2c15b85eb2541a64df0cdf3705fb9aa068634004.tar.gz |
Hadrian: add --test-root-dirs, to only run specific directories of tests
We can specify several of those, by using the flag multiple times or
just once but combining the directories with ':'.
Along the way, this patch also fixes the testsuite-related --only flag,
so that we can use it many times instead of being force to specify a
space-separated list of test in a single --only flag.
Diffstat (limited to 'hadrian/src/CommandLine.hs')
-rw-r--r-- | hadrian/src/CommandLine.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/hadrian/src/CommandLine.hs b/hadrian/src/CommandLine.hs index 37d6607a24..41b2f8d0b9 100644 --- a/hadrian/src/CommandLine.hs +++ b/hadrian/src/CommandLine.hs @@ -53,6 +53,7 @@ data TestArgs = TestArgs , testOnly :: [String] , testOnlyPerf :: Bool , testSkipPerf :: Bool + , testRootDirs :: [FilePath] , testSpeed :: TestSpeed , testSummary :: Maybe FilePath , testVerbosity :: Maybe String @@ -71,6 +72,7 @@ defaultTestArgs = TestArgs , testOnly = [] , testOnlyPerf = False , testSkipPerf = False + , testRootDirs = [] , testSpeed = TestNormal , testSummary = Nothing , testVerbosity = Nothing @@ -153,9 +155,10 @@ readTestJUnit filepath = Right $ \flags -> flags { testArgs = (testArgs flags) { readTestOnly :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) readTestOnly tests = Right $ \flags -> - flags { testArgs = (testArgs flags) { testOnly = tests' } } + flags { testArgs = (testArgs flags) { testOnly = tests'' flags } } where tests' = maybe [] words tests + tests'' flags = testOnly (testArgs flags) ++ tests' readTestOnlyPerf :: Either String (CommandLineArgs -> CommandLineArgs) readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testOnlyPerf = True } } @@ -163,6 +166,13 @@ readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testO readTestSkipPerf :: Either String (CommandLineArgs -> CommandLineArgs) readTestSkipPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testSkipPerf = True } } +readTestRootDirs :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) +readTestRootDirs rootdirs = Right $ \flags -> + flags { testArgs = (testArgs flags) { testRootDirs = rootdirs'' flags } } + + where rootdirs' = maybe [] (splitOn ":") rootdirs + rootdirs'' flags = testRootDirs (testArgs flags) ++ rootdirs' + readTestSpeed :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) readTestSpeed ms = maybe (Left "Cannot parse test-speed") (Right . set) (go =<< lower <$> ms) @@ -243,6 +253,8 @@ optDescrs = "Only run performance tests." , Option [] ["skip-perf"] (NoArg readTestSkipPerf) "Skip performance tests." + , Option [] ["test-root-dirs"] (OptArg readTestRootDirs "DIR1:[DIR2:...:DIRn]") + "Test root directories to look at (all by default)." , Option [] ["test-speed"] (OptArg readTestSpeed "SPEED") "fast, slow or normal. Normal by default" , Option [] ["summary"] (OptArg readTestSummary "TEST_SUMMARY") |