diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-09 20:09:45 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-09 20:47:55 -0700 |
commit | 86097bafbe336131ba9cf2d8d8d2fd1a8774e570 (patch) | |
tree | aba1ca83fda1b2c90921a2b0a7a733cc001d2843 /tests/runner.py | |
parent | fa307241513ecc2e9a7711c79ed0b3a7e321f686 (diff) |
init runtime immediately, so that even with noInitialRun we can still call filesystem-using functions and they will work
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py index 477cd29c..3baf91fd 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -3825,6 +3825,7 @@ Pass: 0.000012 0.000012''') def process(filename): src = \'\'\' var Module = { + 'noFSInit': true, 'preRun': function() { FS.createDataFile('/', 'somefile.binary', [100, 200, 50, 25, 10, 77, 123], true, false); // 200 becomes -56, since signed chars are used in memory FS.createLazyFile('/', 'test.file', 'test.file', true, false); @@ -6551,10 +6552,16 @@ f.close() # 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(); + 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' + if no_initial_run: + # Calling main later should still work, filesystem etc. must be set up. + src = open(os.path.join(self.get_dir(), 'a.out.js')).read() + '\n_main();\n'; + 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')), 'main should print when called manually' + 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() |