Commit de997db4 authored by Johannes Bechberger's avatar Johannes Bechberger

Add new mode `compile`

parent ed117ab4
...@@ -86,7 +86,8 @@ if True:#__name__ == '__main__': ...@@ -86,7 +86,8 @@ if True:#__name__ == '__main__':
count += ret.count count += ret.count
if args["mode"] == "all": if args["mode"] == "all":
report_subdir = datetime.now().strftime("%d-%m-%y_%H-%M-%S") report_subdir = datetime.now().strftime("%d-%m-%y_%H-%M-%S")
for mode in [TestMode.lexer, TestMode.syntax, TestMode.ast, TestMode.semantic, TestMode.compile_firm]: for mode in [TestMode.lexer, TestMode.syntax, TestMode.ast, TestMode.semantic,
TestMode.compile_firm, TestMode.compile]:
args["all_exec_tests"] = True args["all_exec_tests"] = True
args["report_subdir"] = report_subdir + "_" + mode args["report_subdir"] = report_subdir + "_" + mode
cprint("Run {} tests".format(mode), attrs=["bold"]) cprint("Run {} tests".format(mode), attrs=["bold"])
......
...@@ -32,6 +32,8 @@ class TestMode: ...@@ -32,6 +32,8 @@ class TestMode:
compile_firm = "compile-firm" compile_firm = "compile-firm"
compile = "compile"
exec = "exec" exec = "exec"
bench = "bench" bench = "bench"
...@@ -39,12 +41,13 @@ class TestMode: ...@@ -39,12 +41,13 @@ class TestMode:
USE_TESTS_OF_OTHER = { USE_TESTS_OF_OTHER = {
ast: [syntax], ast: [syntax],
compile_firm: [exec], compile_firm: [exec],
compile: [exec],
bench: [exec] bench: [exec]
} }
""" All 'success' tests of the n.th mode can used as 'success' tests for the n-1.th mode""" """ All 'success' tests of the n.th mode can used as 'success' tests for the n-1.th mode"""
TEST_MODES = [TestMode.lexer, TestMode.syntax, TestMode.ast, TestMode.semantic, TestMode.compile_firm, TEST_MODES = [TestMode.lexer, TestMode.syntax, TestMode.ast, TestMode.semantic, TestMode.compile_firm,
TestMode.exec, TestMode.bench] TestMode.exec, TestMode.bench, TestMode.compile]
def get_test_dirname(mode: str) -> str: def get_test_dirname(mode: str) -> str:
...@@ -160,9 +163,13 @@ class Environment: ...@@ -160,9 +163,13 @@ class Environment:
TestMode.syntax: "--parsetest", TestMode.syntax: "--parsetest",
TestMode.ast: "--print-ast", TestMode.ast: "--print-ast",
TestMode.semantic: "--check", TestMode.semantic: "--check",
TestMode.compile_firm: "--compile-firm" TestMode.compile_firm: "--compile-firm",
TestMode.compile: None
}[mode] }[mode]
cmd = [self.mj_run_cmd, mode_flag] + list(args) cmd = [self.mj_run_cmd]
if mode_flag:
cmd.append(mode)
cmd.extend(list(args))
return execute(cmd, timeout=timeout or self.timeout) return execute(cmd, timeout=timeout or self.timeout)
def run_command(self, cmd: str, *args: Tuple[str], timeout: float = None, input_str: Optional[str] = None) -> Tuple[bytes, bytes, int]: def run_command(self, cmd: str, *args: Tuple[str], timeout: float = None, input_str: Optional[str] = None) -> Tuple[bytes, bytes, int]:
......
...@@ -181,7 +181,7 @@ class JavaExecTest(BasicSyntaxTest): ...@@ -181,7 +181,7 @@ class JavaExecTest(BasicSyntaxTest):
assert False assert False
except BaseException: except BaseException:
os.chdir(cwd) os.chdir(cwd)
raise raise
def _check_hash_sum(self, file: str, hash_sum_file: str) -> bool: def _check_hash_sum(self, file: str, hash_sum_file: str) -> bool:
old_hash = "" old_hash = ""
...@@ -222,6 +222,10 @@ class JavaExecTest(BasicSyntaxTest): ...@@ -222,6 +222,10 @@ class JavaExecTest(BasicSyntaxTest):
TestCase.TEST_CASE_CLASSES[TestMode.compile_firm].append(JavaExecTest) TestCase.TEST_CASE_CLASSES[TestMode.compile_firm].append(JavaExecTest)
class JavaCompileExecTest(JavaExecTest):
MODE = TestMode.compile
TestCase.TEST_CASE_CLASSES[TestMode.compile].append(JavaCompileExecTest)
class JavaInfiniteLoopTest(BasicSyntaxTest): class JavaInfiniteLoopTest(BasicSyntaxTest):
......
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