From bf65a502d4edac8ab80133fb8db23e80ada10bcd Mon Sep 17 00:00:00 2001 From: Jean-Sebastien Gelinas Date: Thu, 23 Jul 2009 12:37:03 -0400 Subject: [PATCH] tests: allow multiple lines in argument files Signed-off-by: Jean-Sebastien Gelinas Signed-off-by: Jean Privat --- tests/sav/shootout_ackermann.sav | 2 +- tests/sav/shootout_ackermann_args1.sav | 1 + tests/sav/shootout_binarytrees.sav | 10 +-- tests/sav/shootout_binarytrees_args1.sav | 6 ++ tests/sav/shootout_mandelbrot.sav | Bin 5011 -> 34 bytes tests/sav/shootout_mandelbrot_args1.sav | Bin 0 -> 5011 bytes tests/sav/shootout_pidigits.sav | 5 ++ tests/sav/shootout_pidigits_args1.sav | 100 +++++++++++++++++++++++ tests/sav/test_args.sav | 4 +- tests/sav/test_args_args1.sav | 4 + tests/sav/test_args_args2.sav | 4 + tests/sav/test_args_args3.sav | 14 ++++ tests/test_args.args | 2 + tests/tests.sh | 131 +++++++++++++++++++----------- 14 files changed, 226 insertions(+), 57 deletions(-) create mode 100644 tests/sav/shootout_ackermann_args1.sav create mode 100644 tests/sav/shootout_binarytrees_args1.sav create mode 100644 tests/sav/shootout_mandelbrot_args1.sav create mode 100644 tests/sav/shootout_pidigits.sav create mode 100644 tests/sav/shootout_pidigits_args1.sav create mode 100644 tests/sav/test_args_args1.sav create mode 100644 tests/sav/test_args_args2.sav create mode 100644 tests/sav/test_args_args3.sav diff --git a/tests/sav/shootout_ackermann.sav b/tests/sav/shootout_ackermann.sav index 6d42236..5a636f6 100644 --- a/tests/sav/shootout_ackermann.sav +++ b/tests/sav/shootout_ackermann.sav @@ -1 +1 @@ -Ack(3,4): 125 +Ack(3,1): 13 diff --git a/tests/sav/shootout_ackermann_args1.sav b/tests/sav/shootout_ackermann_args1.sav new file mode 100644 index 0000000..6d42236 --- /dev/null +++ b/tests/sav/shootout_ackermann_args1.sav @@ -0,0 +1 @@ +Ack(3,4): 125 diff --git a/tests/sav/shootout_binarytrees.sav b/tests/sav/shootout_binarytrees.sav index c8f333d..72654db 100644 --- a/tests/sav/shootout_binarytrees.sav +++ b/tests/sav/shootout_binarytrees.sav @@ -1,6 +1,4 @@ -stretch tree of depth 11 check: -1 -2048 trees of depth 4 check: -2048 -512 trees of depth 6 check: -512 -128 trees of depth 8 check: -128 -32 trees of depth 10 check: -32 -long lived tree of depth 10 check: -1 +stretch tree of depth 7 check: -1 +128 trees of depth 4 check: -128 +32 trees of depth 6 check: -32 +long lived tree of depth 6 check: -1 diff --git a/tests/sav/shootout_binarytrees_args1.sav b/tests/sav/shootout_binarytrees_args1.sav new file mode 100644 index 0000000..c8f333d --- /dev/null +++ b/tests/sav/shootout_binarytrees_args1.sav @@ -0,0 +1,6 @@ +stretch tree of depth 11 check: -1 +2048 trees of depth 4 check: -2048 +512 trees of depth 6 check: -512 +128 trees of depth 8 check: -128 +32 trees of depth 10 check: -32 +long lived tree of depth 10 check: -1 diff --git a/tests/sav/shootout_mandelbrot.sav b/tests/sav/shootout_mandelbrot.sav index 2c6ff6b19705a9df3ba49f5c951d43638e901ec5..63e1706626debc20ac5612c373917f7f896b1861 100644 GIT binary patch literal 34 pcmWG7PE1d=QYg;I&o9X@Es4)f%u7klNh-=OQLrh_tV*@x0s!S547&gT literal 5011 zcmaJ_y>1jS5T3mYBG4ofAVnhRR)T_#Q$&e$_XtS5z*W=;nsmDb5+%GrQd05&NGu@H zArKEhE+7Hrbp++I!`NQ$&N%*J>CWEy{CRB8c>MG5{?)zdw3OdfI+sT0BtbCW20#hq zbQ=L12-rjbl*nAbTukub6VWL#!G$uhQ>PwN~a45%YN?=p_O4gvDxfZY{fb-q*1&mEBZ zdqYJ@6)!3EpwWVk=QD0n0`1ks>T|`%I}eB!(rTZ!>hbXrGr!#>DtoCEE|13lM9yoO zl!XQ+zofI0+H~xXH~_pZ4ol7W*9_UMf$^6c&FDtqSv3N*oWvG=S{bAlvsg=|ZbBSvoNi<2F0-mn z*A-wU{%to?t|_B?cH~4M8AcSk+$f(Zq@646_Y`2}N_C1a0F*n*(il>$bPVPYym5g4 zBlNi|VnfbXRfQ{jG^z-{T|1jS5T3mYBG4ofAVnhRR)T_#Q$&e$_XtS5z*W=;nsmDb5+%GrQd05&NGu@H zArKEhE+7Hrbp++I!`NQ$&N%*J>CWEy{CRB8c>MG5{?)zdw3OdfI+sT0BtbCW20#hq zbQ=L12-rjbl*nAbTukub6VWL#!G$uhQ>PwN~a45%YN?=p_O4gvDxfZY{fb-q*1&mEBZ zdqYJ@6)!3EpwWVk=QD0n0`1ks>T|`%I}eB!(rTZ!>hbXrGr!#>DtoCEE|13lM9yoO zl!XQ+zofI0+H~xXH~_pZ4ol7W*9_UMf$^6c&FDtqSv3N*oWvG=S{bAlvsg=|ZbBSvoNi<2F0-mn z*A-wU{%to?t|_B?cH~4M8AcSk+$f(Zq@646_Y`2}N_C1a0F*n*(il>$bPVPYym5g4 zBlNi|VnfbXRfQ{jG^z-{T| "$pattern.diff.sav.log" + if [ "$?" == 0 ]; then + SAV=OK + else + SAV=NOK + fi + fi + if [ -r "sav/$pattern.fail" ]; then + diff -u "$pattern.res" "sav/$pattern.fail" > "$pattern.diff.fail.log" + if [ "$?" == 0 ]; then + FAIL=OK + else + FAIL=NOK + fi + fi + if [ "x$SAV" = "xOK" ]; then + if [ "x$FAIL" = "x" ]; then + echo "[ok] $pattern.res" + else + echo "[ok] $pattern.res - but sav/$pattern.fail remains!" + fi + ok="$ok $pattern" + elif [ "x$FAIL" = "xOK" ]; then + echo "[fail] $pattern.res" + ok="$ok $pattern" + elif [ "x$SAV" = "xNOK" ]; then + echo "[======= fail $pattern.res sav/$pattern.sav =======]" + nok="$nok $ff" + echo "$ii" >> "$ERRLIST" + elif [ "x$FAIL" = "xNOK" ]; then + echo "[======= changed $pattern.res sav/$pattern.fail ======]" + nok="$nok $ff" + echo "$ii" >> "$ERRLIST" + else + echo "[=== no sav ===] $pattern.res" + nos="$nos $pattern" + fi +} + + verbose=false stop=false while [ $stop = false ]; do @@ -103,14 +151,11 @@ for ii in "$@"; do if [ "$ERR" != 0 ]; then echo -n "! " cp "$ff.cmp.err" "$ff.res" + process_result $ff elif [ -x "./$ff.bin" ]; then echo -n ". " # Execute - if [ -f "$f.args" ]; then - args=`cat "$f.args"` - else - args="" - fi + args="" if [ "x$verbose" = "xtrue" ]; then echo "" echo "./$ff.bin" $args @@ -130,51 +175,43 @@ for ii in "$@"; do if [ -s "$ff.err" ]; then cat "$ff.err" >> "$ff.res" fi - else - echo -n "! " - echo "Compilation error" > "$ff.res" - fi + process_result $ff - # Result - SAV="" - FAIL="" - if [ -r "sav/$ff.sav" ]; then - diff -u "$ff.res" "sav/$ff.sav" > "$ff.diff.sav.log" - if [ "$?" == 0 ]; then - SAV=OK - else - SAV=NOK - fi - fi - if [ -r "sav/$ff.fail" ]; then - diff -u "$ff.res" "sav/$ff.fail" > "$ff.diff.fail.log" - if [ "$?" == 0 ]; then - FAIL=OK - else - FAIL=NOK - fi - fi - if [ "x$SAV" = "xOK" ]; then - if [ "x$FAIL" = "x" ]; then - echo "[ok] $ff.res" - else - echo "[ok] $ff.res - but sav/$ff.fail remains!" + if [ -f "$f.args" ]; then + fargs=$f.args + cptr=0 + cat $fargs | + while read line; do + ((cptr=cptr+1)) + args=$line + fff=$ff"_args"$cptr + if [ "x$verbose" = "xtrue" ]; then + echo "" + echo "./$ff.bin" $args + fi + echo -n "==> args #"$cptr " " + if [ -f "$f.inputs" ]; then + "./$ff.bin" $args < "$f.inputs" > "$fff.res" 2>"$fff.err" + else + sh -c "./$ff.bin ''$args > $fff.res 2>$fff.err" + fi + if [ "x$verbose" = "xtrue" ]; then + cat "$fff.res" + cat >&2 "$fff.err" + fi + if [ -f "$fff.write" ]; then + cat "$fff.write" >> "$fff.res" + fi + if [ -s "$fff.err" ]; then + cat "$fff.err" >> "$fff.res" + fi + process_result $fff + done fi - ok="$ok $ff" - elif [ "x$FAIL" = "xOK" ]; then - echo "[fail] $ff.res" - ok="$ok $ff" - elif [ "x$SAV" = "xNOK" ]; then - echo "[======= fail $ff.res sav/$ff.sav =======]" - nok="$nok $ff" - echo "$ii" >> "$ERRLIST" - elif [ "x$FAIL" = "xNOK" ]; then - echo "[======= changed $ff.res sav/$ff.fail ======]" - nok="$nok $ff" - echo "$ii" >> "$ERRLIST" else - echo "[=== no sav ===] $ff.res" - nos="$nos $ff" + echo -n "! " + echo "Compilation error" > "$ff.res" + process_result $ff fi done done -- 1.7.9.5