summaryrefslogtreecommitdiff
path: root/p11-kit/test-server.sh
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2017-10-06 10:58:50 +0200
committerDaiki Ueno <ueno@gnu.org>2017-10-06 16:56:58 +0200
commit96a3d3e6371785f846bc72c2a701a1eb67c89b77 (patch)
tree3697ec61b8ec9fc8aa17da4f248ef7417887f634 /p11-kit/test-server.sh
parent031912fa844c4f3da327c8b2578d9d9ce2a6473e (diff)
server: Better shell integration
This adds -k, -c, and -s options to the "p11-kit server" command, which allows you to terminate the server process, select which C-shell or Bourne shell command line is printed on startup, respectively.
Diffstat (limited to 'p11-kit/test-server.sh')
-rwxr-xr-xp11-kit/test-server.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/p11-kit/test-server.sh b/p11-kit/test-server.sh
new file mode 100755
index 0000000..225127c
--- /dev/null
+++ b/p11-kit/test-server.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+testdir=$PWD/test-server-$$
+test -d "$testdir" || mkdir "$testdir"
+
+cleanup () {
+ rm -rf "$testdir"
+}
+trap cleanup 0
+
+cd "$testdir"
+
+unset P11_KIT_SERVER_ADDRESS
+unset P11_KIT_SERVER_PID
+
+XDG_RUNTIME_DIR="$testdir"
+export XDG_RUNTIME_DIR
+
+"$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
+fi
+
+. ./start.env
+
+test "${P11_KIT_SERVER_ADDRESS+set}" == set || exit 1
+test "${P11_KIT_SERVER_PID+set}" == set || exit 1
+
+"$abs_top_builddir"/p11-kit-server -s -k > stop.env 2> stop.err
+if test $? -ne 0; then
+ cat 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