68222fa7b497fb4610039dead933bc0fa8634931
[platform/upstream/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, 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
22 GPG = gpg
23 GPG_AGENT = gpg-agent
24
25 GNUPGHOME=$(abs_builddir)
26 TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) LC_ALL=C GPG_AGENT_INFO= \
27                     top_srcdir=$(top_srcdir)
28
29 # The keylist tests must come after the import and the edit test.
30 noinst_HEADERS = t-support.h
31
32 if HAVE_W32_SYSTEM
33 tests_unix =
34 else
35 tests_unix = t-eventloop t-thread1 t-thread-keylist t-thread-keylist-verify
36 endif
37
38 c_tests = \
39         t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers         \
40         t-decrypt t-verify t-decrypt-verify t-sig-notation t-export     \
41         t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait      \
42         t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed \
43         $(tests_unix)
44
45 TESTS = initial.test $(c_tests) final.test
46
47 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
48         gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
49         random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp \
50         gpg-sample.stamp tofu.db *.conf.gpgconf.bak
51
52 private_keys = \
53         13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
54         76F7E2B35832976B50A27A282D9B87E44577EB66 \
55         A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
56         13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
57         7A030357C0F253A5BBCD282FFC4E521B37558F5C
58
59
60 EXTRA_DIST = initial.test final.test \
61         pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
62         cipher-3.asc cipher-no-sig.asc \
63         geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys)
64
65 BUILT_SOURCES = gpg.conf gpg-agent.conf pubring-stamp \
66            gpg-sample.stamp
67 AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
68 AM_LDFLAGS = -no-install
69 LDADD = ../../src/libgpgme.la @LDADD_FOR_TESTS_KLUDGE@
70 t_thread1_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@
71 t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@
72 t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@
73 t_cancel_LDADD = ../../src/libgpgme.la -lpthread @LDADD_FOR_TESTS_KLUDGE@
74
75 # We don't run t-genkey and t-cancel in the test suite, because it
76 # takes too long
77 tests_skipped = t-genkey
78 if !HAVE_W32_SYSTEM
79 tests_skipped += t-cancel
80 endif
81
82 noinst_PROGRAMS = $(c_tests) $(tests_skipped)
83
84
85 clean-local:
86         -$(TESTS_ENVIRONMENT) $(top_srcdir)/tests/start-stop-agent --stop
87         -rm -fR private-keys-v1.d
88
89 gpg-sample.stamp: $(srcdir)/$(private_keys)
90         -$(TESTS_ENVIRONMENT) gpgconf --kill all
91         $(MKDIR_P) ./private-keys-v1.d
92         for k in $(private_keys); do \
93           cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
94         done
95         echo x > ./gpg-sample.stamp
96
97 pubring-stamp: $(srcdir)/pubdemo.asc gpg-sample.stamp
98         $(TESTS_ENVIRONMENT) $(GPG) --batch --no-permission-warning \
99                --import $(srcdir)/pubdemo.asc
100         -$(TESTS_ENVIRONMENT) $(GPG) --batch --no-permission-warning \
101                 --import $(srcdir)/secdemo.asc
102         echo x > ./pubring-stamp
103
104 gpg.conf:
105 # This is required for t-sig-notations.
106         echo no-force-v3-sigs > ./gpg.conf
107
108 gpg-agent.conf:
109 # This is required for gpg2, which does not support command fd for the
110 # passphrase.  disable-scdaemon is required so that we don't try using
111 # a key from a smartcard reader (error might be: Unusable secret key)
112         echo pinentry-program $(abs_srcdir)/pinentry > ./gpg-agent.conf
113         echo disable-scdaemon >> ./gpg-agent.conf
114
115
116 # end-of-file