summaryrefslogtreecommitdiff
path: root/tcwg_bmk-build.sh
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2020-04-22 09:45:09 +0100
committerDavid Spickett <david.spickett@linaro.org>2020-04-22 12:51:02 +0000
commit22593d90ca7ebcb06b4ff84389f176b1f9279eb3 (patch)
tree9f7dde0dfead169a47741242545292303c82d44b /tcwg_bmk-build.sh
parentcdd59df3e3f4bd1fb7155087222308e6bbc9b37c (diff)
tcwg_bmk-build.sh: Various shellcheck fixes
Change-Id: I8b2f10c368650fcd74ae261b0da406e3bc259bb3
Diffstat (limited to 'tcwg_bmk-build.sh')
-rwxr-xr-xtcwg_bmk-build.sh46
1 files changed, 34 insertions, 12 deletions
diff --git a/tcwg_bmk-build.sh b/tcwg_bmk-build.sh
index 6143ae6b..4159cfea 100755
--- a/tcwg_bmk-build.sh
+++ b/tcwg_bmk-build.sh
@@ -11,19 +11,25 @@ convert_args_to_variables "$@"
obligatory_variables rr[ci_project] rr[ci_config] ssh_host ssh_port
# Execution mode: baseline, bisect, jenkins-full
+# shellcheck disable=SC2154
rr[mode]="${rr[mode]-baseline}"
# Set custom revision for one of the projects, and use baseline revisions
# for all other projects.
+# shellcheck disable=SC2154
rr[baseline_branch]="${rr[baseline_branch]-linaro-local/ci/${rr[ci_project]}/${rr[ci_config]}}"
+# shellcheck disable=SC2154
rr[update_baseline]="${rr[update_baseline]-update}"
+# shellcheck disable=SC2154
rr[top_artifacts]="${rr[top_artifacts]-$(pwd)/artifacts}"
# {toolchain_name}-{toolchain_ver}-{target}-{bmk}-{cflags}
IFS=- read -a ci_config <<EOF
${rr[ci_config]}
EOF
+# shellcheck disable=SC2154
rr[toolchain]=${rr[toolchain]-${ci_config[0]}}
+# shellcheck disable=SC2154
rr[target]=${rr[target]-${ci_config[2]}}
benchmarks=("${benchmarks[@]-${ci_config[3]}}")
if [ x"${benchmarks[*]}" = x"default" ]; then
@@ -77,8 +83,11 @@ done
gcc_override_configure+=(--set gcc_override_configure=--disable-libsanitizer)
case "${rr[toolchain]}" in
- llvm) rr[components]="binutils gcc glibc llvm" ;;
- gnu) rr[components]="binutils gcc glibc" ;;
+ llvm)
+ # shellcheck disable=SC2154
+ rr[components]="binutils gcc glibc llvm" ;;
+ gnu)
+ rr[components]="binutils gcc glibc" ;;
*) assert false ;;
esac
@@ -135,8 +144,15 @@ benchmark ()
local cflags="$1"
local results_id_file="$3"
- rm -rf $(pwd)/bin
- mkdir $(pwd)/bin
+ # Sanity check
+ if [[ $(pwd) == "/" ]]; then
+ echo "pwd is unexpectedly \"/\", exiting"
+ exit 1;
+ fi
+
+ # shellcheck disable=SC2115
+ rm -rf "$(pwd)"/bin
+ mkdir "$(pwd)"/bin
local bmk_flags bmk_ldflags reboot run_profile
bmk_flags="$(echo $cflags | sed -e "s/_/ -/g" -e "s/LTO/flto/g")"
@@ -181,8 +197,9 @@ benchmark ()
case "${rr[toolchain]}:${benchmarks[@]}" in
llvm:spec2k6) bench_list="c_and_cxx" ;;
gnu:spec2k6) bench_list="all" ;;
- *) bench_list="${benchmarks[@]}" ;;
+ *) bench_list="${benchmarks[*]}" ;;
esac
+ # shellcheck disable=SC2154
sysroot="ssh://$ssh_host:$ssh_port:$sysroot"
local hw results_top image_arch results_id
@@ -194,6 +211,7 @@ benchmark ()
esac
local results_id="$results_top/${rr[ci_project]}/${rr[mode]}-${rr[ci_config]}/@build_num@"
+ # shellcheck disable=SC2154
remote_exec "ci.linaro.org:2222::-l $USER@linaro.org" \
build tcwg-benchmark-$hw -w \
-p bench_list="$bench_list" \
@@ -317,7 +335,7 @@ compare_results ()
result=100
echo "# $bmk,$symbol regressed by $metric" >> $run_step_artifacts/results.regressions
if [ x"$bmk" != x"$prev_bmk" ]; then
- printf "++benchmarks $bmk " >> $run_step_artifacts/extra-bisect-params
+ printf "++benchmarks %s " $bmk >> $run_step_artifacts/extra-bisect-params
prev_bmk="$bmk"
fi
else
@@ -355,18 +373,20 @@ no_regression_vs_p ()
return 0
fi
compare_results "$ref_artifacts/results_id-1" "$ref_artifacts/results_id-2" "--num_dsos 1 --num_symbols 0"
- for i in $(find $run_step_artifacts/ -type f -name "results*"); do
- mv $i $(dirname $i)/ref-$(basename $i)
- done
+ while IFS= read -r -d '' i
+ do
+ mv $i "$(dirname $i)"/ref-"$(basename $i)"
+ done < <(find $run_step_artifacts/ -type f -name "results*" -print0)
# Similarly, generate new-results-compare.csv.
if ! [ -f "$new_artifacts/results_id-1" -a -f "$new_artifacts/results_id-2" ]; then
return 1
fi
compare_results "$new_artifacts/results_id-1" "$new_artifacts/results_id-2" "--num_dsos 1 --num_symbols 0"
- for i in $(find $run_step_artifacts/ -type f -name "results*"); do
- mv $i $(dirname $i)/new-$(basename $i)
- done
+ while IFS= read -r -d '' i
+ do
+ mv $i "$(dirname $i)"/new-"$(basename $i)"
+ done < <(find $run_step_artifacts/ -type f -name "results*" -print0)
# Now compare the two reports.
# If "ref" has value of "100" (bad state), and "new" has value of "100"
@@ -474,6 +494,7 @@ tcwg_bmk_breakup_updated_components ()
fi
)
}
+# shellcheck disable=SC2154
rr[breakup_updated_components]=tcwg_bmk_breakup_updated_components
run_step stop_on_fail -10 reset_artifacts
@@ -490,6 +511,7 @@ case "${#cflags[@]}" in
2)
run_step skip_on_fail 0 benchmark "${cflags[0]}" -- ${rr[top_artifacts]}/results_id-1
run_step skip_on_fail 1 benchmark "${cflags[1]}" -- ${rr[top_artifacts]}/results_id-2
+ # shellcheck disable=SC2154
rr[no_regression_p]=no_regression_vs_p
run_step reset_on_fail x check_regression
;;