aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Austin <caustin@gmail.com>2014-06-26 21:15:07 -0700
committerChad Austin <caustin@gmail.com>2014-06-26 21:15:07 -0700
commit8e97f3fd5a0c46fc3ae739d063d9fcd863340e75 (patch)
treedb918ee080faef9dd33c5eb75c96fd616afc3a56
parent0cec2d52f17ebf8b7e1622974e8a3a6bd032edbb (diff)
many tests depend on commands failing
-rwxr-xr-xtests/runner.py23
-rw-r--r--tests/test_core.py10
2 files changed, 17 insertions, 16 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 6d3f55f8..e9479313 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -258,7 +258,7 @@ process(sys.argv[1])
err = '\n'.join(filter(lambda line: 'uccessfully compiled asm.js code' not in line, err.split('\n')))
return err
- def run_generated_code(self, engine, filename, args=[], check_timeout=True, output_nicerizer=None):
+ def run_generated_code(self, engine, filename, args=[], check_timeout=True, output_nicerizer=None, assert_returncode=0):
stdout = os.path.join(self.get_dir(), 'stdout') # use files, as PIPE can get too full and hang us
stderr = os.path.join(self.get_dir(), 'stderr')
try:
@@ -266,7 +266,7 @@ process(sys.argv[1])
except:
cwd = None
os.chdir(self.get_dir())
- run_js(filename, engine, 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'), assert_returncode=assert_returncode)
if cwd is not None:
os.chdir(cwd)
out = open(stdout, 'r').read()
@@ -445,7 +445,7 @@ process(sys.argv[1])
includes, force_c, build_ll_hook, extra_emscripten_args)
## Does a complete test - builds, runs, checks output, etc.
- def do_run(self, src, expected_output, args=[], output_nicerizer=None, output_processor=None, no_build=False, main_file=None, additional_files=[], js_engines=None, post_build=None, basename='src.cpp', libraries=[], includes=[], force_c=False, build_ll_hook=None, extra_emscripten_args=[]):
+ def do_run(self, src, expected_output, args=[], output_nicerizer=None, output_processor=None, no_build=False, main_file=None, additional_files=[], js_engines=None, post_build=None, basename='src.cpp', libraries=[], includes=[], force_c=False, build_ll_hook=None, extra_emscripten_args=[], assert_returncode=None):
if force_c or (main_file is not None and main_file[-2:]) == '.c':
basename = 'src.c'
Building.COMPILER = to_cc(Building.COMPILER)
@@ -464,7 +464,7 @@ process(sys.argv[1])
js_engines = filter(lambda engine: engine not in self.banned_js_engines, js_engines)
if len(js_engines) == 0: return self.skip('No JS engine present to run this test with. Check %s and the paths therein.' % EM_CONFIG)
for engine in js_engines:
- js_output = self.run_generated_code(engine, filename + '.o.js', args, output_nicerizer=output_nicerizer)
+ js_output = self.run_generated_code(engine, filename + '.o.js', args, output_nicerizer=output_nicerizer, assert_returncode=assert_returncode)
self.assertContained(expected_output, js_output.replace('\r\n', '\n'))
self.assertNotContained('ERROR', js_output)
@@ -477,7 +477,7 @@ process(sys.argv[1])
test_index += 1
# No building - just process an existing .ll file (or .bc, which we turn into .ll)
- def do_ll_run(self, ll_file, expected_output=None, args=[], js_engines=None, output_nicerizer=None, post_build=None, force_recompile=False, build_ll_hook=None, extra_emscripten_args=[]):
+ def do_ll_run(self, ll_file, expected_output=None, args=[], js_engines=None, output_nicerizer=None, post_build=None, force_recompile=False, build_ll_hook=None, extra_emscripten_args=[], assert_returncode=None):
filename = os.path.join(self.get_dir(), 'src.cpp')
self.prep_ll_run(filename, ll_file, force_recompile, build_ll_hook)
@@ -485,12 +485,13 @@ process(sys.argv[1])
self.ll_to_js(filename, extra_emscripten_args, post_build)
self.do_run(None,
- expected_output,
- args,
- no_build=True,
- js_engines=js_engines,
- output_nicerizer=output_nicerizer,
- post_build=None) # post_build was already done in ll_to_js, this do_run call is just to test the output
+ expected_output,
+ args,
+ no_build=True,
+ js_engines=js_engines,
+ output_nicerizer=output_nicerizer,
+ post_build=None,
+ assert_returncode=assert_returncode) # post_build was already done in ll_to_js, this do_run call is just to test the output
# Run a server and a web page. When a test runs, we tell the server about it,
diff --git a/tests/test_core.py b/tests/test_core.py
index a4579800..20278d37 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -6244,7 +6244,7 @@ def process(filename):
'''
try:
- self.do_run(src, '*nothingatall*')
+ self.do_run(src, '*nothingatall*', assert_returncode=None)
except Exception, e:
# This test *should* fail, by throwing this exception
assert 'Assertion failed: Load-store consistency assumption failure!' in str(e), str(e)
@@ -6261,7 +6261,7 @@ def process(filename):
Settings.SAFE_HEAP_LINES = ["src.cpp:99"]
try:
- self.do_run(src, '*nothingatall*')
+ self.do_run(src, '*nothingatall*', assert_returncode=None)
except Exception, e:
# This test *should* fail, by throwing this exception
assert 'Assertion failed: Load-store consistency assumption failure!' in str(e), str(e)
@@ -6311,7 +6311,7 @@ def process(filename):
Building.link([module_name + '.o', main_name + '.o'], all_name)
try:
- self.do_ll_run(all_name, '*nothingatall*')
+ self.do_ll_run(all_name, '*nothingatall*', assert_returncode=None)
except Exception, e:
# This test *should* fail, by throwing this exception
assert 'Assertion failed: Load-store consistency assumption failure!' in str(e), str(e)
@@ -6328,7 +6328,7 @@ def process(filename):
for lines in [["module.cpp:22", "main.cpp:9"], ["module.cpp:7", "main.cpp:29"], ["module.cpp:127", "main.cpp:449"], ["module.cpp:7"], ["main.cpp:9"]]:
Settings.SAFE_HEAP_LINES = lines
try:
- self.do_ll_run(all_name, '*nothingatall*')
+ self.do_ll_run(all_name, '*nothingatall*', assert_returncode=None)
except Exception, e:
# This test *should* fail, by throwing this exception
assert 'Assertion failed: Load-store consistency assumption failure!' in str(e), str(e)
@@ -6353,7 +6353,7 @@ def process(filename):
}
'''
try:
- self.do_run(src, '*nothingatall*')
+ self.do_run(src, '*nothingatall*', assert_returncode=None)
except Exception, e:
# This test *should* fail
assert 'Assertion failed: x < 15' in str(e), str(e)