summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDavid Eichmann <EichmannD@gmail.com>2018-12-11 13:19:50 -0500
committerBen Gamari <ben@smart-cactus.org>2018-12-11 13:19:51 -0500
commit54ee148c2b28d2326cfd273aed4842c2b53e2625 (patch)
tree0832979cab60c5074ee32bf605c103531ee03dd6 /testsuite
parent288f681e06accbae690c46eb8a6e997fa9e5f56a (diff)
downloadhaskell-54ee148c2b28d2326cfd273aed4842c2b53e2625.tar.gz
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
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/driver/perf_notes.py4
-rw-r--r--testsuite/driver/runtests.py9
2 files changed, 11 insertions, 2 deletions
diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py
index 5ceede7be2..6d80e07e12 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 c1e85744b9..02d00f0909 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: