From c6d85babd9e60d830c347eb2650df10804ba7d40 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Wed, 22 Sep 2021 22:44:56 +0200 Subject: add chaos testing --- scripts/chaos_dumps.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 scripts/chaos_dumps.sh (limited to 'scripts') diff --git a/scripts/chaos_dumps.sh b/scripts/chaos_dumps.sh new file mode 100755 index 0000000..d853e83 --- /dev/null +++ b/scripts/chaos_dumps.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +CRASHCNT=0 +GOODCRASHES=0 +PROG=build/dnsd + +make chaos + +ulimit -S -c unlimited $PROG +mkdir -p dumps + +while true; do + $PROG -p 5333 -z tests/zone.file > /dev/null & + PID=$! + + for i in $(seq 50); do + dig -p 5333 test.example.com @localhost > /dev/null & + done + + sleep 5 + + if ! kill -s 15 $PID ; then + CRASHCNT=$(( CRASHCNT + 1 )) + + echo -n "Crash #$CRASHCNT" + + if ! coredumpctl -o dumps/$CRASHCNT.core dump COREDUMP_PID=$PID "COREDUMP_EXE=$(realpath $PROG)" > /dev/null 2>&1; then + GOODCRASHES=$(( GOODCRASHES + 1 )) + echo " Good crash #$GOODCRASHES" + fi + fi +done -- cgit v1.2.3