diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-11 18:31:10 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-11 18:31:10 -0800 |
commit | b1ee96ba0dd86ca8e1f8a14bfd0c48bdd67e58b6 (patch) | |
tree | 6853c275f90688feb5876542ca85ff146c08583e /tests/runner.py | |
parent | d13c1e87d550cb11b3502c10022039a41ac6ab10 (diff) |
refactor run_js and an additional emcc test
Diffstat (limited to 'tests/runner.py')
-rw-r--r-- | tests/runner.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/runner.py b/tests/runner.py index 0d54fd34..97adf2f0 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -147,7 +147,7 @@ class RunnerCore(unittest.TestCase): except: cwd = None os.chdir(self.get_dir()) - run_js(engine, filename, args, check_timeout, stdout=open(stdout, 'w'), stderr=open(stderr, 'w')) + run_js(filename, engine, args, check_timeout, stdout=open(stdout, 'w'), stderr=open(stderr, 'w')) if cwd is not None: os.chdir(cwd) ret = open(stdout, 'r').read() + open(stderr, 'r').read() @@ -4915,13 +4915,20 @@ JavaScript in the final linking stage of building. ''' % (shortcompiler, shortcompiler, shortcompiler), output[0], output[1]) - # emcc src.cpp or emcc src.cpp -o src.js ==> should give a .js file + # emcc src.cpp ==> writes to a.out.js, much like gcc try_delete('a.out.js') output = Popen([compiler, path_from_root('tests', 'hello_world' + suffix)], stdout=PIPE, stderr=PIPE).communicate(input) assert len(output[0]) == 0, output[0] #assert len(output[1]) == 0, output[1] # we have some debug warnings there now, FIXME - assert os.path.exists('a.out.js'), output # should be created in the current directory just like gcc, with a name similar to a.out - self.assertContained('hello, world!', run_js(None, 'a.out.js')) + assert os.path.exists('a.out.js'), output + self.assertContained('hello, world!', run_js('a.out.js')) + + # emcc src.cpp -o something.js + try_delete('something.js') + output = Popen([compiler, path_from_root('tests', 'hello_world' + suffix), '-o', 'something.js'], stdout=PIPE, stderr=PIPE).communicate(input) + assert len(output[0]) == 0, output[0] + assert os.path.exists('something.js'), output + self.assertContained('hello, world!', run_js('something.js')) # TODO: make sure all of these match gcc # TODO: when this is done, more test runner to test these (i.e., test all -Ox thoroughly) @@ -5232,7 +5239,7 @@ if __name__ == '__main__': def check_engine(engine): try: - return 'hello, world!' in run_js(engine, path_from_root('tests', 'hello_world.js')) + return 'hello, world!' in run_js(path_from_root('tests', 'hello_world.js'), engine) except Exception, e: print 'Checking JS engine %s failed. Check ~/.emscripten. Details: %s' % (str(engine), str(e)) return False |