Skip to content

Commit

Permalink
Fix incorrect core file found in run_tests.sh (#2614)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenBright authored Apr 29, 2024
1 parent 68aff69 commit 7230347
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 7230347

Please sign in to comment.