Commit c9d8191f authored by ufebl's avatar ufebl

Add error log if binary could not be run during benchmark

parent 7ba134b2
......@@ -63,16 +63,27 @@ class BenchExecTest(BasicSyntaxTest):
self._should_succeed = True
def _bench_command(self, cmd: str, *args: Tuple[str], timeout: int, input_bytes: str) -> _RunResult:
def _bench_command(self, cmd: str, *args: Tuple[str], compiler_flag: str, timeout: int, input_bytes: str) -> _RunResult:
runs = [] # type: List[float]
for i in range(0, self.env.bench_runs):
try:
start = time.time()
self.env.run_command(cmd, *args, timeout=timeout, input_bytes=input_bytes)
out, err, rtcode = self.env.run_command(cmd, *args, timeout=timeout, input_bytes=input_bytes)
if rtcode == 0:
runs.append((time.time() - start) * 1000)
except subprocess.CalledProcessError:
else:
_LOG.error("File \"{}\" can't be run with flags \"{}\" error code: {}".format(self.preprocessed_file, compiler_flag, rtcode))
_LOG.error("Error: " + err.decode());
return _RunResult([-1,0], False);
except SigKill as sig:
_LOG.error("File \"{}\" can't be run with flags \"{}\"".format(self.preprocessed_file, compiler_flag))
_LOG.error("Error: " + sig.name.strip() +" " + sig.retcode)
return _RunResult([-1,0], False);
except:
raise
# except subprocess.CalledProcessError:
# return _RunResult([-1,0], False);
return _RunResult(runs, True)
......@@ -124,11 +135,12 @@ class BenchExecTest(BasicSyntaxTest):
_LOG.debug("Can't find a main class, using the file name instead")
main_class = base_filename
results.append(self._bench_command("java", main_class, timeout=timeout, input_bytes=input_bytes))
results.append(self._bench_command("java", main_class, compiler_flag="javac", timeout=timeout, input_bytes=input_bytes))
else:
try:
compiler_flag = compiler_flag.replace("\\-", "-")
out, err, rtcode = self.env.run_command(self.env.mj_run_cmd, *(compiler_flag.split(" ") + [base_filename + ".java"]),
compiler_flag = compiler_flag,
timeout=timeout)
if rtcode != 0:
_LOG.error("File \"{}\" can't be compiled with flags \"{}\"".format(self.preprocessed_file, compiler_flag))
......
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