From 148a356dde11df9e306e7e7e13204c59211a6074 Mon Sep 17 00:00:00 2001 From: Maxim Kuvyrkov Date: Tue, 22 Jan 2019 08:14:57 +0000 Subject: tcwg_kernel-bisect.sh: Better handle regressions in merges commits At the moment we check only first parent of first_bad to confirm that it is good. This patch extends that to checking/finding a good parent of merge commits. Change-Id: I0cb38223e70b10531555615ca39f9d584948c751 --- tcwg_kernel-bisect.sh | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/tcwg_kernel-bisect.sh b/tcwg_kernel-bisect.sh index 61876313..24a0917b 100755 --- a/tcwg_kernel-bisect.sh +++ b/tcwg_kernel-bisect.sh @@ -198,8 +198,15 @@ 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"" ] - last_good=$(git rev-parse $first_bad^) - if ! grep -q $last_good "$artifacts/good_revs"; then + 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, @@ -208,10 +215,26 @@ 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. - echo "Testing last_good $last_good (hoping for success)" - git checkout --detach "$last_good" - $artifacts/test.sh & - res=0 && wait $! || res=$? + 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 -- cgit v1.2.3