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
eb9de8b0
Commit
eb9de8b0
authored
9 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Tweak run_tests exit status handling
parent
fdd02259
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/run_tests.py
+32
-13
32 additions, 13 deletions
tools/run_tests/run_tests.py
with
32 additions
and
13 deletions
tools/run_tests/run_tests.py
+
32
−
13
View file @
eb9de8b0
...
@@ -961,6 +961,15 @@ def _calculate_num_runs_failures(list_of_results):
...
@@ -961,6 +961,15 @@ def _calculate_num_runs_failures(list_of_results):
return
num_runs
,
num_failures
return
num_runs
,
num_failures
# _build_and_run results
class
BuildAndRunError
(
object
):
BUILD
=
object
()
TEST
=
object
()
POST_TEST
=
object
()
# returns a list of things that failed (or an empty list on success)
def
_build_and_run
(
def
_build_and_run
(
check_cancelled
,
newline_on_success
,
cache
,
xml_report
=
None
,
build_only
=
False
):
check_cancelled
,
newline_on_success
,
cache
,
xml_report
=
None
,
build_only
=
False
):
"""
Do one pass of building & running tests.
"""
"""
Do one pass of building & running tests.
"""
...
@@ -969,10 +978,10 @@ def _build_and_run(
...
@@ -969,10 +978,10 @@ def _build_and_run(
build_steps
,
maxjobs
=
1
,
stop_on_failure
=
True
,
build_steps
,
maxjobs
=
1
,
stop_on_failure
=
True
,
newline_on_success
=
newline_on_success
,
travis
=
args
.
travis
)
newline_on_success
=
newline_on_success
,
travis
=
args
.
travis
)
if
num_failures
:
if
num_failures
:
return
1
return
[
BuildAndRunError
.
BUILD
]
if
build_only
:
if
build_only
:
return
0
return
[]
# start antagonists
# start antagonists
antagonists
=
[
subprocess
.
Popen
([
'
tools/run_tests/antagonist.py
'
])
antagonists
=
[
subprocess
.
Popen
([
'
tools/run_tests/antagonist.py
'
])
...
@@ -1030,12 +1039,16 @@ def _build_and_run(
...
@@ -1030,12 +1039,16 @@ def _build_and_run(
number_failures
,
_
=
jobset
.
run
(
number_failures
,
_
=
jobset
.
run
(
post_tests_steps
,
maxjobs
=
1
,
stop_on_failure
=
True
,
post_tests_steps
,
maxjobs
=
1
,
stop_on_failure
=
True
,
newline_on_success
=
newline_on_success
,
travis
=
args
.
travis
)
newline_on_success
=
newline_on_success
,
travis
=
args
.
travis
)
if
num_test_failures
or
number_failures
:
return
2
out
=
[]
if
number_failures
:
out
.
append
(
BuildAndRunError
.
POST_TEST
)
if
num_test_failures
:
out
.
append
(
BuildAndRunError
.
TEST
)
if
cache
:
cache
.
save
()
if
cache
:
cache
.
save
()
return
0
return
out
test_cache
=
TestCache
(
runs_per_test
==
1
)
test_cache
=
TestCache
(
runs_per_test
==
1
)
...
@@ -1048,11 +1061,11 @@ if forever:
...
@@ -1048,11 +1061,11 @@ if forever:
initial_time
=
dw
.
most_recent_change
()
initial_time
=
dw
.
most_recent_change
()
have_files_changed
=
lambda
:
dw
.
most_recent_change
()
!=
initial_time
have_files_changed
=
lambda
:
dw
.
most_recent_change
()
!=
initial_time
previous_success
=
success
previous_success
=
success
succes
s
=
_build_and_run
(
check_cancelled
=
have_files_changed
,
error
s
=
_build_and_run
(
check_cancelled
=
have_files_changed
,
newline_on_success
=
False
,
newline_on_success
=
False
,
cache
=
test_cache
,
cache
=
test_cache
,
build_only
=
args
.
build_only
)
==
0
build_only
=
args
.
build_only
)
==
0
if
not
previous_success
and
succes
s
:
if
not
previous_success
and
not
error
s
:
jobset
.
message
(
'
SUCCESS
'
,
jobset
.
message
(
'
SUCCESS
'
,
'
All tests are now passing properly
'
,
'
All tests are now passing properly
'
,
do_newline
=
True
)
do_newline
=
True
)
...
@@ -1060,13 +1073,19 @@ if forever:
...
@@ -1060,13 +1073,19 @@ if forever:
while
not
have_files_changed
():
while
not
have_files_changed
():
time
.
sleep
(
1
)
time
.
sleep
(
1
)
else
:
else
:
result
=
_build_and_run
(
check_cancelled
=
lambda
:
False
,
errors
=
_build_and_run
(
check_cancelled
=
lambda
:
False
,
newline_on_success
=
args
.
newline_on_success
,
newline_on_success
=
args
.
newline_on_success
,
cache
=
test_cache
,
cache
=
test_cache
,
xml_report
=
args
.
xml_report
,
xml_report
=
args
.
xml_report
,
build_only
=
args
.
build_only
)
build_only
=
args
.
build_only
)
if
result
==
0
:
if
not
errors
:
jobset
.
message
(
'
SUCCESS
'
,
'
All tests passed
'
,
do_newline
=
True
)
jobset
.
message
(
'
SUCCESS
'
,
'
All tests passed
'
,
do_newline
=
True
)
else
:
else
:
jobset
.
message
(
'
FAILED
'
,
'
Some tests failed
'
,
do_newline
=
True
)
jobset
.
message
(
'
FAILED
'
,
'
Some tests failed
'
,
do_newline
=
True
)
sys
.
exit
(
result
)
exit_code
=
0
if
BuildAndRunError
.
BUILD
in
errors
:
exit_code
|=
1
if
BuildAndRunError
.
POST_TEST
in
errors
:
exit_code
|=
2
# BuildAndRunError.TEST does not cause run_tests.py to fail
sys
.
exit
(
exit_code
)
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