Unverified Commit b4d0fc35 authored by Zhangyi Chen's avatar Zhangyi Chen Committed by GitHub

Merge pull request #305 from zyearn/master

print bt when core dump happens in running UT
parents 7e56808e 17feeae9
......@@ -14,10 +14,6 @@ env:
before_script:
- ulimit -c unlimited -S # enable core dumps
after_failure:
- COREFILE=$(find . -maxdepth 2 -name "core*" | head -n 1) # find core file
- if [[ -f "$COREFILE" ]]; then gdb -c "$COREFILE" example -ex "thread apply all bt" -ex "set pagination 0" -batch; fi
before_install:
- wget --no-clobber https://github.com/bazelbuild/bazel/releases/download/0.8.1/bazel_0.8.1-linux-x86_64.deb
- sudo dpkg -i bazel_0.8.1-linux-x86_64.deb
......
......@@ -7,9 +7,7 @@
#include "butil/logging.h"
#include "multiprocess_func_list.h"
// Disable coredumps by default to avoid generating a lot of coredumps
// after running death tests.
DEFINE_bool(disable_coredump, true, "Never core dump");
DEFINE_bool(disable_coredump, false, "Never core dump");
int main(int argc, char** argv) {
butil::AtExitManager at_exit;
......
......@@ -17,11 +17,19 @@ if [ $test_num -eq 0 ]; then
>&2 echo "[runtest] Cannot find any tests"
exit 1
fi
print_bt () {
COREFILE=$(find . -maxdepth 2 -name "core*" | head -n 1) # find core file
if [[ -f "$COREFILE" ]]; then
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
print_bt $failed_test
>&2 echo "[runtest] '$failed_test' failed, $((test_num-1)) succeeded"
else
print_bt $failed_test
>&2 echo "[runtest] '$failed_test' failed"
fi
exit $rc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment