summaryrefslogtreecommitdiff
path: root/tcwg_kernel-build.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-12-11 11:13:33 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-12-12 09:44:22 +0000
commit72cc72574129d4298bb8e0c59dd9652ff8ddf491 (patch)
treec2d1beeefb963d99ab107607c83d290b0bc3d22d /tcwg_kernel-build.sh
parented75b2f2de450150ca8f6b5a5f06d7a240fcf84b (diff)
tcwg_kernel-build.sh: Rename reset_artifacts depend only on ${rr[]}
Rename $top_artifacts -> ${rr[top_artifacts]} $baseline -> ${rr[baseline_branch]} Change-Id: I87d07cf41bbbce2fe020c1b84c782ce412e6f596
Diffstat (limited to 'tcwg_kernel-build.sh')
-rwxr-xr-xtcwg_kernel-build.sh72
1 files changed, 36 insertions, 36 deletions
diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh
index 2b05af76..4a9d7beb 100755
--- a/tcwg_kernel-build.sh
+++ b/tcwg_kernel-build.sh
@@ -29,7 +29,7 @@ reset_baseline="${reset_baseline-false}"
start_at="${start_at-default}"
finish_at="${finish_at-default}"
target="${target-native}"
-top_artifacts="${top_artifacts-$(pwd)/artifacts}"
+rr[top_artifacts]="${rr[top_artifacts]-$(pwd)/artifacts}"
verbose="${verbose-true}"
verbose2="${verbose2-false}"
@@ -37,7 +37,7 @@ set -u
if $verbose2; then set -x; fi
-trap "eval \"echo ERROR at \${FUNCNAME[0]}:\${BASH_LINENO[0]}\" > $top_artifacts/failures" EXIT
+trap "eval \"echo ERROR at \${FUNCNAME[0]}:\${BASH_LINENO[0]}\" > ${rr[top_artifacts]}/failures" EXIT
if [ x"$target" = x"native" ]; then
rr[target]=$(uname -m)
@@ -47,7 +47,7 @@ fi
# Baseline branch name for current configuration. These branches are
# present in all above git repos.
-baseline="linaro-local/ci/tcwg_kernel/$toolchain-${rr[${toolchain}_version]}-${rr[target]}-${rr[linux_version]}-$linux_config"
+rr[baseline_branch]="linaro-local/ci/tcwg_kernel/$toolchain-${rr[${toolchain}_version]}-${rr[target]}-${rr[linux_version]}-$linux_config"
# We are not going to push any results for a one-off build.
if [ x"$current_project" = x"none" ]; then
@@ -96,9 +96,9 @@ else
base_artifacts_opt=""
fi
-run_step_init "$start_at" "$finish_at" "$top_artifacts" "$base_artifacts_opt" "$verbose"
+run_step_init "$start_at" "$finish_at" "${rr[top_artifacts]}" "$base_artifacts_opt" "$verbose"
-# Reset artifacts to an empty state. $top_artifacts/results is the most
+# Reset artifacts to an empty state. ${rr[top_artifacts]}/results is the most
# important artifact, since it records the metric of how successful the build
# is.
reset_artifacts ()
@@ -106,25 +106,25 @@ reset_artifacts ()
(
set -euf -o pipefail
- # Clean $top_artifacts but preserve
- # - $top_artifacts/console.log and $run_step_artifacts/console.log, which
+ # Clean ${rr[top_artifacts]} but preserve
+ # - ${rr[top_artifacts]}/console.log and $run_step_artifacts/console.log, which
# are being written to by run_step().
- # - $top_artifacts/jenkins/*, which is cleaned by tcwg_kernel.yaml.
- find $top_artifacts -maxdepth 2 \
- ! -path $top_artifacts ! -path $top_artifacts/console.log \
+ # - ${rr[top_artifacts]}/jenkins/*, which is cleaned by tcwg_kernel.yaml.
+ find ${rr[top_artifacts]} -maxdepth 2 \
+ ! -path ${rr[top_artifacts]} ! -path ${rr[top_artifacts]}/console.log \
! -path $run_step_artifacts ! -path $run_step_artifacts/console.log \
- ! -path $top_artifacts/jenkins ! -path "$top_artifacts/jenkins/*" \
+ ! -path ${rr[top_artifacts]}/jenkins ! -path "${rr[top_artifacts]}/jenkins/*" \
-print0 | xargs -0 rm -rf
# Set success metric to worst possible (-10).
- echo "Starting build" > $top_artifacts/results
- echo "-10" >> $top_artifacts/results
+ echo "Starting build" > ${rr[top_artifacts]}/results
+ echo "-10" >> ${rr[top_artifacts]}/results
# Clone base-artifacts so that run_step can rsync artifacts for skipped
# steps.
# TODO: base-artifacts repo is starting to get big, so we should
# fetch only the $baseline branch, instead of all branches.
- clone_or_update_repo base-artifacts $baseline https://git-us.linaro.org/toolchain/ci/base-artifacts.git
+ clone_or_update_repo base-artifacts ${rr[baseline_branch]} https://git-us.linaro.org/toolchain/ci/base-artifacts.git
)
}
@@ -149,12 +149,12 @@ clone_repo ()
if [ x"$current_rev" = x"default" ]; then
branch=${rr[${current_project}_rev]}
elif [ x"$current_rev" = x"baseline" ]; then
- branch="refs/remotes/baseline/$baseline"
+ branch="refs/remotes/baseline/${rr[baseline_branch]}"
else
branch=$current_rev
fi
else
- branch="refs/remotes/baseline/$baseline"
+ branch="refs/remotes/baseline/${rr[baseline_branch]}"
fi
# Decide on whether to use read-only or read-write mode for
@@ -177,16 +177,16 @@ clone_repo ()
git rev-parse HEAD > $run_step_artifacts/revision
if [ x"$project" = x"$current_project" ]; then
- baseline_rev=$(git rev-parse refs/remotes/baseline/$baseline)
+ baseline_rev=$(git rev-parse refs/remotes/baseline/${rr[baseline_branch]})
bad_rev=$(git rev-parse HEAD)
# Prepare for failure. If build fails we will bisect sha1 for
# $current_rev and sha1 for $baseline_rev.
- cat > $top_artifacts/trigger-bisect-on-failure <<EOF
+ cat > ${rr[top_artifacts]}/trigger-bisect-on-failure <<EOF
current_project=$current_project
baseline_rev=$baseline_rev
bad_rev=$bad_rev
EOF
- git rev-list --count HEAD ^$baseline_rev > $top_artifacts/distance-to-baseline
+ git rev-list --count HEAD ^$baseline_rev > ${rr[top_artifacts]}/distance-to-baseline
fi
)
}
@@ -311,13 +311,13 @@ build_abe ()
# Update artifacts on success.
if [ $res = 0 ]; then
- echo "Finished build_abe $component" >> $top_artifacts/results
+ echo "Finished build_abe $component" >> ${rr[top_artifacts]}/results
case "$component" in
- binutils) echo "-9" >> $top_artifacts/results ;;
- stage1) echo "-8" >> $top_artifacts/results ;;
- linux) echo "-7" >> $top_artifacts/results ;;
- glibc) echo "-6" >> $top_artifacts/results ;;
- stage2) echo "-5" >> $top_artifacts/results ;;
+ binutils) echo "-9" >> ${rr[top_artifacts]}/results ;;
+ stage1) echo "-8" >> ${rr[top_artifacts]}/results ;;
+ linux) echo "-7" >> ${rr[top_artifacts]}/results ;;
+ glibc) echo "-6" >> ${rr[top_artifacts]}/results ;;
+ stage2) echo "-5" >> ${rr[top_artifacts]}/results ;;
*) assert false ;;
esac
@@ -389,8 +389,8 @@ build_llvm ()
# Update artifacts on success.
if [ $res = 0 ]; then
- echo "Finished build_llvm" >> $top_artifacts/results
- echo "-1" >> $top_artifacts/results
+ echo "Finished build_llvm" >> ${rr[top_artifacts]}/results
+ echo "-1" >> ${rr[top_artifacts]}/results
touch $run_step_artifacts/build-ok
fi
)
@@ -467,13 +467,13 @@ count_linux_objs ()
res=0; wait $! || res=$?
# Number of .o files created is the main success metric.
- echo "linux_n_obj:" >> $top_artifacts/results
+ echo "linux_n_obj:" >> ${rr[top_artifacts]}/results
if [ $res != 0 ]; then
local linux_n_obj
linux_n_obj=$(find linux -name "*.o" | wc -l)
- echo "$linux_n_obj" >> $top_artifacts/results
+ echo "$linux_n_obj" >> ${rr[top_artifacts]}/results
else
- echo "all" >> $top_artifacts/results
+ echo "all" >> ${rr[top_artifacts]}/results
fi
fi
)
@@ -486,7 +486,7 @@ no_regression_p ()
set -euf -o pipefail
local linux_n_obj
- linux_n_obj=$(tail -n1 $top_artifacts/results)
+ linux_n_obj=$(tail -n1 ${rr[top_artifacts]}/results)
if [ x"$linux_n_obj" = x"all" ]; then
# Ideal result, no need to compare to baseline.
@@ -571,15 +571,15 @@ update_baseline ()
# Rsync current artifacts.
# !!! From this point on logs and other artifacts won't be included
# in base-artifacts.git repo.
- rsync -a --del --exclude /.git $top_artifacts/ base-artifacts/
+ rsync -a --del --exclude /.git ${rr[top_artifacts]}/ base-artifacts/
build_rev=$(git -C $current_project rev-parse HEAD)
cd base-artifacts
git add .
- git commit $amend -m "$current_project-$build_rev: $(tail -n1 $top_artifacts/results)
+ git commit $amend -m "$current_project-$build_rev: $(tail -n1 ${rr[top_artifacts]}/results)
-$(cat $top_artifacts/results)"
+$(cat ${rr[top_artifacts]}/results)"
)
}
@@ -592,8 +592,8 @@ push_baseline ()
assert ! $git_read_only
git_init_linaro_local_remote base-artifacts baseline false
- git_push base-artifacts baseline $baseline
- git_push $current_project baseline $baseline
+ git_push base-artifacts baseline ${rr[baseline_branch]}
+ git_push $current_project baseline ${rr[baseline_branch]}
)
}