Print summaries at the end of test.sh scripts

This commit is contained in:
Rangi42
2024-03-07 16:45:53 -05:00
parent aed172071b
commit e701faa1bc
4 changed files with 73 additions and 21 deletions

View File

@@ -10,6 +10,8 @@ gb="$(mktemp)"
input="$(mktemp)"
output="$(mktemp)"
errput="$(mktemp)"
tests=0
failed=0
rc=0
# Immediate expansion is the desired behavior.
@@ -73,6 +75,7 @@ for i in *.asm; do
RGBASMFLAGS="$(head -n 1 "$flags")" # Allow other lines to serve as comments
fi
for variant in '' '.pipe'; do
(( tests++ ))
echo "${bold}${green}${i%.asm}${variant}...${rescolors}${resbold}"
if [ -e "${i%.asm}.out" ]; then
desired_outname=${i%.asm}.out
@@ -129,8 +132,17 @@ for i in *.asm; do
fi
(( rc = rc || our_rc ))
if [ $our_rc -ne 0 ]; then break; fi
if [[ $our_rc -ne 0 ]]; then
(( failed++ ))
break
fi
done
done
if [[ "$failed" -eq 0 ]]; then
echo "${bold}${green}All ${tests} tests passed!${rescolors}${resbold}"
else
echo "${bold}${red}${failed} of the tests failed!${rescolors}${resbold}"
fi
exit $rc