1# Copyright (C) 2000 Werner Koch (dd9jn)
2# Copyright (C) 2001 g10 Code GmbH
3#
4# This file is part of GPGME.
5#
6# GPGME is free software; you can redistribute it and/or modify it
7# under the terms of the GNU Lesser General Public License as
8# published by the Free Software Foundation; either version 2.1 of the
9# License, or (at your option) any later version.
10#
11# GPGME is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
14# Public License for more details.
15#
16# You should have received a copy of the GNU Lesser General Public
17# License along with this program; if not, see <https://gnu.org/licenses/>.
18# SPDX-License-Identifier: LGPL-2.1-or-later
19
20## Process this file with automake to produce Makefile.in
21
22GPGSM = gpgsm
23GPG_AGENT = gpg-agent
24
25GNUPGHOME=$(abs_builddir)
26TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) LC_ALL=C GPG_AGENT_INFO= \
27                    top_srcdir=$(top_srcdir)
28
29noinst_HEADERS = t-support.h
30
31c_tests = t-import t-keylist t-encrypt t-verify t-decrypt t-sign t-export
32
33
34TESTS = initial.test $(c_tests) final.test
35
36EXTRA_DIST = cert_dfn_pca01.der cert_dfn_pca15.der cert_g10code_test1.der \
37	$(key_id) initial.test final.test
38
39AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
40AM_LDFLAGS = -no-install
41LDADD = ../../src/libgpgme.la @LDADD_FOR_TESTS_KLUDGE@
42
43# We don't run t-genkey in the test suite, because it takes too long
44# and needs a working pinentry.
45noinst_PROGRAMS = $(c_tests) t-genkey cms-keylist cms-decrypt
46
47key_id = 32100C27173EF6E9C4E9A25D3D69F86D37A4F939
48
49CLEANFILES = pubring-stamp pubring.kbx pubring.kbx~ gpgsm.conf trustlist.txt \
50	random_seed S.gpg-agent gpg-sample.stamp
51
52clean-local:
53	-$(TESTS_ENVIRONMENT) $(top_srcdir)/tests/start-stop-agent --stop
54	-rm -fR private-keys-v1.d
55
56BUILT_SOURCES = gpgsm.conf trustlist.txt pubring-stamp \
57           gpg-sample.stamp
58
59pubring-stamp: $(srcdir)/cert_g10code_test1.der gpg-sample.stamp
60	$(TESTS_ENVIRONMENT) $(GPGSM) --import $(srcdir)/cert_g10code_test1.der
61	touch pubring-stamp
62
63gpgsm.conf:
64	echo disable-crl-checks > ./gpgsm.conf
65	echo faked-system-time 1008241200 >> ./gpgsm.conf
66	echo "agent-program `which $(GPG_AGENT)`|--debug-quick-random" >> ./gpgsm.conf
67
68gpg-sample.stamp: $(srcdir)/$(key_id)
69	-$(TESTS_ENVIRONMENT) gpgconf --kill all
70	$(MKDIR_P) ./private-keys-v1.d
71	cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key
72	echo x > ./gpg-sample.stamp
73
74trustlist.txt:
75	echo $(key_id) > ./trustlist.txt
76	echo >> ./trustlist.txt
77	echo "# CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=Düsseldorf,C=DE" >> ./trustlist.txt
78	echo "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E S" >> ./trustlist.txt
79
80