summaryrefslogtreecommitdiff
path: root/p11-kit
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-03-28 07:50:30 +0200
committerDaiki Ueno <ueno@gnu.org>2018-03-29 11:25:11 +0200
commit294c0efda49a623f47eb3c459bb5ed812ebc757c (patch)
tree11fd037924e9e2c1f03176db7ce5157b7004f4a8 /p11-kit
parent1eb22867b1123601387b1fa06643077225bd7590 (diff)
test: Rewrite test-server.sh in TAP style
Diffstat (limited to 'p11-kit')
-rwxr-xr-xp11-kit/test-server.sh38
1 files changed, 27 insertions, 11 deletions
diff --git a/p11-kit/test-server.sh b/p11-kit/test-server.sh
index f80c409..e9455dc 100755
--- a/p11-kit/test-server.sh
+++ b/p11-kit/test-server.sh
@@ -4,7 +4,7 @@ testdir=$PWD/test-server-$$
test -d "$testdir" || mkdir "$testdir"
cleanup () {
- rm -rf "$testdir"
+ rm -rf "$testdir"
}
trap cleanup 0
@@ -16,24 +16,40 @@ unset P11_KIT_SERVER_PID
XDG_RUNTIME_DIR="$testdir"
export XDG_RUNTIME_DIR
+echo 1..4
+
"$abs_top_builddir"/p11-kit-server -s --provider "$abs_top_builddir"/.libs/mock-one.so pkcs11: > start.env 2> start.err
-if test $? -ne 0; then
- cat start.err
- exit 1
+if test $? -eq 0; then
+ echo "ok 1 /server/start"
+else
+ echo "not ok 1 /server/start"
+ sed 's/^/# /' start.err
+ exit 1
fi
. ./start.env
-test "${P11_KIT_SERVER_ADDRESS+set}" = "set" || exit 1
-test "${P11_KIT_SERVER_PID+set}" = "set" || exit 1
+if test "${P11_KIT_SERVER_ADDRESS+set}" = "set" -a "${P11_KIT_SERVER_PID+set}" = "set"; then
+ echo "ok 2 /server/start-env"
+else
+ echo "not ok 2 /server/start-env"
+ exit 1
+fi
"$abs_top_builddir"/p11-kit-server -s -k > stop.env 2> stop.err
-if test $? -ne 0; then
- cat stop.err
- exit 1
+if test $? -eq 0; then
+ echo "ok 3 /server/stop"
+else
+ echo "not ok 3 /server/stop"
+ sed 's/^/# /' stop.err
+ exit 1
fi
. ./stop.env
-test "${P11_KIT_SERVER_ADDRESS-unset}" = "unset" || exit 1
-test "${P11_KIT_SERVER_PID-unset}" = "unset" || exit 1
+if test "${P11_KIT_SERVER_ADDRESS-unset}" = "unset" -a "${P11_KIT_SERVER_PID-unset}" = "unset"; then
+ echo "ok 4 /server/stop-env"
+else
+ echo "not ok 4 /server/stop-env"
+ exit 1
+fi