Commit 4f0e68a3 authored by Christian Dietrich's avatar Christian Dietrich
Browse files

experiments: clean source dir, if parent commit fails

parent 1cdd593c
Pipeline #3076 passed with stage
in 0 seconds
......@@ -52,6 +52,8 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
# Did initial commit fail? Try again
if info.get("failed"):
logging.info("Parent[%s^]: failed", commit)
shell("cd %s; git clean -dfx", src_path)
self.call_configure(src_path)
return False
return True
else:
......@@ -103,6 +105,7 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
self.setup_compiler_paths(cl_path)
time = 0
last_failed = True
while commits:
# Search for a child of the current revision
commit = None
......@@ -126,7 +129,7 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
# history, this is a NOP. Otherwise, we try to reset
# to the actual parent, and rebuild the project. 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])
self.call_reconfigure(src_path)
......@@ -137,8 +140,10 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
time += info['build-time'] / 1e9
# Build was good. Remember that.
self.current_revision = commit[0]
last_failed = False
else:
self.current_revision = None
last_failed = True
logging.info("Rebuild for %d commits takes %f minutes",
self.commits.value, time/60.)
......
......@@ -59,7 +59,7 @@ class ClangHashHelper:
shell("cd %s; cd build; ../configure", path)
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',):
# This is an ugly hack to make it possible to override the
# CC variable from the outsite.
......@@ -75,7 +75,7 @@ class ClangHashHelper:
raise RuntimeError("Not a valid project")
def call_reconfigure(self, path):
if self.project_name() in ('lua',):
if self.project_name() in ('lua','mbedtls'):
self.call_configure(path)
if self.project_name() in ('cpython',):
shell("cd %s; mkdir -p build/Modules; cp -u Modules/Setup.dist build/Modules/Setup", path)
......@@ -134,9 +134,11 @@ class ClangHashHelper:
log = hash_log.read()
info['clang-hash-hits'] = log.count("H")
info['clang-hash-misses'] = log.count("M")
hash_log.close()
logging.info("Rebuild done[%s]: %s s; failed=%s",
info.get("filename") or info.get("commit"),
build_time / 1e9,
info.get("failed", False))
return info
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment