summaryrefslogtreecommitdiffstats
path: root/test/util/pacsorttest.sh
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2013-07-18 09:41:08 +0200
committerAllan McRae <allan@archlinux.org>2013-08-21 03:00:18 +0200
commitd3726bbd26769b1ab7cdbedda109db31bdfb0f78 (patch)
treea9a610096ea32ffa8d0d6e7a064ddc46a5a47d2c /test/util/pacsorttest.sh
parent2e2c614f0e35dfbf80c17d55377418c1ded3f065 (diff)
downloadpacman-d3726bbd26769b1ab7cdbedda109db31bdfb0f78.tar.gz
pacman-d3726bbd26769b1ab7cdbedda109db31bdfb0f78.tar.xz
convert test scripts to tap output
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'test/util/pacsorttest.sh')
-rwxr-xr-xtest/util/pacsorttest.sh28
1 files changed, 17 insertions, 11 deletions
diff --git a/test/util/pacsorttest.sh b/test/util/pacsorttest.sh
index 9cbf619d..0abddc26 100755
--- a/test/util/pacsorttest.sh
+++ b/test/util/pacsorttest.sh
@@ -2,6 +2,7 @@
#
# pacsorttest - a test suite for pacsort
#
+# Copyright (c) 2013 by Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011 by Dan McGee <dan@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
@@ -20,32 +21,39 @@
# default binary if one was not specified as $1
bin='pacsort'
# holds counts of tests
-total=0
+total=23
+run=0
failure=0
# args:
# runtest input expected test_description optional_opts
runtest() {
# run the test
- diff -u <(printf "$1" | $bin $4) <(printf "$2")
- if [[ $? -ne 0 ]]; then
- echo "FAILURE: $3"
+ ((run++))
+ out=$(diff -u <(printf "$1" | $bin $4) <(printf "$2"))
+ if [[ $? -eq 0 ]]; then
+ echo "ok $run - $3"
+ else
((failure++))
+ echo "not ok $run - $3"
+ while read line; do
+ echo " # $line"
+ done <<<"$out"
fi
- ((total++))
}
# use first arg as our binary if specified
[[ -n "$1" ]] && bin="$1"
if ! type -p "$bin"; then
- echo "pacsort binary ($bin) could not be located"
- echo
+ echo "Bail out! pacsort binary ($bin) could not be located"
exit 1
fi
echo "Running pacsort tests..."
+echo "1..$total"
+
# BEGIN TESTS
in="1\n2\n3\n4\n"
@@ -113,11 +121,9 @@ runtest "$separator" "$separator_reverse" "really long input, sort key, separato
#END TESTS
if [[ $failure -eq 0 ]]; then
- echo "All $total tests successful"
- echo
+ echo "# All $run tests successful"
exit 0
fi
-echo "$failure of $total tests failed"
-echo
+echo "# $failure of $run tests failed"
exit 1