diff --git a/hadrian/src/CommandLine.hs b/hadrian/src/CommandLine.hs index 6b5688059158..39b5b475c52f 100644 --- a/hadrian/src/CommandLine.hs +++ b/hadrian/src/CommandLine.hs @@ -71,6 +71,7 @@ data TestArgs = TestArgs , testJUnit :: Maybe FilePath , testMetricsFile:: Maybe FilePath , testOnly :: [String] + , testSkip :: [String] , testOnlyPerf :: Bool , testSkipPerf :: Bool , testRootDirs :: [FilePath] @@ -100,6 +101,7 @@ defaultTestArgs = TestArgs , testJUnit = Nothing , testMetricsFile= Nothing , testOnly = [] + , testSkip = [] , testOnlyPerf = False , testSkipPerf = False , testRootDirs = [] @@ -191,6 +193,13 @@ readTestOnly tests = Right $ \flags -> where tests' = maybe [] words tests tests'' flags = testOnly (testArgs flags) ++ tests' +readTestSkip :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs) +readTestSkip tests = Right $ \flags -> + flags { testArgs = (testArgs flags) { testSkip = tests'' flags } } + + where tests' = maybe [] words tests + tests'' flags = testSkip (testArgs flags) ++ tests' + readTestOnlyPerf :: Either String (CommandLineArgs -> CommandLineArgs) readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testOnlyPerf = True } } @@ -306,6 +315,8 @@ optDescrs = "Output testsuite performance metrics summary." , Option [] ["only"] (OptArg readTestOnly "TESTS") "Test cases to run." + , Option [] ["skip-test"] (OptArg readTestSkip "TESTS") + "Test cases to skip." , Option [] ["only-perf"] (NoArg readTestOnlyPerf) "Only run performance tests." , Option [] ["skip-perf"] (NoArg readTestSkipPerf) diff --git a/hadrian/src/Settings/Builders/RunTest.hs b/hadrian/src/Settings/Builders/RunTest.hs index 0531294ea961..b890282059b8 100644 --- a/hadrian/src/Settings/Builders/RunTest.hs +++ b/hadrian/src/Settings/Builders/RunTest.hs @@ -360,6 +360,7 @@ getTestArgs = do haveDocs <- willDocsBeBuilt let configFileArg= ["--config-file=" ++ (testConfigFile args)] testOnlyArg = map ("--only=" ++) (testOnly args ++ testEnvTargets) + testSkipArg = map ("--skip=" ++) (testSkip args) onlyPerfArg = if testOnlyPerf args then Just "--only-perf-tests" else Nothing @@ -399,6 +400,6 @@ getTestArgs = do inTreeArg = [ "-e", "config.in_tree_compiler=" ++ show (isInTreeCompiler (testCompiler args) || testHasInTreeFiles args) ] - pure $ configFileArg ++ testOnlyArg ++ speedArg + pure $ configFileArg ++ testOnlyArg ++ testSkipArg ++ speedArg ++ catMaybes [ onlyPerfArg, skipPerfArg, summaryArg , junitArg, metricsArg, verbosityArg ] ++ configArgs ++ wayArgs ++ compilerArg ++ ghcPkgArg