From e599832c459dfecc00d2ab9c61f800aaeaf390d3 Mon Sep 17 00:00:00 2001 From: Maxim Kuvyrkov Date: Sun, 11 Jul 2021 18:43:44 +0000 Subject: round-robin-bisect.sh: Save/restore baseline state ... to avoid bisect tests cloberring shared state. Change-Id: Ibd8059d513df9ec5cf5fe49777c020c655a46fd4 --- round-robin-bisect.sh | 44 +++++++++++++++++++++++++++++++------------- round-robin.sh | 9 --------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/round-robin-bisect.sh b/round-robin-bisect.sh index 1c65070e..fa3aa278 100755 --- a/round-robin-bisect.sh +++ b/round-robin-bisect.sh @@ -85,6 +85,16 @@ EOF ln -f -s "build-baseline" "$artifacts/build-$baseline_rev" ln -f -s "build-baseline.sh" "$artifacts/manifests/build-$baseline_rev.sh" +mkdir -p bisect/baseline + +# Save baseline build state, which we restore before individual bisect tests. +# This ensures that "bad" bisect tests won't affect "good" ones and vice versa. +baseline_exclude=( + --exclude bisect/ --exclude $rel_artifacts/ --exclude $current_project/ +) +rsync -a --del --delete-excluded "${baseline_exclude[@]}" + ./ ./bisect/baseline/ + cd $current_project mkdir $artifacts/git-logs @@ -146,6 +156,9 @@ fi cd .. +# Restore known-good baseline state. +rsync -a --del "${baseline_exclude[@]}" ./bisect/baseline/ ./ + $build_script \ ^^ $reproduce_bisect \ %% $rel_artifacts/manifests/build-\$rev.sh \ @@ -259,9 +272,10 @@ fi # Clone interesting-commits.git repo, which contains a list of SHA1s # that might cut down bisection time. Mostly, these are first_bad and # last_good commits. +interesting_commits="../bisect/interesting-commits" interesting_commits_rev=${interesting_commits_rev-linaro-local/ci/${rr[ci_project]}} -clone_or_update_repo ../interesting-commits $interesting_commits_rev https://git-us.linaro.org/toolchain/ci/interesting-commits.git auto $interesting_commits_rev -interesting_commits_rev=$(git -C ../interesting-commits rev-parse HEAD) +clone_or_update_repo $interesting_commits $interesting_commits_rev https://git-us.linaro.org/toolchain/ci/interesting-commits.git auto $interesting_commits_rev +interesting_commits_rev=$(git -C $interesting_commits rev-parse HEAD) cat <> ../interesting-commits/$current_project + if ! grep -q "^$sha1" $interesting_commits/$current_project; then + echo "$sha1" >> $interesting_commits/$current_project fi if [ x"$kind" = x"regression" ]; then - mapfile -t configs < <(grep "^$sha1" ../interesting-commits/$current_project | sed -e "s/^$sha1 *//") + mapfile -t configs < <(grep "^$sha1" $interesting_commits/$current_project | sed -e "s/^$sha1 *//") configs+=("${rr[ci_project]}"/"${rr[ci_config]}") mapfile -t configs < <(echo "${configs[@]}" | tr ' ' '\n' | sort -u) - sed -i -e "s#^$sha1.*\$#$sha1 ${configs[*]}#" ../interesting-commits/$current_project + sed -i -e "s#^$sha1.*\$#$sha1 ${configs[*]}#" $interesting_commits/$current_project fi - git -C ../interesting-commits add . - if [ x"$(git -C ../interesting-commits status --short)" = x"" ]; then + git -C $interesting_commits add . + if [ x"$(git -C $interesting_commits status --short)" = x"" ]; then # No file has changed. We've been here before... # E.g., this is a re-occuring regression in linux-next. exit 125 fi - git -C ../interesting-commits commit -m "Add $kind $sha1 from $BUILD_URL + git -C $interesting_commits commit -m "Add $kind $sha1 from $BUILD_URL ${configs[*]}" & local res=0 && wait $! || res=$? if [ x"$res" = x"0" ]; then - git_init_linaro_local_remote ../interesting-commits baseline false - git_push ../interesting-commits baseline linaro-local/ci/${rr[ci_project]} + git_init_linaro_local_remote $interesting_commits baseline false + git_push $interesting_commits baseline linaro-local/ci/${rr[ci_project]} fi ) & wait $! || push_interesting_commit_result=$? @@ -342,7 +356,7 @@ print_tested_revs () # Try to reduce bisection range by testing regressions (and their parents) # identified in other configurations. -touch ../interesting-commits/$current_project +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 @@ -387,7 +401,7 @@ while [ x"$(get_first_bad $commits_to_test )