aboutsummaryrefslogtreecommitdiff
path: root/scripts/chaos_dumps.sh
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-09-22 22:44:56 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-09-22 22:44:56 +0200
commitc6d85babd9e60d830c347eb2650df10804ba7d40 (patch)
treeaff31b7b18b5a15c46eab4037fee3c0eaa2d9ca2 /scripts/chaos_dumps.sh
parent3313fc410be0ffabae019de644f041064b054142 (diff)
downloaddns-c6d85babd9e60d830c347eb2650df10804ba7d40.tar.gz
add chaos testing
Diffstat (limited to 'scripts/chaos_dumps.sh')
-rwxr-xr-xscripts/chaos_dumps.sh32
1 files changed, 32 insertions, 0 deletions
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