diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-01-05 19:30:18 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-01-05 19:30:18 +0000 |
commit | d04c755cb2852cb088990d94dc7ae88b4e5ef656 (patch) | |
tree | e6822580140f376eccf40f08c5dccd2876c58521 | |
parent | 8bdc7c170b20821233d8859f8b677ca0a9f568ce (diff) |
round-robin-bisect.sh: Make logic of handling successful bisects more robust
Now on successful bisects we always have either a confirmed
regression or a restarted bisect.
Change-Id: Ic8600fa85c7b511063ddf5bbbbff31021a8b9535
-rwxr-xr-x | round-robin-bisect.sh | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/round-robin-bisect.sh b/round-robin-bisect.sh index 8a49e0c0..016d0883 100755 --- a/round-robin-bisect.sh +++ b/round-robin-bisect.sh @@ -343,6 +343,8 @@ touch ../interesting-commits/$current_project # Generate list of commits inside the bisection range. commits_to_test=$artifacts/git-logs/commits_to_test git bisect view --pretty=%H > $commits_to_test +orig_commits_to_test=$artifacts/git-logs/orig_commits_to_test +cp $commits_to_test $orig_commits_to_test # This loop can generate lots of console noise. set +x while [ x"$(get_first_bad </dev/null)" = x"" ] && read -a arr; do @@ -396,8 +398,13 @@ notify_devs=true 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 $(git rev-parse $first_bad^@); do + last_good="" + bad_last_good="" + for sha1 in $(git rev-parse $first_bad^@); do + # Ignore commits outside of original bisection range. + if ! grep -q "^$sha1\$" $orig_commits_to_test; then + continue + fi # 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, @@ -411,41 +418,35 @@ if [ x"$first_bad" != x"" ]; then $artifacts/test.sh & res=0 && wait $! || res=$? if [ x"$res" = x"0" ]; then + last_good=$sha1 break fi + bad_last_good=$sha1 done - # Add both $last_good and $first_bad to interesting commits. - push_interesting_commit $last_good "last-good" - push_interesting_commit $first_bad "regression" - if [ x"$push_interesting_commit_result" = x"125" ]; then - notify_devs=false - fi - if [ x"$res" = x"0" ]; then + + if [ x"$last_good" != x"" ]; then # Success! Touch $artifacts/first-bad as a marker of successful bisect. echo $first_bad > $artifacts/first-bad + # Add both $last_good and $first_bad to interesting commits. + push_interesting_commit $last_good "last-good" + push_interesting_commit $first_bad "regression" + if [ x"$push_interesting_commit_result" = x"125" ]; then + notify_devs=false + fi else - # It seems $last_good was on a path that tested good, even though - # it itself is bad. - # - # We need to be careful to avoid re-trigger loops - assert_with_msg "Last good is not an ancestor of bad rev!" \ - git merge-base --is-ancestor $last_good $bad_rev - 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 + assert_with_msg "Broken bisection range" [ x"$bad_last_good" != x"" ] + # All parents of $first_bad tested bad, so retrigger bisection with + # a reduced bisection range. + cat > $artifacts/trigger-bisect <<EOF current_project=$current_project bad_url=$bad_url -bad_branch=$last_good +bad_branch=$bad_last_good EOF - 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. + sed -i -e "s/\$/-retry-bisect/" $artifacts/jenkins/build-name + # Don't send any emails. + echo > $artifacts/jenkins/mail-recipients.txt + trap "" EXIT + exit 0 fi else # When "git bisect run" fails, e.g., due to merge-base of $baseline_rev and |