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
1
Issues
1
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
IPDSnelting
mjtest
Commits
ffc2cde8
Commit
ffc2cde8
authored
Dec 02, 2016
by
Johannes Bechberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use shorter timeouts and make them adjustable
parent
c9d130de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
mjtest/environment.py
mjtest/environment.py
+3
-1
mjtest/test/exec_tests.py
mjtest/test/exec_tests.py
+7
-5
No files found.
mjtest/environment.py
View file @
ffc2cde8
...
...
@@ -88,7 +88,6 @@ class Environment:
self
.
only_incorrect_tests
=
only_incorrect_tests
self
.
parallel
=
parallel
self
.
timeout
=
timeout
if
not
produce_no_reports
:
if
report_dir
:
self
.
report_dir
=
os
.
path
.
abspath
(
os
.
path
.
expandvars
(
report_dir
))
...
...
@@ -113,6 +112,9 @@ class Environment:
self
.
_pid_tmpdirs
=
{}
# type: Dict[int, str]
self
.
only_small_exec_tests
=
not
all_exec_tests
self
.
timeout
=
float
(
os
.
getenv
(
"MJ_TIMEOUT"
,
"5"
))
self
.
big_timeout
=
float
(
os
.
getenv
(
"MJ_BIG_TIMEOUT"
,
"30"
))
def
create_tmpfile
(
self
)
->
str
:
self
.
_tmp_file_ctr
+=
1
return
os
.
path
.
join
(
self
.
tmp_dir
,
str
(
round
(
time
.
time
()
*
100000
))
...
...
mjtest/test/exec_tests.py
View file @
ffc2cde8
...
...
@@ -40,6 +40,8 @@ class JavaExecTest(BasicSyntaxTest):
self
.
_should_succeed
=
True
def
run
(
self
)
->
BasicDiffTestResult
:
is_big_testcase
=
"big"
in
self
.
file
timeout
=
self
.
env
.
big_timeout
if
is_big_testcase
else
self
.
env
.
timeout
base_filename
=
path
.
basename
(
self
.
file
).
split
(
"."
)[
0
]
tmp_dir
=
self
.
env
.
create_tmpdir
()
shutil
.
copy
(
self
.
preprocessed_file
,
path
.
join
(
tmp_dir
,
base_filename
+
".java"
))
...
...
@@ -52,7 +54,7 @@ class JavaExecTest(BasicSyntaxTest):
if
not
self
.
_has_expected_output_file
:
_
,
err
,
javac_rtcode
=
\
self
.
env
.
run_command
(
"javac"
,
base_filename
+
".java"
)
self
.
env
.
run_command
(
"javac"
,
base_filename
+
".java"
,
timeout
=
timeout
)
if
javac_rtcode
!=
0
:
_LOG
.
error
(
"File
\"
{}
\"
isn't valid Java"
.
format
(
self
.
preprocessed_file
))
test_result
.
incorrect_msg
=
"invalid java code, but output file missing"
...
...
@@ -61,12 +63,12 @@ class JavaExecTest(BasicSyntaxTest):
test_result
.
add_file
(
"Source file"
,
self
.
preprocessed_file
)
os
.
chdir
(
cwd
)
return
test_result
main_class
=
get_main_class_name
(
base_filename
+
".java"
)
main_class
=
get_main_class_name
(
base_filename
+
".java"
,
timeout
=
timeout
)
if
not
main_class
:
_LOG
.
debug
(
"Can't find a main class, using the file name instead"
)
main_class
=
base_filename
exp_out
,
err
,
java_rtcode
=
\
self
.
env
.
run_command
(
"java"
,
get_main_class_name
(
base_filename
+
".java"
))
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
:
test_result
.
incorrect_msg
=
"java runtime error"
...
...
@@ -91,7 +93,7 @@ class JavaExecTest(BasicSyntaxTest):
try
:
out
,
err
,
rtcode
=
None
,
None
,
None
try
:
out
,
err
,
rtcode
=
self
.
env
.
run_mj_command
(
self
.
MODE
,
base_filename
+
".java"
)
out
,
err
,
rtcode
=
self
.
env
.
run_mj_command
(
self
.
MODE
,
base_filename
+
".java"
,
timeout
=
timeout
)
if
rtcode
!=
0
:
test_result
.
incorrect_msg
=
"file can't be compiled"
test_result
.
set_error_code
(
rtcode
)
...
...
@@ -110,7 +112,7 @@ class JavaExecTest(BasicSyntaxTest):
os
.
chdir
(
cwd
)
raise
try
:
out
,
err
,
rtcode
=
self
.
env
.
run_command
(
"./"
+
base_filename
)
out
,
err
,
rtcode
=
self
.
env
.
run_command
(
"./"
+
base_filename
,
timeout
=
timeout
)
if
rtcode
!=
0
:
test_result
.
incorrect_msg
=
"binary can't be run, non zero error code"
test_result
.
set_error_code
(
rtcode
)
...
...
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