Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
3ea4362b
Commit
3ea4362b
authored
9 years ago
by
Jan Tattermusch
Browse files
Options
Downloads
Patches
Plain Diff
prevent generating unparseable xml reports
parent
8bda67c3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/run_tests/jobset.py
+11
-3
11 additions, 3 deletions
tools/run_tests/jobset.py
with
11 additions
and
3 deletions
tools/run_tests/jobset.py
+
11
−
3
View file @
3ea4362b
...
...
@@ -130,6 +130,14 @@ def which(filename):
raise
Exception
(
'
%s not found
'
%
filename
)
def
_filter_stdout
(
stdout
):
"""
Filters out nonprintable and XML-illegal characters from stdout.
"""
# keep whitespaces but remove formfeed and vertical tab characters
# that make XML report unparseable.
return
filter
(
lambda
x
:
x
in
string
.
printable
and
x
!=
'
\f
'
and
x
!=
'
\v
'
,
stdout
.
decode
(
errors
=
'
ignore
'
))
class
JobSpec
(
object
):
"""
Specifies what to run for a job.
"""
...
...
@@ -206,7 +214,7 @@ class Job(object):
elapsed
=
time
.
time
()
-
self
.
_start
self
.
_tempfile
.
seek
(
0
)
stdout
=
self
.
_tempfile
.
read
()
filtered_stdout
=
filter
(
lambda
x
:
x
in
string
.
printable
,
stdout
.
decode
(
errors
=
'
ignore
'
)
)
filtered_stdout
=
_
filter
_stdout
(
stdout
)
# TODO: looks like jenkins master is slow because parsing the junit results XMLs is not
# implemented efficiently. This is an experiment to workaround the issue by making sure
# results.xml file is small enough.
...
...
@@ -228,7 +236,7 @@ class Job(object):
self
.
_spec
.
shortname
,
self
.
_process
.
returncode
,
self
.
_process
.
pid
),
stdout
,
do_newline
=
True
)
if
self
.
_xml_test
is
not
None
:
ET
.
SubElement
(
self
.
_xml_test
,
'
failure
'
,
message
=
'
Failure
'
)
.
text
ET
.
SubElement
(
self
.
_xml_test
,
'
failure
'
,
message
=
'
Failure
'
)
else
:
self
.
_state
=
_SUCCESS
message
(
'
PASSED
'
,
'
%s [time=%.1fsec; retries=%d;%d]
'
%
(
...
...
@@ -239,7 +247,7 @@ class Job(object):
elif
self
.
_state
==
_RUNNING
and
time
.
time
()
-
self
.
_start
>
self
.
_spec
.
timeout_seconds
:
self
.
_tempfile
.
seek
(
0
)
stdout
=
self
.
_tempfile
.
read
()
filtered_stdout
=
filter
(
lambda
x
:
x
in
string
.
printable
,
stdout
.
decode
(
errors
=
'
ignore
'
)
)
filtered_stdout
=
_
filter
_stdout
(
stdout
)
if
self
.
_timeout_retries
<
self
.
_spec
.
timeout_retries
:
message
(
'
TIMEOUT_FLAKE
'
,
self
.
_spec
.
shortname
,
stdout
,
do_newline
=
True
)
self
.
_timeout_retries
+=
1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment