aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-10 20:05:19 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-11-10 20:05:19 -0800
commit795bcc6e76e59824d725acea1e9c2e1c553a6658 (patch)
tree00a2c232557e754c53d1ac7cf5f7b5fa14192e9e
parent0a8dc20dfab06716146c8ecbda3518121940a737 (diff)
clear cache and run sanity checks on version bumps, this will help with relooper updates etc.1.0.1
-rwxr-xr-xtests/runner.py11
-rw-r--r--tools/shared.py19
2 files changed, 26 insertions, 4 deletions
diff --git a/tests/runner.py b/tests/runner.py
index f965ffb1..413b27f9 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -10015,6 +10015,7 @@ fi
self.assertContained(SANITY_MESSAGE, output)
assert os.path.exists(SANITY_FILE) # EMCC should have checked sanity successfully
assert mtime(SANITY_FILE) >= mtime(CONFIG_FILE)
+ assert open(SANITY_FILE).read() == EMSCRIPTEN_VERSION
self.assertNotContained(SANITY_FAIL_MESSAGE, output)
# emcc run again should not sanity check, because the sanity file is newer
@@ -10022,6 +10023,16 @@ fi
self.assertNotContained(SANITY_MESSAGE, output)
self.assertNotContained(SANITY_FAIL_MESSAGE, output)
+ # correct sanity contents mean we need not check
+ open(SANITY_FILE, 'w').write(EMSCRIPTEN_VERSION)
+ output = self.check_working(EMCC)
+ self.assertNotContained(SANITY_MESSAGE, output)
+
+ # incorrect sanity contents mean we *must* check
+ open(SANITY_FILE, 'w').write('wakawaka')
+ output = self.check_working(EMCC)
+ self.assertContained(SANITY_MESSAGE, output)
+
# but with EMCC_DEBUG=1 we should check
assert not os.environ.get('EMCC_DEBUG'), 'do not run sanity checks in debug mode!'
os.environ['EMCC_DEBUG'] = '1'
diff --git a/tools/shared.py b/tools/shared.py
index 1dc30739..f3e34c85 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -107,6 +107,10 @@ def check_node_version():
# The test runner always does this check (through |force|). emcc does this less frequently,
# only when ${EM_CONFIG}_sanity does not exist or is older than EM_CONFIG (so,
# we re-check sanity when the settings are changed)
+# We also re-check sanity and clear the cache when the version changes
+
+EMSCRIPTEN_VERSION = '1.0.1'
+
def check_sanity(force=False):
try:
if not force:
@@ -114,14 +118,21 @@ def check_sanity(force=False):
return # config stored directly in EM_CONFIG => skip sanity checks
settings_mtime = os.stat(CONFIG_FILE).st_mtime
sanity_file = CONFIG_FILE + '_sanity'
+ reason = 'unknown'
try:
sanity_mtime = os.stat(sanity_file).st_mtime
- if sanity_mtime > settings_mtime:
- return # sanity has been checked
+ if sanity_mtime <= settings_mtime:
+ reason = 'settings file has changed'
+ else:
+ sanity_version = open(sanity_file).read()
+ if sanity_version != EMSCRIPTEN_VERSION:
+ reason = 'version bump'
+ else:
+ return # all is well
except:
pass
- print >> sys.stderr, '(Emscripten: Config file changed, clearing cache)' # LLVM may have changed, etc.
+ print >> sys.stderr, '(Emscripten: %s, clearing cache)' % reason
Cache.erase()
# some warning, not fatal checks - do them even if EM_IGNORE_SANITY is on
@@ -161,7 +172,7 @@ def check_sanity(force=False):
if not force:
# Only create/update this file if the sanity check succeeded, i.e., we got here
f = open(sanity_file, 'w')
- f.write('certified\n')
+ f.write(EMSCRIPTEN_VERSION)
f.close()
except Exception, e: