diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2023-08-25 06:47:06 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2023-08-25 07:29:29 +0000 |
commit | 667d2a7ccf8ace35992398093b96d872eb6cb544 (patch) | |
tree | d49824ae7bf329dc1036ee9bf1247858b684f5f7 /tcwg_bmk-build.sh | |
parent | c7c54410bed3c6a7bd9534693a683aa4997bef52 (diff) |
tcwg_bmk-build.sh: Rework handling of base-artifacts/annex/bmk-data
To avoid committing unwanted files into git (e.g., raw benchmarking
data) we implement "annex" support. Files are base-artifacts/annex
can be either symlinks to directories or regular files containing
an rsync-able url.
Here we convert directory symlinks into tarballs, upload to bkp-01
and replace symlinks with files pointing to their uploaded location.
In round-robin.sh:reset_artifacts() we do the opposite: download and
extract tarball into a temporary directory, and replace the file with
a symlink to that directory.
Change-Id: I78062a5147c944f18d6cd6eb5129f0d9fb74098c
Diffstat (limited to 'tcwg_bmk-build.sh')
-rwxr-xr-x | tcwg_bmk-build.sh | 62 |
1 files changed, 20 insertions, 42 deletions
diff --git a/tcwg_bmk-build.sh b/tcwg_bmk-build.sh index f9bb375d..59ba6683 100755 --- a/tcwg_bmk-build.sh +++ b/tcwg_bmk-build.sh @@ -188,7 +188,6 @@ benchmark () set -euf -o pipefail local bmk_flags="$2" - local results_id_file="$3" sanity_check_pwd @@ -286,10 +285,10 @@ benchmark () *) echo "ERROR: Unknown hw_tag $hw_tag"; exit 1 ;; esac - # we create a tmpdir in /tmp + # Create directory for tcwg-benchmark to upload results to local results_dir - results_dir="$(mktemp -d -p /tmp)" - chmod g+wx $results_dir + results_dir="$(mktemp -d)" + chmod go+wx "$results_dir" # Trigger benchmarking job and capture its console output. # Ignore exit code of the trigger command to detect various failure @@ -315,17 +314,6 @@ benchmark () ${bmk_branch+-p bmk_branch="$bmk_branch"} \ | tee $run_step_artifacts/benchmark-build.log || true - # copy bmk results into artifacts/annex/bmk-data/ - rm -rf ${rr[top_artifacts]}/annex/bmk-data/ - mkdir -p ${rr[top_artifacts]}/annex/bmk-data/ - rsync -rav $results_dir/ ${rr[top_artifacts]}/annex/bmk-data/ - - # make sure we are deleting a /tmp/xxx directory before forcing with sudo, - # and ignore error if any - if [[ "$results_dir" =~ ^/tmp/ ]]; then - sudo -n rm -rf "$results_dir" || true - fi - local build_num build_num=$(head -n1 $run_step_artifacts/benchmark-build.log \ | sed -e "s/Started.*#\([0-9]\+\).*/\1/") @@ -370,8 +358,9 @@ benchmark () | tee $run_step_artifacts/benchmark.log done - echo "$hw_tag/${rr[ci_project]}/${rr[ci_config]}-${rr[mode]}/$build_num" \ - > "$results_id_file" + rm -rf "${rr[top_artifacts]}/annex" + mkdir "${rr[top_artifacts]}/annex" + ln -s "$results_dir" "${rr[top_artifacts]}/annex/bmk-data" return $build_ret ) @@ -402,26 +391,19 @@ compare_results () sudo /usr/lib/linux-tools/install-armhf-perf-workaround.sh fi - local new_results ref_results - new_results="${rr[top_artifacts]}/annex/bmk-data" - assert_with_msg "Benchmarking succeeded, but annex/bmk-data results are missing" \ - [ -d $new_results ] + local new_results="${rr[top_artifacts]}/annex/bmk-data" + local ref_results="base-artifacts/annex/bmk-data" - if [ ! -f base-artifacts/results_id ] ; then - # base-artifacts has no reference results. It doesn't have any results_id. - # This can happen on initialization of base-artifacts (update_baseline=init) - # or in corner-cases like forced build failing during toolchain build. + assert_with_msg "Benchmarking succeeded, but no annex/bmk-data results" \ + [ -d "$new_results" ] + + if ! [ -d "$ref_results" ]; then + # base-artifacts has no reference results. + # This can happen on init build (update_baseline=init). # In such cases we compare results to themselves just as an exercise. - ref_results=$new_results - elif [ -d base-artifacts/annex/bmk-data ] ; then - # If bmk results in part of the baseline, use it. - # Usefule for bisect, during bisect, the first successful run, needs to be used as a reference. - # It updates the local baseline, but will not push the results to bkp-01. - # Use ref_results from baseline if exists. - ref_results="base-artifacts/annex/bmk-data" - else - # reference results to be retrieved before applying the comparison - ref_results="bkp-01.tcwglab:/home/tcwg-benchmark/results-$(cat base-artifacts/results_id)" + ref_results="$new_results" + assert_with_msg "No reference results" \ + [ "${rr[update_baseline]}" = "init" ] fi # Compare vs previous run @@ -510,7 +492,6 @@ compare_results () } # Exit with code 0 if no regression compared to base-artifacts/. -# Inspect build results ./results and performance results in ./results_id. no_regression_p () { ( @@ -528,16 +509,13 @@ no_regression_p () return 0 fi - assert_with_msg "Benchmarking succeeded, but results_id is missing" \ - [ -f $run_step_top_artifacts/results_id ] - # Make sure there is no stray results.regression file, which we use # as failure marker. assert ! [ -f $run_step_artifacts/results.regressions ] # At this stage, - # - new/results_id should exist (score>0) - # - ref/results_id might not exist, (ex: baseline score<0) + # - artifacts/annex/bmk-data should exist (score>0) + # - base-artifacts/annex/bmk-data should exist if update_baseline!=init # we call compare_results to generate the csv, and check metric regressions. compare_results "$metric_id" @@ -586,7 +564,7 @@ case "${rr[toolchain]}" in run_step skip_on_fail -3 build_bmk_llvm ;; esac -run_step skip_on_fail 1 benchmark -- "$cflags" ${rr[top_artifacts]}/results_id +run_step skip_on_fail 1 benchmark -- "$cflags" run_step reset_on_fail x check_regression trap "" EXIT |