summaryrefslogtreecommitdiff
path: root/tcwg_kernel-build.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-11-08 10:00:34 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-11-14 09:42:31 +0000
commit4d4514c4ae6c5dd2f02ecd4a8b09394f9f3b986a (patch)
tree773fba38fcc2f82978800ee8ad680b4b779d3351 /tcwg_kernel-build.sh
parent8ba084e4586a883068b369ccf6cec557b23adf07 (diff)
tcwg_kernel-build.sh: Fill in no_regression_p and check_regression.
Change-Id: I1725a201a7665d8728180bf021050e8c1c1378f7
Diffstat (limited to 'tcwg_kernel-build.sh')
-rwxr-xr-xtcwg_kernel-build.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh
index fe217607..1ace57c3 100755
--- a/tcwg_kernel-build.sh
+++ b/tcwg_kernel-build.sh
@@ -471,12 +471,61 @@ count_linux_objs ()
)
}
+# Exit with code 0 if no regression compared to base-artifacts/results.
no_regression_p ()
{
+ (
+ set -euf -o pipefail
+
+ local linux_n_obj
+ linux_n_obj=$(tail -n1 $top_artifacts/results)
+
+ if [ x"$linux_n_obj" = x"all" ]; then
+ # Ideal result, no need to compare to baseline.
+ return 0
+ fi
+
+ if ! [ "$linux_n_obj" -ge "-3" ]; then
+ # Something is very wrong with result (e.g., it's not a number).
+ return 1
+ fi
+
+ # Assume worst for non-existent baseline.
+ local base_linux_n_obj="-3"
+
+ if [ -f base-artifacts/results ]; then
+ base_linux_n_obj=$(tail -n1 base-artifacts/results)
+ if [ x"$base_linux_n_obj" = x"all" ]; then
+ # Current build is not ideal, so make sure baseline "all" is
+ # better than the current result.
+ base_linux_n_obj=$(($linux_n_obj+1))
+ elif ! [ "$base_linux_n_obj" -ge "-3" ]; then
+ # Something is very wrong with baseline result
+ # (e.g., it's not a number).
+ return 0
+ fi
+ fi
+
+ if [ $linux_n_obj -ge $base_linux_n_obj ]; then
+ return 0
+ else
+ return 1
+ fi
+ )
}
+# Check if current build regressed compared to the baseline
+# (unless $reset_baseline is set).
check_regression ()
{
+ (
+ set -euf -o pipefail
+
+ if ! $reset_baseline && ! no_regression_p; then
+ # Fail.
+ false
+ fi
+ )
}
update_baseline ()