Closes the last of the per-format fuzz gap Fimail flagged on the v0.6.1 scan (their LOW priority; "we don't open those formats today" but good to have before anyone does). test_fuzz_ezycom (F-EZ-1..4): missing AREA1/ dir, empty MH/MT files, truncated half-header, garbage-filled bundle. test_fuzz_wildcat (F-WC-1..3): empty dir, garbage MAKEWILD.DAT only, garbage MSGDB*/MSGTXT files. The WC SDK's historic Mark/Release + LogFatalError pattern is the thing we're testing for -- our wrapper must return False from Open rather than raising or halting. Not cutting a release just for these; the behaviour under test is whether Open refuses cleanly on corrupt input, which was already the case. Rides along on the next real release as pinned regression coverage. Wired into run_tests.sh; all 7 happy-path + 31 fuzz tests green.
85 lines
2.1 KiB
Bash
Executable File
85 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# run_tests.sh - build and run every test against the native
|
|
# x86_64-linux target. Tests that don't need network / FS features
|
|
# that are linux-specific should also work on other native hosts,
|
|
# but we only run them here.
|
|
#
|
|
# Exits non-zero on any failure.
|
|
|
|
set -e
|
|
|
|
FPCNATIVE=/opt/fpcup/fpc/bin/x86_64-linux/fpc
|
|
TGT=x86_64-linux
|
|
|
|
cd "$(dirname "$0")"
|
|
mkdir -p "units/$TGT" "exe/$TGT"
|
|
|
|
compile() {
|
|
local src=$1
|
|
echo " compile $(basename "$src")"
|
|
"$FPCNATIVE" -Mobjfpc -Sh -Sgic \
|
|
-Fusrc -Fusrc/formats -Fusrc/wc_sdk -Futests \
|
|
-FUunits/"$TGT" -FEexe/"$TGT" \
|
|
"$src" >/tmp/ma_test_build.$$.log 2>&1 || {
|
|
cat /tmp/ma_test_build.$$.log
|
|
rm -f /tmp/ma_test_build.$$.log
|
|
exit 1
|
|
}
|
|
rm -f /tmp/ma_test_build.$$.log
|
|
}
|
|
|
|
run() {
|
|
local name=$1
|
|
echo " run $name"
|
|
rm -rf "/tmp/ma_$name"
|
|
"./exe/$TGT/$name"
|
|
}
|
|
|
|
echo "Building tests..."
|
|
compile tests/test_read.pas
|
|
compile tests/test_roundtrip.pas
|
|
compile tests/test_roundtrip_attrs.pas
|
|
compile tests/test_lock.pas
|
|
compile tests/test_wildcat.pas
|
|
compile tests/test_write_existing.pas
|
|
compile tests/test_pack.pas
|
|
compile tests/test_hwm.pas
|
|
compile tests/test_consumer_round1.pas
|
|
compile tests/adversarial/test_fuzz_jam.pas
|
|
compile tests/adversarial/test_fuzz_squish.pas
|
|
compile tests/adversarial/test_fuzz_msg.pas
|
|
compile tests/adversarial/test_fuzz_hudson.pas
|
|
compile tests/adversarial/test_fuzz_goldbase.pas
|
|
compile tests/adversarial/test_fuzz_pcboard.pas
|
|
compile tests/adversarial/test_fuzz_ezycom.pas
|
|
compile tests/adversarial/test_fuzz_wildcat.pas
|
|
compile tests/adversarial/test_fuzz_kludge.pas
|
|
|
|
echo
|
|
echo "Running happy-path tests..."
|
|
run test_read
|
|
run test_roundtrip
|
|
run test_roundtrip_attrs
|
|
run test_lock
|
|
run test_wildcat
|
|
run test_write_existing
|
|
run test_pack
|
|
run test_hwm
|
|
run test_consumer_round1
|
|
|
|
echo
|
|
echo "Running adversarial / corruption-resilience tests..."
|
|
run test_fuzz_jam
|
|
run test_fuzz_squish
|
|
run test_fuzz_msg
|
|
run test_fuzz_hudson
|
|
run test_fuzz_goldbase
|
|
run test_fuzz_pcboard
|
|
run test_fuzz_ezycom
|
|
run test_fuzz_wildcat
|
|
run test_fuzz_kludge
|
|
|
|
echo
|
|
echo "All tests passed."
|