hiroyuki-sato commented on code in PR #50935:
URL: https://github.com/apache/arrow/pull/50935#discussion_r3843968241
##########
cpp/build-support/run-test.sh:
##########
@@ -23,42 +23,51 @@
# $ARGN - arguments for executable
#
-OUTPUT_ROOT=$1
+OUTPUT_ROOT="$1"
shift
-ROOT=$(cd $(dirname $BASH_SOURCE)/..; pwd)
+ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) || {
+ echo "Failed to determine project root directory" >&2
+ exit 1
+}
Review Comment:
I also tried using `set -e` instead of `|| { echo "error"; }`.
However, it seems we need to modify more code.
For example, this part causes the script to exit when the exit status is 1.
I'm not sure if this is the exact reason, but it seems to cause an error.
Do you have any idea?
```
"$TEST_EXECUTABLE" "$@" > "${LOGFILE}.raw" 2>&1
```
```diff
diff --git a/cpp/build-support/run-test.sh b/cpp/build-support/run-test.sh
index e3c0738410..0e02b1ab8a 100755
--- a/cpp/build-support/run-test.sh
+++ b/cpp/build-support/run-test.sh
@@ -23,12 +23,11 @@
# $ARGN - arguments for executable
#
+set -e
+
OUTPUT_ROOT="$1"
shift
-ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) || {
- echo "Failed to determine project root directory" >&2
- exit 1
-}
+ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
TEST_LOGDIR="$OUTPUT_ROOT/build/$1-logs"
mkdir -p "$TEST_LOGDIR"
@@ -38,10 +37,7 @@ shift
TEST_DEBUGDIR="$OUTPUT_ROOT/build/$RUN_TYPE-debug"
mkdir -p "$TEST_DEBUGDIR"
-TEST_DIRNAME=$(cd "$(dirname "$1")" && pwd) || {
- echo "Failed to change to test directory: $(dirname "$1")" >&2
- exit 1
-}
+TEST_DIRNAME=$(cd "$(dirname "$1")" && pwd)
TEST_FILENAME=$(basename "$1")
shift
TEST_EXECUTABLE="$TEST_DIRNAME/$TEST_FILENAME"
@@ -50,10 +46,7 @@ TEST_NAME=$(echo "$TEST_FILENAME" | sed -E -e
's/\..+$//') # Remove path and ext
# We run each test in its own subdir to avoid core file related races.
TEST_WORKDIR="$OUTPUT_ROOT/build/test-work/$TEST_NAME"
mkdir -p "$TEST_WORKDIR"
-pushd "$TEST_WORKDIR" >/dev/null || {
- echo "Failed to change to test working directory: $TEST_WORKDIR" >&2
- exit 1
-}
+pushd "$TEST_WORKDIR" >/dev/null
rm -f ./*
set -o pipefail
@@ -243,10 +236,7 @@ fi
print_coredumps
-popd || {
- echo "Failed to restore the previous working directory" >&2
- exit 1
-}
+popd
rm -Rf "$TEST_WORKDIR"
exit "$STATUS"
```
This change cause the following errors.
```
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1775143Z Total
Test time (real) = 548.94 sec
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1775314Z
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1775405Z The
following tests FAILED:
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1775759Z 2
- arrow-buffer-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1776240Z 3
- arrow-extension-type-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1776688Z 4
- arrow-misc-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1777139Z 5
- arrow-public-api-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1777585Z 6
- arrow-scalar-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1778010Z 7
- arrow-type-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1778430Z 8
- arrow-table-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1778858Z 9
- arrow-tensor-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1779308Z 10
- arrow-sparse-tensor-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1779745Z 11
- arrow-stl-test (Failed) arrow-tests unittest
AMD64 Conda C++ AVX2 UNKNOWN STEP 2026-08-24T11:10:33.1780176Z 18
- arrow-generator-test (Failed) arrow-tests unittest
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]