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
cd43da82
Commit
cd43da82
authored
9 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Add fast stop
Allows run_tests to early out as soon as a test fails. Plays well with -f.
parent
0882bf00
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/run_tests/jobset.py
+11
-4
11 additions, 4 deletions
tools/run_tests/jobset.py
tools/run_tests/run_tests.py
+5
-0
5 additions, 0 deletions
tools/run_tests/run_tests.py
with
16 additions
and
4 deletions
tools/run_tests/jobset.py
+
11
−
4
View file @
cd43da82
...
@@ -234,7 +234,8 @@ class Job(object):
...
@@ -234,7 +234,8 @@ class Job(object):
class
Jobset
(
object
):
class
Jobset
(
object
):
"""
Manages one run of jobs.
"""
"""
Manages one run of jobs.
"""
def
__init__
(
self
,
check_cancelled
,
maxjobs
,
newline_on_success
,
travis
,
cache
):
def
__init__
(
self
,
check_cancelled
,
maxjobs
,
newline_on_success
,
travis
,
stop_on_failure
,
cache
):
self
.
_running
=
set
()
self
.
_running
=
set
()
self
.
_check_cancelled
=
check_cancelled
self
.
_check_cancelled
=
check_cancelled
self
.
_cancelled
=
False
self
.
_cancelled
=
False
...
@@ -244,6 +245,7 @@ class Jobset(object):
...
@@ -244,6 +245,7 @@ class Jobset(object):
self
.
_newline_on_success
=
newline_on_success
self
.
_newline_on_success
=
newline_on_success
self
.
_travis
=
travis
self
.
_travis
=
travis
self
.
_cache
=
cache
self
.
_cache
=
cache
self
.
_stop_on_failure
=
stop_on_failure
def
start
(
self
,
spec
):
def
start
(
self
,
spec
):
"""
Start a job. Return True on success, False on failure.
"""
"""
Start a job. Return True on success, False on failure.
"""
...
@@ -280,8 +282,12 @@ class Jobset(object):
...
@@ -280,8 +282,12 @@ class Jobset(object):
for
job
in
self
.
_running
:
for
job
in
self
.
_running
:
st
=
job
.
state
(
self
.
_cache
)
st
=
job
.
state
(
self
.
_cache
)
if
st
==
_RUNNING
:
continue
if
st
==
_RUNNING
:
continue
if
st
==
_FAILURE
:
self
.
_failures
+=
1
if
st
==
_FAILURE
or
st
==
_KILLED
:
if
st
==
_KILLED
:
self
.
_failures
+=
1
self
.
_failures
+=
1
if
self
.
_stop_on_failure
:
self
.
_cancelled
=
True
for
job
in
self
.
_running
:
job
.
kill
()
dead
.
add
(
job
)
dead
.
add
(
job
)
for
job
in
dead
:
for
job
in
dead
:
self
.
_completed
+=
1
self
.
_completed
+=
1
...
@@ -333,10 +339,11 @@ def run(cmdlines,
...
@@ -333,10 +339,11 @@ def run(cmdlines,
maxjobs
=
None
,
maxjobs
=
None
,
newline_on_success
=
False
,
newline_on_success
=
False
,
travis
=
False
,
travis
=
False
,
stop_on_failure
=
False
,
cache
=
None
):
cache
=
None
):
js
=
Jobset
(
check_cancelled
,
js
=
Jobset
(
check_cancelled
,
maxjobs
if
maxjobs
is
not
None
else
_DEFAULT_MAX_JOBS
,
maxjobs
if
maxjobs
is
not
None
else
_DEFAULT_MAX_JOBS
,
newline_on_success
,
travis
,
newline_on_success
,
travis
,
stop_on_failure
,
cache
if
cache
is
not
None
else
NoCache
())
cache
if
cache
is
not
None
else
NoCache
())
if
not
travis
:
if
not
travis
:
cmdlines
=
shuffle_iteratable
(
cmdlines
)
cmdlines
=
shuffle_iteratable
(
cmdlines
)
...
...
This diff is collapsed.
Click to expand it.
tools/run_tests/run_tests.py
+
5
−
0
View file @
cd43da82
...
@@ -349,6 +349,10 @@ argp.add_argument('-l', '--language',
...
@@ -349,6 +349,10 @@ argp.add_argument('-l', '--language',
choices
=
[
'
all
'
]
+
sorted
(
_LANGUAGES
.
keys
()),
choices
=
[
'
all
'
]
+
sorted
(
_LANGUAGES
.
keys
()),
nargs
=
'
+
'
,
nargs
=
'
+
'
,
default
=
[
'
all
'
])
default
=
[
'
all
'
])
argp
.
add_argument
(
'
-S
'
,
'
--stop_on_failure
'
,
default
=
False
,
action
=
'
store_const
'
,
const
=
True
)
argp
.
add_argument
(
'
-a
'
,
'
--antagonists
'
,
default
=
0
,
type
=
int
)
argp
.
add_argument
(
'
-a
'
,
'
--antagonists
'
,
default
=
0
,
type
=
int
)
args
=
argp
.
parse_args
()
args
=
argp
.
parse_args
()
...
@@ -457,6 +461,7 @@ def _build_and_run(check_cancelled, newline_on_success, travis, cache):
...
@@ -457,6 +461,7 @@ def _build_and_run(check_cancelled, newline_on_success, travis, cache):
if
not
jobset
.
run
(
all_runs
,
check_cancelled
,
if
not
jobset
.
run
(
all_runs
,
check_cancelled
,
newline_on_success
=
newline_on_success
,
travis
=
travis
,
newline_on_success
=
newline_on_success
,
travis
=
travis
,
maxjobs
=
args
.
jobs
,
maxjobs
=
args
.
jobs
,
stop_on_failure
=
args
.
stop_on_failure
,
cache
=
cache
):
cache
=
cache
):
return
2
return
2
finally
:
finally
:
...
...
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