[commit: ghc] wip/perf-testsuite: Can now load up git note data into python (df78afc)

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


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

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

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

commit df78afc0d54f7513d855ea08e5bf56e579a2b143
Author: Jared Weakly <jweakly at pdx.edu>
Date:   Tue Jul 18 12:17:57 2017 -0700

    Can now load up git note data into python


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

df78afc0d54f7513d855ea08e5bf56e579a2b143
 testsuite/driver/runtests.py |  6 ++++--
 testsuite/driver/testutil.py | 12 +++++++++---
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 996dae1..239003c 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -337,8 +337,10 @@ else:
     sys.stdout.flush()
 
     summary(t, sys.stdout, config.no_print_summary)
-    print("Only perf tests: " + str(config.only_perf_tests) + "\n")
-    print("Skip perf tests: " + str(config.skip_perf_tests) + "\n")
+
+    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...
 
     if config.summary_file != '':
         with open(config.summary_file, 'w') as file:
diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py
index c6297ff..59906a0 100644
--- a/testsuite/driver/testutil.py
+++ b/testsuite/driver/testutil.py
@@ -47,9 +47,15 @@ def lndir(srcdir, dstdir):
             os.mkdir(dst)
             lndir(src, dst)
 
-# def git_append(note):
-# def print_metrics():
-#     print(config.accumulate_metrics)
+# This function allows one to read in git notes from the commandline
+# and then breaks it into a list of dictionaries that can be parsed
+# later on in the testing functions.
+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]
 
 # 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