From 647ed2f2f70d91612e99c13e9bc931324c1a60ae Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 17 Nov 2011 23:31:25 +0100 Subject: pp-test: if given, only run specific testcase Signed-off-by: Florian Pritz --- pp-test | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'pp-test') diff --git a/pp-test b/pp-test index 736aede..e84ecb7 100755 --- a/pp-test +++ b/pp-test @@ -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 -- cgit v1.2.3-24-g4f1b