Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
METRo projects
metro
Commits
c99237aa
Commit
c99237aa
authored
Nov 06, 2019
by
Sasa Zhang
Browse files
disabled xml file banner for no_error cases and displayed exit code for failed cases
parent
7c01dd4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
usr/share/metro/data/test_suite/test_suite.py
View file @
c99237aa
...
...
@@ -86,6 +86,9 @@ class XmlTree:
elif
abs
(
float
(
xml_file1
.
text
)
-
float
(
xml_file2
.
text
))
-
self
.
get_error
()
>
0.00000001
:
XmlTree
.
sum_of_error_outside_tolerance
+=
1
if
display_info
:
if
XmlTree
.
sum_of_error_outside_tolerance
==
1
:
print
(
"
\n
roadcast_reference.xml roadcast_test_suite_run.xml"
"
\n
---------------------- ---------------------------"
)
tag_reference
=
'<'
+
xml_file1
.
tag
+
'>'
+
xml_file1
.
text
+
'<'
+
xml_file1
.
tag
+
'>'
tag_test_suite_run
=
'<'
+
xml_file2
.
tag
+
'>'
+
xml_file2
.
text
+
'<'
+
xml_file2
.
tag
+
'>'
print
(
"{}{}{}"
.
format
(
tag_reference
.
ljust
(
24
),
'!='
.
ljust
(
10
),
tag_test_suite_run
))
...
...
@@ -188,6 +191,9 @@ def process_test_result(case_folder, test_code, expected_value_json):
or
(
test_code
==
0
and
expected_value_json
==
'SUCCESS'
and
XmlTree
.
sum_of_error_outside_tolerance
>
0
):
num_of_failure
+=
1
list_of_failure_cases
.
append
(
case_folder
)
# ----------------------------------------------------------------------------------------------------------------------
print
(
'Exit code: {}
\n
'
.
format
(
test_code
))
# ----------------------------------------------------------------------------------------------------------------------
print
(
case_folder
,
' FAILURE! ***'
)
else
:
print
(
'Something went wrong with this test run, please try to restart it again!'
)
...
...
@@ -199,7 +205,7 @@ def process_xml_file(current_case_path, case_folder, error_value, verbosity=Fals
:param current_case_path: directory of the current case that is going to be compared
:param case_folder: case number that is being compared
:param error_value: defined error tolerance for the running case
:param verbosity: boolean variable to indicate the willingness of display the comparison result in det
i
al
:param verbosity: boolean variable to indicate the willingness of display the comparison result in deta
i
l
:return: comparison result
"""
global
dict_error
...
...
@@ -379,6 +385,7 @@ def main():
file_station_path
,
file_observation_path
,
file_output_path
)
if
verbosity
:
try
:
print
(
'
\n
>>>>>>>>>>>>>>>>>>>>>>>> {} starts to run...... <<<<<<<<<<<<<<<<<<<<<<<<<<'
...
...
@@ -389,9 +396,7 @@ def main():
print
(
'
\n\n
'
)
test_run
=
subprocess
.
run
(
command_to_run
,
shell
=
True
,
check
=
True
)
print
(
'
\n\n
{}'
.
format
(
arrow_line
))
print
(
'
\n
Error Tolerance: {}
\n
'
.
format
(
error_value
))
print
(
"roadcast_reference.xml roadcast_test_suite_run.xml"
"
\n
---------------------- ---------------------------"
)
print
(
'
\n
Error Tolerance: {}'
.
format
(
error_value
))
process_xml_file
(
current_case_path
,
folder
,
error_value
,
verbosity
=
True
)
process_test_result
(
folder
,
test_run
.
returncode
,
expected_value
)
except
subprocess
.
CalledProcessError
:
...
...
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