Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
IPDSnelting
mjtest
Commits
cfafbf1b
Commit
cfafbf1b
authored
Nov 27, 2016
by
Johannes Bechberger
Browse files
Fix `compile_firm` mode and add simple test cases
parent
70ac960b
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.mdwn
View file @
cfafbf1b
...
...
@@ -129,12 +129,12 @@ usage: mjt.py [-h] [--only_incorrect_tests] [--produce_no_reports]
[--produce_all_reports] [--parallel]
[--output_no_incorrect_reports] [--color] [--ci_testing]
[--log_level LOG_LEVEL]
{all,lexer,syntax,ast,semantic,exec} MJ_RUN
{all,lexer,syntax,ast,semantic,
compile-firm.
exec} MJ_RUN
MiniJava test runner
positional arguments:
{all,lexer,syntax,ast,semantic,exec}
{all,lexer,syntax,ast,semantic,
compile-firm,
exec}
What do you want to test?
MJ_RUN Command to run your MiniJava implementation, e.g.
`mj/run`, can be omitted by assigning the environment
...
...
mjtest/test/exec_tests.py
View file @
cfafbf1b
...
...
@@ -36,17 +36,26 @@ class JavaExecTest(BasicSyntaxTest):
self
.
env
.
run_command
(
"javac"
,
base_filename
+
".java"
)
if
javac_rtcode
!=
0
:
_LOG
.
error
(
"File
\"
{}
\"
isn't valid Java"
.
format
(
self
.
preprocessed_file
))
os
.
chdir
(
cwd
)
shutil
.
rmtree
(
tmp_dir
)
raise
InterruptedError
()
exp_out
,
_
,
_
=
\
self
.
env
.
run_command
(
"java"
,
base_filename
)
exp_out
=
exp_out
.
decode
().
strip
()
if
self
.
_has_expected_output_file
and
self
.
type
==
self
.
MODE
and
self
.
env
.
mode
==
self
.
MODE
:
with
open
(
self
.
_expected_output_file
,
"r"
)
as
f
:
exp_out
=
f
.
read
()
_
,
err
,
rtcode
=
self
.
env
.
run_mj_command
(
self
.
MODE
,
base_filename
+
".java"
)
out
,
_
,
_
=
self
.
env
.
run_command
(
base_filename
)
os
.
chdir
(
cwd
)
if
self
.
type
==
self
.
MODE
and
self
.
env
.
mode
==
self
.
MODE
:
return
BasicDiffTestResult
(
self
,
rtcode
,
out
.
decode
(),
err
.
decode
(),
exp_out
)
return
BasicTestResult
(
self
,
rtcode
,
out
.
decode
(),
err
.
decode
())
try
:
_
,
err
,
rtcode
=
self
.
env
.
run_mj_command
(
self
.
MODE
,
base_filename
+
".java"
)
out
,
_
,
_
=
self
.
env
.
run_command
(
"./"
+
base_filename
)
out
=
out
.
decode
().
strip
()
os
.
chdir
(
cwd
)
shutil
.
rmtree
(
tmp_dir
)
if
self
.
type
==
self
.
MODE
and
self
.
env
.
mode
==
self
.
MODE
:
return
BasicDiffTestResult
(
self
,
rtcode
,
out
,
err
.
decode
(),
exp_out
)
return
BasicTestResult
(
self
,
rtcode
,
out
.
decode
(),
err
.
decode
())
except
:
os
.
chdir
(
cwd
)
raise
TestCase
.
TEST_CASE_CLASSES
[
TestMode
.
comile_firm
].
append
(
JavaExecTest
)
\ No newline at end of file
mjtest/test/tests.py
View file @
cfafbf1b
...
...
@@ -437,3 +437,4 @@ TestCase.TEST_CASE_CLASSES[TestMode.lexer].append(LexerDiffTest)
import
mjtest.test.syntax_tests
import
mjtest.test.ast_tests
import
mjtest.test.semantic_tests
import
mjtest.test.exec_tests
\ No newline at end of file
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