[commit: ghc] master: Do not save performance test results if worktree is dirty. (54ee148)

git at git.haskell.org git at git.haskell.org
Tue Dec 11 23:21:48 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/54ee148c2b28d2326cfd273aed4842c2b53e2625/ghc

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

commit 54ee148c2b28d2326cfd273aed4842c2b53e2625
Author: David Eichmann <EichmannD at gmail.com>
Date:   Tue Dec 11 13:19:50 2018 -0500

    Do not save performance test results if worktree is dirty.
    
    Reviewers: bgamari, tdammers
    
    Reviewed By: bgamari, tdammers
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15924
    
    Differential Revision: https://phabricator.haskell.org/D5368


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

54ee148c2b28d2326cfd273aed4842c2b53e2625
 testsuite/driver/perf_notes.py | 4 ++++
 testsuite/driver/runtests.py   | 9 +++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py
index 5ceede7..6d80e07 100644
--- a/testsuite/driver/perf_notes.py
+++ b/testsuite/driver/perf_notes.py
@@ -30,6 +30,10 @@ def inside_git_repo():
     except subprocess.CalledProcessError:
         return False
 
+# Check if the worktree is dirty.
+def is_worktree_dirty():
+    return subprocess.check_output(['git', 'status', '--porcelain']) != b''
+
 #
 # Some data access functions. A the moment this uses git notes.
 #
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index c1e8574..02d00f0 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -25,7 +25,7 @@ import subprocess
 
 from testutil import getStdout, Watcher, str_warn, str_info
 from testglobals import getConfig, ghc_env, getTestRun, TestOptions, brokens
-from perf_notes import MetricChange, inside_git_repo
+from perf_notes import MetricChange, inside_git_repo, is_worktree_dirty
 from junit import junit
 
 # Readline sometimes spews out ANSI escapes for some values of TERM,
@@ -394,7 +394,12 @@ else:
         with open(config.metrics_file, 'a') as file:
             file.write("\n" + Perf.format_perf_stat(stats))
     elif canGitStatus and any(stats):
-        Perf.append_perf_stat(stats)
+        if is_worktree_dirty():
+            print()
+            print(str_warn('Working Tree is Dirty') + ' performance metrics will not be saved.' + \
+                                    ' Commit changes or use --metrics-file to save metrics to a file.')
+        else:
+            Perf.append_perf_stat(stats)
 
     # Write summary
     if config.summary_file:



More information about the ghc-commits mailing list