Commit 2ac784ab authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

hadrian: Add --test-metrics argument

Allowing the test metric output to be captured to a file, a la
the METRIC_FILE environment variable of the make build system.
parent 1f630025
......@@ -112,6 +112,9 @@ build test --only-perf
build test --skip-perf
```
The testsuite driver will produce a summary of the observed performance metrics
if `hadrian` is passed the `--summary-metrics=<file>` flag.
## Test speed
You can run the tests in `slow`, `normal` (default) or `fast`
......
......@@ -52,6 +52,7 @@ data TestArgs = TestArgs
, testConfigFile :: String
, testConfigs :: [String]
, testJUnit :: Maybe FilePath
, testMetrics :: Maybe FilePath
, testOnly :: [String]
, testOnlyPerf :: Bool
, testSkipPerf :: Bool
......@@ -71,6 +72,7 @@ defaultTestArgs = TestArgs
, testConfigFile = "testsuite/config/ghc"
, testConfigs = []
, testJUnit = Nothing
, testMetrics = Nothing
, testOnly = []
, testOnlyPerf = False
, testSkipPerf = False
......@@ -143,6 +145,9 @@ readTestConfigFile filepath =
readTestJUnit :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
readTestJUnit filepath = Right $ \flags -> flags { testArgs = (testArgs flags) { testJUnit = filepath } }
readTestMetrics :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
readTestMetrics filepath = Right $ \flags -> flags { testArgs = (testArgs flags) { testMetrics = filepath } }
readTestOnly :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
readTestOnly tests = Right $ \flags ->
flags { testArgs = (testArgs flags) { testOnly = tests'' flags } }
......@@ -240,6 +245,8 @@ optDescrs =
"Configurations to run test, in key=value format."
, Option [] ["summary-junit"] (OptArg readTestJUnit "TEST_SUMMARY_JUNIT")
"Output testsuite summary in JUnit format."
, Option [] ["summary-metrics"] (OptArg readTestMetrics "METRICS_FILE")
"Output testsuite performance metrics summary."
, Option [] ["only"] (OptArg readTestOnly "TESTS")
"Test cases to run."
, Option [] ["only-perf"] (NoArg readTestOnlyPerf)
......
......@@ -169,6 +169,9 @@ getTestArgs = do
junitArg = case testJUnit args of
Just filepath -> Just $ "--junit=" ++ filepath
Nothing -> Nothing
metricsArg = case testMetricsFile args of
Just filepath -> Just $ "--metrics-file=" ++ filepath
Nothing -> Nothing
configArgs = concat [["-e", configArg] | configArg <- testConfigs args]
verbosityArg = case testVerbosity args of
Nothing -> Just $ "--verbose=" ++ show (fromEnum globalVerbosity)
......@@ -186,7 +189,7 @@ getTestArgs = do
pure $ configFileArg ++ testOnlyArg ++ speedArg
++ catMaybes [ onlyPerfArg, skipPerfArg, summaryArg
, junitArg, verbosityArg ]
, junitArg, metricsArg, verbosityArg ]
++ configArgs ++ wayArgs ++ compilerArg ++ ghcPkgArg
++ haddockArg ++ hp2psArg ++ hpcArg ++ inTreeArg
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment