summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-01-23 14:08:32 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-01-28 12:45:50 +0000
commita0698db2d98eb6e0fa186ce7964c5c813fae5e48 (patch)
treeab445b22ca39c4a1da43d68094870c190fa4b811
parent9f60df151bfe81ae4e056978aa4b01a34c6c8210 (diff)
tcwg_kernel-bisect.sh: Simplify linux-next rebase workaround
Linux-next:master rebases almost every day on top of the Linus's tree (aka linux-next:stable), which creates problems for bisections. We have tried to workaround these rebases, but results are still not ideal. This patch reworks (and simplifies!) handling of linux-next. The goal of testing linux-next:master is to detect regressions before they reach Linus's tree (linux-next:stable). Therefore, we are really only interested in regressions between linux-next:stable and linux-next:master (regressions in Linus's tree will be bisected in another job anyway). So the new workaround is to force baseline_rev to linux-next:stable and be done with it! This also allows us to remove confusing distinction between baseline_rev and good_rev. Change-Id: I96002f1d21f68e353c0b62837c4968bf956ecbf2
-rwxr-xr-xtcwg_kernel-bisect.sh93
1 files changed, 34 insertions, 59 deletions
diff --git a/tcwg_kernel-bisect.sh b/tcwg_kernel-bisect.sh
index 2bde3c3f..196633a4 100755
--- a/tcwg_kernel-bisect.sh
+++ b/tcwg_kernel-bisect.sh
@@ -39,6 +39,24 @@ if $verbose; then set -x; fi
trap "eval \"echo ERROR at \${FUNCNAME[0]}:\${BASH_LINENO[0]}\" > $artifacts/failures" EXIT
+rebase_workaround=false
+
+if [ x"$ci_project" = x"tcwg_kernel" ] \
+ && [ x"$current_project" = x"linux" -a x"${rr[linux_version]}" = x"next" ]; then
+ # Workaround linux-next/master rebasing on top of linux-next/stable.
+ # Search for regressions against linux-mainline:master (aka linux-next:stable).
+ clone_or_update_repo $current_project stable ${rr[linux_url]}
+ # Just in case linux-next:stable has advanced between the build and bisect jobs,
+ # use merge base between linux-next:stable and $bad_rev.
+ linux_next_stable="${linux_next_stable-$(git -C $current_project merge-base HEAD $bad_rev)}"
+ cat <<EOF | manifest_out
+declare -g linux_next_stable=$linux_next_stable
+EOF
+ echo "Rebase workaround: forcing baseline_rev to $linux_next_stable"
+ baseline_rev=$linux_next_stable
+ rebase_workaround=true
+fi
+
# Build baseline that we are going to re-use to speed-up bisection.
# (This also confirms that infrastructure is OK.)
echo "Testing baseline_rev $baseline_rev (should be success)"
@@ -118,68 +136,25 @@ fi
EOF
chmod +x $artifacts/test.sh
-# Workaround linux-next/master rebasing on top of linux-next/stable.
-# Try to find $good_rev that is "good" compared to baseline
-# and that is an ancesstor of both $baseline_rev and $bad_rev.
-merge_base=$(git merge-base $bad_rev $baseline_rev)
-origin=$(git remote get-url origin)
-origin=$(basename "$origin")
-if [ x"$merge_base" != x"$baseline_rev" -a x"$origin" = x"linux-next.git" ]; then
- # Try to use merge_base (just like git-bisect).
- try_revs=($merge_base)
-
- # Check if we can use linux-next/stable as our 2nd try.
- linux_next_stable="${linux_next_stable-$(git rev-parse refs/remotes/origin/stable)}"
- cat <<EOF | manifest_out
-declare -g linux_next_stable=$linux_next_stable
-EOF
- try_revs+=($linux_next_stable)
-
- # Check if we can use linux-mainline/master as our last resort.
- url=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
- git remote add mainline "$url" > /dev/null 2>&1 || true
- git remote set-url mainline "$url"
- clone_or_update_repo . refs/remotes/mainline/master "$url"
- mainline_master="${mainline_master-$(git merge-base $bad_rev HEAD)}"
- cat <<EOF | manifest_out
-declare -g mainline_master=$mainline_master
-EOF
- try_revs+=($mainline_master)
-
- for good_rev in "${try_revs[@]}"; do
- echo "Linux-next rebase workaround: testing potential good_rev $good_rev (hoping for success)"
- git checkout --detach "$good_rev"
- $artifacts/test.sh &
- res=0 && wait $! || res=$?
- if [ x"$res" = x"0" ]; then
- break
- fi
- done
-
- if [ x"$res" != x"0" ]; then
- # Below bisect will fail :-(
- echo "Linux-next rebase workaround: could not find a good parent, below bisect will fail"
- good_rev=$baseline_rev
- fi
-else
- good_rev=$baseline_rev
-fi
-
-ln -f -s "build-$good_rev" "$artifacts/build-good"
-ln -f -s "build-$good_rev.sh" "$artifacts/manifests/build-good.sh"
-
git checkout --detach $bad_rev
$artifacts/test.sh &
res=0 && wait $! || res=$?
if [ x"$res" = x"0" ]; then
- echo "WARNING: build for bad_rev $bad_rev succeeded"
- # Build job had a spurious failure. Re-try.
- cat > $artifacts/trigger-2-build-master <<EOF
+ touch $artifacts/jenkins/build-name
+ if $rebase_workaround; then
+ echo "Rebase workaround: no regression between $baseline_rev and $bad_rev"
+ sed -i -e "s/\$/-bad_rev-good/" $artifacts/jenkins/build-name
+ else
+ echo "WARNING: build for bad_rev $bad_rev succeeded"
+ # Build job had a spurious failure. Re-try.
+ cat > $artifacts/trigger-2-build-master <<EOF
current_project=$current_project
current_branch=$bad_rev
EOF
- rm -f $artifacts/jenkins/mail-recipients.txt
+ sed -i -e "s/\$/-spurious/" $artifacts/jenkins/build-name
+ fi
+ echo > $artifacts/jenkins/mail-recipients.txt
trap "" EXIT
exit 0
fi
@@ -187,7 +162,7 @@ fi
ln -f -s "build-$bad_rev" "$artifacts/build-bad"
ln -f -s "build-$bad_rev.sh" "$artifacts/manifests/build-bad.sh"
-git bisect start $bad_rev $good_rev 2>&1 | tee $artifacts/bisect.log
+git bisect start $bad_rev $baseline_rev 2>&1 | tee $artifacts/bisect.log
# "git bisect run" can fail (exit with non-zero) in a number of cases:
# - on trivial bisects (e.g., between HEAD^ and HEAD),
@@ -244,10 +219,10 @@ EOF
else
first_bad=$(git rev-parse HEAD)
if ! [ -f .git/BISECT_LOG ]; then
- # It seems this was a trivial bisect with $bad_rev^ == $good_rev.
+ # It seems this was a trivial bisect with $bad_rev^ == $baseline_rev.
first_bad=$bad_rev
last_good=$(git rev-parse $first_bad^)
- assert [ x"$last_good" = x"$good_rev" ]
+ assert [ x"$last_good" = x"$baseline_rev" ]
echo $first_bad > $artifacts/first-bad
fi
@@ -284,8 +259,8 @@ $(git -C $current_project log -n 1 $first_bad)
EOF
else
- good_name="good_rev"
- good_sha1="$good_rev"
+ good_name="baseline_rev"
+ good_sha1="$baseline_rev"
bad_name="bad"
bad_sha1="$bad_rev"
cat >> $artifacts/jenkins/mail-body.txt <<EOF