#!/bin/bash export HAKMEM_DEBUG_LEVEL=5 for i in $(seq 1 50); do seed=$RANDOM echo "=== Run $i seed=$seed ===" ./bench_random_mixed_hakmem 100000 512 $seed 2>&1 | tail -100 > /tmp/debug_$i.log exitcode=$? if [ $exitcode -eq 139 ]; then echo "CRASH on run $i seed=$seed!" cp /tmp/debug_$i.log crash_debug_output.log echo "Last 50 lines before crash:" tail -50 /tmp/debug_$i.log exit 0 fi done echo "No crash in 50 runs"