diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-23 07:33:24 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-23 07:33:24 -0800 |
commit | ef56626b6c721550dba2690dadbe05c645efa69d (patch) | |
tree | bdbb5eeed9205dbc2c2b925eaf6d579c263fbde8 /tests | |
parent | ebbde8f46f75053a6026723c57c09b82d5853377 (diff) | |
parent | 3e131aa980448a994a71aba82fcbe3840d7e2cbc (diff) |
Merge pull request #714 from juj/test_fail
test_failure_error_code
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runner.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py index 3f17cf2c..09fd7d49 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -7709,7 +7709,20 @@ f.close() finally: os.chdir(path_from_root('tests')) # Move away from the directory we are about to remove. shutil.rmtree(tempdirname) - + + def test_failure_error_code(self): + # Test that if one file is missing from the build, then emcc shouldn't succeed, and shouldn't try to produce an output file. + process = Popen(['python', EMCC, path_from_root('tests', 'hello_world.c'), 'this_file_is_missing.c', '-o', 'this_output_file_should_never_exist.js'], stdout=PIPE, stderr=PIPE) + process.communicate() + assert process.returncode is not 0, 'Trying to compile a nonexisting file should return with a nonzero error code!' + assert os.path.exists('this_output_file_should_never_exist.js') == False, 'Emcc should not produce an output file when build fails!' + + # Same goes for em++ + process = Popen(['python', EMXX, path_from_root('tests', 'hello_world.cpp'), 'this_file_is_missing.cpp', '-o', 'this_output_file_should_never_exist.js'], stdout=PIPE, stderr=PIPE) + process.communicate() + assert process.returncode is not 0, 'Trying to compile a nonexisting file should return with a nonzero error code!' + assert os.path.exists('this_output_file_should_never_exist.js') == False, 'Emcc should not produce an output file when build fails!' + def test_Os(self): for opt in ['s', '0']: output = Popen(['python', EMCC, path_from_root('tests', 'hello_world.c'), '-O' + opt], stdout=PIPE, stderr=PIPE).communicate() |