[opensaml2] 21/24: Run the internal tests during package build

Ferenc Wágner wferi at moszumanska.debian.org
Tue Aug 30 20:55:05 UTC 2016


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

wferi pushed a commit to branch debian/experimental
in repository opensaml2.

commit 4965d41a67dfbbe5c89d3e49a3c494a7a2972a49
Author: Ferenc Wágner <wferi at niif.hu>
Date:   Tue Jul 12 11:19:55 2016 +0200

    Run the internal tests during package build
---
 debian/control                                     |  1 +
 ...tomatically-includes-the-user-variable-CX.patch | 21 +++++++
 ...ck-BUILD_UNITTEST-in-the-main-Makefile.am.patch | 53 ++++++++++++++++++
 ...erive-correct-test-data-paths-from-srcdir.patch | 59 ++++++++++++++++++++
 ...ll-the-test-program-but-use-it-for-make-c.patch | 23 ++++++++
 ...ipping-tests-which-require-network-access.patch | 65 ++++++++++++++++++++++
 .../patches/Refactor-test-source-generation.patch  | 48 ++++++++++++++++
 .../Remove-.pl-extension-of-cxxtestgen.patch       | 21 +++++++
 ...pendencies-are-well-known-no-need-to-decl.patch | 20 +++++++
 debian/patches/series                              |  8 +++
 debian/rules                                       |  3 +
 11 files changed, 322 insertions(+)

diff --git a/debian/control b/debian/control
index 4fbbf88..1215ee2 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Uploaders:
  Russ Allbery <rra at debian.org>,
  Ferenc Wágner <wferi at niif.hu>,
 Build-Depends:
+ cxxtest,
  debhelper (>= 9),
  dh-autoreconf,
  libboost-dev,
diff --git a/debian/patches/Automake-automatically-includes-the-user-variable-CX.patch b/debian/patches/Automake-automatically-includes-the-user-variable-CX.patch
new file mode 100644
index 0000000..707ec86
--- /dev/null
+++ b/debian/patches/Automake-automatically-includes-the-user-variable-CX.patch
@@ -0,0 +1,21 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Tue, 12 Jul 2016 11:07:27 +0200
+Subject: Automake automatically includes the "user" variable CXXFLAGS here
+
+---
+ samltest/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/samltest/Makefile.am b/samltest/Makefile.am
+index 5d49992..fc1fd2d 100644
+--- a/samltest/Makefile.am
++++ b/samltest/Makefile.am
+@@ -1,7 +1,7 @@
+ AUTOMAKE_OPTIONS = foreign subdir-objects
+ 
+ bin_PROGRAMS = samltest
+-samltest_CXXFLAGS = $(CXXFLAGS) $(CXXTESTFLAGS)
++samltest_CXXFLAGS = $(CXXTESTFLAGS)
+ 
+ samltest_h = \
+     samltest.h \
diff --git a/debian/patches/Check-BUILD_UNITTEST-in-the-main-Makefile.am.patch b/debian/patches/Check-BUILD_UNITTEST-in-the-main-Makefile.am.patch
new file mode 100644
index 0000000..1c3e7d1
--- /dev/null
+++ b/debian/patches/Check-BUILD_UNITTEST-in-the-main-Makefile.am.patch
@@ -0,0 +1,53 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Tue, 12 Jul 2016 11:02:53 +0200
+Subject: Check BUILD_UNITTEST in the main Makefile.am
+
+---
+ Makefile.am          | 6 +++++-
+ samltest/Makefile.am | 6 ------
+ 2 files changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 801f48e..95ef69e 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -5,7 +5,11 @@ include doxygen.am
+ 
+ MOSTLYCLEANFILES = $(DX_CLEANFILES)
+ 
+-SUBDIRS = doc schemas saml samltest samlsign
++SUBDIRS = doc schemas saml samlsign
++
++if BUILD_UNITTEST
++SUBDIRS += samltest
++endif
+ 
+ if DX_COND_doc
+ all-local: doxygen-doc
+diff --git a/samltest/Makefile.am b/samltest/Makefile.am
+index a0c933e..5b93d74 100644
+--- a/samltest/Makefile.am
++++ b/samltest/Makefile.am
+@@ -1,11 +1,7 @@
+ AUTOMAKE_OPTIONS = foreign subdir-objects
+ 
+-if BUILD_UNITTEST
+ bin_PROGRAMS = samltest
+ samltest_CXXFLAGS = $(CXXFLAGS) $(CXXTESTFLAGS)
+-else
+-bin_PROGRAMS = 
+-endif
+ 
+ samltest_h = \
+     samltest.h \
+@@ -106,10 +102,8 @@ noinst_HEADERS = \
+ 
+ nodist_samltest_SOURCES = $(samltest_h:.h=.cpp)
+ 
+-if BUILD_UNITTEST
+ BUILT_SOURCES = $(nodist_samltest_SOURCES)
+ CLEANFILES = $(nodist_samltest_SOURCES)
+-endif
+ 
+ do-cxxtestgen:
+ 	if test "$(CPPFILE)" = "samltest.cpp"; then \
diff --git a/debian/patches/Derive-correct-test-data-paths-from-srcdir.patch b/debian/patches/Derive-correct-test-data-paths-from-srcdir.patch
new file mode 100644
index 0000000..a3ae560
--- /dev/null
+++ b/debian/patches/Derive-correct-test-data-paths-from-srcdir.patch
@@ -0,0 +1,59 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Tue, 12 Jul 2016 12:20:46 +0200
+Subject: Derive correct test data paths from srcdir
+
+Beyond making the tests succeed, in theory this also helps with VPATH
+builds (other problems still disallow that, though).
+
+../samltest could be abbreviated to .; I left that convention alone.
+---
+ samltest/Makefile.am                                  | 2 ++
+ samltest/data/saml2/metadata/HTTPMetadataProvider.xml | 4 ++--
+ samltest/data/saml2/metadata/XMLMetadataProvider.xml  | 4 ++--
+ 3 files changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/samltest/Makefile.am b/samltest/Makefile.am
+index 9cd7c97..6426b1d 100644
+--- a/samltest/Makefile.am
++++ b/samltest/Makefile.am
+@@ -2,6 +2,8 @@ AUTOMAKE_OPTIONS = foreign subdir-objects
+ 
+ TESTS = samltest
+ 
++AM_TESTS_ENVIRONMENT = export SAMLTEST_DATA=$(srcdir)/data;
++
+ check_PROGRAMS = samltest
+ 
+ samltest_CXXFLAGS = $(CXXTESTFLAGS)
+diff --git a/samltest/data/saml2/metadata/HTTPMetadataProvider.xml b/samltest/data/saml2/metadata/HTTPMetadataProvider.xml
+index 9eba9a3..c5a9abf 100644
+--- a/samltest/data/saml2/metadata/HTTPMetadataProvider.xml
++++ b/samltest/data/saml2/metadata/HTTPMetadataProvider.xml
+@@ -1,9 +1,9 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+-<MetadataProvider type="XML" url="http://URL.TO.EXAMPLE/ORG/InCommon-metadata.xml" backingFilePath="../../../samltest/data/saml2/metadata/InCommon-metadata.xml.bck" validate="0">
++<MetadataProvider type="XML" url="http://wayf.incommonfederation.org/InCommon/InCommon-metadata.xml" backingFilePath="../samltest/data/saml2/metadata/InCommon-metadata.xml.bck" validate="0">
+     <SignatureMetadataFilter>
+         <CredentialResolver type="File">
+             <Certificate>
+-                <Path>../../../samltest/data/incommon.pem</Path>
++                <Path>../samltest/data/incommon.pem</Path>
+             </Certificate>
+         </CredentialResolver>
+     </SignatureMetadataFilter>
+diff --git a/samltest/data/saml2/metadata/XMLMetadataProvider.xml b/samltest/data/saml2/metadata/XMLMetadataProvider.xml
+index 8da61b9..8302ff0 100644
+--- a/samltest/data/saml2/metadata/XMLMetadataProvider.xml
++++ b/samltest/data/saml2/metadata/XMLMetadataProvider.xml
+@@ -1,9 +1,9 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+-<FilesystemMetadataProvider path="../../../samltest/data/saml2/metadata/InCommon-metadata.xml" validate="0">
++<FilesystemMetadataProvider path="../samltest/data/saml2/metadata/InCommon-metadata.xml" validate="0">
+     <SignatureMetadataFilter>
+         <CredentialResolver type="File">
+             <Certificate>
+-                <Path>../../../samltest/data/incommon.pem</Path>
++                <Path>../samltest/data/incommon.pem</Path>
+             </Certificate>
+         </CredentialResolver>
+     </SignatureMetadataFilter>
diff --git a/debian/patches/Don-t-install-the-test-program-but-use-it-for-make-c.patch b/debian/patches/Don-t-install-the-test-program-but-use-it-for-make-c.patch
new file mode 100644
index 0000000..57f8f2f
--- /dev/null
+++ b/debian/patches/Don-t-install-the-test-program-but-use-it-for-make-c.patch
@@ -0,0 +1,23 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Tue, 12 Jul 2016 11:09:02 +0200
+Subject: Don't install the test program, but use it for make check
+
+---
+ samltest/Makefile.am | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/samltest/Makefile.am b/samltest/Makefile.am
+index fc1fd2d..6bc58e5 100644
+--- a/samltest/Makefile.am
++++ b/samltest/Makefile.am
+@@ -1,6 +1,9 @@
+ AUTOMAKE_OPTIONS = foreign subdir-objects
+ 
+-bin_PROGRAMS = samltest
++TESTS = samltest
++
++check_PROGRAMS = samltest
++
+ samltest_CXXFLAGS = $(CXXTESTFLAGS)
+ 
+ samltest_h = \
diff --git a/debian/patches/Enable-skipping-tests-which-require-network-access.patch b/debian/patches/Enable-skipping-tests-which-require-network-access.patch
new file mode 100644
index 0000000..675b704
--- /dev/null
+++ b/debian/patches/Enable-skipping-tests-which-require-network-access.patch
@@ -0,0 +1,65 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Thu, 25 Aug 2016 17:04:27 +0200
+Subject: Enable skipping tests which require network access
+
+These either require a fresh download of the InCommon metadata
+or online access to it.  However, buildds don't provide network
+access and an arbitrary snapshot would eventually expire.
+---
+ samltest/internal.h                               | 6 ++++++
+ samltest/saml2/metadata/XMLMetadataProviderTest.h | 4 ++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/samltest/internal.h b/samltest/internal.h
+index 2389848..d72b81e 100644
+--- a/samltest/internal.h
++++ b/samltest/internal.h
+@@ -124,6 +124,12 @@ protected:
+         }
+     }
+ 
++    void skipNetworked() {
++        if (getenv("SAMLTEST_SKIP_NETWORKED")) {
++            TS_SKIP("requires network access");
++        }
++    }
++
+ public:
+     void setUp() {
+         ParserPool& p=XMLToolingConfig::getConfig().getParser();
+diff --git a/samltest/saml2/metadata/XMLMetadataProviderTest.h b/samltest/saml2/metadata/XMLMetadataProviderTest.h
+index e98ef4d..df4888c 100644
+--- a/samltest/saml2/metadata/XMLMetadataProviderTest.h
++++ b/samltest/saml2/metadata/XMLMetadataProviderTest.h
+@@ -53,6 +53,7 @@ public:
+     }
+ 
+     void testXMLProvider() {
++        skipNetworked();
+         string config = data_path + "saml2/metadata/XMLMetadataProvider.xml";
+         ifstream in(config.c_str());
+         DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+@@ -95,6 +96,7 @@ public:
+ 
+     void testHTTPProvider()
+     {
++        skipNetworked();
+         string config = data_path + "saml2/metadata/HTTPMetadataProvider.xml";
+         ifstream in(config.c_str());
+         DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+@@ -138,6 +140,7 @@ public:
+ 
+ 
+     void testXMLWithBlacklists() {
++        skipNetworked();
+         string config = data_path + "saml2/metadata/XMLWithBlacklists.xml";
+         ifstream in(config.c_str());
+         DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+@@ -168,6 +171,7 @@ public:
+     }
+ 
+     void testXMLWithWhitelists() {
++        skipNetworked();
+         string config = data_path + "saml2/metadata/XMLWithWhitelists.xml";
+         ifstream in(config.c_str());
+         DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
diff --git a/debian/patches/Refactor-test-source-generation.patch b/debian/patches/Refactor-test-source-generation.patch
new file mode 100644
index 0000000..a825247
--- /dev/null
+++ b/debian/patches/Refactor-test-source-generation.patch
@@ -0,0 +1,48 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Tue, 12 Jul 2016 16:35:28 +0200
+Subject: Refactor test source generation
+
+---
+ samltest/Makefile.am | 16 ++++++----------
+ 1 file changed, 6 insertions(+), 10 deletions(-)
+
+diff --git a/samltest/Makefile.am b/samltest/Makefile.am
+index 6bc58e5..9cd7c97 100644
+--- a/samltest/Makefile.am
++++ b/samltest/Makefile.am
+@@ -7,7 +7,6 @@ check_PROGRAMS = samltest
+ samltest_CXXFLAGS = $(CXXTESTFLAGS)
+ 
+ samltest_h = \
+-    samltest.h \
+     SAMLArtifactCreationTest.h \
+     SAMLArtifactType0001Test.h \
+     SAMLArtifactType0002Test.h \
+@@ -101,21 +100,18 @@ noinst_HEADERS = \
+     binding.h \
+     internal.h \
+     signature/SAMLSignatureTestBase.h \
++    samltest.h \
+     $(samltest_h)
+ 
+-nodist_samltest_SOURCES = $(samltest_h:.h=.cpp)
++nodist_samltest_SOURCES = $(samltest_h:.h=.cpp) samltest.cpp
+ 
+ CLEANFILES = $(nodist_samltest_SOURCES)
+ 
+-do-cxxtestgen:
+-	if test "$(CPPFILE)" = "samltest.cpp"; then \
+-		$(CXXTEST) --error-printer --have-eh --have-std --abort-on-fail -o $(CPPFILE) $(HFILE); \
+-	else \
+-		$(CXXTEST) --part --have-eh --have-std --abort-on-fail -o $(CPPFILE) $(HFILE); \
+-	fi;
++samltest.cpp: samltest.h
++	$(CXXTEST) --have-eh --have-std --abort-on-fail --error-printer -o $@ $<
+ 
+-$(nodist_samltest_SOURCES): %.cpp: %.h
+-	$(MAKE) do-cxxtestgen HFILE=$< CPPFILE=$@
++$(samltest_h:.h=.cpp): %.cpp: %.h
++	$(CXXTEST) --have-eh --have-std --abort-on-fail --part -o $@ $<
+ 
+ samltest_CPPFLAGS = \
+     $(xerces_CFLAGS) \
diff --git a/debian/patches/Remove-.pl-extension-of-cxxtestgen.patch b/debian/patches/Remove-.pl-extension-of-cxxtestgen.patch
new file mode 100644
index 0000000..da2e1ec
--- /dev/null
+++ b/debian/patches/Remove-.pl-extension-of-cxxtestgen.patch
@@ -0,0 +1,21 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Tue, 12 Jul 2016 10:38:02 +0200
+Subject: Remove .pl extension of cxxtestgen
+
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5e27029..002b7cd 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -120,7 +120,7 @@ AX_PKG_CHECK_MODULES([xmltooling],,[xmltooling >= 1.4])
+ PKG_CHECK_VAR([DX_INCLUDE], [xmltooling], [includedir])
+ 
+ # Check for unit test support
+-CXXTEST="/usr/bin/cxxtestgen.pl"
++CXXTEST="/usr/bin/cxxtestgen"
+ CXXTESTFLAGS=""
+ AC_ARG_WITH(cxxtest,
+     AS_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
diff --git a/debian/patches/The-.cpp-dependencies-are-well-known-no-need-to-decl.patch b/debian/patches/The-.cpp-dependencies-are-well-known-no-need-to-decl.patch
new file mode 100644
index 0000000..59da8d1
--- /dev/null
+++ b/debian/patches/The-.cpp-dependencies-are-well-known-no-need-to-decl.patch
@@ -0,0 +1,20 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Tue, 12 Jul 2016 11:03:48 +0200
+Subject: The .cpp dependencies are well known, no need to declare them
+
+---
+ samltest/Makefile.am | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/samltest/Makefile.am b/samltest/Makefile.am
+index 5b93d74..5d49992 100644
+--- a/samltest/Makefile.am
++++ b/samltest/Makefile.am
+@@ -102,7 +102,6 @@ noinst_HEADERS = \
+ 
+ nodist_samltest_SOURCES = $(samltest_h:.h=.cpp)
+ 
+-BUILT_SOURCES = $(nodist_samltest_SOURCES)
+ CLEANFILES = $(nodist_samltest_SOURCES)
+ 
+ do-cxxtestgen:
diff --git a/debian/patches/series b/debian/patches/series
index 016260c..f24190c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,11 @@ Use-pkg-config-for-Xerces.patch
 Use-pkg-config-for-xmlsec.patch
 Make-pkgconfigdir-configurable.patch
 Make-pkgxmldir-configurable-and-export-it-via-pkg-co.patch
+Remove-.pl-extension-of-cxxtestgen.patch
+Check-BUILD_UNITTEST-in-the-main-Makefile.am.patch
+The-.cpp-dependencies-are-well-known-no-need-to-decl.patch
+Automake-automatically-includes-the-user-variable-CX.patch
+Don-t-install-the-test-program-but-use-it-for-make-c.patch
+Refactor-test-source-generation.patch
+Derive-correct-test-data-paths-from-srcdir.patch
+Enable-skipping-tests-which-require-network-access.patch
diff --git a/debian/rules b/debian/rules
index 9090252..570558a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,6 +15,9 @@ endif
 override_dh_auto_configure:
 	dh_auto_configure -- $(DEBUG)
 
+override_dh_auto_test:
+	make check SAMLTEST_SKIP_NETWORKED=1
+
 override_dh_install:
 	cd debian/tmp/usr/share/doc/opensaml-* && \
 	    rm README.txt LICENSE.txt NOTICE.txt LOG4CPP.LICENSE

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



More information about the Pkg-shibboleth-devel mailing list