tests: Make sure to kill all previously running daemons.
[gpgme.git] / tests / gpg / Makefile.am
1 # Copyright (C) 2000 Werner Koch (dd9jn)
2 # Copyright (C) 2001, 2004, 2005, 2009 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, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
20 ## Process this file with automake to produce Makefile.in
21
22 GPG = gpg
23 GPG_AGENT = gpg-agent
24
25 TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO= \
26                     top_srcdir=$(top_srcdir)
27
28 # The keylist tests must come after the import and the edit test.
29 noinst_HEADERS = t-support.h
30
31 if HAVE_W32_SYSTEM
32 tests_unix =
33 else
34 tests_unix = t-eventloop t-thread1 t-thread-keylist t-thread-keylist-verify
35 endif
36
37 c_tests = \
38         t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers         \
39         t-decrypt t-verify t-decrypt-verify t-sig-notation t-export     \
40         t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait      \
41         t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed \
42         $(tests_unix)
43
44 TESTS = initial.test $(c_tests) final.test
45
46 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
47         gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
48         random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp \
49         tofu.db *.conf.gpgconf.bak
50
51 private_keys = \
52         13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
53         76F7E2B35832976B50A27A282D9B87E44577EB66 \
54         A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
55         13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
56         7A030357C0F253A5BBCD282FFC4E521B37558F5C
57
58
59 EXTRA_DIST = initial.test final.test \
60         pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
61         geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys)
62
63 BUILT_SOURCES = gpg.conf gpg-agent.conf pubring-stamp \
64            private-keys-v1.d/gpg-sample.stamp
65 AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
66 AM_LDFLAGS = -no-install
67 LDADD = ../../src/libgpgme.la
68 t_thread1_LDADD = ../../src/libgpgme.la -lpthread
69 t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread
70 t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread
71 t_cancel_LDADD = ../../src/libgpgme.la -lpthread
72
73 # We don't run t-genkey and t-cancel in the test suite, because it
74 # takes too long
75 tests_skipped = t-genkey
76 if !HAVE_W32_SYSTEM
77 tests_skipped += t-cancel
78 endif
79
80 noinst_PROGRAMS = $(c_tests) $(tests_skipped)
81
82
83 clean-local:
84         -$(top_srcdir)/tests/start-stop-agent --stop
85         -rm -fR private-keys-v1.d
86
87 export GNUPGHOME := $(abs_builddir)
88
89 export GPG_AGENT_INFO :=
90
91 ./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
92         -gpgconf --kill all
93         $(MKDIR_P) ./private-keys-v1.d
94         for k in $(private_keys); do \
95           cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
96         done
97         echo x > ./private-keys-v1.d/gpg-sample.stamp
98
99 ./pubring-stamp: $(srcdir)/pubdemo.asc ./private-keys-v1.d/gpg-sample.stamp
100         $(GPG) --batch --no-permission-warning \
101                --import $(srcdir)/pubdemo.asc
102         -$(GPG) --batch --no-permission-warning \
103                 --import $(srcdir)/secdemo.asc
104         echo x > ./pubring-stamp
105
106 ./gpg.conf:
107 # This is required for t-sig-notations.
108         echo no-force-v3-sigs > ./gpg.conf
109
110 ./gpg-agent.conf:
111 # This is required for gpg2, which does not support command fd.
112         echo pinentry-program $(abs_srcdir)/pinentry > ./gpg-agent.conf