[commit: ghc] wip/perf-testsuite: Small changes to address Ben's comments (e04118d)

git at git.haskell.org git at git.haskell.org
Fri Jul 28 20:33:08 UTC 2017


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

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

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

commit e04118d15dd06471afda042bcb91a5f5947b0d14
Author: Jared Weakly <jweakly at pdx.edu>
Date:   Tue Jul 18 17:35:34 2017 -0700

    Small changes to address Ben's comments
    
    Signed-off-by: Jared Weakly <jweakly at pdx.edu>


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

e04118d15dd06471afda042bcb91a5f5947b0d14
 testsuite/driver/runtests.py    | 13 +++++++++----
 testsuite/driver/testglobals.py |  2 +-
 testsuite/driver/testlib.py     |  5 ++---
 testsuite/driver/testutil.py    |  6 ++++--
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 239003c..e0c652a 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -54,9 +54,9 @@ long_options = [
   "check-files-written",  # check files aren't written by multiple tests
   "verbose=",             # verbose (0,1,2 so far)
   "skip-perf-tests",      # skip performance tests
-  "only-perf-tests",       # Only do performance tests
+  "only-perf-tests",      # Only do performance tests
   "use-git-notes",        # use git notes to store metrics. NOTE: This is expected to become the default and will eventually be taken out.
-  "TEST_ENV=",            # Override default chosen test-env.
+  "test-env=",            # Override default chosen test-env.
   ]
 
 opts, args = getopt.getopt(sys.argv[1:], "e:", long_options)
@@ -125,8 +125,8 @@ for opt,arg in opts:
             sys.exit(1)
         config.verbose = int(arg)
 
-    if opt == '--TEST_ENV':
-        config.TEST_ENV = arg
+    if opt == '--test-env':
+        config.test_env = arg
 
 
 config.cygwin = False
@@ -338,6 +338,11 @@ else:
 
     summary(t, sys.stdout, config.no_print_summary)
 
+    # This here is loading up all of the git notes into memory.
+    # It's most likely in the wrong spot and I haven't fully fleshed out
+    # where exactly I'm putting this and how I'm refactoring the performance
+    # test running logic.
+    # Currently this is useful for debugging, at least.
     if config.use_git_notes:
             note = subprocess.check_output(["git","notes","--ref=perf","append","-m", "\n".join(config.accumulate_metrics)])
             parse_git_notes('perf') # Should this be hardcoded? Most likely not...
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index bd8eefe..aa81b32 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -125,7 +125,7 @@ class TestConfig:
         # To accumulate the metrics for the git notes
         self.accumulate_metrics = []
         # Has the user defined a custom test environment? Local is default.
-        self.TEST_ENV = 'local'
+        self.test_env = 'local'
 
 global config
 config = TestConfig()
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index a54fe38..a5a97fa 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1085,7 +1085,6 @@ def stats( name, way, stats_file ):
 # Check -t stats info
 
 def checkStats(name, way, stats_file, range_fields):
-
     full_name = name + '(' + way + ')'
 
     result = passed()
@@ -1111,8 +1110,8 @@ def checkStats(name, way, stats_file, range_fields):
 
             # Add val into the git note if option is set.
             if config.use_git_notes:
-                test_env = config.TEST_ENV
-                config.accumulate_metrics.append(test_env + '\t' + name + '\t' + way + '\t' + field + '\t' + str(val))
+                test_env = config.test_env
+                config.accumulate_metrics.append('\t'.join([test_env, name, way, field, str(val)]))
 
             if val < lowerBound:
                 print(field, 'value is too low:')
diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py
index 59906a0..1fe1c20 100644
--- a/testsuite/driver/testutil.py
+++ b/testsuite/driver/testutil.py
@@ -54,8 +54,10 @@ def parse_git_notes(namespace):
     logFields = ['TEST_ENV','TEST','WAY','METRIC','VALUE']
     log = subprocess.check_output(['git', 'notes', '--ref=' + namespace, 'show']).decode('utf-8')
     log = log.strip('\n').split('\n')
-    log = [entry.strip('\t').split('\t') for entry in log]
-    log = [dict(zip(logFields, row)) for row in log]
+    log = [line.strip('\t').split('\t') for line in log]
+    log = [dict(zip(logFields, field)) for field in log]
+    return log
+    # Add a print statement here if you want to see what's being loaded from git notes.
 
 # On Windows, os.symlink is not defined with Python 2.7, but is in Python 3
 # when using msys2, as GHC does. Unfortunately, only Administrative users have



More information about the ghc-commits mailing list