aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2012-11-15 21:33:35 +0200
committerJukka Jylänki <jujjyl@gmail.com>2012-11-15 21:33:35 +0200
commit3e131aa980448a994a71aba82fcbe3840d7e2cbc (patch)
tree99abe912a495a941356661bf2094422aa6ea6539
parent9b846744151a4d628d76cbf2cb5c0b385bc9300d (diff)
Test that a missing file for emcc and em++ should fail with nonzero error code, and should not produce an output.
-rwxr-xr-xtests/runner.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 0baf79dc..b7e44c05 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -7592,7 +7592,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()