Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
ag-ohlberger
dune-community
dune-xt
Commits
24104be3
Unverified
Commit
24104be3
authored
7 years ago
by
René Fritze
Browse files
Options
Downloads
Patches
Plain Diff
[py] cleanup test distribution script
parent
1f72f9c7
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
python/scripts/distribute_testing.py
+10
-11
10 additions, 11 deletions
python/scripts/distribute_testing.py
with
10 additions
and
11 deletions
python/scripts/distribute_testing.py
+
10
−
11
View file @
24104be3
...
@@ -15,7 +15,7 @@ import os
...
@@ -15,7 +15,7 @@ import os
import
pickle
import
pickle
import
json
import
json
import
sys
import
sys
import
pprint
from
pprint
import
pprint
,
pformat
import
subprocess
import
subprocess
import
time
import
time
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
...
@@ -105,8 +105,8 @@ def do_timings(builddir, pickledir, binaries, testnames, processes, headerlibs):
...
@@ -105,8 +105,8 @@ def do_timings(builddir, pickledir, binaries, testnames, processes, headerlibs):
compiles
=
_load
(
compiles_fn
)
compiles
=
_load
(
compiles_fn
)
if
set
(
compiles
.
keys
())
!=
set
(
targets
):
if
set
(
compiles
.
keys
())
!=
set
(
targets
):
logging
.
error
(
'
redoing compiles due to mismatched binaries
'
)
logging
.
error
(
'
redoing compiles due to mismatched binaries
'
)
logging
.
error
(
'
Removed: {}
'
.
format
(
pprint
.
pformat
(
set
(
compiles
.
keys
())
-
set
(
targets
))))
logging
.
error
(
'
Removed: {}
'
.
format
(
pformat
(
set
(
compiles
.
keys
())
-
set
(
targets
))))
logging
.
error
(
'
New: {}
'
.
format
(
pprint
.
pformat
(
set
(
targets
)
-
set
(
compiles
.
keys
()))))
logging
.
error
(
'
New: {}
'
.
format
(
pformat
(
set
(
targets
)
-
set
(
compiles
.
keys
()))))
compiles
=
_redo
(
processes
,
targets
,
_compile
,
targets
)
compiles
=
_redo
(
processes
,
targets
,
_compile
,
targets
)
except
FileNotFoundError
:
except
FileNotFoundError
:
logging
.
error
(
'
redoing compiles due to missing pickle
'
)
logging
.
error
(
'
redoing compiles due to missing pickle
'
)
...
@@ -119,8 +119,8 @@ def do_timings(builddir, pickledir, binaries, testnames, processes, headerlibs):
...
@@ -119,8 +119,8 @@ def do_timings(builddir, pickledir, binaries, testnames, processes, headerlibs):
loaded_testnames
,
testruns
=
_load
(
testruns_fn
)
loaded_testnames
,
testruns
=
_load
(
testruns_fn
)
if
set
(
compiles
.
keys
())
!=
set
(
targets
)
or
loaded_testnames
!=
testnames
:
if
set
(
compiles
.
keys
())
!=
set
(
targets
)
or
loaded_testnames
!=
testnames
:
logging
.
error
(
'
redoing tests due to mismatched binaries/testnames
'
)
logging
.
error
(
'
redoing tests due to mismatched binaries/testnames
'
)
logging
.
error
(
'
Removed: {}
'
.
format
(
pprint
.
pformat
([
f
for
f
in
loaded_testnames
if
f
not
in
set
(
testnames
)])))
logging
.
error
(
'
Removed: {}
'
.
format
(
pformat
([
f
for
f
in
loaded_testnames
if
f
not
in
set
(
testnames
)])))
logging
.
error
(
'
New: {}
'
.
format
(
pprint
.
pformat
([
n
for
n
in
testnames
if
n
not
in
set
(
loaded_testnames
)])))
logging
.
error
(
'
New: {}
'
.
format
(
pformat
([
n
for
n
in
testnames
if
n
not
in
set
(
loaded_testnames
)])))
testruns
=
_redo
(
processes
,
binaries
,
_run_tests
,
zip
(
binaries
,
testnames
))
testruns
=
_redo
(
processes
,
binaries
,
_run_tests
,
zip
(
binaries
,
testnames
))
except
FileNotFoundError
:
except
FileNotFoundError
:
logging
.
error
(
'
redoing tests due to missing pickle
'
)
logging
.
error
(
'
redoing tests due to missing pickle
'
)
...
@@ -136,19 +136,19 @@ def do_timings(builddir, pickledir, binaries, testnames, processes, headerlibs):
...
@@ -136,19 +136,19 @@ def do_timings(builddir, pickledir, binaries, testnames, processes, headerlibs):
return
totals
return
totals
# list comes with a leading empty entry
all_testnames
=
open
(
sys
.
argv
[
4
],
'
rt
'
).
read
().
split
(
'
/
'
)[
1
:]
builddir
=
sys
.
argv
[
1
]
builddir
=
sys
.
argv
[
1
]
testdir
=
sys
.
argv
[
2
]
testdir
=
sys
.
argv
[
2
]
cmake_outfile
=
os
.
path
.
join
(
builddir
,
'
builder_definitions.cmake
'
)
cmake_outfile
=
os
.
path
.
join
(
builddir
,
'
builder_definitions.cmake
'
)
binaries
=
open
(
sys
.
argv
[
3
],
'
rt
'
).
read
().
split
(
'
;
'
)
binaries
=
open
(
sys
.
argv
[
3
],
'
rt
'
).
read
().
split
(
'
;
'
)
# list comes with a leading empty entry
all_testnames
=
open
(
sys
.
argv
[
4
],
'
rt
'
).
read
().
split
(
'
/
'
)[
1
:]
headerlibs
=
open
(
sys
.
argv
[
5
],
'
rt
'
).
read
().
split
(
'
;
'
)
headerlibs
=
open
(
sys
.
argv
[
5
],
'
rt
'
).
read
().
split
(
'
;
'
)
try
:
try
:
bincount
=
int
(
sys
.
argv
[
6
])
bincount
=
int
(
sys
.
argv
[
6
])
except
:
except
:
bincount
=
13
bincount
=
13
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
testname_map
=
{
b
:
t
.
split
(
'
;
'
)
for
b
,
t
in
zip
(
binaries
,
all_testnames
)}
testname_map
=
{
b
:
t
.
strip
().
split
(
'
;
'
)
for
b
,
t
in
zip
(
binaries
,
all_testnames
)}
processes
=
1
#cpu_count()
processes
=
1
#cpu_count()
totals
=
do_timings
(
builddir
,
testdir
,
binaries
,
all_testnames
,
processes
,
headerlibs
)
totals
=
do_timings
(
builddir
,
testdir
,
binaries
,
all_testnames
,
processes
,
headerlibs
)
...
@@ -160,12 +160,11 @@ norm = 100/MAXTIME
...
@@ -160,12 +160,11 @@ norm = 100/MAXTIME
print
(
'
Generated {} bins.
\n
Relative volumes:
\n\t\t
Min {:.2f}%
\n\t\t
Max {:.2f}%
\n\t\t
Avg {:.2f}%
\n
'
.
format
(
print
(
'
Generated {} bins.
\n
Relative volumes:
\n\t\t
Min {:.2f}%
\n\t\t
Max {:.2f}%
\n\t\t
Avg {:.2f}%
\n
'
.
format
(
len
(
bins
),
min
(
vols
)
*
norm
,
max
(
vols
)
*
norm
,
mean
(
vols
)
*
norm
,
stdev
(
vols
)))
len
(
bins
),
min
(
vols
)
*
norm
,
max
(
vols
)
*
norm
,
mean
(
vols
)
*
norm
,
stdev
(
vols
)))
set_tpl
=
'''
set_tests_properties({
testname
} PROPERTIES LABELS
"
builder_{
idx
}
"
)
\n
'''
set_tpl
=
'''
set_tests_properties({} PROPERTIES LABELS
"
builder_{}
"
)
\n
'''
with
open
(
cmake_outfile
,
'
wt
'
)
as
out
:
with
open
(
cmake_outfile
,
'
wt
'
)
as
out
:
out
.
write
(
'
set(DXT_BIN_COUNT
"
{}
"
CACHE STRING
"
number of bins for test targets
"
)
\n
'
.
format
(
len
(
bins
)))
out
.
write
(
'
set(DXT_BIN_COUNT
"
{}
"
CACHE STRING
"
number of bins for test targets
"
)
\n
'
.
format
(
len
(
bins
)))
for
idx
,
bin
in
enumerate
(
bins
):
for
idx
,
bin
in
enumerate
(
bins
):
out
.
write
(
'
add_custom_target(test_binaries_builder_{} DEPENDS {})
\n
'
.
format
(
idx
,
'
'
.
join
(
sorted
(
bin
.
keys
()))))
out
.
write
(
'
add_custom_target(test_binaries_builder_{} DEPENDS {})
\n
'
.
format
(
idx
,
'
'
.
join
(
sorted
(
bin
.
keys
()))))
for
binary
in
sorted
(
bin
.
keys
()):
for
binary
in
sorted
(
bin
.
keys
()):
if
binary
not
in
headerlibs
:
if
binary
not
in
headerlibs
:
for
testname
in
testname_map
[
binary
]:
out
.
write
(
set_tpl
.
format
(
'
'
.
join
(
testname_map
[
binary
]),
idx
))
out
.
write
(
set_tpl
.
format
(
testname
=
testname
,
idx
=
idx
))
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