X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/9628bd06223d7e1730574ca0c93d76b1d39856b4..9c8633f0258d0750fd81387fe826d4522873cd90:/tests/crossparse-c-random.sh diff --git a/tests/crossparse-c-random.sh b/tests/crossparse-c-random.sh index 8fb1b63..9fc45fb 100755 --- a/tests/crossparse-c-random.sh +++ b/tests/crossparse-c-random.sh @@ -14,19 +14,52 @@ randomdecl=test/randomdecl$EXEEXT crossparse=test/crossparse$EXEEXT test -x $randomdecl || exit 77 +# Slow case: run tests one at a time to determine exactly which one failed. +first_failed() { + ff_count=0 + + while test $# -gt 0 + do + $crossparse "$1" 2>/dev/null || break + ff_count=`expr $ff_count + 1` + shift + done + + echo "$ff_count" +} + proc() { result=pass count=0 + set x while read decl do - count=`expr $count + 1` - $crossparse "$decl" || { result=fail - printf 'original input: %s\n' "$decl" 1>&2 - break + set "$@" "$decl" + + # Accumulate tests in $@ and run them in batches to avoid + # significant startup costs. + if test $# -gt 25; then + shift + $crossparse "$@" || { result=fail + tmp_count=`first_failed "$@"` + count=`expr $count + $tmp_count` + break } + count=`expr $count + $#` + set x + fi done + shift + if test $# -gt 0 && test x"$result" = x"pass"; then + tmp_count=$# + $crossparse "$@" || { result=fail + tmp_count=`first_failed "$@"` + } + count=`expr $count + $tmp_count` + fi + echo "result=$result" echo "count=$count" }