aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-06 17:25:09 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-06 17:25:09 -0700
commit0266e05582042f69de08b966a7e63c6828ba25d4 (patch)
tree29aa8d9a1ae9b14feda5fb20b03f76c038a81f19
parent3ef0364bbda11df569a8e11254138c6b0b7b17c6 (diff)
restore support for noInitialRun
-rw-r--r--src/postamble.js3
-rwxr-xr-xtests/runner.py7
2 files changed, 10 insertions, 0 deletions
diff --git a/src/postamble.js b/src/postamble.js
index b14a31a1..1f4c9c04 100644
--- a/src/postamble.js
+++ b/src/postamble.js
@@ -64,6 +64,9 @@ Module['run'] = run;
#else
addRunDependency();
#endif
+if (Module['noInitialRun']) {
+ addRunDependency();
+}
if (runDependencies == 0) {
var ret = run();
diff --git a/tests/runner.py b/tests/runner.py
index 76fa7a8a..7479aaf0 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -6482,6 +6482,13 @@ f.close()
open(os.path.join(self.get_dir(), 'a.out.js'), 'w').write(src)
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]:
+ 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();
+ 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'
+
def test_eliminator(self):
input = open(path_from_root('tools', 'eliminator', 'eliminator-test.js')).read()
expected = open(path_from_root('tools', 'eliminator', 'eliminator-test-output.js')).read()