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
b50d1666
Commit
b50d1666
authored
10 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Make run_tests.py pass lint
parent
71735185
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
+24
-18
24 additions, 18 deletions
tools/run_tests/run_tests.py
with
24 additions
and
18 deletions
tools/run_tests/run_tests.py
+
24
−
18
View file @
b50d1666
...
@@ -4,16 +4,18 @@
...
@@ -4,16 +4,18 @@
import
argparse
import
argparse
import
glob
import
glob
import
itertools
import
itertools
import
simplejson
import
multiprocessing
import
multiprocessing
import
sys
import
sys
import
time
import
time
import
jobset
import
jobset
import
simplejson
import
watch_dirs
import
watch_dirs
# SimpleConfig: just compile with CONFIG=config, and run the binary to test
# SimpleConfig: just compile with CONFIG=config, and run the binary to test
class
SimpleConfig
(
object
):
class
SimpleConfig
(
object
):
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
self
.
build_config
=
config
self
.
build_config
=
config
self
.
maxjobs
=
32
*
multiprocessing
.
cpu_count
()
self
.
maxjobs
=
32
*
multiprocessing
.
cpu_count
()
...
@@ -24,6 +26,7 @@ class SimpleConfig(object):
...
@@ -24,6 +26,7 @@ class SimpleConfig(object):
# ValgrindConfig: compile with some CONFIG=config, but use valgrind to run
# ValgrindConfig: compile with some CONFIG=config, but use valgrind to run
class
ValgrindConfig
(
object
):
class
ValgrindConfig
(
object
):
def
__init__
(
self
,
config
,
tool
):
def
__init__
(
self
,
config
,
tool
):
self
.
build_config
=
config
self
.
build_config
=
config
self
.
tool
=
tool
self
.
tool
=
tool
...
@@ -35,15 +38,15 @@ class ValgrindConfig(object):
...
@@ -35,15 +38,15 @@ class ValgrindConfig(object):
# different configurations we can run under
# different configurations we can run under
_CONFIGS
=
{
_CONFIGS
=
{
'
dbg
'
:
SimpleConfig
(
'
dbg
'
),
'
dbg
'
:
SimpleConfig
(
'
dbg
'
),
'
opt
'
:
SimpleConfig
(
'
opt
'
),
'
opt
'
:
SimpleConfig
(
'
opt
'
),
'
tsan
'
:
SimpleConfig
(
'
tsan
'
),
'
tsan
'
:
SimpleConfig
(
'
tsan
'
),
'
msan
'
:
SimpleConfig
(
'
msan
'
),
'
msan
'
:
SimpleConfig
(
'
msan
'
),
'
asan
'
:
SimpleConfig
(
'
asan
'
),
'
asan
'
:
SimpleConfig
(
'
asan
'
),
'
gcov
'
:
SimpleConfig
(
'
gcov
'
),
'
gcov
'
:
SimpleConfig
(
'
gcov
'
),
'
memcheck
'
:
ValgrindConfig
(
'
valgrind
'
,
'
memcheck
'
),
'
memcheck
'
:
ValgrindConfig
(
'
valgrind
'
,
'
memcheck
'
),
'
helgrind
'
:
ValgrindConfig
(
'
dbg
'
,
'
helgrind
'
)
'
helgrind
'
:
ValgrindConfig
(
'
dbg
'
,
'
helgrind
'
)
}
}
_DEFAULT
=
[
'
dbg
'
,
'
opt
'
]
_DEFAULT
=
[
'
dbg
'
,
'
opt
'
]
...
@@ -87,6 +90,8 @@ forever = args.forever
...
@@ -87,6 +90,8 @@ forever = args.forever
class
TestCache
(
object
):
class
TestCache
(
object
):
"""
Cache for running tests.
"""
def
__init__
(
self
):
def
__init__
(
self
):
self
.
_last_successful_run
=
{}
self
.
_last_successful_run
=
{}
...
@@ -102,7 +107,8 @@ class TestCache(object):
...
@@ -102,7 +107,8 @@ class TestCache(object):
self
.
_last_successful_run
[
'
'
.
join
(
cmdline
)]
=
bin_hash
self
.
_last_successful_run
[
'
'
.
join
(
cmdline
)]
=
bin_hash
def
dump
(
self
):
def
dump
(
self
):
return
[{
'
cmdline
'
:
k
,
'
hash
'
:
v
}
for
k
,
v
in
self
.
_last_successful_run
.
iteritems
()]
return
[{
'
cmdline
'
:
k
,
'
hash
'
:
v
}
for
k
,
v
in
self
.
_last_successful_run
.
iteritems
()]
def
parse
(
self
,
exdump
):
def
parse
(
self
,
exdump
):
self
.
_last_successful_run
=
dict
((
o
[
'
cmdline
'
],
o
[
'
hash
'
])
for
o
in
exdump
)
self
.
_last_successful_run
=
dict
((
o
[
'
cmdline
'
],
o
[
'
hash
'
])
for
o
in
exdump
)
...
@@ -138,19 +144,19 @@ def _build_and_run(check_cancelled, newline_on_success, cache):
...
@@ -138,19 +144,19 @@ def _build_and_run(check_cancelled, newline_on_success, cache):
glob
.
glob
(
'
bins/%s/%s_test
'
%
(
glob
.
glob
(
'
bins/%s/%s_test
'
%
(
config
.
build_config
,
filt
)),
config
.
build_config
,
filt
)),
runs_per_test
)))),
runs_per_test
)))),
check_cancelled
,
check_cancelled
,
newline_on_success
=
newline_on_success
,
newline_on_success
=
newline_on_success
,
maxjobs
=
min
(
c
.
maxjobs
for
c
in
run_configs
),
maxjobs
=
min
(
c
.
maxjobs
for
c
in
run_configs
),
cache
=
cache
):
cache
=
cache
):
return
2
return
2
return
0
return
0
test_cache
=
(
None
if
runs_per_test
!=
1
test_cache
=
(
None
if
runs_per_test
!=
1
or
'
gcov
'
in
build_configs
or
'
gcov
'
in
build_configs
or
'
valgrind
'
in
build_configs
or
'
valgrind
'
in
build_configs
else
TestCache
())
else
TestCache
())
if
test_cache
:
if
test_cache
:
test_cache
.
load
()
test_cache
.
load
()
...
...
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