summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2020-12-19 17:10:29 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2020-12-19 17:11:03 +0000
commitc2a83d2bfc7a35fcef7c1257ced8259ac8d20d29 (patch)
tree6f72bb45e34a60c0c2443413aeebcf93dadd7bba
parent43b6a6a9422579ef3491269ef380401b2f1067e8 (diff)
Optimize testing of interesting commits
It's now taking 1 hour (!) to check all entries in interesting-commits/linux. This time is spent in --is-ancestor checks. With the list of interesting commits growing over time we either need to trim it from time to time, so optimize processing. This patch does 2 optimizations: - the obvious optimization to break from loop on first match - the optimization to quickly check whether commit is inside the bisict range. Change-Id: I712e08970a65e26a517571240e2a513878c907bb
-rwxr-xr-xround-robin-bisect.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/round-robin-bisect.sh b/round-robin-bisect.sh
index 7a48bf0e..24155b7b 100755
--- a/round-robin-bisect.sh
+++ b/round-robin-bisect.sh
@@ -344,6 +344,11 @@ print_tested_revs ()
# Try to reduce bisection range by testing regressions (and their parents)
# identified in other configurations.
touch ../interesting-commits/$current_project
+# Generate list of commits inside the bisection range.
+# It's surprising how expensive beloow "--is-ancestor" checks are, and it's
+# a good optimization to skip commits outside of our bisect range quickly.
+commits_to_test=$artifacts/git-logs/commits_to_test
+git bisect view --pretty=%H > $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
@@ -351,6 +356,13 @@ while [ x"$(get_first_bad </dev/null)" = x"" ] && read -a arr; do
set -euf -o pipefail
sha1="${arr[0]}"
+
+ if ! grep -q "^$sha1\$" $commits_to_test; then
+ # Commit is outside of bisection range.
+ # shellcheck disable=SC2106
+ continue
+ fi
+
# Skip $bad_rev and $baseline_rev, these were already tested.
if git bisect log | grep -q "^git bisect .* $sha1\$"; then
# shellcheck disable=SC2106
@@ -364,11 +376,17 @@ while [ x"$(get_first_bad </dev/null)" = x"" ] && read -a arr; do
for tested_bad in $(print_tested_revs bad); do
if ! git merge-base --is-ancestor $sha1 $tested_bad; then
skip=true
+ break
fi
done
+ if $skip; then
+ # shellcheck disable=SC2106
+ continue
+ fi
for tested_good in $(print_tested_revs good); do
if git merge-base --is-ancestor $sha1 $tested_good; then
skip=true
+ break
fi
done
if $skip; then
@@ -388,6 +406,7 @@ while [ x"$(get_first_bad </dev/null)" = x"" ] && read -a arr; do
else
git bisect bad
fi
+ git bisect view --pretty=%H > $commits_to_test
) </dev/null
done < <(tac ../interesting-commits/$current_project)
if $verbose; then set -x; fi