summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-03-14 10:43:31 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-03-14 10:49:52 +0000
commit54f2d735bc3fab394b7b28e5fbffe26261a46603 (patch)
treec32f59424f28181d7d35a044fda25bfdc8df142b
parente53831da288d46eb2288f7251dcc8092d6088ef1 (diff)
tcwg_kernel-bisect.sh: Fix re-triggering bisection with invalid range
When re-triggering bisections due to bad $last_good commit, we need to check that baseline_rev is a parent of last_good -- otherwise we will end up with invalid bisection interval. Change-Id: Ic9f9e07783c967f2aef777105a26f02e526a8505
-rwxr-xr-xtcwg_kernel-bisect.sh35
1 files changed, 23 insertions, 12 deletions
diff --git a/tcwg_kernel-bisect.sh b/tcwg_kernel-bisect.sh
index 468b4bc6..12d48f68 100755
--- a/tcwg_kernel-bisect.sh
+++ b/tcwg_kernel-bisect.sh
@@ -289,6 +289,8 @@ fi
first_bad=$(get_first_bad)
if [ x"$first_bad" != x"" ]; then
+ # "git bisect run" succeeded. Check whether this is an actual regression
+ # or bisection artifact.
res=0
for last_good in $last_good $(git rev-parse $first_bad^@); do
# It seems that git-bisect assumes parent commit as "good" on
@@ -307,29 +309,38 @@ if [ x"$first_bad" != x"" ]; then
break
fi
done
- if [ x"$res" != x"0" ]; then
+ if [ x"$res" = x"0" ]; then
+ # Success!
+ push_interesting_commits $first_bad $last_good
+ # Touch $artifacts/first-bad as a marker of successful bisect.
+ echo $first_bad > $artifacts/first-bad
+ else
# It seems $last_good was on a path that tested good, even though
# it itself is bad. We re-trigger the bisection job with updated
# parameters.
+ push_interesting_commits $last_good
+
# We need to be careful to avoid re-trigger loops, so verify that
# last_good is an ancestor of bad_rev.
assert git merge-base --is-ancestor $last_good $bad_rev
- cat > $artifacts/trigger-bisect <<EOF
+ if git merge-base --is-ancestor $baseline_rev $last_good; then
+ # $last_good is a child of $baseline_rev, so we can re-trigger
+ # bisection with reduced bisection range.
+ cat > $artifacts/trigger-bisect <<EOF
current_project=$current_project
baseline_branch=$baseline_rev
bad_branch=$last_good
EOF
- # Don't send any emails.
- echo > $artifacts/jenkins/mail-recipients.txt
- touch $artifacts/jenkins/build-name
- sed -i -e "s/\$/-last_good-bad/" $artifacts/jenkins/build-name
- push_interesting_commits $last_good
- trap "" EXIT
- exit 0
+ touch $artifacts/jenkins/build-name
+ sed -i -e "s/\$/-last_good-bad/" $artifacts/jenkins/build-name
+ # Don't send any emails.
+ echo > $artifacts/jenkins/mail-recipients.txt
+ trap "" EXIT
+ exit 0
+ fi
+ # This case will be handled similar to "git bisect run" failure below.
+ # We are going to reset baseline to $first_bad.
fi
-
- push_interesting_commits $first_bad $last_good
- echo $first_bad > $artifacts/first-bad
else
# When "git bisect run" fails, e.g., due to merge-base of $baseline_rev and
# $bad_rev is worse than $baseline_rev, we want to reset baseline to HEAD,