Blame p11-kit/test-server.sh
|
Packit Service |
3749ba |
#!/bin/sh
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
set -e
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
: ${P11_MODULE_PATH="$abs_top_builddir"/.libs}
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
testdir=`mktemp -d -t test-server.XXXXXX`
|
|
Packit Service |
3749ba |
if test $? -ne 0; then
|
|
Packit Service |
3749ba |
echo "cannot create temporary directory" >&2
|
|
Packit Service |
3749ba |
exit 77
|
|
Packit Service |
3749ba |
fi
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
cleanup () {
|
|
Packit Service |
3749ba |
rm -rf "$testdir"
|
|
Packit Service |
3749ba |
}
|
|
Packit Service |
3749ba |
trap cleanup 0
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
cd "$testdir"
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
unset P11_KIT_SERVER_ADDRESS
|
|
Packit Service |
3749ba |
unset P11_KIT_SERVER_PID
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
XDG_RUNTIME_DIR="$testdir"
|
|
Packit Service |
3749ba |
export XDG_RUNTIME_DIR
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
echo 1..4
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
"$abs_top_builddir"/p11-kit/p11-kit-server -s --provider "$P11_MODULE_PATH"/mock-one.so pkcs11: > start.env 2> start.err
|
|
Packit Service |
3749ba |
if test $? -eq 0; then
|
|
Packit Service |
3749ba |
echo "ok 1 /server/start"
|
|
Packit Service |
3749ba |
else
|
|
Packit Service |
3749ba |
echo "not ok 1 /server/start"
|
|
Packit Service |
3749ba |
sed 's/^/# /' start.err
|
|
Packit Service |
3749ba |
exit 1
|
|
Packit Service |
3749ba |
fi
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
. ./start.env
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
if test "${P11_KIT_SERVER_ADDRESS+set}" = "set" -a "${P11_KIT_SERVER_PID+set}" = "set"; then
|
|
Packit Service |
3749ba |
echo "ok 2 /server/start-env"
|
|
Packit Service |
3749ba |
else
|
|
Packit Service |
3749ba |
echo "not ok 2 /server/start-env"
|
|
Packit Service |
3749ba |
exit 1
|
|
Packit Service |
3749ba |
fi
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
"$abs_top_builddir"/p11-kit/p11-kit-server -s -k > stop.env 2> stop.err
|
|
Packit Service |
3749ba |
if test $? -eq 0; then
|
|
Packit Service |
3749ba |
echo "ok 3 /server/stop"
|
|
Packit Service |
3749ba |
else
|
|
Packit Service |
3749ba |
echo "not ok 3 /server/stop"
|
|
Packit Service |
3749ba |
sed 's/^/# /' stop.err
|
|
Packit Service |
3749ba |
exit 1
|
|
Packit Service |
3749ba |
fi
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
. ./stop.env
|
|
Packit Service |
3749ba |
|
|
Packit Service |
3749ba |
if test "${P11_KIT_SERVER_ADDRESS-unset}" = "unset" -a "${P11_KIT_SERVER_PID-unset}" = "unset"; then
|
|
Packit Service |
3749ba |
echo "ok 4 /server/stop-env"
|
|
Packit Service |
3749ba |
else
|
|
Packit Service |
3749ba |
echo "not ok 4 /server/stop-env"
|
|
Packit Service |
3749ba |
exit 1
|
|
Packit Service |
3749ba |
fi
|