From 723034713e2aa544dfb7e2fa3d65987d11ddf802 Mon Sep 17 00:00:00 2001 From: Bright Chen Date: Mon, 29 Apr 2024 10:08:57 +0800 Subject: [PATCH] Fix incorrect core file found in run_tests.sh (#2614) --- test/run_tests.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/run_tests.sh b/test/run_tests.sh index fbf9ee87b0..ebd648402a 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -15,11 +15,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +# turn on coredumps +ulimit -c unlimited +rm core.* + test_num=0 failed_test="" rc=0 test_bins="test_butil test_bvar bthread*unittest brpc*unittest" -ulimit -c unlimited # turn on coredumps for test_bin in $test_bins; do test_num=$((test_num + 1)) >&2 echo "[runtest] $test_bin" @@ -34,6 +37,7 @@ if [ $test_num -eq 0 ]; then >&2 echo "[runtest] Cannot find any tests" exit 1 fi + print_bt () { # find newest core file COREFILE=$(find . -name "core*" -type f -printf "%T@ %p\n" | sort -k 1 -n | cut -d' ' -f 2- | tail -n 1) @@ -42,6 +46,7 @@ print_bt () { gdb -c "$COREFILE" $1 -ex "thread apply all bt" -ex "set pagination 0" -batch; fi } + if [ -z "$failed_test" ]; then >&2 echo "[runtest] $test_num succeeded" elif [ $test_num -gt 1 ]; then