CI: ability to run tests through debugger and print backtrace if there is a crash

pull/821/head
Brad House 4 months ago
parent f68992a159
commit 2bd73c9a7d
  1. 29
      .cirrus.yml
  2. 6
      .github/workflows/netbsd.yml
  3. 6
      .github/workflows/openbsd.yml
  4. 5
      .github/workflows/solaris.yml
  5. 15
      ci/test.sh

@ -19,6 +19,7 @@ task:
BUILD_VALGRIND: "yes"
BUILD_COVERAGE: "yes"
BUILD_ANALYZE: "yes"
TEST_DEBUGGER: "gdb"
TEST_SYMBOL_VISIBILITY: "yes"
container:
image: debian:latest
@ -32,6 +33,7 @@ task:
BUILD_UBSAN: "yes"
BUILD_VALGRIND: "yes"
BUILD_ANALYZE: "yes"
TEST_DEBUGGER: "gdb"
TEST_SYMBOL_VISIBILITY: "yes"
container:
image: alpine:latest
@ -40,6 +42,7 @@ task:
DIST: "UBUNTU"
LC_ALL: "C"
MAKE: "make"
TEST_DEBUGGER: "gdb"
container:
image: ubuntu:20.04
- name: "Debian arm64"
@ -57,12 +60,14 @@ task:
BUILD_ASAN: "no"
BUILD_UBSAN: "no"
BUILD_ANALYZE: "yes"
TEST_DEBUGGER: "gdb"
arm_container:
image: debian:latest
- name: "FreeBSD amd64"
env:
DIST: "FREEBSD"
SCAN_BUILD: "scan-build"
TEST_DEBUGGER: "lldb"
MAKE: "gmake"
BUILD_ANALYZE: "yes"
TEST_SYMBOL_VISIBILITY: "yes"
@ -73,6 +78,7 @@ task:
DIST: "MACOS"
SCAN_BUILD: "/opt/homebrew/opt/llvm/bin/scan-build-py"
MAKE: "make"
TEST_DEBUGGER: "lldb"
BUILD_ASAN: "yes"
BUILD_UBSAN: "yes"
BUILD_ANALYZE: "yes"
@ -113,6 +119,7 @@ task:
env:
BUILD_TYPE: "asan"
CC: "clang"
TEST_DEBUGGER: "none"
CONFIG_OPTS: "--enable-debug"
CFLAGS: "-fsanitize=address"
CXXFLAGS: "-fsanitize=address"
@ -123,6 +130,7 @@ task:
env:
BUILD_TYPE: "ubsan"
CC: "clang"
TEST_DEBUGGER: "none"
CONFIG_OPTS: "--enable-debug"
CFLAGS: "-fsanitize=undefined -fno-sanitize-recover"
CXXFLAGS: "-fsanitize=undefined -fno-sanitize-recover"
@ -132,6 +140,7 @@ task:
env:
BUILD_TYPE: "analyze"
CC: "clang"
TEST_DEBUGGER: "lldb"
SCAN_WRAP: "${SCAN_BUILD} -v --status-bugs"
CONFIG_OPTS: "--enable-debug --disable-tests"
CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=OFF"
@ -161,16 +170,16 @@ task:
apk add cmake samurai gtest-dev autoconf autoconf-archive automake libtool pkgconf make
case "${BUILD_TYPE}" in
asan|lsan|ubsan)
apk add clang17 compiler-rt
apk add clang17 compiler-rt lldb
;;
analyze)
apk add clang17 clang17-analyzer compiler-rt
apk add clang17 clang17-analyzer compiler-rt lldb
;;
valgrind)
apk add gcc g++ valgrind
;;
*)
apk add gcc g++
apk add gcc g++ gdb
;;
esac
;;
@ -180,10 +189,10 @@ task:
apt-get install -y cmake ninja-build autoconf automake libtool g++ libgmock-dev pkg-config
case "${BUILD_TYPE}" in
asan|lsan|ubsan)
apt-get install -yq clang
apt-get install -yq clang lldb
;;
analyze)
apt-get install -yq clang clang-tools
apt-get install -yq clang clang-tools lldb
;;
valgrind)
apt-get install -yq valgrind
@ -192,17 +201,17 @@ task:
apt-get install -yq lcov git pip
pip3 install --break-system-packages --user cpp-coveralls
;;
*)
apt-get install -yq gdb
;;
esac
;;
FREEBSD)
# pkg upgrade -y && \
pkg install -y cmake ninja googletest pkgconf
pkg install -y cmake ninja googletest pkgconf llvm gmake
case "${BUILD_TYPE}" in
asan|analyze|ubsan|lsan)
pkg install -y llvm autoconf automake libtool gmake
;;
autotools)
pkg install -y autoconf automake libtool gmake
pkg install -y autoconf automake libtool
;;
esac
;;

@ -21,18 +21,18 @@ jobs:
CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON"
PKG_PATH: https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/10.0/All/
TEST_FILTER: "--gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*Parallel*"
GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1
TEST_DEBUGGER: "gdb"
with:
operating_system: netbsd
version: '10.0'
shell: 'bash'
environment_variables: DIST BUILD_TYPE CMAKE_FLAGS CMAKE_TEST_FLAGS PKG_PATH TEST_FILTER GTEST_INSTALL_FAILURE_SIGNAL_HANDLER
environment_variables: DIST BUILD_TYPE CMAKE_FLAGS CMAKE_TEST_FLAGS PKG_PATH TEST_FILTER TEST_DEBUGGER
run: |
echo "BUILD_TYPE: $BUILD_TYPE"
echo "CMAKE_FLAGS: $CMAKE_FLAGS"
echo "CMAKE_TEST_FLAGS: $CMAKE_TEST_FLAGS"
echo "PKG_PATH: $PKG_PATH"
sudo -E /usr/pkg/sbin/pkg_add -u cmake googletest pkgconf ninja-build
sudo -E /usr/pkg/sbin/pkg_add -u cmake googletest pkgconf ninja-build gdb
./ci/build.sh
./ci/test.sh

@ -18,14 +18,14 @@ jobs:
BUILD_TYPE: "cmake"
CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=DEBUG -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -G Ninja"
CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON"
GTEST_INSTALL_FAILURE_SIGNAL_HANDLER: 1
TEST_DEBUGGER: "lldb"
with:
operating_system: openbsd
version: '7.5'
shell: 'bash'
environment_variables: DIST BUILD_TYPE CMAKE_FLAGS CMAKE_TEST_FLAGS GTEST_INSTALL_FAILURE_SIGNAL_HANDLER
environment_variables: DIST BUILD_TYPE CMAKE_FLAGS CMAKE_TEST_FLAGS TEST_DEBUGGER
run: |
sudo pkg_add cmake gtest pkgconf ninja
sudo pkg_add cmake gtest pkgconf ninja gdb lldb
echo "BUILD_TYPE: $BUILD_TYPE"
echo "CMAKE_FLAGS: $CMAKE_FLAGS"
echo "CMAKE_TEST_FLAGS: $CMAKE_TEST_FLAGS"

@ -16,17 +16,18 @@ jobs:
CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=DEBUG -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON"
CMAKE_TEST_FLAGS: "-DCMAKE_PREFIX_PATH=/usr/local/ -DCARES_BUILD_TESTS=ON -DCMAKE_CXX_FLAGS=-DGTEST_HAS_PTHREAD=0"
TEST_FILTER: "--gtest_filter=-*Live*"
TEST_DEBUGGER: "none"
steps:
- uses: actions/checkout@v4
- name: Solaris Build and Test
id: solaris
uses: vmactions/solaris-vm@v1
with:
envs: 'DIST BUILD_TYPE CMAKE_FLAGS CMAKE_TEST_FLAGS TEST_FILTER CXXFLAGS'
envs: 'DIST BUILD_TYPE CMAKE_FLAGS CMAKE_TEST_FLAGS TEST_FILTER CXXFLAGS TEST_DEBUGGER'
usesh: true
# package list: http://pkg.oracle.com/solaris/release/en/catalog.shtml
prepare: |
pkg install -v --no-refresh cmake gcc pkg-config gnu-make git
pkg install -v --no-refresh cmake gcc pkg-config gnu-make git gdb
# We have to jump through a lot of hoops with google test.
# - We need to max out at v1.13.x because this solaris VM is old and
# only has cmake 3.9

@ -25,6 +25,7 @@ TESTDIR="${PWD}/test"
if [ "$BUILD_TYPE" = "autotools" -o "$BUILD_TYPE" = "coverage" ]; then
TOOLSBIN="${PWD}/atoolsbld/src/tools"
TESTSBIN="${PWD}/atoolsbld/test"
TEST_DEBUGGER=""
else
TOOLSBIN="${PWD}/cmakebld/bin"
TESTSBIN="${PWD}/cmakebld/bin"
@ -36,7 +37,19 @@ export GTEST_INSTALL_FAILURE_SIGNAL_HANDLER
$TEST_WRAP "${TOOLSBIN}/adig" www.google.com
$TEST_WRAP "${TOOLSBIN}/ahost" www.google.com
cd "${TESTSBIN}"
$TEST_WRAP ./arestest -4 $TEST_FILTER
if [ "$TEST_WRAP" != "" ] ; then
$TEST_WRAP ./arestest -4 $TEST_FILTER
elif [ "$TEST_DEBUGGER" = "gdb-nothreads" ] ; then
gdb --batch --batch-silent --return-child-result -ex "handle SIGPIPE nostop noprint pass" -ex "run" -ex "bt" -ex "quit" --args ./arestest -4 $TEST_FILTER
elif [ "$TEST_DEBUGGER" = "gdb" ] ; then
gdb --batch --batch-silent --return-child-result -ex "handle SIGPIPE nostop noprint pass" -ex "run" -ex "thread apply all bt" -ex "quit" --args ./arestest -4 $TEST_FILTER
elif [ "$TEST_DEBUGGER" = "lldb" ] ; then
lldb --batch -o "settings set target.process.extra-startup-command 'process handle SIGPIPE -n true -p true -s false'" -o "process launch --shell-expand-args 0" -k "thread backtrace all" -k "quit 1" -- ./arestest -4 $TEST_FILTER
else
./arestest -4 $TEST_FILTER
fi
./aresfuzz ${TESTDIR}/fuzzinput/*
./aresfuzzname ${TESTDIR}/fuzznames/*
./dnsdump "${TESTDIR}/fuzzinput/answer_a" "${TESTDIR}/fuzzinput/answer_aaaa"

Loading…
Cancel
Save