diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-06 12:00:21 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-06 12:00:21 -0800 |
commit | b787395d8ff7a8ae0a173e25f903e5b9d425960e (patch) | |
tree | f7388f5667207676f00845ba35e90a4a1f609c72 | |
parent | 8e12485da51502aecbadd456852c845bc79f501f (diff) |
do not call run if dependencies are resolved but we were not supposed to call run in the first place
-rw-r--r-- | src/preamble.js | 3 | ||||
-rwxr-xr-x | tests/runner.py | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js index fa86fca6..cb01994f 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -871,7 +871,8 @@ function removeRunDependency(id) { clearInterval(runDependencyWatcher); runDependencyWatcher = null; } - if (!calledRun) run(); + // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false) + if (!calledRun && shouldRunNow) run(); } } Module['removeRunDependency'] = removeRunDependency; diff --git a/tests/runner.py b/tests/runner.py index 2d4146a9..2ba1ede1 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -8788,9 +8788,13 @@ f.close() self.assertNotContained('pre-run\nhello from main\npost-run\n', run_js(os.path.join(self.get_dir(), 'a.out.js'))) # noInitialRun prevents run - for no_initial_run in [0, 1]: + for no_initial_run, run_dep in [(0, 0), (1, 0), (0, 1), (1, 1)]: + print no_initial_run, run_dep Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp')]).communicate() src = 'var Module = { noInitialRun: %d };\n' % no_initial_run + open(os.path.join(self.get_dir(), 'a.out.js')).read() + if run_dep: + src = src.replace('// {{PRE_RUN_ADDITIONS}}', '// {{PRE_RUN_ADDITIONS}}\naddRunDependency("test");') \ + .replace('// {{POST_RUN_ADDITIONS}}', '// {{POST_RUN_ADDITIONS}}\nremoveRunDependency("test");') open(os.path.join(self.get_dir(), 'a.out.js'), 'w').write(src) assert ('hello from main' in run_js(os.path.join(self.get_dir(), 'a.out.js'))) != no_initial_run, 'only run if no noInitialRun' |