aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-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