From 49df24987b404982deab5e5155338ead580d803c Mon Sep 17 00:00:00 2001 From: "takaaki.koike" Date: Wed, 18 Dec 2024 01:37:16 +0900 Subject: [PATCH 1/2] GH-45050: [CI][Dev] Apply ShellCheck lint to c_glib/test/run-test.sh --- .pre-commit-config.yaml | 1 + c_glib/test/run-test.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6bde1cb2964e..27823cae5fa2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -182,4 +182,5 @@ repos: ( ?^ci/scripts/c_glib_build\.sh$| ?^ci/scripts/c_glib_test\.sh$| + ?^c_glib/test/run-test\.sh$| ) diff --git a/c_glib/test/run-test.sh b/c_glib/test/run-test.sh index c7bc6edca5f0..6dd49cf05cdc 100755 --- a/c_glib/test/run-test.sh +++ b/c_glib/test/run-test.sh @@ -17,7 +17,7 @@ # specific language governing permissions and limitations # under the License. -test_dir="$(cd $(dirname $0); pwd)" +test_dir="$(cd "$(dirname "$0")" || exit; pwd)" build_dir="$(cd .; pwd)" modules=( @@ -47,7 +47,7 @@ if [ "${BUILD}" != "no" ]; then fi for module in "${modules[@]}"; do - MODULE_TYPELIB_DIR_VAR_NAME="$(echo ${module} | tr a-z- A-Z_)_TYPELIB_DIR" + MODULE_TYPELIB_DIR_VAR_NAME="$(echo "${module}" | tr a-z- A-Z_)_TYPELIB_DIR" module_typelib_dir=$(eval "echo \${${MODULE_TYPELIB_DIR_VAR_NAME}}") if [ -z "${module_typelib_dir}" ]; then module_typelib_dir="${build_dir}/${module}" @@ -74,4 +74,4 @@ case "${DEBUGGER}" in DEBUGGER_ARGS+=(--) ;; esac -${DEBUGGER} "${DEBUGGER_ARGS[@]}" "${RUBY}" ${test_dir}/run-test.rb "$@" +${DEBUGGER} "${DEBUGGER_ARGS[@]}" "${RUBY}" "${test_dir}"/run-test.rb "$@" From 8cc04f1d7cddcba161e1c6e2e53e73a6b35d5cde Mon Sep 17 00:00:00 2001 From: Takaaki Koike <93052259+tks1197@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:44:26 +0900 Subject: [PATCH 2/2] use && instated of exit Co-authored-by: Sutou Kouhei --- c_glib/test/run-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_glib/test/run-test.sh b/c_glib/test/run-test.sh index 6dd49cf05cdc..8b1868942073 100755 --- a/c_glib/test/run-test.sh +++ b/c_glib/test/run-test.sh @@ -17,7 +17,7 @@ # specific language governing permissions and limitations # under the License. -test_dir="$(cd "$(dirname "$0")" || exit; pwd)" +test_dir="$(cd "$(dirname "$0")" && pwd)" build_dir="$(cd .; pwd)" modules=(