summaryrefslogtreecommitdiff
path: root/tcwg_kernel-build.sh
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2020-04-22 15:24:49 +0100
committerDavid Spickett <david.spickett@linaro.org>2020-04-23 12:54:33 +0100
commit52eb5a521c093601e3fba856599288bad7a5d96f (patch)
tree0e8a0c567c9d727becf411078f44cfc619c5f954 /tcwg_kernel-build.sh
parent2382c087b5f0d51a4556c8c62f4723ab5a0ab7c9 (diff)
Shellcheck fixes round 2
Also update the sanity check script to include .job files. Change-Id: Ibf72d9ff346ff7b012d4e282a6ac8f3b7e73590d
Diffstat (limited to 'tcwg_kernel-build.sh')
-rwxr-xr-xtcwg_kernel-build.sh39
1 files changed, 31 insertions, 8 deletions
diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh
index af8f8514..f6d5aea7 100755
--- a/tcwg_kernel-build.sh
+++ b/tcwg_kernel-build.sh
@@ -11,27 +11,39 @@ convert_args_to_variables "$@"
obligatory_variables rr[ci_config]
# 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[ci_project]="${rr[ci_project]-tcwg_kernel}"
+# 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}-{linux}-{linux_config}
IFS=- read -a ci_config <<EOF
${rr[ci_config]}
EOF
+# shellcheck disable=SC2154
rr[toolchain]=${rr[toolchain]-${ci_config[0]}}
+# shellcheck disable=SC2154
rr[release]=${rr[release]-${ci_config[1]}}
+# shellcheck disable=SC2154
rr[target]=${rr[target]-${ci_config[2]}}
+# shellcheck disable=SC2154
rr[linux_config]=${rr[linux_config]-${ci_config[4]}}
case "${rr[toolchain]}" in
- llvm) rr[components]="llvm linux" ;;
- gnu) rr[components]="binutils gcc linux" ;;
+ llvm)
+ # shellcheck disable=SC2154
+ rr[components]="llvm linux" ;;
+ gnu)
+ rr[components]="binutils gcc linux" ;;
*) assert false ;;
esac
@@ -87,10 +99,17 @@ build_linux_1 ()
(
set -euf -o pipefail
+ # Sanity check
+ if [[ $(pwd) == "/" ]]; then
+ echo "pwd is unexpectedly \"/\", exiting"
+ exit 1;
+ fi
+
clone_repo linux
- rm -rf $(pwd)/bin
- mkdir $(pwd)/bin
+ # shellcheck disable=SC2115
+ rm -rf "$(pwd)"/bin
+ mkdir "$(pwd)"/bin
local bin cc ld_opt
@@ -122,14 +141,15 @@ build_linux_1 ()
-a x"$(print_single_updated_component)" = x"linux" ]; then
ccache="ccache"
fi
- cat > $(pwd)/bin/${rr[target]}-cc <<EOF
+ cat > "$(pwd)"/bin/${rr[target]}-cc <<EOF
#!/bin/sh
exec $ccache $cc "\$@"
EOF
- chmod +x $(pwd)/bin/${rr[target]}-cc
+ chmod +x "$(pwd)"/bin/${rr[target]}-cc
# Define make variables.
- local opts="CC=$(pwd)/bin/${rr[target]}-cc $ld_opt SUBLEVEL=0 EXTRAVERSION=-bisect"
+ local opts
+ opts="CC=$(pwd)/bin/${rr[target]}-cc $ld_opt SUBLEVEL=0 EXTRAVERSION=-bisect"
if [ x"${rr[target]}" != x"$(uname -m)" ]; then
opts="$opts ARCH=$(print_kernel_target ${rr[target]})"
opts="$opts CROSS_COMPILE=$(print_gnu_target ${rr[target]})-"
@@ -146,7 +166,7 @@ EOF
make $opts oldconfig
ccache -z
- KBUILD_BUILD_TIMESTAMP=0 make $opts -j$(nproc --all) -s -k &
+ KBUILD_BUILD_TIMESTAMP=0 make $opts -j"$(nproc --all)" -s -k &
local res=0 && wait $! || res=$?
ccache -s
return $res
@@ -229,6 +249,8 @@ no_regression_p ()
# - "^ERROR:" detects linker errors
# - ": undefined reference" detects missing symbols during linking
# - "] Error " detects GNU make errors
+ # shellcheck disable=SC2154
+ # (defined by init_step in jenkins-helpers)
cat > $run_step_artifacts/results.regressions <<EOF
# First few build errors in logs:
$(cat $new_artifacts/console.log | sed -e 's/"[^"]*"//g' | grep " error:\|^ERROR:\|: undefined reference\|\] Error " | head | sed -e "s/^/# /")
@@ -277,6 +299,7 @@ tcwg_kernel_breakup_updated_components ()
fi
)
}
+# shellcheck disable=SC2154
rr[breakup_updated_components]=tcwg_kernel_breakup_updated_components
run_step stop_on_fail -10 reset_artifacts