summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-24 11:33:26 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-24 11:33:26 +0200
commit1c1914344edfabfe24315638566944caff8536b5 (patch)
tree5e6188ccb7e904b9ccf3e0d47dc6ae9f26b6d5c2 /test
parentd420d4114863fadc6458b489cff32b3d3ab61349 (diff)
downloadapk-tools-1c1914344edfabfe24315638566944caff8536b5.tar.gz
apk-tools-1c1914344edfabfe24315638566944caff8536b5.tar.bz2
apk-tools-1c1914344edfabfe24315638566944caff8536b5.tar.xz
apk-tools-1c1914344edfabfe24315638566944caff8536b5.zip
test: clean up solver.sh
* take list of tests to run (and default to all) * merge the awk invocation to a function
Diffstat (limited to 'test')
-rwxr-xr-xtest/solver.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/solver.sh b/test/solver.sh
index aa9ffc5..8c27d8f 100755
--- a/test/solver.sh
+++ b/test/solver.sh
@@ -1,16 +1,21 @@
#!/bin/sh
+get_block() {
+ awk '/^@'$1'/{p=1;next} /^@/{p=0} p{print}'
+}
+
APK_TEST=../src/apk-test
+TEST_TO_RUN="$@"
fail=0
pass=0
-for test in *.test; do
- awk '/^@ARGS/{p=1;next} /^@/{p=0} p{print}' < $test | xargs $APK_TEST &> .$test.got
+for test in ${TEST_TO_RUN:-*.test}; do
+ get_block ARGS < $test | xargs $APK_TEST &> .$test.got
- if ! awk '/^@EXPECT/{p=1;next} /^@/{p=0} p{print}' < $test | cmp .$test.got &> /dev/null; then
+ if ! get_block EXPECT < $test | cmp .$test.got &> /dev/null; then
fail=$((fail+1))
echo "FAIL: $test"
- awk '/^@EXPECT/{p=1;next} /^@/{p=0} p{print}' < $test | diff -ru - .$test.got
+ get_block EXPECT < $test | diff -ru - .$test.got
else
pass=$((pass+1))
fi
@@ -24,4 +29,3 @@ else
fi
exit $fail
-