Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Christian Dietrich
clang-hash
Commits
4f0e68a3
Commit
4f0e68a3
authored
Jan 31, 2017
by
Christian Dietrich
Browse files
experiments: clean source dir, if parent commit fails
parent
1cdd593c
Pipeline
#3076
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
experiments/historical_build.py
View file @
4f0e68a3
...
@@ -52,6 +52,8 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
...
@@ -52,6 +52,8 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
# Did initial commit fail? Try again
# Did initial commit fail? Try again
if
info
.
get
(
"failed"
):
if
info
.
get
(
"failed"
):
logging
.
info
(
"Parent[%s^]: failed"
,
commit
)
logging
.
info
(
"Parent[%s^]: failed"
,
commit
)
shell
(
"cd %s; git clean -dfx"
,
src_path
)
self
.
call_configure
(
src_path
)
return
False
return
False
return
True
return
True
else
:
else
:
...
@@ -103,6 +105,7 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
...
@@ -103,6 +105,7 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
self
.
setup_compiler_paths
(
cl_path
)
self
.
setup_compiler_paths
(
cl_path
)
time
=
0
time
=
0
last_failed
=
True
while
commits
:
while
commits
:
# Search for a child of the current revision
# Search for a child of the current revision
commit
=
None
commit
=
None
...
@@ -126,7 +129,7 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
...
@@ -126,7 +129,7 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
# history, this is a NOP. Otherwise, we try to reset
# history, this is a NOP. Otherwise, we try to reset
# to the actual parent, and rebuild the project. This
# to the actual parent, and rebuild the project. This
# may fail, since the current commit might fix this.
# may fail, since the current commit might fix this.
self
.
build_parent
(
commit
[
0
])
self
.
build_parent
(
commit
[
0
]
,
from_scratch
=
last_failed
)
shell
(
"cd %s; git reset --hard %s"
,
src_path
,
commit
[
0
])
shell
(
"cd %s; git reset --hard %s"
,
src_path
,
commit
[
0
])
self
.
call_reconfigure
(
src_path
)
self
.
call_reconfigure
(
src_path
)
...
@@ -137,8 +140,10 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
...
@@ -137,8 +140,10 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
time
+=
info
[
'build-time'
]
/
1e9
time
+=
info
[
'build-time'
]
/
1e9
# Build was good. Remember that.
# Build was good. Remember that.
self
.
current_revision
=
commit
[
0
]
self
.
current_revision
=
commit
[
0
]
last_failed
=
False
else
:
else
:
self
.
current_revision
=
None
self
.
current_revision
=
None
last_failed
=
True
logging
.
info
(
"Rebuild for %d commits takes %f minutes"
,
logging
.
info
(
"Rebuild for %d commits takes %f minutes"
,
self
.
commits
.
value
,
time
/
60.
)
self
.
commits
.
value
,
time
/
60.
)
...
...
experiments/lib.py
View file @
4f0e68a3
...
@@ -59,7 +59,7 @@ class ClangHashHelper:
...
@@ -59,7 +59,7 @@ class ClangHashHelper:
shell
(
"cd %s; cd build; ../configure"
,
path
)
shell
(
"cd %s; cd build; ../configure"
,
path
)
elif
self
.
project_name
()
in
(
'mbedtls'
):
elif
self
.
project_name
()
in
(
'mbedtls'
):
shell
(
"cd %s; mkdir build; cd build; cmake .. -DCMAKE_C_COMPILER=$CC -DENABLE_PROGRAMS=OFF"
,
path
)
shell
(
"cd %s; mkdir
-p
build; cd build; cmake .. -DCMAKE_C_COMPILER=$CC -DENABLE_PROGRAMS=OFF"
,
path
)
elif
self
.
project_name
()
in
(
'lua'
,):
elif
self
.
project_name
()
in
(
'lua'
,):
# This is an ugly hack to make it possible to override the
# This is an ugly hack to make it possible to override the
# CC variable from the outsite.
# CC variable from the outsite.
...
@@ -75,7 +75,7 @@ class ClangHashHelper:
...
@@ -75,7 +75,7 @@ class ClangHashHelper:
raise
RuntimeError
(
"Not a valid project"
)
raise
RuntimeError
(
"Not a valid project"
)
def
call_reconfigure
(
self
,
path
):
def
call_reconfigure
(
self
,
path
):
if
self
.
project_name
()
in
(
'lua'
,):
if
self
.
project_name
()
in
(
'lua'
,
'mbedtls'
):
self
.
call_configure
(
path
)
self
.
call_configure
(
path
)
if
self
.
project_name
()
in
(
'cpython'
,):
if
self
.
project_name
()
in
(
'cpython'
,):
shell
(
"cd %s; mkdir -p build/Modules; cp -u Modules/Setup.dist build/Modules/Setup"
,
path
)
shell
(
"cd %s; mkdir -p build/Modules; cp -u Modules/Setup.dist build/Modules/Setup"
,
path
)
...
@@ -134,9 +134,11 @@ class ClangHashHelper:
...
@@ -134,9 +134,11 @@ class ClangHashHelper:
log
=
hash_log
.
read
()
log
=
hash_log
.
read
()
info
[
'clang-hash-hits'
]
=
log
.
count
(
"H"
)
info
[
'clang-hash-hits'
]
=
log
.
count
(
"H"
)
info
[
'clang-hash-misses'
]
=
log
.
count
(
"M"
)
info
[
'clang-hash-misses'
]
=
log
.
count
(
"M"
)
hash_log
.
close
()
logging
.
info
(
"Rebuild done[%s]: %s s; failed=%s"
,
logging
.
info
(
"Rebuild done[%s]: %s s; failed=%s"
,
info
.
get
(
"filename"
)
or
info
.
get
(
"commit"
),
info
.
get
(
"filename"
)
or
info
.
get
(
"commit"
),
build_time
/
1e9
,
build_time
/
1e9
,
info
.
get
(
"failed"
,
False
))
info
.
get
(
"failed"
,
False
))
return
info
return
info
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