Log indiviual rgblink test variants

This commit is contained in:
Rangi42
2024-02-18 19:37:19 -05:00
parent cd297e1f90
commit f00e57a0ed
2 changed files with 23 additions and 6 deletions

View File

@@ -17,14 +17,14 @@ RGBGFX=../../rgbgfx
rc=0 rc=0
new_test() { new_test() {
cmdline="$*" cmdline="$*"
echo "$bold${green}Testing: $cmdline$rescolors$resbold" >&2 echo "${bold}${green}Testing: ${cmdline}${rescolors}${resbold}" >&2
} }
test() { test() {
eval "$cmdline" eval "$cmdline"
} }
fail() { fail() {
rc=1 rc=1
echo "$bold${red}Test $cmdline failed!${1:+ (RC=$1)}$rescolors$resbold" echo "${bold}${red}Test ${cmdline} failed!${1:+ (RC=$1)}${rescolors}${resbold}"
} }

View File

@@ -23,7 +23,11 @@ RGBASM=../../rgbasm
RGBLINK=../../rgblink RGBLINK=../../rgblink
startTest () { startTest () {
echo "$bold$green${i%.asm}...$rescolors$resbold" echo "${bold}${green}${i%.asm} assembling...${rescolors}${resbold}"
}
continueTest () {
echo "${bold}${green}${i%.asm}$1...${rescolors}${resbold}"
} }
tryDiff () { tryDiff () {
@@ -50,7 +54,7 @@ tryCmpRom () {
rgblinkQuiet () { rgblinkQuiet () {
out="$(env $RGBLINK "$@")" || return $? out="$(env $RGBLINK "$@")" || return $?
if [[ -n "$out" ]]; then if [[ -n "$out" ]]; then
echo "$bold${red}Linking shouldn't produce anything on stdout!$rescolors$resbold" echo "$bold${red}Linking shouldn't produce anything on stdout!${rescolors}${resbold}"
false false
fi fi
} }
@@ -63,12 +67,14 @@ for i in *.asm; do
ran_flag=false ran_flag=false
for flag in '-d' '-t' '-w'; do for flag in '-d' '-t' '-w'; do
if [ -f "${i%.asm}-no${flag}.out" ]; then if [ -f "${i%.asm}-no${flag}.out" ]; then
continueTest "-no${flag}"
rgblinkQuiet -o "$gbtemp" "$otemp" >"$outtemp" 2>&1 rgblinkQuiet -o "$gbtemp" "$otemp" >"$outtemp" 2>&1
tryDiff "${i%.asm}-no${flag}.out" "$outtemp" tryDiff "${i%.asm}-no${flag}.out" "$outtemp"
(( rc = rc || $? )) (( rc = rc || $? ))
ran_flag=true ran_flag=true
fi fi
if [ -f "${i%.asm}${flag}.out" ]; then if [ -f "${i%.asm}${flag}.out" ]; then
continueTest "$flag"
rgblinkQuiet ${flag} -o "$gbtemp" "$otemp" >"$outtemp" 2>&1 rgblinkQuiet ${flag} -o "$gbtemp" "$otemp" >"$outtemp" 2>&1
tryDiff "${i%.asm}${flag}.out" "$outtemp" tryDiff "${i%.asm}${flag}.out" "$outtemp"
(( rc = rc || $? )) (( rc = rc || $? ))
@@ -83,6 +89,7 @@ for i in *.asm; do
for script in "${i%.asm}"*.link; do for script in "${i%.asm}"*.link; do
[[ -e "$script" ]] || break # If the glob doesn't match, it just... doesn't expand! [[ -e "$script" ]] || break # If the glob doesn't match, it just... doesn't expand!
continueTest "${script#${i%.asm}}"
rgblinkQuiet -l "$script" -o "$gbtemp" "$otemp" >"$outtemp" 2>&1 rgblinkQuiet -l "$script" -o "$gbtemp" "$otemp" >"$outtemp" 2>&1
tryDiff "${script%.link}.out" "$outtemp" tryDiff "${script%.link}.out" "$outtemp"
(( rc = rc || $? )) (( rc = rc || $? ))
@@ -93,6 +100,7 @@ for i in *.asm; do
fi fi
# The rest of the tests just links a file, and maybe checks the binary # The rest of the tests just links a file, and maybe checks the binary
continueTest
rgblinkQuiet -o "$gbtemp" "$otemp" >"$outtemp" 2>&1 rgblinkQuiet -o "$gbtemp" "$otemp" >"$outtemp" 2>&1
if [ -f "${i%.asm}.out" ]; then if [ -f "${i%.asm}.out" ]; then
tryDiff "${i%.asm}.out" "$outtemp" tryDiff "${i%.asm}.out" "$outtemp"
@@ -112,6 +120,7 @@ i="bank-const.asm"
startTest startTest
"$RGBASM" -o "$otemp" bank-const/a.asm "$RGBASM" -o "$otemp" bank-const/a.asm
"$RGBASM" -o "$gbtemp2" bank-const/b.asm "$RGBASM" -o "$gbtemp2" bank-const/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" "$gbtemp2" "$otemp" >"$outtemp" 2>&1 rgblinkQuiet -o "$gbtemp" "$gbtemp2" "$otemp" >"$outtemp" 2>&1
tryDiff bank-const/out.err "$outtemp" tryDiff bank-const/out.err "$outtemp"
(( rc = rc || $? )) (( rc = rc || $? ))
@@ -120,6 +129,7 @@ for i in fragment-align/*; do
startTest startTest
"$RGBASM" -o "$otemp" "$i"/a.asm "$RGBASM" -o "$otemp" "$i"/a.asm
"$RGBASM" -o "$gbtemp2" "$i"/b.asm "$RGBASM" -o "$gbtemp2" "$i"/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" "$otemp" "$gbtemp2" 2>"$outtemp" rgblinkQuiet -o "$gbtemp" "$otemp" "$gbtemp2" 2>"$outtemp"
tryDiff "$i"/out.err "$outtemp" tryDiff "$i"/out.err "$outtemp"
(( rc = rc || $? )) (( rc = rc || $? ))
@@ -132,15 +142,17 @@ done
i="high-low.asm" i="high-low.asm"
startTest startTest
"$RGBASM" -o "$otemp" high-low/a.asm "$RGBASM" -o "$otemp" high-low/a.asm
"$RGBASM" -o "$outtemp" high-low/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" "$otemp" rgblinkQuiet -o "$gbtemp" "$otemp"
"$RGBASM" -o "$otemp" high-low/b.asm rgblinkQuiet -o "$gbtemp2" "$outtemp"
rgblinkQuiet -o "$gbtemp2" "$otemp"
tryCmp "$gbtemp" "$gbtemp2" tryCmp "$gbtemp" "$gbtemp2"
(( rc = rc || $? )) (( rc = rc || $? ))
i="overlay.asm" i="overlay.asm"
startTest startTest
"$RGBASM" -o "$otemp" overlay/a.asm "$RGBASM" -o "$otemp" overlay/a.asm
continueTest
rgblinkQuiet -o "$gbtemp" -t -O overlay/overlay.gb "$otemp" >"$outtemp" 2>&1 rgblinkQuiet -o "$gbtemp" -t -O overlay/overlay.gb "$otemp" >"$outtemp" 2>&1
tryDiff overlay/out.err "$outtemp" tryDiff overlay/out.err "$outtemp"
(( rc = rc || $? )) (( rc = rc || $? ))
@@ -151,6 +163,7 @@ tryCmp overlay/out.gb "$gbtemp"
i="scramble-romx.asm" i="scramble-romx.asm"
startTest startTest
"$RGBASM" -o "$otemp" scramble-romx/a.asm "$RGBASM" -o "$otemp" scramble-romx/a.asm
continueTest
rgblinkQuiet -o "$gbtemp" -S romx=3 "$otemp" >"$outtemp" 2>&1 rgblinkQuiet -o "$gbtemp" -S romx=3 "$otemp" >"$outtemp" 2>&1
tryDiff scramble-romx/out.err "$outtemp" tryDiff scramble-romx/out.err "$outtemp"
(( rc = rc || $? )) (( rc = rc || $? ))
@@ -163,6 +176,7 @@ i="section-fragment/jr-offset.asm"
startTest startTest
"$RGBASM" -o "$otemp" section-fragment/jr-offset/a.asm "$RGBASM" -o "$otemp" section-fragment/jr-offset/a.asm
"$RGBASM" -o "$gbtemp2" section-fragment/jr-offset/b.asm "$RGBASM" -o "$gbtemp2" section-fragment/jr-offset/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" "$otemp" "$gbtemp2" rgblinkQuiet -o "$gbtemp" "$otemp" "$gbtemp2"
tryCmpRom section-fragment/jr-offset/ref.out.bin tryCmpRom section-fragment/jr-offset/ref.out.bin
(( rc = rc || $? )) (( rc = rc || $? ))
@@ -171,6 +185,7 @@ i="section-union/good.asm"
startTest startTest
"$RGBASM" -o "$otemp" section-union/good/a.asm "$RGBASM" -o "$otemp" section-union/good/a.asm
"$RGBASM" -o "$gbtemp2" section-union/good/b.asm "$RGBASM" -o "$gbtemp2" section-union/good/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" -l section-union/good/script.link "$otemp" "$gbtemp2" rgblinkQuiet -o "$gbtemp" -l section-union/good/script.link "$otemp" "$gbtemp2"
tryCmpRom section-union/good/ref.out.bin tryCmpRom section-union/good/ref.out.bin
(( rc = rc || $? )) (( rc = rc || $? ))
@@ -179,6 +194,7 @@ i="section-union/fragments.asm"
startTest startTest
"$RGBASM" -o "$otemp" section-union/fragments/a.asm "$RGBASM" -o "$otemp" section-union/fragments/a.asm
"$RGBASM" -o "$gbtemp2" section-union/fragments/b.asm "$RGBASM" -o "$gbtemp2" section-union/fragments/b.asm
continueTest
rgblinkQuiet -o "$gbtemp" "$otemp" "$gbtemp2" rgblinkQuiet -o "$gbtemp" "$otemp" "$gbtemp2"
tryCmpRom section-union/fragments/ref.out.bin tryCmpRom section-union/fragments/ref.out.bin
(( rc = rc || $? )) (( rc = rc || $? ))
@@ -187,6 +203,7 @@ for i in section-union/*.asm; do
startTest startTest
"$RGBASM" -o "$otemp" "$i" "$RGBASM" -o "$otemp" "$i"
"$RGBASM" -o "$gbtemp2" "$i" -DSECOND "$RGBASM" -o "$gbtemp2" "$i" -DSECOND
continueTest
if rgblinkQuiet "$otemp" "$gbtemp2" 2>"$outtemp"; then if rgblinkQuiet "$otemp" "$gbtemp2" 2>"$outtemp"; then
echo -e "${bold}${red}$i didn't fail to link!${rescolors}${resbold}" echo -e "${bold}${red}$i didn't fail to link!${rescolors}${resbold}"
rc=1 rc=1