Commit aa066aee authored by Johannes Bechberger's avatar Johannes Bechberger

Check return code of compiled binaries

parent 489668ba
...@@ -110,7 +110,15 @@ class JavaExecTest(BasicSyntaxTest): ...@@ -110,7 +110,15 @@ class JavaExecTest(BasicSyntaxTest):
os.chdir(cwd) os.chdir(cwd)
raise raise
try: try:
out, err, _ = self.env.run_command("./" + base_filename) out, err, rtcode = self.env.run_command("./" + base_filename)
if rtcode != 0:
test_result.incorrect_msg = "binary can't be run, non zero error code"
test_result.set_error_code(rtcode)
test_result.add_long_text("Error output", err.decode())
test_result.add_long_text("Output", out.decode())
test_result.add_file("Source file", self.preprocessed_file)
os.chdir(cwd)
return test_result
except SigKill as sig: except SigKill as sig:
test_result.incorrect_msg = "binary can't be run: " + sig.name.strip() test_result.incorrect_msg = "binary can't be run: " + sig.name.strip()
test_result.set_error_code(sig.retcode) test_result.set_error_code(sig.retcode)
...@@ -184,6 +192,14 @@ class JavaInfiniteLoopTest(BasicSyntaxTest): ...@@ -184,6 +192,14 @@ class JavaInfiniteLoopTest(BasicSyntaxTest):
os.chdir(cwd) os.chdir(cwd)
return test_result return test_result
out, err, rtcode = self.env.run_command("./" + base_filename, timeout=timeout) out, err, rtcode = self.env.run_command("./" + base_filename, timeout=timeout)
if rtcode != 0:
test_result.incorrect_msg = "binary can't be run, non zero error code"
test_result.set_error_code(rtcode)
test_result.add_long_text("Error output", err.decode())
test_result.add_long_text("Output", out.decode())
test_result.add_file("Source file", self.preprocessed_file)
os.chdir(cwd)
return test_result
except SigKill as sig: except SigKill as sig:
if sig.retcode == signal.SIGXCPU: if sig.retcode == signal.SIGXCPU:
test_result.add_long_text("Output", out.decode()) test_result.add_long_text("Output", out.decode())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment