summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2013-01-04 18:16:56 -0500
committerMathias Stearn <mathias@10gen.com>2013-01-04 19:04:05 -0500
commit0eba42b858f33c2e016a9b0c496e22043ddecace (patch)
treec93ba6ba88f0dc3789f76b4e68e697c181fb6fac /buildscripts
parentea17746c8bada229b5b5dff7e2a5e7dce3c4ab59 (diff)
downloadmongo-0eba42b858f33c2e016a9b0c496e22043ddecace.tar.gz
Skip --only-old-fails if generated with an old version of smoke.py
Diffstat (limited to 'buildscripts')
-rwxr-xr-xbuildscripts/smoke.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/buildscripts/smoke.py b/buildscripts/smoke.py
index 3e171a13584..adc0f924199 100755
--- a/buildscripts/smoke.py
+++ b/buildscripts/smoke.py
@@ -60,6 +60,11 @@ except ImportError:
import pickle
try:
+ from hashlib import md5 # new in 2.5
+except ImportError:
+ from md5 import md5 # deprecated in 2.5
+
+try:
import json
except:
try:
@@ -769,6 +774,9 @@ def set_globals(options, tests):
# file (or stdin) rather than running a suite of js tests
file_of_commands_mode = options.File and options.mode == 'files'
+def file_version():
+ return md5(open(__file__, 'r').read()).hexdigest()
+
def clear_failfile():
if os.path.exists(failfile):
os.remove(failfile)
@@ -778,7 +786,7 @@ def run_old_fails():
try:
f = open(failfile, 'r')
- testsAndOptions = pickle.load(f)
+ state = pickle.load(f)
f.close()
except Exception:
try:
@@ -788,6 +796,12 @@ def run_old_fails():
clear_failfile()
return # This counts as passing so we will run all tests
+ if ('version' not in state or state['version'] != file_version()):
+ print "warning: old version of failfile.smoke detected. skipping recent fails"
+ clear_failfile()
+ return
+
+ testsAndOptions = state['testsAndOptions']
tests = [x[0] for x in testsAndOptions]
passed = []
try:
@@ -815,7 +829,8 @@ def run_old_fails():
if testsAndOptions:
f = open(failfile, 'w')
- pickle.dump(testsAndOptions, f)
+ state = {'version':file_version(), 'testsAndOptions':testsAndOptions}
+ pickle.dump(state, f)
else:
clear_failfile()
@@ -832,8 +847,9 @@ def add_to_failfile(tests, options):
if (test, options) not in testsAndOptions:
testsAndOptions.append( (test, options) )
+ state = {'version':file_version(), 'testsAndOptions':testsAndOptions}
f = open(failfile, 'w')
- pickle.dump(testsAndOptions, f)
+ pickle.dump(state, f)