Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
uqdwn
mjtest
Commits
de997db4
Commit
de997db4
authored
Dec 30, 2016
by
Johannes Bechberger
Browse files
Add new mode `compile`
parent
ed117ab4
Changes
3
Hide whitespace changes
Inline
Side-by-side
mjtest/cli.py
View file @
de997db4
...
...
@@ -86,7 +86,8 @@ if True:#__name__ == '__main__':
count
+=
ret
.
count
if
args
[
"mode"
]
==
"all"
:
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
[
"report_subdir"
]
=
report_subdir
+
"_"
+
mode
cprint
(
"Run {} tests"
.
format
(
mode
),
attrs
=
[
"bold"
])
...
...
mjtest/environment.py
View file @
de997db4
...
...
@@ -32,6 +32,8 @@ class TestMode:
compile_firm
=
"compile-firm"
compile
=
"compile"
exec
=
"exec"
bench
=
"bench"
...
...
@@ -39,12 +41,13 @@ class TestMode:
USE_TESTS_OF_OTHER
=
{
ast
:
[
syntax
],
compile_firm
:
[
exec
],
compile
:
[
exec
],
bench
:
[
exec
]
}
""" 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
,
TestMode
.
exec
,
TestMode
.
bench
]
TestMode
.
exec
,
TestMode
.
bench
,
TestMode
.
compile
]
def
get_test_dirname
(
mode
:
str
)
->
str
:
...
...
@@ -160,9 +163,13 @@ class Environment:
TestMode
.
syntax
:
"--parsetest"
,
TestMode
.
ast
:
"--print-ast"
,
TestMode
.
semantic
:
"--check"
,
TestMode
.
compile_firm
:
"--compile-firm"
TestMode
.
compile_firm
:
"--compile-firm"
,
TestMode
.
compile
:
None
}[
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
)
def
run_command
(
self
,
cmd
:
str
,
*
args
:
Tuple
[
str
],
timeout
:
float
=
None
,
input_str
:
Optional
[
str
]
=
None
)
->
Tuple
[
bytes
,
bytes
,
int
]:
...
...
mjtest/test/exec_tests.py
View file @
de997db4
...
...
@@ -181,7 +181,7 @@ class JavaExecTest(BasicSyntaxTest):
assert
False
except
BaseException
:
os
.
chdir
(
cwd
)
raise
raise
def
_check_hash_sum
(
self
,
file
:
str
,
hash_sum_file
:
str
)
->
bool
:
old_hash
=
""
...
...
@@ -222,6 +222,10 @@ class JavaExecTest(BasicSyntaxTest):
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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment