Qt: Add encryption test and refactor testsuite
[gpgme.git] / lang / qt / tests / Makefile.am
1 # Makefile.am - Makefile for GPGME Qt tests.
2 # Copyright (C) 2016 Intevation 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 <http://www.gnu.org/licenses/>.
18
19 ## Process this file with automake to produce Makefile.in
20
21 GPG = gpg
22
23 TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir)
24
25 EXTRA_DIST = initial.test
26
27 TESTS = initial.test t-keylist t-keylocate t-ownertrust t-tofuinfo \
28         t-encrypt
29
30 moc_files = t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \
31             t-encrypt.moc t-support.hmoc
32
33 AM_LDFLAGS = -no-install
34
35 LDADD = ../../cpp/src/libgpgmepp.la ../src/libqgpgme.la \
36         ../../../src/libgpgme.la @GPGME_QT_LIBS@ @GPG_ERROR_LIBS@ \
37         @GPGME_QTTEST_LIBS@ -lstdc++
38
39 AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
40               @GPG_ERROR_CFLAGS@ @GPGME_QT_CFLAGS@ @GPG_ERROR_CFLAGS@ \
41               @LIBASSUAN_CFLAGS@ @GPGME_QTTEST_CFLAGS@ -DBUILDING_QGPGME \
42               -I$(top_srcdir)/lang/qt/src \
43               -DTOP_SRCDIR="$(top_srcdir)"
44
45 check-local: ./pubring-stamp
46
47 # To guarantee that check-local is run before any tests we
48 # add this dependency:
49 initial.test : check-local
50
51 support_src = t-support.h t-support.cpp
52
53 t_keylist_SOURCES = t-keylist.cpp $(support_src)
54 t_keylocate_SOURCES = t-keylocate.cpp $(support_src)
55 t_ownertrust_SOURCES = t-ownertrust.cpp $(support_src)
56 t_tofuinfo_SOURCES = t-tofuinfo.cpp $(support_src)
57 t_encrypt_SOURCES = t-encrypt.cpp $(support_src)
58
59 nodist_t_keylist_SOURCES = $(moc_files)
60
61 BUILT_SOURCES = $(moc_files)
62
63 noinst_PROGRAMS = t-keylist t-keylocate t-ownertrust t-tofuinfo t-encrypt
64
65 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
66         gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
67         random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp $(moc_files) \
68         gpg.conf
69
70 clean-local:
71         -rm -fR -- private-keys-v1.d
72
73 export GNUPGHOME := $(abs_builddir)
74
75 ./pubring-stamp: $(top_srcdir)/tests/gpg/pubdemo.asc \
76                      $(top_srcdir)/tests/gpg/secdemo.asc
77         echo "ignore-invalid-option allow-loopback-pinentry" > $(abs_builddir)/gpg-agent.conf
78         echo "allow-loopback-pinentry" >> gpg-agent.conf
79         echo "ignore-invalid-option pinentry-mode" > gpg.conf
80         echo "pinentry-mode loopback" >> gpg.conf
81         $(GPG) --no-permission-warning \
82            --import $(top_srcdir)/tests/gpg/pubdemo.asc
83         $(GPG) --no-permission-warning \
84                    --passphrase "abc" \
85            --import $(top_srcdir)/tests/gpg/secdemo.asc
86         touch ./pubring-stamp
87
88 .cpp.moc:
89         $(MOC) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
90
91 .h.hmoc:
92         $(MOC) `test -f '$<' || echo '$(srcdir)/'`$< -o $@