summaryrefslogtreecommitdiff
path: root/testsuite/driver/perf_notes.py
diff options
context:
space:
mode:
authorDavid Eichmann <EichmannD@gmail.com>2019-02-19 11:38:51 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-02-21 04:20:09 -0500
commit32f44ed81b0f16099d780e73ad2ea1a3cd812448 (patch)
tree7df37791de91cbc53575ccc8c3568620825a58c6 /testsuite/driver/perf_notes.py
parent2a0be1468cf440547e2ceb93f0d01d23637affc6 (diff)
downloadhaskell-32f44ed81b0f16099d780e73ad2ea1a3cd812448.tar.gz
Fix test runner crash when not in a git repo
Respect `inside_git_repo()` when checking performance stats.
Diffstat (limited to 'testsuite/driver/perf_notes.py')
-rw-r--r--testsuite/driver/perf_notes.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py
index 365732ca69..2b4835392c 100644
--- a/testsuite/driver/perf_notes.py
+++ b/testsuite/driver/perf_notes.py
@@ -23,13 +23,17 @@ from testutil import passed, failBecause
# Check if "git rev-parse" can be run successfully.
# True implies the current directory is a git repo.
+_inside_git_repo_cache = None
def inside_git_repo():
- try:
- subprocess.check_call(['git', 'rev-parse', 'HEAD'],
- stdout=subprocess.DEVNULL)
- return True
- except subprocess.CalledProcessError:
- return False
+ global _inside_git_repo_cache
+ if _inside_git_repo_cache == None:
+ try:
+ subprocess.check_call(['git', 'rev-parse', 'HEAD'],
+ stdout=subprocess.DEVNULL)
+ _inside_git_repo_cache = True
+ except subprocess.CalledProcessError:
+ _inside_git_repo_cache = False
+ return _inside_git_repo_cache
# Check if the worktree is dirty.
def is_worktree_dirty():