[Pkg-gnupg-commit] [gpgme] 58/412: Qt: Fix unit test by adding initial.test dep

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit d9f7a18ed88127e7f05d770d55118d1e928f3b3f
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Apr 11 17:46:03 2016 +0200

    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(-)

diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am
index 3b483fe..def50c8 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 0000000..039e4d0
--- /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 626d0a7..8aa5999 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)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list