This is an automated email from the ASF dual-hosted git repository. aw pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/yetus.git
The following commit(s) were added to refs/heads/main by this push: new b83d2689 YETUS-1223. fix array usage in precommit (#304) b83d2689 is described below commit b83d2689a7ef5a8f4c275fa67e62bdc1604d9cc2 Author: Allen Wittenauer <a...@apache.org> AuthorDate: Mon May 22 12:25:35 2023 -0700 YETUS-1223. fix array usage in precommit (#304) --- precommit/src/main/shell/core.d/00-yetuslib.sh | 4 +- .../src/main/shell/core.d/builtin-bugsystem.sh | 10 +- precommit/src/main/shell/plugins.d/briefreport.sh | 6 +- precommit/src/main/shell/plugins.d/checkstyle.sh | 14 +-- precommit/src/main/shell/plugins.d/github.sh | 12 +-- precommit/src/main/shell/plugins.d/gitlab.sh | 8 +- precommit/src/main/shell/plugins.d/htmlout.sh | 8 +- precommit/src/main/shell/plugins.d/jira.sh | 8 +- precommit/src/main/shell/plugins.d/junit.sh | 2 +- precommit/src/main/shell/plugins.d/spotbugs.sh | 38 ++++---- precommit/src/main/shell/robots.d/buildkite.sh | 8 +- precommit/src/main/shell/test-patch.sh | 108 ++++++++++----------- 12 files changed, 113 insertions(+), 113 deletions(-) diff --git a/precommit/src/main/shell/core.d/00-yetuslib.sh b/precommit/src/main/shell/core.d/00-yetuslib.sh index acd93187..9b2177a5 100755 --- a/precommit/src/main/shell/core.d/00-yetuslib.sh +++ b/precommit/src/main/shell/core.d/00-yetuslib.sh @@ -143,7 +143,7 @@ function yetus_add_option declare option=$1 declare text=$2 - YETUS_OPTION_USAGE[${YETUS_OPTION_USAGE_COUNTER}]="${option}@${text}" + YETUS_OPTION_USAGE[YETUS_OPTION_USAGE_COUNTER]="${option}@${text}" ((YETUS_OPTION_USAGE_COUNTER=YETUS_OPTION_USAGE_COUNTER+1)) } @@ -191,7 +191,7 @@ function yetus_generic_columnprinter fi while read -r line; do - tmpa[${counter}]=${line} + tmpa[counter]=${line} ((counter=counter+1)) option="${line%%@*}" if [[ ${#option} -gt ${maxoptsize} ]]; then diff --git a/precommit/src/main/shell/core.d/builtin-bugsystem.sh b/precommit/src/main/shell/core.d/builtin-bugsystem.sh index 4ffd4aea..6a445d40 100755 --- a/precommit/src/main/shell/core.d/builtin-bugsystem.sh +++ b/precommit/src/main/shell/core.d/builtin-bugsystem.sh @@ -105,7 +105,7 @@ function console_finalreport seccoladj=$((seccoladj + 2 )) i=0 until [[ $i -ge ${#TP_HEADER[@]} ]]; do - printf '%s\n' "${TP_HEADER[${i}]}" + printf '%s\n' "${TP_HEADER[i]}" ((i=i+1)) done @@ -113,7 +113,7 @@ function console_finalreport echo "============================================================================" i=0 until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\|) subs=$(echo "${ourstring}" | cut -f3 -d\|) ela=$(echo "${ourstring}" | cut -f4 -d\|) @@ -145,7 +145,7 @@ function console_finalreport printf '\n\n%*s | Tests\n' "${seccoladj}" "Reason" i=0 until [[ $i -ge ${#TP_TEST_TABLE[@]} ]]; do - ourstring=$(echo "${TP_TEST_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_TEST_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\|) subs=$(echo "${ourstring}" | cut -f3 -d\|) printf '%*s | %s\n' "${seccoladj}" "${vote}" "${subs}" @@ -167,7 +167,7 @@ function console_finalreport i=0 until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\|) subs=$(echo "${ourstring}" | cut -f3 -d\|) logfile=$(echo "${ourstring}" | cut -f5 -d\| | tr -d ' ') @@ -186,7 +186,7 @@ function console_finalreport i=0 until [[ $i -ge ${#TP_FOOTER_TABLE[@]} ]]; do - comment=$(echo "${TP_FOOTER_TABLE[${i}]}" | "${SED}" -e "s,@@BASE@@,${url},g") + comment=$(echo "${TP_FOOTER_TABLE[i]}" | "${SED}" -e "s,@@BASE@@,${url},g") printf '%s\n' "${comment}" ((i=i+1)) done diff --git a/precommit/src/main/shell/plugins.d/briefreport.sh b/precommit/src/main/shell/plugins.d/briefreport.sh index b61e3b11..4e3489a9 100755 --- a/precommit/src/main/shell/plugins.d/briefreport.sh +++ b/precommit/src/main/shell/plugins.d/briefreport.sh @@ -115,7 +115,7 @@ function briefreport_finalreport i=0 until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\|) subs=$(echo "${ourstring}" | cut -f3 -d\|) ela=$(echo "${ourstring}" | cut -f4 -d\|) @@ -199,7 +199,7 @@ function briefreport_finalreport i=0 until [[ $i -gt ${#TP_TEST_TABLE[@]} ]]; do - ourstring=$(echo "${TP_TEST_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_TEST_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\|) subs=$(echo "${ourstring}" | cut -f3 -d\|) { @@ -225,7 +225,7 @@ function briefreport_finalreport i=0 until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') subs=$(echo "${ourstring}" | cut -f3 -d\|) logfile=$(echo "${ourstring}" | cut -f5 -d\| | tr -d ' ') diff --git a/precommit/src/main/shell/plugins.d/checkstyle.sh b/precommit/src/main/shell/plugins.d/checkstyle.sh index 91bee981..a2345566 100755 --- a/precommit/src/main/shell/plugins.d/checkstyle.sh +++ b/precommit/src/main/shell/plugins.d/checkstyle.sh @@ -177,8 +177,8 @@ function checkstyle_runner # start the clock per module, setup some help vars, etc start_clock - fn=$(module_file_fragment "${MODULE[${i}]}") - modulesuffix=$(basename "${MODULE[${i}]}") + fn=$(module_file_fragment "${MODULE[i]}") + modulesuffix=$(basename "${MODULE[i]}") output="${PATCH_DIR}/${repostatus}-checkstyle-${fn}.txt" logfile="${PATCH_DIR}/buildtool-${repostatus}-checkstyle-${fn}.txt" @@ -190,19 +190,19 @@ function checkstyle_runner ant) cmd="${ANT} \ -Dcheckstyle.consoleOutput=true \ - ${MODULEEXTRAPARAM[${i}]//@@@MODULEFN@@@/${fn}} \ + ${MODULEEXTRAPARAM[i]//@@@MODULEFN@@@/${fn}} \ ${ANT_ARGS[*]} checkstyle" ;; maven) cmd="${MAVEN} ${MAVEN_ARGS[*]} \ checkstyle:${CHECKSTYLE_GOAL} \ ${CHECKSTYLE_OPTIONS} \ - ${MODULEEXTRAPARAM[${i}]//@@@MODULEFN@@@/${fn}} -Ptest-patch" + ${MODULEEXTRAPARAM[i]//@@@MODULEFN@@@/${fn}} -Ptest-patch" ;; gradle) cmd="${GRADLEW} ${GRADLEW_ARGS[*]} \ checkstyleMain checkstyleTest \ - ${MODULEEXTRAPARAM[${i}]//@@@MODULEFN@@@/${fn}}" + ${MODULEEXTRAPARAM[i]//@@@MODULEFN@@@/${fn}}" ;; *) UNSUPPORTED_TEST=true @@ -334,7 +334,7 @@ function checkstyle_runner savestop=$(stop_clock) #shellcheck disable=SC2034 - MODULE_STATUS_TIMER[${i}]=${savestop} + MODULE_STATUS_TIMER[i]=${savestop} popd >/dev/null || return 1 ((i=i+1)) @@ -418,7 +418,7 @@ personality_modules_wrapper patch checkstyle offset_clock "${CHECKSTYLE_TIMER}" until [[ $i -eq ${#MODULE[@]} ]]; do - if [[ ${MODULE_STATUS[${i}]} == -1 ]]; then + if [[ ${MODULE_STATUS[i]} == -1 ]]; then ((result=result+1)) ((i=i+1)) continue diff --git a/precommit/src/main/shell/plugins.d/github.sh b/precommit/src/main/shell/plugins.d/github.sh index 75651154..b49c404f 100755 --- a/precommit/src/main/shell/plugins.d/github.sh +++ b/precommit/src/main/shell/plugins.d/github.sh @@ -852,7 +852,7 @@ function github_finalreport_as_comment i=0 until [[ ${i} -ge ${#TP_HEADER[@]} ]]; do - printf '%s\n\n' "${TP_HEADER[${i}]}" >> "${commentfile}" + printf '%s\n\n' "${TP_HEADER[i]}" >> "${commentfile}" ((i=i+1)) done @@ -864,7 +864,7 @@ function github_finalreport_as_comment i=0 until [[ ${i} -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ') subs=$(echo "${ourstring}" | cut -f3 -d\|) ela=$(echo "${ourstring}" | cut -f4 -d\|) @@ -933,7 +933,7 @@ function github_finalreport_as_comment } >> "${commentfile}" i=0 until [[ ${i} -ge ${#TP_TEST_TABLE[@]} ]]; do - echo "${TP_TEST_TABLE[${i}]}" >> "${commentfile}" + echo "${TP_TEST_TABLE[i]}" >> "${commentfile}" ((i=i+1)) done fi @@ -946,7 +946,7 @@ function github_finalreport_as_comment i=0 until [[ $i -ge ${#TP_FOOTER_TABLE[@]} ]]; do - comment=$(echo "${TP_FOOTER_TABLE[${i}]}" | "${SED}" -e "s,@@BASE@@,${url},g") + comment=$(echo "${TP_FOOTER_TABLE[i]}" | "${SED}" -e "s,@@BASE@@,${url},g") printf '%s\n' "${comment}" >> "${commentfile}" ((i=i+1)) done @@ -1126,7 +1126,7 @@ function github_finalreport if [[ "${result}" == 0 ]]; then i=0 until [[ ${i} -eq ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ') if [[ "${vote}" == "-0" ]]; then @@ -1182,7 +1182,7 @@ function github_finalreport url=$(get_artifact_url) i=0 until [[ ${i} -eq ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ') subs=$(echo "${ourstring}" | cut -f3 -d\|) logfile=$(echo "${ourstring}" | cut -f5 -d\| | tr -d ' ') diff --git a/precommit/src/main/shell/plugins.d/gitlab.sh b/precommit/src/main/shell/plugins.d/gitlab.sh index 18b5b1dd..d647751c 100755 --- a/precommit/src/main/shell/plugins.d/gitlab.sh +++ b/precommit/src/main/shell/plugins.d/gitlab.sh @@ -448,7 +448,7 @@ function gitlab_finalreport i=0 until [[ ${i} -ge ${#TP_HEADER[@]} ]]; do - printf "%s\\n\\n" "${TP_HEADER[${i}]}" >> "${commentfile}" + printf "%s\\n\\n" "${TP_HEADER[i]}" >> "${commentfile}" ((i=i+1)) done @@ -460,7 +460,7 @@ function gitlab_finalreport i=0 until [[ ${i} -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ') subs=$(echo "${ourstring}" | cut -f3 -d\|) ela=$(echo "${ourstring}" | cut -f4 -d\|) @@ -529,7 +529,7 @@ function gitlab_finalreport } >> "${commentfile}" i=0 until [[ ${i} -ge ${#TP_TEST_TABLE[@]} ]]; do - echo "${TP_TEST_TABLE[${i}]}" >> "${commentfile}" + echo "${TP_TEST_TABLE[i]}" >> "${commentfile}" ((i=i+1)) done fi @@ -543,7 +543,7 @@ function gitlab_finalreport i=0 until [[ $i -ge ${#TP_FOOTER_TABLE[@]} ]]; do - comment=$(echo "${TP_FOOTER_TABLE[${i}]}" | "${SED}" -e "s,@@BASE@@,${url},g") + comment=$(echo "${TP_FOOTER_TABLE[i]}" | "${SED}" -e "s,@@BASE@@,${url},g") printf '%s\n' "${comment}" >> "${commentfile}" ((i=i+1)) done diff --git a/precommit/src/main/shell/plugins.d/htmlout.sh b/precommit/src/main/shell/plugins.d/htmlout.sh index 89afbe4b..b14056ea 100755 --- a/precommit/src/main/shell/plugins.d/htmlout.sh +++ b/precommit/src/main/shell/plugins.d/htmlout.sh @@ -126,7 +126,7 @@ function htmlout_report_writer i=0 until [[ $i -ge ${#TP_HEADER[@]} ]]; do - ourstring=$(echo "${TP_HEADER[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_HEADER[i]}" | tr -s ' ') comment=$(echo "${ourstring}" | cut -f2 -d\|) printf '<tr><td>%s</td></tr>\n' "${comment}" ((i=i+1)) @@ -145,7 +145,7 @@ function htmlout_report_writer i=0 until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ') subs=$(echo "${ourstring}" | cut -f3 -d\|) ela=$(echo "${ourstring}" | cut -f4 -d\|) @@ -227,7 +227,7 @@ function htmlout_report_writer i=0 until [[ $i -ge ${#TP_TEST_TABLE[@]} ]]; do - ourstring=$(echo "${TP_TEST_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_TEST_TABLE[i]}" | tr -s ' ') subs=$(echo "${ourstring}" | cut -f2 -d\|) comment=$(echo "${ourstring}" | cut -f3 -d\|) { @@ -265,7 +265,7 @@ function htmlout_report_writer # excess spaces set -f ourstring="" - for j in ${TP_FOOTER_TABLE[${i}]}; do + for j in ${TP_FOOTER_TABLE[i]}; do if [[ "${j}" =~ ^@@BASE@@ ]]; then t1=${j#@@BASE@@/} t2=$(echo "${j}" | "${SED}" -e "s,@@BASE@@,${url},g") diff --git a/precommit/src/main/shell/plugins.d/jira.sh b/precommit/src/main/shell/plugins.d/jira.sh index af47d1df..a6b46e4f 100755 --- a/precommit/src/main/shell/plugins.d/jira.sh +++ b/precommit/src/main/shell/plugins.d/jira.sh @@ -447,7 +447,7 @@ function jira_finalreport i=0 until [[ $i -ge ${#TP_HEADER[@]} ]]; do - printf '%s\n' "${TP_HEADER[${i}]}" >> "${commentfile}" + printf '%s\n' "${TP_HEADER[i]}" >> "${commentfile}" ((i=i+1)) done @@ -457,7 +457,7 @@ function jira_finalreport i=0 until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ') subs=$(echo "${ourstring}" | cut -f3 -d\|) ela=$(echo "${ourstring}" | cut -f4 -d\|) @@ -527,7 +527,7 @@ function jira_finalreport echo "|| Reason || Tests ||" >> "${commentfile}" i=0 until [[ $i -ge ${#TP_TEST_TABLE[@]} ]]; do - printf '%s\n' "${TP_TEST_TABLE[${i}]}" >> "${commentfile}" + printf '%s\n' "${TP_TEST_TABLE[i]}" >> "${commentfile}" ((i=i+1)) done fi @@ -538,7 +538,7 @@ function jira_finalreport echo "|| Subsystem || Report/Notes ||" >> "${commentfile}" i=0 until [[ $i -ge ${#TP_FOOTER_TABLE[@]} ]]; do - comment=$(echo "${TP_FOOTER_TABLE[${i}]}" | "${SED}" -e "s,@@BASE@@,${url},g") + comment=$(echo "${TP_FOOTER_TABLE[i]}" | "${SED}" -e "s,@@BASE@@,${url},g") printf '%s\n' "${comment}" >> "${commentfile}" ((i=i+1)) done diff --git a/precommit/src/main/shell/plugins.d/junit.sh b/precommit/src/main/shell/plugins.d/junit.sh index 0f52a13b..13ddc280 100755 --- a/precommit/src/main/shell/plugins.d/junit.sh +++ b/precommit/src/main/shell/plugins.d/junit.sh @@ -183,7 +183,7 @@ EOF i=0 until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\|) subs=$(echo "${ourstring}" | cut -f3 -d\|) ela=$(echo "${ourstring}" | cut -f4 -d\|) diff --git a/precommit/src/main/shell/plugins.d/spotbugs.sh b/precommit/src/main/shell/plugins.d/spotbugs.sh index 1a4268ba..ddc5c197 100755 --- a/precommit/src/main/shell/plugins.d/spotbugs.sh +++ b/precommit/src/main/shell/plugins.d/spotbugs.sh @@ -129,14 +129,14 @@ function spotbugs_runner #shellcheck disable=SC2153 until [[ ${i} -eq ${#MODULE[@]} ]]; do - if [[ ${MODULE_STATUS[${i}]} == -1 ]]; then + if [[ ${MODULE_STATUS[i]} == -1 ]]; then ((result=result+1)) ((i=i+1)) continue fi start_clock - offset_clock "${MODULE_STATUS_TIMER[${i}]}" - module="${MODULE[${i}]}" + offset_clock "${MODULE_STATUS_TIMER[i]}" + module="${MODULE[i]}" fn=$(module_file_fragment "${module}") if [[ "${module}" == . ]]; then @@ -186,7 +186,7 @@ function spotbugs_runner if [[ ${retval} != 0 ]]; then savestop=$(stop_clock) - MODULE_STATUS_TIMER[${i}]=${savestop} + MODULE_STATUS_TIMER[i]=${savestop} module_status "${i}" -1 "" "${name}/${module} cannot run setBugDatabaseInfo from spotbugs" ((result=result+1)) ((i=i+1)) @@ -204,7 +204,7 @@ function spotbugs_runner "${warnings_file}.xml" \ "${warnings_file}.html"; then savestop=$(stop_clock) - MODULE_STATUS_TIMER[${i}]=${savestop} + MODULE_STATUS_TIMER[i]=${savestop} module_status "${i}" -1 "" "${name}/${module} cannot run convertXmlToText from spotbugs" ((result=result+1)) fi @@ -255,15 +255,15 @@ function spotbugs_preapply fi until [[ ${modindex} -eq ${#MODULE[@]} ]]; do - if [[ ${MODULE_STATUS[${modindex}]} == -1 ]]; then + if [[ ${MODULE_STATUS[modindex]} == -1 ]]; then ((result=result+1)) ((modindex=modindex+1)) continue fi - module=${MODULE[${modindex}]} + module=${MODULE[modindex]} start_clock - offset_clock "${MODULE_STATUS_TIMER[${modindex}]}" + offset_clock "${MODULE_STATUS_TIMER[modindex]}" fn=$(module_file_fragment "${module}") if [[ "${module}" == . ]]; then @@ -273,7 +273,7 @@ function spotbugs_preapply warnings_file="${PATCH_DIR}/branch-spotbugs-${fn}-warnings" if [[ ! -f "${warnings_file}.xml" ]]; then savestop=$(stop_clock) - MODULE_STATUS_TIMER[${modindex}]=${savestop} + MODULE_STATUS_TIMER[modindex]=${savestop} ((modindex=modindex+1)) continue fi @@ -306,7 +306,7 @@ function spotbugs_preapply fi savestop=$(stop_clock) - MODULE_STATUS_TIMER[${modindex}]=${savestop} + MODULE_STATUS_TIMER[modindex]=${savestop} ((modindex=modindex+1)) done modules_messages branch "spotbugs" true @@ -357,15 +357,15 @@ function spotbugs_postinstall fi until [[ $i -eq ${#MODULE[@]} ]]; do - if [[ ${MODULE_STATUS[${i}]} == -1 ]]; then + if [[ ${MODULE_STATUS[i]} == -1 ]]; then ((result=result+1)) ((i=i+1)) continue fi start_clock - offset_clock "${MODULE_STATUS_TIMER[${i}]}" - module="${MODULE[${i}]}" + offset_clock "${MODULE_STATUS_TIMER[i]}" + module="${MODULE[i]}" buildtool_cwd "${i}" @@ -397,7 +397,7 @@ function spotbugs_postinstall module_status "${i}" 0 "" "${module} has no data from spotbugs" ((result=result+1)) savestop=$(stop_clock) - MODULE_STATUS_TIMER[${i}]=${savestop} + MODULE_STATUS_TIMER[i]=${savestop} ((i=i+1)) popd >/dev/null || return 1 continue @@ -412,7 +412,7 @@ function spotbugs_postinstall module_status "${i}" -1 "" "${module} cannot run computeBugHistory from spotbugs" ((result=result+1)) savestop=$(stop_clock) - MODULE_STATUS_TIMER[${i}]=${savestop} + MODULE_STATUS_TIMER[i]=${savestop} ((i=i+1)) popd >/dev/null || return 1 continue @@ -433,7 +433,7 @@ function spotbugs_postinstall module_status "${i}" -1 "" "${module} cannot run filterBugs (#1) from spotbugs" ((result=result+1)) savestop=$(stop_clock) - MODULE_STATUS_TIMER[${i}]=${savestop} + MODULE_STATUS_TIMER[i]=${savestop} ((i=i+1)) popd >/dev/null || return 1 continue @@ -447,7 +447,7 @@ function spotbugs_postinstall module_status "${i}" -1 "" "${module} cannot run filterBugs (#2) from spotbugs" ((result=result+1)) savestop=$(stop_clock) - MODULE_STATUS_TIMER[${i}]=${savestop} + MODULE_STATUS_TIMER[i]=${savestop} ((i=i+1)) popd >/dev/null || return 1 continue @@ -460,7 +460,7 @@ function spotbugs_postinstall module_status "${i}" -1 "" "${module} cannot run convertXmlToText from spotbugs" ((result=result+1)) savestop=$(stop_clock) - MODULE_STATUS_TIMER[${i}]=${savestop} + MODULE_STATUS_TIMER[i]=${savestop} ((i=i+1)) popd >/dev/null || return 1 continue @@ -482,7 +482,7 @@ function spotbugs_postinstall summarize=false fi savestop=$(stop_clock) - MODULE_STATUS_TIMER[${i}]=${savestop} + MODULE_STATUS_TIMER[i]=${savestop} popd >/dev/null || return 1 ((i=i+1)) done diff --git a/precommit/src/main/shell/robots.d/buildkite.sh b/precommit/src/main/shell/robots.d/buildkite.sh index 3edd672f..d6b076d5 100755 --- a/precommit/src/main/shell/robots.d/buildkite.sh +++ b/precommit/src/main/shell/robots.d/buildkite.sh @@ -128,7 +128,7 @@ function buildkiteannotate_finalreport i=0 until [[ ${i} -ge ${#TP_HEADER[@]} ]]; do - printf '%s\n\n' "${TP_HEADER[${i}]}" >> "${commentfile}" + printf '%s\n\n' "${TP_HEADER[i]}" >> "${commentfile}" ((i=i+1)) done @@ -140,7 +140,7 @@ function buildkiteannotate_finalreport i=0 until [[ ${i} -ge ${#TP_VOTE_TABLE[@]} ]]; do - ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ') + ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ') vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ') subs=$(echo "${ourstring}" | cut -f3 -d\|) ela=$(echo "${ourstring}" | cut -f4 -d\|) @@ -205,7 +205,7 @@ function buildkiteannotate_finalreport } >> "${commentfile}" i=0 until [[ ${i} -ge ${#TP_TEST_TABLE[@]} ]]; do - echo "${TP_TEST_TABLE[${i}]}" >> "${commentfile}" + echo "${TP_TEST_TABLE[i]}" >> "${commentfile}" ((i=i+1)) done fi @@ -218,7 +218,7 @@ function buildkiteannotate_finalreport i=0 until [[ $i -ge ${#TP_FOOTER_TABLE[@]} ]]; do - comment=$(echo "${TP_FOOTER_TABLE[${i}]}" | "${SED}" -e "s,@@BASE@@,${url},g") + comment=$(echo "${TP_FOOTER_TABLE[i]}" | "${SED}" -e "s,@@BASE@@,${url},g") printf '%s\n' "${comment}" >> "${commentfile}" ((i=i+1)) done diff --git a/precommit/src/main/shell/test-patch.sh b/precommit/src/main/shell/test-patch.sh index 9541bcf2..726696f3 100755 --- a/precommit/src/main/shell/test-patch.sh +++ b/precommit/src/main/shell/test-patch.sh @@ -185,7 +185,7 @@ function offset_clock function add_header_line { # shellcheck disable=SC2034 - TP_HEADER[${TP_HEADER_COUNTER}]="$*" + TP_HEADER[TP_HEADER_COUNTER]="$*" ((TP_HEADER_COUNTER=TP_HEADER_COUNTER+1 )) } @@ -220,7 +220,7 @@ function add_vote_table_v2 yetus_debug "add_vote_table_v2 >${value}< >${subsystem}< >${logfile}< >${elapsed}< ${*}" if [[ "${value}" = H ]]; then - TP_VOTE_TABLE[${TP_VOTE_COUNTER}]="|${value}| | | | ${subsystem} |" + TP_VOTE_TABLE[TP_VOTE_COUNTER]="|${value}| | | | ${subsystem} |" ((TP_VOTE_COUNTER=TP_VOTE_COUNTER+1)) return fi @@ -236,7 +236,7 @@ function add_vote_table_v2 done # shellcheck disable=SC2034 - TP_VOTE_TABLE[${TP_VOTE_COUNTER}]="| ${value} | ${subsystem} | ${elapsed} | ${logfile} | $* |" + TP_VOTE_TABLE[TP_VOTE_COUNTER]="| ${value} | ${subsystem} | ${elapsed} | ${logfile} | $* |" ((TP_VOTE_COUNTER=TP_VOTE_COUNTER+1)) if [[ "${value}" = -1 ]]; then @@ -354,7 +354,7 @@ function finish_vote_table echo "" # shellcheck disable=SC2034 - TP_VOTE_TABLE[${TP_VOTE_COUNTER}]="| | | ${elapsed} | |" + TP_VOTE_TABLE[TP_VOTE_COUNTER]="| | | ${elapsed} | |" ((TP_VOTE_COUNTER=TP_VOTE_COUNTER+1 )) } @@ -372,7 +372,7 @@ function add_footer_table shift 1 # shellcheck disable=SC2034 - TP_FOOTER_TABLE[${TP_FOOTER_COUNTER}]="| ${subsystem} | $* |" + TP_FOOTER_TABLE[TP_FOOTER_COUNTER]="| ${subsystem} | $* |" ((TP_FOOTER_COUNTER=TP_FOOTER_COUNTER+1 )) } @@ -388,7 +388,7 @@ function add_test_table shift 1 # shellcheck disable=SC2034 - TP_TEST_TABLE[${TP_TEST_COUNTER}]="| ${failure} | $* |" + TP_TEST_TABLE[TP_TEST_COUNTER]="| ${failure} | $* |" ((TP_TEST_COUNTER=TP_TEST_COUNTER+1 )) } @@ -1525,7 +1525,7 @@ function buildtool_cwd declare modindex=$1 BUILDTOOLCWD="${BUILDTOOLCWD//@@@BASEDIR@@@/${BASEDIR}}" - BUILDTOOLCWD="${BUILDTOOLCWD//@@@MODULEDIR@@@/${BASEDIR}/${MODULE[${modindex}]}}" + BUILDTOOLCWD="${BUILDTOOLCWD//@@@MODULEDIR@@@/${BASEDIR}/${MODULE[modindex]}}" if [[ "${BUILDTOOLCWD}" =~ ^/ ]]; then yetus_debug "buildtool_cwd: ${BUILDTOOLCWD}" @@ -1541,10 +1541,10 @@ function buildtool_cwd pushd "${BASEDIR}" >/dev/null || return 1 ;; module) - if [[ ! -d "${BASEDIR}/${MODULE[${modindex}]}" ]]; then + if [[ ! -d "${BASEDIR}/${MODULE[modindex]}" ]]; then return 1 fi - pushd "${BASEDIR}/${MODULE[${modindex}]}" >/dev/null || return 1 + pushd "${BASEDIR}/${MODULE[modindex]}" >/dev/null || return 1 ;; *) pushd "$(pwd)" >/dev/null || return 1 @@ -1776,34 +1776,34 @@ function modules_messages until [[ ${modindex} -eq ${#MODULE[@]} ]]; do if [[ ${multijdkmode} == true ]]; then - statusjdk=${MODULE_STATUS_JDK[${modindex}]} + statusjdk=${MODULE_STATUS_JDK[modindex]} fi - if [[ "${MODULE_STATUS[${modindex}]}" == '+1' ]]; then - ((goodtime=goodtime + ${MODULE_STATUS_TIMER[${modindex}]})) + if [[ "${MODULE_STATUS[modindex]}" == '+1' ]]; then + ((goodtime=goodtime + MODULE_STATUS_TIMER[modindex])) else failure=true start_clock echo "" - echo "${MODULE_STATUS_MSG[${modindex}]}" + echo "${MODULE_STATUS_MSG[modindex]}" echo "" - offset_clock "${MODULE_STATUS_TIMER[${modindex}]}" - if [[ ${MODULE_STATUS[${modindex}]} == -1 - && -n "${MODULE_STATUS_LOG[${modindex}]}" ]]; then + offset_clock "${MODULE_STATUS_TIMER[modindex]}" + if [[ ${MODULE_STATUS[modindex]} == -1 + && -n "${MODULE_STATUS_LOG[modindex]}" ]]; then add_vote_table_v2 \ - "${MODULE_STATUS[${modindex}]}" \ + "${MODULE_STATUS[modindex]}" \ "${testtype}" \ - "@@BASE@@/${MODULE_STATUS_LOG[${modindex}]}" \ - "${MODULE_STATUS_MSG[${modindex}]}" + "@@BASE@@/${MODULE_STATUS_LOG[modindex]}" \ + "${MODULE_STATUS_MSG[modindex]}" bugsystem_linecomments_queue \ "${testtype}" \ - "${PATCH_DIR}/${MODULE_STATUS_LOG[${modindex}]}" + "${PATCH_DIR}/${MODULE_STATUS_LOG[modindex]}" else add_vote_table_v2 \ - "${MODULE_STATUS[${modindex}]}" \ + "${MODULE_STATUS[modindex]}" \ "${testtype}" \ "" \ - "${MODULE_STATUS_MSG[${modindex}]}" + "${MODULE_STATUS_MSG[modindex]}" fi fi ((modindex=modindex+1)) @@ -1818,22 +1818,22 @@ function modules_messages until [[ ${modindex} -eq ${#MODULE[@]} ]]; do start_clock echo "" - echo "${MODULE_STATUS_MSG[${modindex}]}" + echo "${MODULE_STATUS_MSG[modindex]}" echo "" - offset_clock "${MODULE_STATUS_TIMER[${modindex}]}" - if [[ ${MODULE_STATUS[${modindex}]} == -1 - && -n "${MODULE_STATUS_LOG[${modindex}]}" ]]; then + offset_clock "${MODULE_STATUS_TIMER[modindex]}" + if [[ ${MODULE_STATUS[modindex]} == -1 + && -n "${MODULE_STATUS_LOG[modindex]}" ]]; then add_vote_table_v2 \ - "${MODULE_STATUS[${modindex}]}" \ + "${MODULE_STATUS[modindex]}" \ "${testtype}" \ - "@@BASE@@/${MODULE_STATUS_LOG[${modindex}]}" \ - "${MODULE_STATUS_MSG[${modindex}]}" + "@@BASE@@/${MODULE_STATUS_LOG[modindex]}" \ + "${MODULE_STATUS_MSG[modindex]}" else add_vote_table_v2 \ - "${MODULE_STATUS[${modindex}]}" \ + "${MODULE_STATUS[modindex]}" \ "${testtype}" \ "" \ - "${MODULE_STATUS_MSG[${modindex}]}" + "${MODULE_STATUS_MSG[modindex]}" fi ((modindex=modindex+1)) done @@ -1867,13 +1867,13 @@ function module_status if [[ -n ${index} && ${index} =~ ^[0-9]+$ ]]; then - MODULE_STATUS[${index}]="${value}" + MODULE_STATUS[index]="${value}" if [[ -n ${log} ]]; then - MODULE_STATUS_LOG[${index}]="${log}" + MODULE_STATUS_LOG[index]="${log}" fi if [[ -n $1 ]]; then - MODULE_STATUS_JDK[${index}]=" with JDK ${jdk}" - MODULE_STATUS_MSG[${index}]="${*}" + MODULE_STATUS_JDK[index]=" with JDK ${jdk}" + MODULE_STATUS_MSG[index]="${*}" fi else yetus_error "ASSERT: module_status given bad index: ${index}" @@ -1929,28 +1929,28 @@ function modules_workers until [[ ${modindex} -eq ${#MODULE[@]} ]]; do start_clock - fn=$(module_file_fragment "${MODULE[${modindex}]}") + fn=$(module_file_fragment "${MODULE[modindex]}") fn="${fn}${jdk}" - modulesuffix=$(basename "${MODULE[${modindex}]}") + modulesuffix=$(basename "${MODULE[modindex]}") if [[ ${modulesuffix} = \. ]]; then modulesuffix="root" fi if ! buildtool_cwd "${modindex}"; then - echo "${BASEDIR}/${MODULE[${modindex}]} no longer exists. Skipping." + echo "${BASEDIR}/${MODULE[modindex]} no longer exists. Skipping." ((modindex=modindex+1)) savestop=$(stop_clock) - MODULE_STATUS_TIMER[${modindex}]=${savestop} + MODULE_STATUS_TIMER[modindex]=${savestop} continue fi argv=("${@//@@@MODULEFN@@@/${fn}}") - argv=("${argv[@]//@@@MODULEDIR@@@/${BASEDIR}/${MODULE[${modindex}]}}") + argv=("${argv[@]//@@@MODULEDIR@@@/${BASEDIR}/${MODULE[modindex]}}") # shellcheck disable=2086,2046 echo_and_redirect "${PATCH_DIR}/${repostatus}-${testtype}-${fn}.txt" \ $("${BUILDTOOL}_executor" "${testtype}") \ - ${MODULEEXTRAPARAM[${modindex}]//@@@MODULEFN@@@/${fn}} \ + ${MODULEEXTRAPARAM[modindex]//@@@MODULEFN@@@/${fn}} \ "${argv[@]}" execvalue=$? @@ -1974,12 +1974,12 @@ function modules_workers # compile is special if [[ ${testtype} = compile ]]; then - MODULE_COMPILE_LOG[${modindex}]="${PATCH_DIR}/${repostatus}-${testtype}-${fn}.txt" - yetus_debug "Compile log set to ${MODULE_COMPILE_LOG[${modindex}]}" + MODULE_COMPILE_LOG[modindex]="${PATCH_DIR}/${repostatus}-${testtype}-${fn}.txt" + yetus_debug "Compile log set to ${MODULE_COMPILE_LOG[modindex]}" fi savestop=$(stop_clock) - MODULE_STATUS_TIMER[${modindex}]=${savestop} + MODULE_STATUS_TIMER[modindex]=${savestop} # shellcheck disable=SC2086 echo "Elapsed: $(clock_display ${savestop})" popd >/dev/null || return 1 @@ -2017,8 +2017,8 @@ function personality_enqueue_module local module=$1 shift - MODULE[${MODCOUNT}]=${module} - MODULEEXTRAPARAM[${MODCOUNT}]=${*} + MODULE[MODCOUNT]=${module} + MODULEEXTRAPARAM[MODCOUNT]=${*} ((MODCOUNT=MODCOUNT+1)) } @@ -2039,10 +2039,10 @@ function dequeue_personality_module clear_personality_queue until [[ ${modindex} -eq ${#oldmodule[@]} ]]; do - if [[ "${oldmodule[${modindex}]}" = "${modname}" ]]; then - yetus_debug "Personality: removing ${modindex}, ${oldmodule[${modindex}]} = ${modname}" + if [[ "${oldmodule[modindex]}" = "${modname}" ]]; then + yetus_debug "Personality: removing ${modindex}, ${oldmodule[modindex]} = ${modname}" else - personality_enqueue_module "${oldmodule[${modindex}]}" "${oldmodparams[${modindex}]}" + personality_enqueue_module "${oldmodule[modindex}]}" "${oldmodparams[modindex]}" fi ((modindex=modindex+1)) done @@ -2122,7 +2122,7 @@ function check_unittests i=0 until [[ $i -eq ${#MODULE[@]} ]]; do - module=${MODULE[${i}]} + module=${MODULE[i]} fn=$(module_file_fragment "${module}") fn="${fn}${jdk}" test_logfile="${PATCH_DIR}/patch-unit-${fn}.txt" @@ -2567,15 +2567,15 @@ function module_postlog_compare i=0 until [[ ${i} -eq ${#MODULE[@]} ]]; do - if [[ ${MODULE_STATUS[${i}]} == -1 ]]; then + if [[ ${MODULE_STATUS[i]} == -1 ]]; then ((result=result+1)) ((i=i+1)) continue fi - fn=$(module_file_fragment "${MODULE[${i}]}") + fn=$(module_file_fragment "${MODULE[i]}") fn="${fn}${jdk}" - module_suffix=$(basename "${MODULE[${i}]}") + module_suffix=$(basename "${MODULE[i]}") if [[ ${module_suffix} == \. ]]; then module_suffix=root fi @@ -2616,7 +2616,7 @@ function module_postlog_compare ((result = result + 1)) module_status "${i}" -1 "results-${origlog}-${testtype}-${fn}.txt" "${fn}${statusjdk} ${statstring}" elif [[ ${fixedpatch} -gt 0 ]]; then - module_status "${i}" +1 "${MODULE_STATUS_LOG[${i}]}" "${fn}${statusjdk} ${statstring}" + module_status "${i}" +1 "${MODULE_STATUS_LOG[i]}" "${fn}${statusjdk} ${statstring}" summarize=false fi ((i=i+1))