Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mjtest
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ufebl
mjtest
Commits
cfafbf1b
Commit
cfafbf1b
authored
Nov 27, 2016
by
Johannes Bechberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `compile_firm` mode and add simple test cases
parent
70ac960b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
README.mdwn
README.mdwn
+2
-2
mjtest/test/exec_tests.py
mjtest/test/exec_tests.py
+15
-6
mjtest/test/tests.py
mjtest/test/tests.py
+1
-0
No files found.
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
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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