Imported Upstream version 1.12.0
[platform/upstream/gpgme.git] / lang / python / tests / Makefile.am
1 # Makefile.am for the tests of the Python bindings.
2 # Copyright (C) 2016 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 General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (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 <http://www.gnu.org/licenses/>.
18
19 GPG = gpg
20 GPG_AGENT = gpg-agent
21
22 test_srcdir = $(top_srcdir)/tests/gpg
23
24 GNUPGHOME=$(abs_builddir)
25 TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) \
26         LC_ALL=C GPG_AGENT_INFO= \
27         top_srcdir=$(top_srcdir) \
28         srcdir=$(srcdir) \
29         LD_LIBRARY_PATH="../../../src/.libs:$(LD_LIBRARY_PATH)"
30
31 py_tests = t-wrapper.py \
32         t-callbacks.py \
33         t-data.py \
34         t-encrypt.py \
35         t-encrypt-sym.py \
36         t-encrypt-sign.py \
37         t-sign.py \
38         t-signers.py \
39         t-decrypt.py \
40         t-verify.py \
41         t-decrypt-verify.py \
42         t-sig-notation.py \
43         t-export.py \
44         t-import.py \
45         t-trustlist.py \
46         t-edit.py \
47         t-keylist.py \
48         t-keylist-from-data.py \
49         t-wait.py \
50         t-encrypt-large.py \
51         t-file-name.py \
52         t-idiomatic.py \
53         t-protocol-assuan.py \
54         t-quick-key-creation.py \
55         t-quick-subkey-creation.py \
56         t-quick-key-manipulation.py \
57         t-quick-key-signing.py
58
59 XTESTS = initial.py $(py_tests) final.py
60 EXTRA_DIST = support.py $(XTESTS) encrypt-only.asc sign-only.asc \
61              run-tests.py
62
63 # XXX: Currently, one cannot override automake's 'check' target.  As a
64 # workaround, we avoid defining 'TESTS', thus automake will not emit
65 # the 'check' target.  For extra robustness, we merely define a
66 # dependency on 'xcheck', so this hack should also work even if
67 # automake would emit the 'check' target, as adding dependencies to
68 # targets is okay.
69 check: xcheck
70
71 .PHONY: xcheck
72
73 xcheck: all
74         $(TESTS_ENVIRONMENT) $(PYTHON) $(srcdir)/run-tests.py \
75           --interpreters="$(PYTHONS)" --srcdir=$(srcdir) $(TESTFLAGS) \
76           $(XTESTS)
77
78 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
79         gpg-agent.conf pubring.kbx~ gpg.conf pubring.gpg~ \
80         random_seed .gpg-v21-migrated tofu.db \
81         pubring-stamp gpg-sample.stamp
82
83 private_keys = \
84         $(test_srcdir)/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
85         $(test_srcdir)/76F7E2B35832976B50A27A282D9B87E44577EB66 \
86         $(test_srcdir)/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
87         $(test_srcdir)/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
88         $(test_srcdir)/7A030357C0F253A5BBCD282FFC4E521B37558F5C
89
90 clean-local:
91         -$(TESTS_ENVIRONMENT) $(top_srcdir)/tests/start-stop-agent --stop
92         -rm -fR -- private-keys-v1.d openpgp-revocs.d S.gpg-agent sshcontrol
93
94
95 BUILT_SOURCES = gpg.conf gpg-agent.conf pubring-stamp \
96            gpg-sample.stamp
97
98 gpg-sample.stamp: $(private_keys)
99         -$(TESTS_ENVIRONMENT) gpgconf --kill all
100         $(MKDIR_P) ./private-keys-v1.d
101         for k in $(private_keys); do \
102           cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \
103         done
104         echo x > ./gpg-sample.stamp
105
106 pubring-stamp: $(test_srcdir)/pubdemo.asc gpg-sample.stamp
107         $(TESTS_ENVIRONMENT) $(GPG) --batch --no-permission-warning \
108                --import $(test_srcdir)/pubdemo.asc
109         -$(TESTS_ENVIRONMENT) $(GPG) --batch --no-permission-warning \
110                 --import $(test_srcdir)/secdemo.asc
111         echo x > ./pubring-stamp
112
113 gpg.conf:
114 # This is required for t-sig-notations.
115         echo no-force-v3-sigs > ./gpg.conf
116         echo ignore-invalid-option agent-program >> ./gpg.conf
117         echo "agent-program `which $(GPG_AGENT)`|--debug-quick-random" >> ./gpg.conf
118
119 gpg-agent.conf:
120 # This is required for gpg2, which does not support command fd.
121         echo pinentry-program $(abs_top_srcdir)/tests/gpg/pinentry >$@
122         echo disable-scdaemon >> $@
123
124
125 # end-of-file