[commit: ghc] wip/perf-testsuite: Add name format verification to comparison function and fix boolean conditional in some test functions (2445d20)

git at git.haskell.org git at git.haskell.org
Tue Aug 29 15:12:22 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/perf-testsuite
Link       : http://ghc.haskell.org/trac/ghc/changeset/2445d20906b43a468999a117b8a4b5ebf9eacf58/ghc

>---------------------------------------------------------------

commit 2445d20906b43a468999a117b8a4b5ebf9eacf58
Author: Jared Weakly <jweakly at pdx.edu>
Date:   Tue Aug 29 08:13:53 2017 -0700

    Add name format verification to comparison function and fix boolean conditional in some test functions


>---------------------------------------------------------------

2445d20906b43a468999a117b8a4b5ebf9eacf58
 testsuite/driver/perf_notes.py | 10 ++++++++--
 testsuite/driver/testlib.py    |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py
index d0b229e..97e6d1c 100644
--- a/testsuite/driver/perf_notes.py
+++ b/testsuite/driver/perf_notes.py
@@ -102,6 +102,8 @@ def main():
 
 testing_metrics = ['bytes allocated', 'peak_megabytes_allocated', 'max_bytes_used']
 
+# These my_ functions are duplicates of functions in testlib.py that I can't import here.
+# and are mostly a consequence of some semi-ugly refactoring.
 def my_passed(reason=''):
     return {'passFail': 'pass', 'reason' : reason}
 
@@ -121,9 +123,9 @@ def test_cmp(full_name, field, val, expected, dev=20):
     if val < lowerBound:
         result = my_failBecause('value is too low:\n(If this is \
         because you have improved GHC, please\nupdate the test so that GHC \
-        doesn\'t regress again)')
+        doesn\'t regress again)','stat')
     if val > upperBound:
-        result = my_failBecause('value is too high:\nstat is not good enough')
+        result = my_failBecause('value is too high:\nstat is not good enough','stat')
 
     if val < lowerBound or val > upperBound or config.verbose >= 4:
         length = max(len(str(x)) for x in [expected, lowerBound, upperBound, val])
@@ -147,6 +149,10 @@ def comparison(metric='all', deviation=20, compiler=False):
     return lambda name, opts, m=metric, d=deviation, c=compiler: _comparison(name, opts, m, d, c)
 
 def _comparison(name, opts, metric, deviation, is_compiler_test):
+    if not re.match('^[0-9]*[a-zA-Z][a-zA-Z0-9._-]*$', name):
+        # my_framework_fail(name, 'bad_name', 'This test has an invalid name')
+        my_failBecause('This test has an invalid name.')
+
     tests = parse_git_notes('perf','HEAD^')
 
     # Might have multiple metrics being measured for a single test.
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 042e330..7cb3269 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1192,7 +1192,7 @@ def simple_run(name, way, prog, extra_run_opts):
     my_rts_flags = rts_flags(way)
 
     stats_file = name + '.stats'
-    if not opts.is_compiler_test:
+    if isStatsTest() and not opts.is_compiler_test:
         stats_args = ' +RTS -V0 -t' + stats_file + ' --machine-readable -RTS'
     else:
         stats_args = ''



More information about the ghc-commits mailing list