Only test a few random padding values each time

It's unlikely that a specific value matters, though in theory possible;
however, an exhaustive test every time is really slow, and testing a couple
random values should, over time, cover everything.

It is fine to test random values because those tested will be logged,
so the problem can be manually reproduced later.
It does make CI technically not deterministic... but that should be fine.
This commit is contained in:
ISSOtm
2022-05-19 22:45:02 +02:00
parent 01777c96c8
commit 68d3ef8e76

View File

@@ -80,22 +80,23 @@ echo "${bold}Checking padding...${resbold}"
cp "$src"/padding{,-large,-larger}.bin . cp "$src"/padding{,-large,-larger}.bin .
touch padding{,-large,-larger}.err touch padding{,-large,-larger}.err
progress=0 progress=0
for b in {0..254}; do for (( i=0; i < 10; ++i )); do
printf "\r$b..." (( padding = RANDOM % 256 ))
echo "$padding..."
for suffix in '' -large -larger; do for suffix in '' -large -larger; do
cat <<<'-p $b' >padding$suffix.flags cat <<<"-p $padding" >padding$suffix.flags
tr '\377' \\$(($b / 64))$((($b / 8) % 8))$(($b % 8)) <"$src/padding$suffix.gb" >padding$suffix.gb # OK because $FF bytes are only used for padding tr '\377' \\$((padding / 64))$(((padding / 8) % 8))$((padding % 8)) <"$src/padding$suffix.gb" >padding$suffix.gb # OK because $FF bytes are only used for padding
runTest padding${suffix} . runTest padding${suffix} .
done done
done done
printf "\rDone! \n" echo "Done!"
# TODO: check MBC names # TODO: check MBC names
# Check that RGBFIX errors out when inputting a non-existent file... # Check that RGBFIX errors out when inputting a non-existent file...
$RGBFIX noexist 2>out.err $RGBFIX noexist 2>out.err
rc=$(($rc || $? != 1)) rc=$((rc || $? != 1))
tryDiff "$src/noexist.err" out.err noexist.err tryDiff "$src/noexist.err" out.err noexist.err
rc=$(($rc || $?)) rc=$((rc || $?))
exit $rc exit $rc