aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar David Klempner <klempner@google.com>2015-02-11 15:57:32 -0800
committerGravatar David Klempner <klempner@google.com>2015-02-11 15:57:32 -0800
commit2573958e844ecfb03203d486cbac7ce500401395 (patch)
treec79f459d946d13348e877557be560ce0cc95d00f /tools
parent5e35b140941099ee25674ef559e5297be3399cbb (diff)
Change TestCache to parameterize whether to skip running tests.
This allows caching results with --runs_per_test.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/run_tests/run_tests.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 0a42ffc1b5..8b9cb9dc6d 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -180,14 +180,17 @@ forever = args.forever
class TestCache(object):
"""Cache for running tests."""
- def __init__(self):
+ def __init__(self, use_cache_results):
self._last_successful_run = {}
+ self._use_cache_results = use_cache_results
def should_run(self, cmdline, bin_hash):
if cmdline not in self._last_successful_run:
return True
if self._last_successful_run[cmdline] != bin_hash:
return True
+ if not self._use_cache_results:
+ return True
return False
def finished(self, cmdline, bin_hash):
@@ -228,11 +231,8 @@ def _build_and_run(check_cancelled, newline_on_success, cache):
return 0
-if runs_per_test == 1:
- test_cache = TestCache()
- test_cache.maybe_load()
-else:
- test_cache = None
+test_cache = TestCache(runs_per_test == 1)
+test_cache.maybe_load()
if forever:
success = True
@@ -249,8 +249,7 @@ if forever:
'All tests are now passing properly',
do_newline=True)
jobset.message('IDLE', 'No change detected')
- if test_cache != None:
- test_cache.save()
+ test_cache.save()
while not have_files_changed():
time.sleep(1)
else: