diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2019-02-07 16:33:53 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2019-02-07 16:56:46 +0000 |
commit | 34962065fb408fbd486d5765fe6a690c94ee4c8b (patch) | |
tree | 61a18ad852df1a48b98b1c709255f4ead0b7c2fd | |
parent | 742e147d463a1f9cf95c01077336b36d24187247 (diff) |
tcwg_kernel-*.sh: Avoid proxy variables
... and use ${rr[X]} instead of $X.
We make an exception for $current_project in tcwg_kernel-bisect.sh
to do a mechanical change in a separate patch.
Change-Id: Ib365552483d016e9096cc791f61a34015e50e32a
-rwxr-xr-x | tcwg_kernel-bisect.sh | 30 | ||||
-rwxr-xr-x | tcwg_kernel-build.sh | 81 |
2 files changed, 43 insertions, 68 deletions
diff --git a/tcwg_kernel-bisect.sh b/tcwg_kernel-bisect.sh index bcd0909d..45a6aaf0 100755 --- a/tcwg_kernel-bisect.sh +++ b/tcwg_kernel-bisect.sh @@ -16,7 +16,7 @@ fresh_dir $artifacts "$artifacts/manifests/*" "$artifacts/jenkins/*" convert_args_to_variables "$@" shift "$SHIFT_CONVERTED_ARGS" -obligatory_variables bad_rev baseline_rev build_script ci_project ci_config +obligatory_variables bad_rev baseline_rev build_script rr[ci_project] BUILD_URL="${BUILD_URL:-$(pwd)}" reproduce_bisect="${reproduce_bisect:-false}" @@ -25,9 +25,11 @@ reproduce_bisect="${reproduce_bisect:-false}" convert_args_to_variables ^^ $reproduce_bisect %% $artifacts/manifests/build-parameters.sh "$@" $reproduce_bisect || manifest_pop -obligatory_variables current_project +obligatory_variables rr[current_project] rr[ci_config] -if [ x"$ci_project" = x"tcwg_kernel" ]; then +current_project=${rr[current_project]} + +if [ x"${rr[ci_project]}" = x"tcwg_kernel" ]; then obligatory_variables toolchain fi @@ -41,7 +43,7 @@ trap "eval \"echo ERROR at \${FUNCNAME[0]}:\${BASH_LINENO[0]}\" > $artifacts/fai rebase_workaround=false -if [ x"$ci_project" = x"tcwg_kernel" ] \ +if [ x"${rr[ci_project]}" = x"tcwg_kernel" ] \ && [ x"$current_project" = x"linux" -a x"${rr[linux_version]}" = x"next" ]; then # Workaround linux-next/master rebasing on top of linux-next/stable. # Search for regressions against linux-mainline:master (aka linux-next:stable). @@ -64,10 +66,10 @@ $build_script \ ^^ $reproduce_bisect \ %% $rel_artifacts/manifests/build-baseline.sh \ @@ $rel_artifacts/manifests/build-parameters.sh \ - --mode "baseline" \ - --current_branch "$baseline_rev" \ - --reset_baseline true \ - --top_artifacts "$rel_artifacts/build-baseline" \ + ==rr[mode] "baseline" \ + ==rr[current_branch] "$baseline_rev" \ + ==rr[reset_baseline] true \ + ==rr[top_artifacts] "$rel_artifacts/build-baseline" \ --verbose "$verbose" assert ! [ -f $artifacts/failures ] @@ -121,8 +123,8 @@ $build_script \ ^^ $reproduce_bisect \ %% $rel_artifacts/manifests/build-\$rev.sh \ @@ $rel_artifacts/manifests/build-parameters.sh \ - --mode bisect \ - --top_artifacts $rel_artifacts/build-\$rev \ + ==rr[mode] bisect \ + ==rr[top_artifacts] $rel_artifacts/build-\$rev \ --verbose "$verbose" & res=0 && wait \$! || res=\$? @@ -250,7 +252,7 @@ if [ -f $artifacts/first-bad ]; then ln -f -s "build-$last_good.sh" "$artifacts/manifests/build-last_good.sh" cat >> $artifacts/jenkins/mail-body.txt <<EOF -Successfully identified regression in $current_project for CI configuration $ci_config. +Successfully identified regression in $current_project for CI configuration ${rr[ci_config]}. Culprit: <cut> @@ -264,7 +266,7 @@ else bad_name="bad" bad_sha1="$bad_rev" cat >> $artifacts/jenkins/mail-body.txt <<EOF -Could not identify regression in $current_project for CI configuration $ci_config. See 'Bisect log' in the links below for bisection details. +Could not identify regression in $current_project for CI configuration ${rr[ci_config]}. See 'Bisect log' in the links below for bisection details. EOF fi @@ -314,7 +316,7 @@ git checkout --detach $good_sha1 cd .. </cut> -History of pending regressions and results: https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/ci/$ci_project/$ci_config +History of pending regressions and results: https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/ci/${rr[ci_project]}/${rr[ci_config]} Bisect log: ${BUILD_URL}artifact/$rel_artifacts/bisect.log/*view*/ Artifacts: ${BUILD_URL}artifact/$rel_artifacts/ @@ -335,7 +337,7 @@ fi # Set mail recipients last to preserve catch-error value from .yaml file. # Email developers. CI_MAIL_RECIPIENTS="tcwg-validation@linaro.org" -if [ x"$ci_project" = x"tcwg_kernel" ]; then +if [ x"${rr[ci_project]}" = x"tcwg_kernel" ]; then case "$toolchain:$current_project" in gnu:linux) ;; gnu:*) CI_MAIL_RECIPIENTS="$CI_MAIL_RECIPIENTS, christophe.lyon@linaro.org, maxim.kuvyrkov@linaro.org" ;; diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh index 6eda2248..ab169e5b 100755 --- a/tcwg_kernel-build.sh +++ b/tcwg_kernel-build.sh @@ -1,66 +1,59 @@ #!/bin/bash -set -ef -o pipefail +set -euf -o pipefail scripts=$(dirname $0) . $scripts/jenkins-helpers.sh convert_args_to_variables "$@" +obligatory_variables rr[ci_config] + # Execution mode: baseline, bisect, continue, jenkins-full -mode="${mode-baseline}" - -obligatory_variables toolchain \ - rr[linux_version] rr[linux_url] rr[linux_branch] - -# Toolchain to use: gnu or llvm -case "$toolchain" in - "gnu") obligatory_variables rr[gnu_version] \ - rr[binutils_url] rr[binutils_branch] \ - rr[gcc_url] rr[gcc_branch] ;; - "llvm") obligatory_variables rr[llvm_version] \ - rr[llvm_url] rr[llvm_branch] ;; -esac +rr[mode]="${rr[mode]-baseline}" -case "$mode" in +case "${rr[mode]}" in "jenkins-full") - obligatory_variables current_project current_branch + obligatory_variables rr[current_project] rr[current_branch] ;; esac # Set custom revision for one of the projects, and use baseline revisions # for all other projects. -current_project="${current_project-none}" -current_branch="${current_branch-default}" +rr[ci_project]="${rr[ci_project]-tcwg_kernel}" +rr[baseline_branch]="${rr[baseline_branch]-linaro-local/ci/${rr[ci_project]}/${rr[ci_config]}}" +rr[current_branch]="${rr[current_branch]-default}" +rr[current_project]="${rr[current_project]-none}" +rr[reset_baseline]="${rr[reset_baseline]-false}" +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 +rr[toolchain]=${rr[toolchain]-${ci_config[0]}} +rr[target]=${rr[target]-${ci_config[2]}} +rr[linux_config]=${rr[linux_config]-${ci_config[4]}} -linux_config="${linux_config-defconfig}" -reset_baseline="${reset_baseline-false}" start_at="${start_at-default}" finish_at="${finish_at-default}" -target="${target-native}" -top_artifacts="${top_artifacts-$(pwd)/artifacts}" verbose="${verbose-true}" verbose2="${verbose2-false}" -set -u - if $verbose2; then set -x; fi -trap "eval \"echo ERROR at \${FUNCNAME[0]}:\${BASH_LINENO[0]}\" > $top_artifacts/failures" EXIT - -if [ x"$target" = x"native" ]; then - target=$(uname -m) -fi +trap "eval \"echo ERROR at \${FUNCNAME[0]}:\${BASH_LINENO[0]}\"" EXIT # Set start and finish steps for different modes. default_start_at="" default_finish_at="" -case "$mode" in +base_artifacts_opt="base-artifacts" +case "${rr[mode]}" in "baseline") default_finish_at="update_baseline" ;; "bisect") - case "$toolchain:$current_project" in + case "${rr[toolchain]}:${rr[current_project]}" in gnu:binutils) default_start_at="build_abe-binutils" ;; gnu:gcc) default_start_at="build_abe-stage1" ;; gnu:linux) default_start_at="count_linux_objs" ;; @@ -71,14 +64,14 @@ case "$mode" in ;; "continue") # Developer mode. - case "$toolchain" in + case "${rr[toolchain]}" in "gnu") default_start_at="prepare_abe" ;; "llvm") default_start_at="build_llvm" ;; esac + base_artifacts_opt="" ;; "jenkins-full") ;; esac - if [ x"$start_at" = x"default" ]; then start_at="$default_start_at" fi @@ -86,27 +79,7 @@ if [ x"$finish_at" = x"default" ]; then finish_at="$default_finish_at" fi -if [ x"$mode" != x"continue" ]; then - base_artifacts_opt="base-artifacts" -else - base_artifacts_opt="" -fi - -run_step_init "$start_at" "$finish_at" "$top_artifacts" "$base_artifacts_opt" "$verbose" - -rr[baseline_branch]="linaro-local/ci/tcwg_kernel/$toolchain-${rr[${toolchain}_version]}-$target-${rr[linux_version]}-$linux_config" -rr[current_project]="$current_project" -rr[current_branch]="$current_branch" -rr[mode]="$mode" -rr[reset_baseline]="$reset_baseline" -rr[target]="$target" -rr[top_artifacts]="$top_artifacts" - -# Linux config to build in build_linux. -rr[linux_config]="$linux_config" - -# Toolchain to use: gnu or llvm. -rr[toolchain]="$toolchain" +run_step_init "$start_at" "$finish_at" "${rr[top_artifacts]}" "$base_artifacts_opt" "$verbose" . $scripts/round-robin.sh |