7df40a2d4625043230d89fa1cf7bf3581bd8df0f
[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 export GNUPGHOME := $(abs_builddir)
22 export GPG_AGENT_INFO :=
23
24 test_srcdir = $(top_srcdir)/tests/gpg
25
26 TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) \
27         LC_ALL=C GPG_AGENT_INFO= \
28         top_srcdir=$(top_srcdir) \
29         LD_LIBRARY_PATH="../../../src/.libs" \
30         PYTHONPATH=`echo $(abs_builddir)/../build/lib.*`
31
32 py_tests = t-wrapper.py \
33         t-callbacks.py \
34         t-data.py \
35         t-encrypt.py \
36         t-encrypt-sym.py \
37         t-encrypt-sign.py \
38         t-sign.py \
39         t-signers.py \
40         t-decrypt.py \
41         t-export.py \
42         t-edit.py \
43         t-wait.py
44
45 TESTS = $(top_srcdir)/tests/gpg/initial.test \
46         $(py_tests) \
47         $(top_srcdir)/tests/gpg/final.test
48
49 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
50         gpg-agent.conf pubring.kbx~ gpg.conf pubring.gpg~ \
51         random_seed .gpg-v21-migrated pubring-stamp
52
53 private_keys = \
54         $(test_srcdir)/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
55         $(test_srcdir)/76F7E2B35832976B50A27A282D9B87E44577EB66 \
56         $(test_srcdir)/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
57         $(test_srcdir)/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
58         $(test_srcdir)/7A030357C0F253A5BBCD282FFC4E521B37558F5C
59
60 clean-local:
61         -$(top_srcdir)/tests/start-stop-agent --stop
62         -rm -fR -- private-keys-v1.d openpgp-revocs.d S.gpg-agent sshcontrol
63
64 check-local: ./gpg.conf ./gpg-agent.conf ./pubring-stamp \
65            ./private-keys-v1.d/gpg-sample.stamp
66
67 # To guarantee that check-local is run before any tests we
68 # add this dependency:
69 $(top_srcdir)/tests/gpg/initial.test: check-local
70
71 ./private-keys-v1.d/gpg-sample.stamp: $(private_keys)
72         test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
73         for k in $(private_keys); do \
74           cp $$k private-keys-v1.d/`basename $$k`.key; \
75         done
76         echo x > ./private-keys-v1.d/gpg-sample.stamp
77
78 ./pubring-stamp: $(test_srcdir)/pubdemo.asc
79         $(GPG) --no-permission-warning \
80                --import $(test_srcdir)/pubdemo.asc
81         -$(GPG) --no-permission-warning \
82                 --import $(test_srcdir)/secdemo.asc
83         touch ./pubring-stamp
84
85 ./gpg.conf:
86 # This is required for t-sig-notations.
87         echo no-force-v3-sigs > ./gpg.conf
88
89 ./gpg-agent.conf:
90 # This is required for gpg2, which does not support command fd.
91         echo pinentry-program $(abs_top_srcdir)/tests/gpg/pinentry > ./gpg-agent.conf