From faf987dd62893955251378a2a715edd2892a540c Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Sun, 3 Apr 2016 01:48:46 -0800 Subject: Qt: Add a unit test for qgpgme * configure.ac: Configure test Makefile. * m4/qt.m4: Look up Qt5Test flags. * lang/qt/tests/t-keylist.cpp: New. Simple keylist check. * lang/qt/tests/Makefile.am: New. General test framework. -- This test mostly checks that it basically compiles / works and adds a test framework. --- lang/qt/tests/Makefile.am | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 lang/qt/tests/Makefile.am (limited to 'lang/qt/tests/Makefile.am') diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am new file mode 100644 index 00000000..3b483fe8 --- /dev/null +++ b/lang/qt/tests/Makefile.am @@ -0,0 +1,66 @@ +# Makefile.am - Makefile for GPGME Qt tests. +# Copyright (C) 2016 Intevation GmbH +# +# This file is part of GPGME. +# +# GPGME is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# GPGME is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, see . + +## Process this file with automake to produce Makefile.in + +GPG = gpg + +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) + +TESTS = t-keylist + +moc_files = t-keylist.moc + +AM_LDFLAGS = -no-install + +LDADD = ../../cpp/src/libgpgmepp.la ../src/libqgpgme.la \ + ../../../src/libgpgme.la @GPGME_QT_LIBS@ @GPG_ERROR_LIBS@ \ + @GPGME_QTTEST_LIBS@ + +AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ \ + @GPGME_QT_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \ + @GPGME_QTTEST_CFLAGS@ \ + -I$(top_srcdir)/lang/cpp/src -I$(top_srcdir)/lang/qt/src \ + -DTOP_SRCDIR="$(top_srcdir)" + +check-local: ./t-keylist ./pubring-stamp + +t_keylist_SOURCES = t-keylist.cpp t-keylist.h + +nodist_t_keylist_SOURCES = $(moc_files) + +BUILT_SOURCES = $(moc_files) + +noinst_PROGRAMS = t-keylist + +CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ + gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ + random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp $(moc_files) + +export GNUPGHOME := $(abs_builddir) + +./pubring-stamp: $(top_srcdir)/tests/gpg/pubdemo.asc \ + $(top_srcdir)/tests/gpg/secdemo.asc + $(GPG) --no-permission-warning \ + --import $(top_srcdir)/tests/gpg/pubdemo.asc + -$(GPG) --no-permission-warning \ + --import $(top_srcdir)/tests/gpg/secdemo.asc + touch ./pubring-stamp + +.cpp.moc: + $(MOC) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ -- cgit From d9f7a18ed88127e7f05d770d55118d1e928f3b3f Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Mon, 11 Apr 2016 17:46:03 +0200 Subject: Qt: Fix unit test by adding initial.test dep * lang/qt/tests/t-keylist.cpp: Verify that GNUPGHOME is set. * lang/qt/tests/initial.test: New dummy test. * lang/qt/tests/Makefile.am: Add dependency to initial.test -- Feels weird but this follows the pattern in tests/gpg/Makefile.am and solves the problem that the environment is dirty. --- lang/qt/tests/Makefile.am | 14 ++++++++++---- lang/qt/tests/initial.test | 2 ++ lang/qt/tests/t-keylist.cpp | 6 ++++++ 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100755 lang/qt/tests/initial.test (limited to 'lang/qt/tests/Makefile.am') diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am index 3b483fe8..def50c86 100644 --- a/lang/qt/tests/Makefile.am +++ b/lang/qt/tests/Makefile.am @@ -22,7 +22,9 @@ GPG = gpg TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) -TESTS = t-keylist +EXTRA_DIST = initial.test + +TESTS = initial.test t-keylist moc_files = t-keylist.moc @@ -38,7 +40,11 @@ AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ \ -I$(top_srcdir)/lang/cpp/src -I$(top_srcdir)/lang/qt/src \ -DTOP_SRCDIR="$(top_srcdir)" -check-local: ./t-keylist ./pubring-stamp +check-local: ./pubring-stamp + +# To guarantee that check-local is run before any tests we +# add this dependency: +initial.test : check-local t_keylist_SOURCES = t-keylist.cpp t-keylist.h @@ -58,8 +64,8 @@ export GNUPGHOME := $(abs_builddir) $(top_srcdir)/tests/gpg/secdemo.asc $(GPG) --no-permission-warning \ --import $(top_srcdir)/tests/gpg/pubdemo.asc - -$(GPG) --no-permission-warning \ - --import $(top_srcdir)/tests/gpg/secdemo.asc + $(GPG) --no-permission-warning \ + --import $(top_srcdir)/tests/gpg/secdemo.asc touch ./pubring-stamp .cpp.moc: diff --git a/lang/qt/tests/initial.test b/lang/qt/tests/initial.test new file mode 100755 index 00000000..039e4d00 --- /dev/null +++ b/lang/qt/tests/initial.test @@ -0,0 +1,2 @@ +#!/bin/sh +exit 0 diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp index 626d0a7f..8aa59990 100644 --- a/lang/qt/tests/t-keylist.cpp +++ b/lang/qt/tests/t-keylist.cpp @@ -23,6 +23,12 @@ private Q_SLOTS: const QString kId = QLatin1String(keys.front().keyID()); Q_ASSERT (kId == QStringLiteral("2D727CC768697734")); } + + void initTestCase() + { + const QString gpgHome = qgetenv("GNUPGHOME"); + QVERIFY2(!gpgHome.isEmpty(), "GNUPGHOME environment variable is not set."); + } }; QTEST_MAIN(KeyListTest) -- cgit From c303292aca26c43b6efe98719edb3ff7b2d6665d Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Tue, 10 May 2016 15:05:11 +0200 Subject: Qt / Cpp: Fix make dist * lang/cpp/src/Makefile.am (EXTRA_DIST): Fix typo. (private_gpgmepp_headers): New. Private headers. (libgpgmepp_la_SOURCES): Add private headers. * lang/qt/src/Makefile.am (t_keylist_SOURCES): Remove non existent header. --- lang/cpp/src/Makefile.am | 7 +++++-- lang/qt/tests/Makefile.am | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'lang/qt/tests/Makefile.am') diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am index e56b8185..24e0461c 100644 --- a/lang/cpp/src/Makefile.am +++ b/lang/cpp/src/Makefile.am @@ -18,7 +18,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA -EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeConfigVersion.cmake.in +EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeppConfigVersion.cmake.in lib_LTLIBRARIES = libgpgmepp.la @@ -45,6 +45,9 @@ gpgmepp_headers = \ notation.h result.h scdgetinfoassuantransaction.h signingresult.h \ trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h +private_gpgmepp_headers = \ + result_p.h context_p.h util.h callbacks.h data_p.h + interface_headers= \ interfaces/assuantransaction.h interfaces/dataprovider.h \ interfaces/passphraseprovider.h interfaces/progressprovider.h @@ -54,7 +57,7 @@ gpgmeppinclude_HEADERS = $(gpgmepp_headers) nobase_gpgmeppinclude_HEADERS = $(interface_headers) libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \ - $(interface_headers) + $(interface_headers) $(private_gpgmepp_headers) AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ -DBUILDING_GPGMEPP diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am index def50c86..6da9d29c 100644 --- a/lang/qt/tests/Makefile.am +++ b/lang/qt/tests/Makefile.am @@ -46,7 +46,7 @@ check-local: ./pubring-stamp # add this dependency: initial.test : check-local -t_keylist_SOURCES = t-keylist.cpp t-keylist.h +t_keylist_SOURCES = t-keylist.cpp nodist_t_keylist_SOURCES = $(moc_files) -- cgit