From e454338dddef9089a3b9998cc8ba33e247ee9f26 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 7 Mar 2018 15:40:20 +0100 Subject: test: Add test for error messages --- p11-kit/Makefile.am | 2 + p11-kit/test-messages.sh | 110 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100755 p11-kit/test-messages.sh (limited to 'p11-kit') diff --git a/p11-kit/Makefile.am b/p11-kit/Makefile.am index f4e9069..e02a1eb 100644 --- a/p11-kit/Makefile.am +++ b/p11-kit/Makefile.am @@ -293,6 +293,8 @@ check_PROGRAMS += \ print_messages_SOURCES = p11-kit/print-messages.c print_messages_LDADD = $(p11_kit_LIBS) +sh_tests += p11-kit/test-messages.sh + frob_setuid_SOURCES = p11-kit/frob-setuid.c frob_setuid_LDADD = $(p11_kit_LIBS) diff --git a/p11-kit/test-messages.sh b/p11-kit/test-messages.sh new file mode 100755 index 0000000..16c8544 --- /dev/null +++ b/p11-kit/test-messages.sh @@ -0,0 +1,110 @@ +#!/bin/sh + +set -e + +testdir=$PWD/test-messages-$$ +test -d "$testdir" || mkdir "$testdir" + +cleanup () { + rm -rf "$testdir" +} +trap cleanup 0 + +cd "$testdir" + +cat > messages.exp < messages.out + +echo 1..1 + +: ${DIFF=diff} +if ${DIFF} messages.exp messages.out > messages.diff; then + echo "ok 1 /messages/return-code" +else + echo "not ok 1 /messages/return-code" + sed 's/^/# /' messages.diff + exit 1 +fi -- cgit v1.1