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
c9d8191f
Commit
c9d8191f
authored
Jan 17, 2019
by
ufebl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add error log if binary could not be run during benchmark
parent
7ba134b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
mjtest/test/bench.py
mjtest/test/bench.py
+17
-5
No files found.
mjtest/test/bench.py
View file @
c9d8191f
...
@@ -63,16 +63,27 @@ class BenchExecTest(BasicSyntaxTest):
...
@@ -63,16 +63,27 @@ class BenchExecTest(BasicSyntaxTest):
self
.
_should_succeed
=
True
self
.
_should_succeed
=
True
def
_bench_command
(
self
,
cmd
:
str
,
*
args
:
Tuple
[
str
],
timeout
:
int
,
input_bytes
:
str
)
->
_RunResult
:
def
_bench_command
(
self
,
cmd
:
str
,
*
args
:
Tuple
[
str
],
compiler_flag
:
str
,
timeout
:
int
,
input_bytes
:
str
)
->
_RunResult
:
runs
=
[]
# type: List[float]
runs
=
[]
# type: List[float]
for
i
in
range
(
0
,
self
.
env
.
bench_runs
):
for
i
in
range
(
0
,
self
.
env
.
bench_runs
):
try
:
try
:
start
=
time
.
time
()
start
=
time
.
time
()
self
.
env
.
run_command
(
cmd
,
*
args
,
timeout
=
timeout
,
input_bytes
=
input_bytes
)
out
,
err
,
rtcode
=
self
.
env
.
run_command
(
cmd
,
*
args
,
timeout
=
timeout
,
input_bytes
=
input_bytes
)
runs
.
append
((
time
.
time
()
-
start
)
*
1000
)
if
rtcode
==
0
:
except
subprocess
.
CalledProcessError
:
runs
.
append
((
time
.
time
()
-
start
)
*
1000
)
else
:
_LOG
.
error
(
"File
\"
{}
\"
can't be run with flags
\"
{}
\"
error code: {}"
.
format
(
self
.
preprocessed_file
,
compiler_flag
,
rtcode
))
_LOG
.
error
(
"Error: "
+
err
.
decode
());
return
_RunResult
([
-
1
,
0
],
False
);
except
SigKill
as
sig
:
_LOG
.
error
(
"File
\"
{}
\"
can't be run with flags
\"
{}
\"
"
.
format
(
self
.
preprocessed_file
,
compiler_flag
))
_LOG
.
error
(
"Error: "
+
sig
.
name
.
strip
()
+
" "
+
sig
.
retcode
)
return
_RunResult
([
-
1
,
0
],
False
);
return
_RunResult
([
-
1
,
0
],
False
);
except
:
raise
# except subprocess.CalledProcessError:
# return _RunResult([-1,0], False);
return
_RunResult
(
runs
,
True
)
return
_RunResult
(
runs
,
True
)
...
@@ -124,11 +135,12 @@ class BenchExecTest(BasicSyntaxTest):
...
@@ -124,11 +135,12 @@ class BenchExecTest(BasicSyntaxTest):
_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
results
.
append
(
self
.
_bench_command
(
"java"
,
main_class
,
timeout
=
timeout
,
input_bytes
=
input_bytes
))
results
.
append
(
self
.
_bench_command
(
"java"
,
main_class
,
compiler_flag
=
"javac"
,
timeout
=
timeout
,
input_bytes
=
input_bytes
))
else
:
else
:
try
:
try
:
compiler_flag
=
compiler_flag
.
replace
(
"
\\
-"
,
"-"
)
compiler_flag
=
compiler_flag
.
replace
(
"
\\
-"
,
"-"
)
out
,
err
,
rtcode
=
self
.
env
.
run_command
(
self
.
env
.
mj_run_cmd
,
*
(
compiler_flag
.
split
(
" "
)
+
[
base_filename
+
".java"
]),
out
,
err
,
rtcode
=
self
.
env
.
run_command
(
self
.
env
.
mj_run_cmd
,
*
(
compiler_flag
.
split
(
" "
)
+
[
base_filename
+
".java"
]),
compiler_flag
=
compiler_flag
,
timeout
=
timeout
)
timeout
=
timeout
)
if
rtcode
!=
0
:
if
rtcode
!=
0
:
_LOG
.
error
(
"File
\"
{}
\"
can't be compiled with flags
\"
{}
\"
"
.
format
(
self
.
preprocessed_file
,
compiler_flag
))
_LOG
.
error
(
"File
\"
{}
\"
can't be compiled with flags
\"
{}
\"
"
.
format
(
self
.
preprocessed_file
,
compiler_flag
))
...
...
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