2011-07-26 13:56:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-02-24 09:33:26 +00:00
|
|
|
get_block() {
|
|
|
|
awk '/^@'$1'/{p=1;next} /^@/{p=0} p{print}'
|
|
|
|
}
|
|
|
|
|
2012-02-23 20:02:11 +00:00
|
|
|
APK_TEST=../src/apk-test
|
2012-02-24 09:33:26 +00:00
|
|
|
TEST_TO_RUN="$@"
|
2011-07-26 13:56:55 +00:00
|
|
|
|
|
|
|
fail=0
|
2012-02-23 20:02:11 +00:00
|
|
|
pass=0
|
2012-02-24 09:33:26 +00:00
|
|
|
for test in ${TEST_TO_RUN:-*.test}; do
|
|
|
|
get_block ARGS < $test | xargs $APK_TEST &> .$test.got
|
2012-02-23 20:02:11 +00:00
|
|
|
|
2012-02-24 09:33:26 +00:00
|
|
|
if ! get_block EXPECT < $test | cmp .$test.got &> /dev/null; then
|
2011-07-26 13:56:55 +00:00
|
|
|
fail=$((fail+1))
|
|
|
|
echo "FAIL: $test"
|
2012-02-24 09:33:26 +00:00
|
|
|
get_block EXPECT < $test | diff -ru - .$test.got
|
2011-07-26 13:56:55 +00:00
|
|
|
else
|
2012-02-23 20:02:11 +00:00
|
|
|
pass=$((pass+1))
|
2011-07-26 13:56:55 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-02-23 20:02:11 +00:00
|
|
|
total=$((fail+pass))
|
2011-07-26 13:56:55 +00:00
|
|
|
if [ "$fail" != "0" ]; then
|
2012-02-23 20:02:11 +00:00
|
|
|
echo "FAIL: $fail of $total test cases failed"
|
|
|
|
else
|
|
|
|
echo "OK: all $total solver test cases passed"
|
2011-07-26 13:56:55 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit $fail
|