Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
b972895b
Commit
b972895b
authored
May 21, 2021
by
Dennis Gläser
Browse files
[bin][findtests] avoid caching mechanism
parent
ae76d3d3
Pipeline
#4350
passed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bin/testing/findtests.py
View file @
b972895b
...
...
@@ -26,29 +26,26 @@ def hasCommonMember(myset, mylist):
# make dry run and return the compilation command
def
getCompileCommand
(
testConfig
,
buildTreeRoot
=
'.'
):
lines
=
subprocess
.
check_output
([
"make"
,
"--dry-run"
,
testConfig
[
"target"
]],
target
=
testConfig
[
'target'
]
lines
=
subprocess
.
check_output
([
"make"
,
"-B"
,
"--dry-run"
,
target
],
encoding
=
'ascii'
,
cwd
=
buildTreeRoot
).
splitlines
()
def
hasCppCommand
(
line
):
return
any
(
cpp
in
line
for
cpp
in
[
'g++'
,
'clang++'
])
# there may be library build commands first, last one is the actual target
commands
=
list
(
filter
(
lambda
line
:
hasCppCommand
(
line
),
lines
))
assert
len
(
commands
)
<=
1
return
commands
[
0
]
if
commands
else
None
return
commands
[
-
1
]
if
commands
else
None
# get the command and folder to compile the given test
def
buildCommandAndDir
(
testConfig
,
cache
,
buildTreeRoot
=
'.'
):
def
buildCommandAndDir
(
testConfig
,
buildTreeRoot
=
'.'
):
compCommand
=
getCompileCommand
(
testConfig
,
buildTreeRoot
)
if
compCommand
is
None
:
with
open
(
cache
)
as
c
:
data
=
json
.
load
(
c
)
return
data
[
"command"
],
data
[
"dir"
]
raise
Exception
(
"Could not determine compile command for {}"
.
format
(
testConfig
))
else
:
(
_
,
dir
),
command
=
[
comm
.
split
()
for
comm
in
compCommand
.
split
(
"&&"
)]
with
open
(
cache
,
"w"
)
as
c
:
json
.
dump
({
"command"
:
command
,
"dir"
:
dir
},
c
)
return
command
,
dir
...
...
@@ -57,9 +54,7 @@ def isAffectedTest(testConfigFile, changedFiles, buildTreeRoot='.'):
with
open
(
testConfigFile
)
as
configFile
:
testConfig
=
json
.
load
(
configFile
)
cacheFile
=
"TestTargets/"
+
testConfig
[
"target"
]
+
".json"
cacheFile
=
os
.
path
.
join
(
buildTreeRoot
,
cacheFile
)
command
,
dir
=
buildCommandAndDir
(
testConfig
,
cacheFile
,
buildTreeRoot
)
command
,
dir
=
buildCommandAndDir
(
testConfig
,
buildTreeRoot
)
mainFile
=
command
[
-
1
]
# detect headers included in this test
...
...
@@ -104,9 +99,6 @@ if __name__ == '__main__':
subprocess
.
run
([
"make"
,
"clean"
],
cwd
=
buildDir
)
subprocess
.
run
([
"make"
,
"all"
],
cwd
=
buildDir
)
# create cache folder
os
.
makedirs
(
os
.
path
.
join
(
buildDir
,
"TestTargets"
),
exist_ok
=
True
)
# detect affected tests
print
(
"Detecting affected tests:"
)
affectedTests
=
{}
...
...
Dennis Gläser
@DennisGlaeser
mentioned in commit
bffd84f3
·
Jun 02, 2021
mentioned in commit
bffd84f3
mentioned in commit bffd84f3e6ec5ada85159c7e22c9ac6906e7c60b
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment