kou commented on code in PR #51121:
URL: https://github.com/apache/arrow/pull/51121#discussion_r3910019329
##########
cpp/build-support/run-test.sh:
##########
@@ -139,23 +140,33 @@ function print_coredumps() {
FILENAME=$(basename "${TEST_EXECUTABLE}")
FILENAME=$(echo "${FILENAME}" | cut -c-15)
- COREFILES=$(find /tmp -maxdepth 1 -type f -name "core.${FILENAME}*" -exec
basename {} \;)
- if [ -n "$COREFILES" ]; then
- for COREFILE in $COREFILES; do
- COREPATH="/tmp/${COREFILE}"
- echo
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "Running '${TEST_EXECUTABLE}' produced core dump at '${COREPATH}',
printing backtrace:"
- # Print backtrace
- if [ "$(uname)" == "Darwin" ]; then
- lldb -c "${COREPATH}" --batch --one-line "thread backtrace all -e true"
- else
- gdb -c "${COREPATH}" "$TEST_EXECUTABLE" -ex "thread apply all bt" -ex
"set pagination 0" -batch
- fi
- echo
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- # Remove the coredump, it can be regenerated via running the test case
directly
- rm "${COREPATH}"
- done
+ COREFILES=(/tmp/"core.${FILENAME}"*)
+ # Clear the array if no core files match the pattern.
+ if [[ "${COREFILES[0]}" == *\* ]]; then
+ COREFILES=()
fi
+
+ for COREPATH in "${COREFILES[@]}"; do
Review Comment:
Can we simplify this?
```suggestion
for COREPATH in "/tmp/core.${FILENAME}"*; do
```
--
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]