[Git][ghc/ghc][master] 2 commits: Don't quote argument to Hadrian's test-env flag (#18656)

Marge Bot gitlab at gitlab.haskell.org
Sat Sep 12 04:33:33 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
853d121a by Ryan Scott at 2020-09-12T00:33:25-04:00
Don't quote argument to Hadrian's test-env flag (#18656)

Doing so causes the name of the test environment to gain an extra
set of double quotes, which changes the name entirely.

Fixes #18656.

- - - - -
8440b5fa by Krzysztof Gogolewski at 2020-09-12T00:33:25-04:00
Make sure we can read past perf notes

See #18656.

- - - - -


2 changed files:

- hadrian/src/Settings/Builders/RunTest.hs
- testsuite/driver/perf_notes.py


Changes:

=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -142,7 +142,7 @@ runTestBuilderArgs = builder RunTest ? do
             , case perfBaseline of
                 Just commit | not (null commit) -> arg ("--perf-baseline=" ++ show commit)
                 _ -> mempty
-            , emitWhenSet testEnv $ \env -> arg ("--test-env=" ++ show env)
+            , emitWhenSet testEnv $ \env -> arg ("--test-env=" ++ env)
             , emitWhenSet testMetricsFile $ \file -> arg ("--metrics-file=" ++ file)
             , getTestArgs -- User-provided arguments from command line.
             ]


=====================================
testsuite/driver/perf_notes.py
=====================================
@@ -130,7 +130,13 @@ MetricOracles = NamedTuple("MetricOracles", [("baseline", MetricBaselineOracle),
 
 def parse_perf_stat(stat_str: str) -> PerfStat:
     field_vals = stat_str.strip('\t').split('\t')
-    return PerfStat(*field_vals) # type: ignore
+    stat = PerfStat(*field_vals) # type: ignore
+    if stat.test_env.startswith('"') and stat.test_env.endswith('"'):
+        # Due to a bug, in historical data sometimes the test_env
+        # contains additional quotation marks (#18656).
+        # Remove them, so that we can refer to past data in a uniform fashion.
+        stat = stat._replace(test_env=TestEnv(stat.test_env[1:-1]))
+    return stat
 
 # Get all recorded (in a git note) metrics for a given commit.
 # Returns an empty array if the note is not found.
@@ -662,6 +668,8 @@ def main() -> None:
         metrics = [test for test in metrics if test.stat.way == args.way]
 
     if args.test_env:
+        if '"' in args.test_env:
+            raise Exception('test_env should not contain quotation marks')
         metrics = [test for test in metrics if test.stat.test_env == args.test_env]
 
     if args.test_name:



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/389a668343c0d4f5fa095112ff98d0da6998e99d...8440b5fa1397940f2f293935927e690b34110a73

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/389a668343c0d4f5fa095112ff98d0da6998e99d...8440b5fa1397940f2f293935927e690b34110a73
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200912/8168b715/attachment-0001.html>


More information about the ghc-commits mailing list