summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-01-05 19:36:53 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-01-05 19:36:53 +0000
commit36aa35cacb1ec2aaa8850fd78dc561a16dec8b59 (patch)
treeeb89150dec3a26fa92bd8e1db56401f228d9e295
parentd04c755cb2852cb088990d94dc7ae88b4e5ef656 (diff)
round-robin-bisect.sh: Make code to trigger follow-up builds more robust
... and with better comments. Change-Id: I9e61b94e382d265daeae6cc8fd4ba5ab9f83bb68
-rwxr-xr-xround-robin-bisect.sh51
1 files changed, 36 insertions, 15 deletions
diff --git a/round-robin-bisect.sh b/round-robin-bisect.sh
index 016d0883..fb702166 100755
--- a/round-robin-bisect.sh
+++ b/round-robin-bisect.sh
@@ -456,8 +456,44 @@ else
first_bad=$(git rev-parse HEAD)
push_interesting_commit $first_bad "bad-merge-base"
fi
+
+# Bisect if officially over.
cd ..
+# Create trigger-build-* files for subsequent builds.
+if ! [ -f $artifacts/build-$bad_rev/trigger-build-$current_project ]; then
+ # This can happen *only* when replaying bisects.
+ # Otherwise $bad_rev is always tested second to $baseline_rev.
+ bad_build=$(find $artifacts -path "$artifacts/build-*/trigger-build-$current_project" | tail -n1)
+ assert_with_msg "No bad build during this bisect" [ x"$bad_build" != x"" ]
+ mkdir -p $artifacts/build-$bad_rev
+ cp $bad_build $artifacts/build-$bad_rev/trigger-build-$current_project
+ sed -i -e "s/^${current_project}_branch=.*\$/${current_project}_branch=$bad_rev/" \
+ $artifacts/build-$bad_rev/trigger-build-$current_project
+fi
+
+if ! [ -f $artifacts/build-$first_bad/trigger-build-$current_project ]; then
+ # This is rare, but git bisect can infer that a commit is first-bad
+ # without actually testing it. Workaround by constructing trigger-build
+ # file from that of $bad_rev's.
+ mkdir -p $artifacts/build-$first_bad
+ cp $artifacts/build-$bad_rev/trigger-build-$current_project \
+ $artifacts/build-$first_bad/trigger-build-$current_project
+ sed -i -e "s/$first_bad/$bad_rev/" $artifacts/trigger-build-2-default
+fi
+
+if ! [ -f $artifacts/trigger-build-1-advance ]; then
+ # Reset baseline to the regressed commit so that we will catch subsequent
+ # regressions (worse than $bad_rev).
+ cp $artifacts/build-$first_bad/trigger-build-$current_project \
+ $artifacts/trigger-build-1-reset
+ echo "update_baseline=reset" >> $artifacts/trigger-build-1-reset
+fi
+
+# Trigger master build now instead of waiting for next timed SCM trigger.
+cp $artifacts/build-$bad_rev/trigger-build-$current_project \
+ $artifacts/trigger-build-2-default
+
# Save BISECT_* logs
find "$current_project" -path "$current_project/.git/BISECT_*" -print0 | xargs -0 -I@ mv @ $artifacts/git-logs/
@@ -644,19 +680,4 @@ $CI_MAIL_RECIPIENTS
EOF
fi
-# Reset baseline to the regressed commit so that we will catch subsequent
-# regressions (worse than $bad_rev).
-cp $artifacts/build-$first_bad/trigger-build-$current_project $artifacts/trigger-build-1-reset
-echo "update_baseline=reset" >> $artifacts/trigger-build-1-reset
-
-# Trigger master build now instead of waiting for next timed SCM trigger.
-if [ -f $artifacts/build-$bad_rev/trigger-build-$current_project ]; then
- cp $artifacts/build-$bad_rev/trigger-build-$current_project $artifacts/trigger-build-2-default
-else
- # When replaying a bisect we often skip the $bad_rev build, so we won't
- # have its artifacts. Use $first_bad's trigger-build-* instead.
- cp $artifacts/build-$first_bad/trigger-build-$current_project $artifacts/trigger-build-2-default
- sed -i -e "s/$first_bad/$bad_rev/" $artifacts/trigger-build-2-default
-fi
-
trap "" EXIT