#!/usr/bin/env bash # Review re-run: one A (fixed lib), then B variants that all load the same nukedmd.sav. # B1: fixed lib, ASLR on, load after 6 s of running (closer to a real F7) # B2: fixed lib, ASLR on, load before the first pass (same as study harness) # B3: upstream lib, ASLR on, load after 6 s of running cd "$(dirname "$0")"; export SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy; STOP=${1:-20000000} R=../nmd-repro cp -f $R/rom.bin . ; cp -f $R/lib-fixed.so $R/lib-upstream.so . rm -f nukedmd.sav dump-*.sav echo "### A fixed" DUMP=dump-A.sav timeout 900 python3 -I drive3.py lib-fixed.so A $STOP 2>&1 | grep -E '^A:|stop at' runb() { lib=$1; d=$2; tag=$3 echo "### $tag" DUMP=dump-$tag.sav timeout 900 python3 -I drive3.py $lib B $STOP $d 2>&1 | grep -E '^B:|stop at|timed out'; b=${PIPESTATUS[0]} [ $b -ne 0 ] && echo " B exit=$b$([ $b -eq 139 ] && echo ' (segmentation fault)')" if [ -f dump-$tag.sav ]; then cmp -s dump-A.sav dump-$tag.sav && echo " RESULT: IDENTICAL" || echo " RESULT: DIFFER, $(cmp -l dump-A.sav dump-$tag.sav | wc -l) bytes"; else echo " RESULT: no B dump"; fi; } runb lib-fixed.so 6 B1-fixed-delayed runb lib-fixed.so 0 B2-fixed-immediate runb lib-upstream.so 6 B3-upstream-delayed echo DONE