diff options
author | Florian Pritz <bluewind@xinu.at> | 2011-11-17 23:31:25 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2011-11-17 23:31:25 +0100 |
commit | 647ed2f2f70d91612e99c13e9bc931324c1a60ae (patch) | |
tree | b93453576a78244234e30d4652aac0b243a320a6 | |
parent | 8e42cf6d3095398a295aa5508d604dca0ede98e6 (diff) | |
download | bin-647ed2f2f70d91612e99c13e9bc931324c1a60ae.tar.gz bin-647ed2f2f70d91612e99c13e9bc931324c1a60ae.tar.xz |
pp-test: if given, only run specific testcase
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | pp-test | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -1,6 +1,6 @@ #!/bin/sh -prog="$1" +prog="$1"; shift realpath="$(readlink -f "$prog")" workdir=${realpath%/*} basepath=${workdir##*/} @@ -9,13 +9,25 @@ cd $workdir javac $prog.java || exit 1 -i=1 - -while [[ -e "$basepath.i$i" ]]; do - echo "testing $basepath.i$i" - java -ea "$prog" < "$basepath.i$i" > tmpout +testcase() { + if [[ ! -e "$basepath.i$i" ]]; then + return 1 + fi + echo "testing $basepath.i$1" + java -ea "$prog" < "$basepath.i$1" > tmpout dos2unix tmpout - diff -Nua "$basepath.o$i" tmpout + diff -Nua "$basepath.o$1" tmpout rm tmpout - ((i++)); -done +} + +if (($#)); then + for i in "$@"; do + testcase $i + done +else + i=1 + while true; do + testcase $i || break + ((i++)) + done +fi |