Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
IPDSnelting
mjtest
Commits
28d4296d
Commit
28d4296d
authored
Dec 02, 2016
by
Johannes Bechberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve mjtest and move one test case
parent
9400fe7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
mjtest/environment.py
mjtest/environment.py
+2
-2
mjtest/test/exec_tests.py
mjtest/test/exec_tests.py
+6
-4
No files found.
mjtest/environment.py
View file @
28d4296d
...
@@ -112,8 +112,8 @@ class Environment:
...
@@ -112,8 +112,8 @@ class Environment:
self
.
_pid_tmpdirs
=
{}
# type: Dict[int, str]
self
.
_pid_tmpdirs
=
{}
# type: Dict[int, str]
self
.
only_small_exec_tests
=
not
all_exec_tests
self
.
only_small_exec_tests
=
not
all_exec_tests
self
.
timeout
=
float
(
os
.
getenv
(
"MJ_TIMEOUT"
,
"
5
"
))
self
.
timeout
=
float
(
os
.
getenv
(
"MJ_TIMEOUT"
,
"
10
"
))
self
.
big_timeout
=
float
(
os
.
getenv
(
"MJ_BIG_TIMEOUT"
,
"
3
0"
))
self
.
big_timeout
=
float
(
os
.
getenv
(
"MJ_BIG_TIMEOUT"
,
"
6
0"
))
def
create_tmpfile
(
self
)
->
str
:
def
create_tmpfile
(
self
)
->
str
:
self
.
_tmp_file_ctr
+=
1
self
.
_tmp_file_ctr
+=
1
...
...
mjtest/test/exec_tests.py
View file @
28d4296d
...
@@ -63,14 +63,14 @@ class JavaExecTest(BasicSyntaxTest):
...
@@ -63,14 +63,14 @@ class JavaExecTest(BasicSyntaxTest):
test_result
.
add_file
(
"Source file"
,
self
.
preprocessed_file
)
test_result
.
add_file
(
"Source file"
,
self
.
preprocessed_file
)
os
.
chdir
(
cwd
)
os
.
chdir
(
cwd
)
return
test_result
return
test_result
main_class
=
get_main_class_name
(
base_filename
+
".java"
,
timeout
=
timeout
)
main_class
=
get_main_class_name
(
base_filename
+
".java"
)
if
not
main_class
:
if
not
main_class
:
_LOG
.
debug
(
"Can't find a main class, using the file name instead"
)
_LOG
.
debug
(
"Can't find a main class, using the file name instead"
)
main_class
=
base_filename
main_class
=
base_filename
exp_out
,
err
,
java_rtcode
=
\
exp_out
,
err
,
java_rtcode
=
\
self
.
env
.
run_command
(
"java"
,
get_main_class_name
(
base_filename
+
".java"
),
timeout
=
timeout
)
self
.
env
.
run_command
(
"java"
,
get_main_class_name
(
base_filename
+
".java"
),
timeout
=
timeout
)
test_result
.
add_long_text
(
"Java output: "
,
exp_out
.
decode
())
if
javac_rtcode
!=
0
:
if
javac_rtcode
!=
0
:
test_result
.
add_long_text
(
"Java output: "
,
exp_out
.
decode
())
test_result
.
incorrect_msg
=
"java runtime error"
test_result
.
incorrect_msg
=
"java runtime error"
test_result
.
set_error_code
(
java_rtcode
)
test_result
.
set_error_code
(
java_rtcode
)
test_result
.
add_long_text
(
"Java error message"
,
err
.
decode
())
test_result
.
add_long_text
(
"Java error message"
,
err
.
decode
())
...
@@ -88,8 +88,7 @@ class JavaExecTest(BasicSyntaxTest):
...
@@ -88,8 +88,7 @@ class JavaExecTest(BasicSyntaxTest):
if
self
.
_has_expected_output_file
and
self
.
type
==
self
.
MODE
and
self
.
env
.
mode
==
self
.
MODE
:
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
:
with
open
(
self
.
_expected_output_file
,
"r"
)
as
f
:
exp_out
=
f
.
read
()
exp_out
=
f
.
read
()
test_result
.
add_short_text
(
"Expected output file"
,
self
.
_expected_output_file
)
test_result
.
add_long_text
(
"Expected output"
,
exp_out
)
try
:
try
:
out
,
err
,
rtcode
=
None
,
None
,
None
out
,
err
,
rtcode
=
None
,
None
,
None
try
:
try
:
...
@@ -136,6 +135,9 @@ class JavaExecTest(BasicSyntaxTest):
...
@@ -136,6 +135,9 @@ class JavaExecTest(BasicSyntaxTest):
if
exp_out
.
strip
()
!=
out
.
strip
():
if
exp_out
.
strip
()
!=
out
.
strip
():
test_result
.
incorrect_msg
=
"incorrect output"
test_result
.
incorrect_msg
=
"incorrect output"
test_result
.
has_succeeded
=
False
test_result
.
has_succeeded
=
False
test_result
.
add_short_text
(
"Expected output file"
,
self
.
_expected_output_file
)
test_result
.
add_long_text
(
"Expected output"
,
exp_out
)
test_result
.
add_long_text
(
"Actual output"
,
out
)
test_result
.
add_diff
(
"Output diff [expected <-> actual]"
,
exp_out
,
out
,
with_line_numbers
=
True
)
test_result
.
add_diff
(
"Output diff [expected <-> actual]"
,
exp_out
,
out
,
with_line_numbers
=
True
)
test_result
.
add_file
(
"Source file"
,
self
.
preprocessed_file
)
test_result
.
add_file
(
"Source file"
,
self
.
preprocessed_file
)
os
.
chdir
(
cwd
)
os
.
chdir
(
cwd
)
...
...
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