if [ $? = 0 ]; then
exit
fi
- FILES_TO_PRINT="build/meson-logs/testlog.txt build/.ninja_log build/meson-logs/meson-log.txt"
+ FILES_TO_PRINT="build/meson-logs/testlog.txt"
+ FILES_TO_PRINT="$FILES_TO_PRINT build/.ninja_log"
+ FILES_TO_PRINT="$FILES_TO_PRINT build/meson-logs/meson-log.txt"
+ FILES_TO_PRINT="$FILES_TO_PRINT build/gdb.log"
for pr_file in $FILES_TO_PRINT; do
if [ -e "$pr_file" ]; then
rm ${version}.tar.gz
}
+configure_coredump() {
+ # No point in configuring coredump without gdb
+ which gdb >/dev/null || return 0
+ ulimit -c unlimited
+ sudo sysctl -w kernel.core_pattern=/tmp/dpdk-core.%e.%p
+}
+
+catch_coredump() {
+ ls /tmp/dpdk-core.*.* 2>/dev/null || return 0
+ for core in /tmp/dpdk-core.*.*; do
+ binary=$(sudo readelf -n $core |grep $(pwd)/build/ 2>/dev/null |head -n1)
+ [ -x $binary ] || binary=
+ sudo gdb $binary -c $core \
+ -ex 'info threads' \
+ -ex 'thread apply all bt full' \
+ -ex 'quit'
+ done |tee -a build/gdb.log
+ return 1
+}
+
if [ "$AARCH64" = "true" ]; then
# convert the arch specifier
if [ "$CC_FOR_BUILD" = "gcc" ]; then
ninja -C build
if [ "$AARCH64" != "true" ]; then
- devtools/test-null.sh
+ failed=
+ configure_coredump
+ devtools/test-null.sh || failed="true"
+ catch_coredump
+ [ "$failed" != "true" ]
fi
if [ "$ABI_CHECKS" = "true" ]; then
fi
if [ "$RUN_TESTS" = "true" ]; then
- sudo meson test -C build --suite fast-tests -t 3
+ failed=
+ configure_coredump
+ sudo meson test -C build --suite fast-tests -t 3 || failed="true"
+ catch_coredump
+ [ "$failed" != "true" ]
fi
if: env.AARCH64 == 'true'
run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
pkg-config-aarch64-linux-gnu
+ - name: Install test tools packages
+ if: env.AARCH64 != 'true' || env.RUN_TESTS == 'true'
+ run: sudo apt install -y gdb
- name: Install doc generation packages
if: env.BUILD_DOCS == 'true'
run: sudo apt install -y doxygen graphviz python3-sphinx
build/meson-logs/testlog.txt
build/.ninja_log
build/meson-logs/meson-log.txt
+ build/gdb.log
#include <stdio.h>
#include <stdint.h>
+#include <sys/resource.h>
+#include <sys/time.h>
#include <sys/wait.h>
#include <unistd.h>
pid = fork();
- if (pid == 0)
+ if (pid == 0) {
+ struct rlimit rl;
+
+ /* No need to generate a coredump when panicking. */
+ rl.rlim_cur = rl.rlim_max = 0;
+ setrlimit(RLIMIT_CORE, &rl);
rte_panic("Test Debug\n");
- else if (pid < 0){
+ } else if (pid < 0) {
printf("Fork Failed\n");
return -1;
}
}
#include <unistd.h>
+#include <sys/resource.h>
+#include <sys/time.h>
#include <sys/wait.h>
/* use fork() to test mbuf errors panic */
pid = fork();
if (pid == 0) {
+ struct rlimit rl;
+
+ /* No need to generate a coredump when panicking. */
+ rl.rlim_cur = rl.rlim_max = 0;
+ setrlimit(RLIMIT_CORE, &rl);
rte_mbuf_sanity_check(buf, 1); /* should panic */
exit(0); /* return normally if it doesn't panic */
- } else if (pid < 0){
+ } else if (pid < 0) {
printf("Fork Failed\n");
return -1;
}