#!/bin/bash set -euf -o pipefail scripts=$(dirname $0) # shellcheck source=jenkins-helpers.sh . $scripts/jenkins-helpers.sh # shellcheck source=round-robin.sh . $scripts/round-robin.sh convert_args_to_variables "$@" obligatory_variables rr[ci_project] rr[ci_config] declare -A rr # All config about configure flags, simulator, pretty names, .... is # implemented in this file # shellcheck source=tcwg_gnu-config.sh . $scripts/tcwg_gnu-config.sh # Execution mode: build or bisect, rr[mode]="${rr[mode]-build}" # Set custom revision for one of the projects, and use baseline revisions # for all other projects. rr[baseline_branch]="${rr[baseline_branch]-linaro-local/ci/${rr[ci_project]}/${rr[ci_config]}}" rr[update_baseline]="${rr[update_baseline]-ignore}" rr[top_artifacts]="${rr[top_artifacts]-$(pwd)/artifacts}" # {toolchain_ver}-{target}[-{type_of_test}] IFS=- read -a ci_config < "$xfails" <> "$xfails" echo "# Known failures (from baseline)" >> "$xfails" cat "$baseline_fails" >> "$xfails" # Set and save result_expiry_date so that we use the same expiration date # when re-generating results in round-robin-baseline.sh. if [ "${rr[result_expiry_date]-}" = "" ]; then rr[result_expiry_date]=$(date +%Y%m%d) # finalize_manifest() will not see declaration because we are running # in a sub-shell. Update manifest manually. cat < $run_step_artifacts/fails.sum & local res res=0 && wait $! || res=$? if [ $res != 0 ]; then # Add a short marker to record the status (used by Jenkins build-name) local n_regressions n_regressions=$(grep -c "^[A-Z]\+:" $run_step_artifacts/fails.sum \ || true) echo "# $n_regressions regressions" \ > $run_step_artifacts/results.regressions if [ $res = 2 ]; then # Result comparison found regressions (exit code 2) # # Exit code 1 means that the script has failed to process # .sum files. This likely indicates malformed or very unusual # results. printf "extra_build_params=" > $run_step_artifacts/extra-bisect-params local exp while read exp; do printf "++testsuites %s " $exp >> $run_step_artifacts/extra-bisect-params done < <(cat $run_step_artifacts/fails.sum \ | awk '/^Running .* \.\.\./ { print $2 }') printf "\n" >> $run_step_artifacts/extra-bisect-params else # validate_failures.py failed to process results. This means # either a corrupted manifest, or corrupted results, or a bug # in validate_failures.py. In either case, stop and wait for # a fix. return $EXTERNAL_FAIL fi fi return $res ) } # Implement rr[breakup_changed_components] hook. tcwg_gnu_breakup_changed_components () { ( set -euf -o pipefail local cc="" case "${rr[ci_project]}" in *_check_*) # Changes to "foo" of check_foo projects tend to cause the most # regressions. # Breakup changed components into "foo" and the rest of components # to reduce the number of builds. cc=$(echo "${rr[ci_project]}" | sed -e "s/.*_check_\(.*\)/\1/") ;; esac if print_changed_components "\n" | grep "^$cc\$" >/dev/null; then echo "$cc" print_changed_components "\n" | grep -v "^$cc\$" | tr '\n' ' ' \ | sed -e "s/ \$//g" echo else print_changed_components "\n" fi ) } rr[breakup_changed_components]=tcwg_gnu_breakup_changed_components # Define gnu_data[] as needed below settings_for_ci_project_and_config "${rr[ci_project]}" "${rr[ci_config]}" run_step stop_on_fail -10 reset_artifacts run_step stop_on_fail x prepare_abe case "${rr[ci_project]}" in tcwg_gnu_cross_build|tcwg_gnu_embed_build) run_step skip_on_fail 0 true run_step skip_on_fail 1 build_abe binutils run_step skip_on_fail 2 build_abe stage1 -- \ ${gnu_data[gcc_override_configure]} run_step skip_on_fail x clean_sysroot case "${rr[components]}" in *glibc*) run_step skip_on_fail 3 build_abe linux run_step skip_on_fail 4 build_abe glibc ;; *newlib*) run_step skip_on_fail 4 build_abe newlib ;; esac run_step skip_on_fail 5 build_abe stage2 -- \ ${gnu_data[gcc_override_configure]} run_step skip_on_fail 6 build_abe gdb run_step skip_on_fail 7 build_abe qemu ;; tcwg_gnu_cross_check_*|tcwg_gnu_embed_check_*) run_step skip_on_fail -8 build_abe binutils run_step skip_on_fail -7 build_abe stage1 -- \ ${gnu_data[gcc_override_configure]} run_step skip_on_fail x clean_sysroot case "${rr[components]}" in *glibc*) run_step skip_on_fail -6 build_abe linux run_step skip_on_fail -5 build_abe glibc ;; *newlib*) run_step skip_on_fail -5 build_abe newlib ;; esac run_step skip_on_fail -4 build_abe stage2 -- \ ${gnu_data[gcc_override_configure]} run_step skip_on_fail -3 build_abe gdb run_step skip_on_fail -2 build_abe qemu run_step skip_on_fail -1 build_abe dejagnu run_step skip_on_fail 0 build_abe "check_${rr[ci_project]#*check_}" -- "${runtestflags[@]}" \ ${gnu_data[gcc_override_configure]} \ ${gnu_data[gcc_target_board_options]} \ ${gnu_data[qemu_cpu]} ;; tcwg_gnu_native_build) run_step skip_on_fail 0 true run_step skip_on_fail 1 build_abe binutils run_step skip_on_fail 2 build_abe gcc run_step skip_on_fail x clean_sysroot run_step skip_on_fail 4 build_abe linux run_step skip_on_fail 5 build_abe glibc run_step skip_on_fail 6 build_abe gdb ;; tcwg_gnu_native_check_*|tcwg_gnu_native_fast_check_*) component="${rr[ci_project]#tcwg_gnu_native_}" component="${component#fast_}" declare -a abe_arguments=() if [ "${component}" = check_gdb ]; then abe_arguments=(--set check_buffer_workaround=gdb-read1) fi run_step skip_on_fail -8 build_abe binutils run_step skip_on_fail -7 build_abe gcc run_step skip_on_fail x clean_sysroot run_step skip_on_fail -5 build_abe linux run_step skip_on_fail -4 build_abe glibc run_step skip_on_fail -3 build_abe gdb run_step skip_on_fail -1 build_abe dejagnu run_step skip_on_fail 0 build_abe "$component" -- "${runtestflags[@]}" \ "${abe_arguments[@]}" ;; tcwg_bootstrap_build) run_step skip_on_fail 0 true run_step skip_on_fail 1 build_abe ${type_of_test} ;; tcwg_bootstrap_check) run_step skip_on_fail -2 build_abe ${type_of_test#check_} run_step skip_on_fail -1 build_abe dejagnu run_step skip_on_fail 0 build_abe ${type_of_test} -- "${runtestflags[@]}" ;; tcwg_binutils_build|tcwg_gcc_build|tcwg_gdb_build) run_step skip_on_fail 0 true run_step skip_on_fail 1 build_abe "${rr[components]}" ;; tcwg_binutils_check|tcwg_gcc_check) run_step skip_on_fail -2 build_abe "${rr[components]}" run_step skip_on_fail -1 build_abe dejagnu run_step skip_on_fail 0 build_abe "check_${rr[components]}" \ -- "${runtestflags[@]}" ;; tcwg_gdb_check) # GDB's testsuite has a limitation where it can only find debug info # within the installation prefix. To allow it to find the # distro-installed debug info for ld.so, use /usr as the prefix. We # don't need to actually install GDB there though, so disable the # install step. run_step skip_on_fail -2 build_abe "${rr[components]}" \ -- --prefix /usr --disable install run_step skip_on_fail -1 build_abe dejagnu run_step skip_on_fail 0 build_abe "check_${rr[components]}" \ -- "${runtestflags[@]}" --set check_buffer_workaround=gdb-read1 ;; tcwg_glibc_build) run_step skip_on_fail 0 init_abe_sysroot # ABE tries to copy gcc runtime libraries on glibc install, which # fails when we don't build gcc. Workaround by not installing glibc. run_step skip_on_fail 1 build_abe glibc -- --disable install ;; tcwg_glibc_check) run_step skip_on_fail -3 init_abe_sysroot run_step skip_on_fail -2 build_abe glibc -- --disable install run_step skip_on_fail -1 build_abe dejagnu run_step skip_on_fail 0 build_abe check_glibc \ -- "${runtestflags[@]}" --disable install ;; tcwg_gnu_mingw_build) run_step skip_on_fail 0 true run_step skip_on_fail x clean_sysroot run_step skip_on_fail 1 build_abe binutils run_step skip_on_fail 2 build_mingw headers run_step skip_on_fail 3 build_abe stage1 run_step skip_on_fail 4 build_mingw crt run_step skip_on_fail 5 build_mingw libs run_step skip_on_fail 6 build_abe stage2 #run_step skip_on_fail 7 build_abe gdb ;; tcwg_gnu_mingw_check_*) run_step skip_on_fail x clean_sysroot run_step skip_on_fail -8 build_abe binutils run_step skip_on_fail -7 build_mingw headers run_step skip_on_fail -6 build_abe stage1 run_step skip_on_fail -5 build_mingw crt run_step skip_on_fail -4 build_mingw libs run_step skip_on_fail -3 build_abe stage2 #run_step skip_on_fail -2 build_abe gdb run_step skip_on_fail -1 build_abe dejagnu run_step skip_on_fail 0 build_abe "${rr[ci_project]#tcwg_gnu_mingw_}" \ -- "${runtestflags[@]}" ;; esac run_step reset_on_fail x check_regression trap "" EXIT