shithub: rgbds

Download patch

ref: 68d3ef8e76dca8c545ca2084e6d17e11987dcec7
parent: 01777c96c8b074d9587045f271a9edc0e19b718d
author: ISSOtm <eldredhabert0@gmail.com>
date: Thu May 19 18:45:02 EDT 2022

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.

--- a/test/fix/test.sh
+++ b/test/fix/test.sh
@@ -80,22 +80,23 @@
 cp "$src"/padding{,-large,-larger}.bin .
 touch padding{,-large,-larger}.err
 progress=0
-for b in {0..254}; do
-	printf "\r$b..."
+for (( i=0; i < 10; ++i )); do
+	(( padding = RANDOM % 256 ))
+	echo "$padding..."
 	for suffix in '' -large -larger; do
-		cat <<<'-p $b' >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
+		cat <<<"-p $padding" >padding$suffix.flags
+		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} .
 	done
 done
-printf "\rDone! \n"
+echo "Done!"
 
 # TODO: check MBC names
 
 # Check that RGBFIX errors out when inputting a non-existent file...
 $RGBFIX noexist 2>out.err
-rc=$(($rc || $? != 1))
+rc=$((rc || $? != 1))
 tryDiff "$src/noexist.err" out.err noexist.err
-rc=$(($rc || $?))
+rc=$((rc || $?))
 
 exit $rc