summaryrefslogtreecommitdiff
path: root/round-robin.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-10-10 08:16:33 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-10-10 12:40:10 +0000
commit8905025aa0567f6785c43a8f18056df5b4bd11a6 (patch)
tree7fe88dffc97c38ea59eb0067d696e65341a26b11 /round-robin.sh
parent2342182ab68b5784a9854971feeaaa56b8d212be (diff)
round-robin.sh: Add no_build_regression_p helper
... by moving code from tcwg_gnu-build.sh. This helper will also be used in upcoming improvements to tcwg_bmk-build.sh. Change-Id: I298cefc6d65d13461e3de53ef542b4a804042fad
Diffstat (limited to 'round-robin.sh')
-rw-r--r--round-robin.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/round-robin.sh b/round-robin.sh
index f886c73a..caf9c3e2 100644
--- a/round-robin.sh
+++ b/round-robin.sh
@@ -432,6 +432,35 @@ EOF
)
}
+# Exit with code 0 if no regression compared to base-artifacts/results.
+no_build_regression_p ()
+{
+ (
+ set -euf -o pipefail
+
+ local ref_artifacts=$1
+ local new_artifacts=$2
+
+ # The following check tests for an empty branch, and we return 0 if results
+ # are not present, since that's an inherently better state. If base-artifacts
+ # were not existing, then it would fail in reset_artifacts() stage.
+
+ if ! [ -f $ref_artifacts/results ]; then
+ return 0
+ fi
+
+ local build_result_ref build_result_new
+ build_result_ref=$(tail -n1 $ref_artifacts/results)
+ build_result_new=$(tail -n1 $new_artifacts/results)
+
+ if [ $build_result_new -lt $build_result_ref ]; then
+ return 1
+ elif [ $build_result_new -gt $build_result_ref ]; then
+ return 0
+ fi
+ )
+}
+
# Check if current build regressed compared to the baseline
# (unless ${rr[update_baseline]} is set to "reset").
check_regression ()