diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2019-03-22 15:44:00 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2019-04-16 09:11:06 +0000 |
commit | 4ecd3dc43e4851fdd88455f6488eff4d39124be0 (patch) | |
tree | addcdb284a3c31399c0234c364fb5d25860b3e1c /round-robin.sh | |
parent | 47b5f3241cc42d3e54b6f15e14fb607324e4cf8d (diff) |
round-robin.sh: Add ${rr[update_baseline]} "rebase" capability
When initial results of CI jobs are not ideal we may be interested
in exporing whether earlier versions of components gave better results.
This is useful for general book-keeping, and as basis for manual
bisections. E.g., for code-size benchmarking we have started with
gcc-8 branches, but, ideally, also want to check whether gcc-7, gcc-6,
and earlier branches might have provided smaller binaries.
For this we add "rebase" mode for update_baseline parameter. This
mode is intended to be manually selected in jenkins web-UI, along
with component versions pre-dating earliest result recorded in
base-artifacts.git repo. The essence of this mode is to push results
to the bottom of base-artifacts.git history, rather than the top.
For code-size example we would trigger builds for gcc versions from
latest to earliest: gcc-7, gcc-6, gcc-5, and so on.
Note that "rebase" builds don't change apparent baseline viewed by
normal builds.
Change-Id: I0b0590a90460a1cd273165c0bf270a4cb227515a
Diffstat (limited to 'round-robin.sh')
-rw-r--r-- | round-robin.sh | 83 |
1 files changed, 57 insertions, 26 deletions
diff --git a/round-robin.sh b/round-robin.sh index a0c15aa2..a62bf98c 100644 --- a/round-robin.sh +++ b/round-robin.sh @@ -32,7 +32,9 @@ # build successful. Push our artifacts to the top of base-artifacts/. # - init: use "empty" results for base-artifacts, which will make current # build successful. Push our artifacts as the one and only entry. -#rr[update_baseline]=update/reset/init +# - rebase: treat results of this build as historically eldest, and +# rebase base-artifacts commits on top of this build's artifacts. +#rr[update_baseline]=update/reset/init/rebase # Target architecture to build for: arm or aarch64. #rr[target]="$target" @@ -380,7 +382,8 @@ check_regression () ( set -euf -o pipefail - if [ x"${rr[update_baseline]}" = x"update" ] && ! no_regression_p; then + if [ x"${rr[update_baseline]}" = x"update" ] \ + && ! no_regression_p base-artifacts ${rr[top_artifacts]}; then local single_component=$(print_single_updated_component) if [ x"$single_component" = x"" -o x"${rr[mode]}" = x"bisect" ]; then @@ -409,6 +412,19 @@ EOF # Fail. false + elif [ x"${rr[update_baseline]}" = x"rebase" ]; then + local base_artifacts_head base_artifacts_tail + base_artifacts_head=$(git -C base-artifacts rev-parse HEAD) + base_artifacts_tail=$(git -C base-artifacts rev-list --max-parents=0 HEAD) + git -C base-artifacts reset --hard $base_artifacts_tail + + if no_regression_p ${rr[top_artifacts]} base-artifacts; then + # Current results are no better then the all-time-best results. + # No reason to rebase base-artifacts. + false + fi + + git -C base-artifacts reset --hard $base_artifacts_head fi ) } @@ -420,32 +436,39 @@ update_baseline () set -euf -o pipefail local amend="" - local prev_head="" - - # We discard baseline entries for results worse or same than - # the current one, but keep entries for results that are better - # (so that we have a record of pending regressions). - while no_regression_p; do - prev_head="" - if git -C base-artifacts rev-parse HEAD^ >/dev/null 2>&1; then - # For every regression we want to keep artifacts for the first-bad - # build, so reset to the most relevant regression (marked by reset-baseline). - if [ -f base-artifacts/reset-baseline ] \ - && [ x"${rr[update_baseline]}" = x"update" ]; then - prev_head=$(git -C base-artifacts rev-parse HEAD) + local rebase_head + if [ x"${rr[update_baseline]}" != x"rebase" ]; then + local prev_head="" + + # We discard baseline entries for results worse or same than + # the current one, but keep entries for results that are better + # (so that we have a record of pending regressions). + while no_regression_p base-artifacts ${rr[top_artifacts]}; do + prev_head="" + if git -C base-artifacts rev-parse HEAD^ >/dev/null 2>&1; then + # For every regression we want to keep artifacts for the first-bad + # build, so reset to the most relevant regression (marked by reset-baseline). + if [ -f base-artifacts/reset-baseline ] \ + && [ x"${rr[update_baseline]}" = x"update" ]; then + prev_head=$(git -C base-artifacts rev-parse HEAD) + fi + git -C base-artifacts reset --hard HEAD^ + else + # We got to the beginning of git history, so amend the current + # commit. The initial state of baseline is "empty" branch, + # which we treat as worst possible in no_regression_p(). + amend="--amend" + break fi - git -C base-artifacts reset --hard HEAD^ - else - # We got to the beginning of git history, so amend the current - # commit. The initial state of baseline is "empty" branch, - # which we treat as worst possible in no_regression_p(). - amend="--amend" - break - fi - done + done - if [ x"$prev_head" != x"" ]; then - git -C base-artifacts reset --hard $prev_head + if [ x"$prev_head" != x"" ]; then + git -C base-artifacts reset --hard $prev_head + fi + else + rebase_head=$(git -C base-artifacts rev-parse HEAD) + git -C base-artifacts reset --hard refs/remotes/origin/empty + amend="--amend" fi # Rsync current artifacts. Make sure to use -I rsync option since @@ -486,6 +509,10 @@ update_baseline () git -C base-artifacts commit $amend -m "$msg_title $(cat ${rr[top_artifacts]}/results)" + + if [ x"${rr[update_baseline]}" = x"rebase" ]; then + git -C base-artifacts rebase -X theirs HEAD $rebase_head + fi ) } @@ -498,6 +525,10 @@ push_baseline () git_init_linaro_local_remote base-artifacts baseline false git_push base-artifacts baseline ${rr[baseline_branch]} + if [ x"${rr[update_baseline]}" = x"rebase" ]; then + return + fi + local c for c in $(print_updated_components); do git_push $c baseline ${rr[baseline_branch]} |