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
e90cd37a
Commit
e90cd37a
authored
9 years ago
by
David Garcia Quintas
Browse files
Options
Downloads
Patches
Plain Diff
Added "inf" as a valid option to run_test.py's -n flag.
Especially useful in combination with -f.
parent
2e378c89
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
+3
-1
3 additions, 1 deletion
tools/run_tests/jobset.py
tools/run_tests/run_tests.py
+27
-3
27 additions, 3 deletions
tools/run_tests/run_tests.py
with
30 additions
and
4 deletions
tools/run_tests/jobset.py
+
3
−
1
View file @
e90cd37a
...
...
@@ -339,13 +339,15 @@ def run(cmdlines,
maxjobs
=
None
,
newline_on_success
=
False
,
travis
=
False
,
infinite_runs
=
False
,
stop_on_failure
=
False
,
cache
=
None
):
js
=
Jobset
(
check_cancelled
,
maxjobs
if
maxjobs
is
not
None
else
_DEFAULT_MAX_JOBS
,
newline_on_success
,
travis
,
stop_on_failure
,
cache
if
cache
is
not
None
else
NoCache
())
if
not
travis
:
# We can't sort an infinite sequence of runs.
if
not
travis
or
infinite_runs
:
cmdlines
=
shuffle_iteratable
(
cmdlines
)
else
:
cmdlines
=
sorted
(
cmdlines
,
key
=
lambda
x
:
x
.
shortname
)
...
...
This diff is collapsed.
Click to expand it.
tools/run_tests/run_tests.py
+
27
−
3
View file @
e90cd37a
...
...
@@ -330,7 +330,28 @@ argp.add_argument('-c', '--config',
choices
=
[
'
all
'
]
+
sorted
(
_CONFIGS
.
keys
()),
nargs
=
'
+
'
,
default
=
_DEFAULT
)
argp
.
add_argument
(
'
-n
'
,
'
--runs_per_test
'
,
default
=
1
,
type
=
int
)
def
runs_per_test_type
(
arg_str
):
"""
Auxilary function to parse the
"
runs_per_test
"
flag.
Returns:
A positive integer or 0, the latter indicating an infinite number of
runs.
Raises:
argparse.ArgumentTypeError: Upon invalid input.
"""
if
arg_str
==
'
inf
'
:
return
0
try
:
n
=
int
(
arg_str
)
if
n
<=
0
:
raise
ValueError
except
:
msg
=
"'
{}
'
isn
'
t a positive integer or
'
inf
'"
.
format
(
arg_str
)
raise
argparse
.
ArgumentTypeError
(
msg
)
argp
.
add_argument
(
'
-n
'
,
'
--runs_per_test
'
,
default
=
1
,
type
=
runs_per_test_type
,
help
=
'
A positive integer or
"
inf
"
. If
"
inf
"
, all tests will run in an
'
'
infinite loop. Especially useful in combination with
"
-f
"'
)
argp
.
add_argument
(
'
-r
'
,
'
--regex
'
,
default
=
'
.*
'
,
type
=
str
)
argp
.
add_argument
(
'
-j
'
,
'
--jobs
'
,
default
=
2
*
multiprocessing
.
cpu_count
(),
type
=
int
)
argp
.
add_argument
(
'
-s
'
,
'
--slowdown
'
,
default
=
1.0
,
type
=
float
)
...
...
@@ -453,11 +474,14 @@ def _build_and_run(check_cancelled, newline_on_success, travis, cache):
antagonists
=
[
subprocess
.
Popen
([
'
tools/run_tests/antagonist.py
'
])
for
_
in
range
(
0
,
args
.
antagonists
)]
try
:
infinite_runs
=
runs_per_test
==
0
# run all the tests
all_runs
=
itertools
.
chain
.
from_iterable
(
itertools
.
repeat
(
one_run
,
runs_per_test
))
runs_sequence
=
(
itertools
.
repeat
(
one_run
)
if
infinite_runs
else
itertools
.
repeat
(
one_run
,
runs_per_test
))
all_runs
=
itertools
.
chain
.
from_iterable
(
runs_sequence
)
if
not
jobset
.
run
(
all_runs
,
check_cancelled
,
newline_on_success
=
newline_on_success
,
travis
=
travis
,
infinite_runs
=
infinite_runs
,
maxjobs
=
args
.
jobs
,
stop_on_failure
=
args
.
stop_on_failure
,
cache
=
cache
):
...
...
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