summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-01-23 14:01:09 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-01-28 12:45:07 +0000
commit9f60df151bfe81ae4e056978aa4b01a34c6c8210 (patch)
treef3d1c43c4953155c4c3db4b28b9d24c28842b2f7
parent3323a972727c91c9df0ffc7328ab4eaedfe497e1 (diff)
tcwg_kernel-bisect.sh: Simplify checking first_bad's parents
Add a quick exit path to the $artifacts/test.sh script, which simplifies checking of first_bad's parents. Remove list of skipped_revs since we are not using it. Change-Id: I3d8601bafcbf1501239fa5a097830181b327454c
-rwxr-xr-xtcwg_kernel-bisect.sh86
1 files changed, 38 insertions, 48 deletions
diff --git a/tcwg_kernel-bisect.sh b/tcwg_kernel-bisect.sh
index acfc20c2..2bde3c3f 100755
--- a/tcwg_kernel-bisect.sh
+++ b/tcwg_kernel-bisect.sh
@@ -84,9 +84,21 @@ echo "$baseline_rev" >> $artifacts/good_revs
# skip revisions between rev_20 and rev_22. This might cause other edge
# cases to be handled sub-optimally, though.
cat > $artifacts/test.sh <<EOF
-#!/bin/sh
+#!/bin/bash
+
+set -euf -o pipefail
+
rev=\$(git rev-parse HEAD)
cd ..
+
+touch $rel_artifacts/bad_revs $rel_artifacts/good_revs
+
+if grep -q \$rev $rel_artifacts/bad_revs; then
+ exit 1
+elif grep -q \$rev $rel_artifacts/good_revs; then
+ exit 0
+fi
+
$build_script \
^^ $reproduce_bisect \
%% $rel_artifacts/manifests/build-\$rev.sh \
@@ -95,12 +107,10 @@ $build_script \
--top_artifacts $rel_artifacts/build-\$rev \
--verbose "$verbose" &
res=0 && wait \$! || res=\$?
-if [ -f $rel_artifacts/build-\$rev/failures ]; then
+
+if [ x"\$res" != x"0" ]; then
echo "\$rev" >> $rel_artifacts/bad_revs
exit 1
-elif [ x"\$res" != x"0" ]; then
- echo "\$rev" >> $rel_artifacts/skipped_revs
- exit 125
else
echo "\$rev" >> $rel_artifacts/good_revs
exit 0
@@ -192,15 +202,8 @@ if [ x"$res" = x"0" ]; then
first_bad=$(cat .git/BISECT_RUN | head -n 1 | grep "is the first bad commit" | cut -d" " -f 1)
assert [ x"$first_bad" != x"" ]
+ res=0
for last_good in $(git rev-parse $first_bad^@); do
- if grep -q $last_good "$artifacts/good_revs"; then
- # One of immediate parrents of $first_bad tested good.
- break
- fi
- last_good=""
- done
- if [ x"$last_good" = x"" ]; then
- # None of immediate parents of $first_bad tested as good.
# It seems that git-bisect assumes parent commit as "good" on
# the basis of one of its children being "good". Therefore we
# can have a situation when we have parent P with children C1 and C2,
@@ -209,45 +212,32 @@ if [ x"$res" = x"0" ]; then
# and it knows CB is "bad", so git-bisect returns C1 as the first bad
# commit.
# To simplify investigations we explicitly test parent of $first_bad.
- res=0
- for last_good in $(git rev-parse $first_bad^@); do
- if grep -q $last_good "$artifacts/bad_revs" "$artifacts/skipped_revs"; then
- echo "First_bad's parent $last_good has tested bad or skipped"
- last_good=""
- continue
- fi
- if [ x"$(git merge-base $merge_base $last_good)" != x"$merge_base" ]; then
- echo "First_bad's parent $last_good is outside of bisect scope"
- last_good=""
- continue
- fi
- echo "Testing first_bad's parent $last_good (hoping for success)"
- git checkout --detach "$last_good"
- $artifacts/test.sh &
- res=0 && wait $! || res=$?
- if [ x"$res" = x"0" ]; then
- break
- fi
- done
- if [ x"$res" != x"0" ]; then
- # 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.
- # We need to be careful to avoid re-trigger loops, so verify that
- # last_good is an ancestor of bad_rev.
- assert [ x"$(git rev-list $last_good ^$bad_rev)" = x"" ]
- cat > $artifacts/trigger-0-bisect-again <<EOF
+ echo "Testing first_bad's parent $last_good (hoping for success)"
+ git checkout --detach "$last_good"
+ $artifacts/test.sh &
+ res=0 && wait $! || res=$?
+ if [ x"$res" = x"0" ]; then
+ break
+ fi
+ done
+ if [ x"$res" != x"0" ]; then
+ # 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.
+ # 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-0-bisect-again <<EOF
current_project=$current_project
baseline_rev=$baseline_rev
bad_rev=$last_good
EOF
- # Don't send any emails.
- echo > $artifacts/jenkins/mail-recipients.txt
- touch $artifacts/jenkins/build-name
- sed -i -e "s/\$/-retry/" $artifacts/jenkins/build-name
- trap "" EXIT
- exit 0
- fi
+ # 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
+ trap "" EXIT
+ exit 0
fi
echo $first_bad > $artifacts/first-bad