[cpp-xmltooling] branch master updated: Conditionalize tests on older platforms.

Scott Cantor cantor.2 at osu.edu
Wed May 2 11:49:19 EDT 2018


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

scantor pushed a commit to branch master
in repository cpp-xmltooling.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-xmltooling.git;a=commit;h=6c9d443c3e7a87ca7ea42f5d95715ff020f0ac57

The following commit(s) were added to refs/heads/master by this push:
       new  6c9d443   Conditionalize tests on older platforms.
6c9d443 is described below

commit 6c9d443c3e7a87ca7ea42f5d95715ff020f0ac57
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed May 2 11:49:15 2018 -0400

    Conditionalize tests on older platforms.
---
 xmltoolingtest/DataSealerTest.h                   | 8 +++++---
 xmltoolingtest/ExplicitKeyTrustEngineTest.h       | 2 ++
 xmltoolingtest/FilesystemCredentialResolverTest.h | 6 +++++-
 xmltoolingtest/SignatureTest.h                    | 5 ++++-
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/xmltoolingtest/DataSealerTest.h b/xmltoolingtest/DataSealerTest.h
index 994a24f..f782922 100644
--- a/xmltoolingtest/DataSealerTest.h
+++ b/xmltoolingtest/DataSealerTest.h
@@ -30,7 +30,7 @@
 class DataSealerTest : public CxxTest::TestSuite {
 public:
     void testStaticDataSealer() {
-
+#ifdef XSEC_OPENSSL_HAVE_GCM
         unsigned char keybuf[32];
         TS_ASSERT_EQUALS(sizeof(keybuf), XSECPlatformUtils::g_cryptoProvider->getRandom(keybuf, sizeof(keybuf)));
 
@@ -76,10 +76,11 @@ public:
 		wrapped = sealer->wrap(data.c_str(), time(nullptr) - 500);
 		wrapped.insert(0, "invalid");
 		TSM_ASSERT_THROWS("DataSealer did not throw on wrong key label.", sealer->unwrap(wrapped.c_str()), IOException);
-	}
+#endif
+    }
 
 	void testVersionedDataSealer() {
-
+#ifdef XSEC_OPENSSL_HAVE_GCM
 		DOMDocument* doc = XMLToolingConfig::getConfig().getParser().newDocument();
 		Janitor<DOMDocument> jdoc(doc);
 
@@ -124,5 +125,6 @@ public:
 		wrapped = sealer->wrap(data.c_str(), time(nullptr) - 500);
 		wrapped.insert(0, "invalid");
 		TSM_ASSERT_THROWS("DataSealer did not throw on wrong key label.", sealer->unwrap(wrapped.c_str()), IOException);
+#endif
 	}
 };
diff --git a/xmltoolingtest/ExplicitKeyTrustEngineTest.h b/xmltoolingtest/ExplicitKeyTrustEngineTest.h
index f45e350..58ff832 100644
--- a/xmltoolingtest/ExplicitKeyTrustEngineTest.h
+++ b/xmltoolingtest/ExplicitKeyTrustEngineTest.h
@@ -79,8 +79,10 @@ public:
         SecurityHelper::loadCertificatesFromFile(certs, pathname.c_str());
         pathname = data_path + "dsa-cert.pem";
         SecurityHelper::loadCertificatesFromFile(certs, pathname.c_str());
+#ifdef XMLTOOLING_OPENSSL_HAVE_EC
         pathname = data_path + "ec-cert.pem";
         SecurityHelper::loadCertificatesFromFile(certs, pathname.c_str());
+#endif
 
         for (vector<XSECCryptoX509*>::const_iterator cert=certs.begin(); cert!=certs.end(); ++cert) {
             // certs is ignore but must be present
diff --git a/xmltoolingtest/FilesystemCredentialResolverTest.h b/xmltoolingtest/FilesystemCredentialResolverTest.h
index 6419e78..b3c022f 100644
--- a/xmltoolingtest/FilesystemCredentialResolverTest.h
+++ b/xmltoolingtest/FilesystemCredentialResolverTest.h
@@ -48,7 +48,11 @@ public:
         vector<const Credential*> creds;
         Locker locker(credResolver.get());
         credResolver->resolve(creds);
-        TSM_ASSERT_EQUALS("Retrieved credential was null", 3, creds.size());
+#ifdef XSEC_OPENSSL_HAVE_EC
+        TSM_ASSERT_EQUALS("Wrong number of credentials", 3, creds.size());
+#else
+        TSM_ASSERT_EQUALS("Wrong number of credentials", 2, creds.size());
+#endif
         TSM_ASSERT("Retrieved key was null", creds.front()->getPrivateKey()!=nullptr);
         TSM_ASSERT_EQUALS("Unexpected number of certificates", 1,
             dynamic_cast<const X509Credential*>(creds.front())->getEntityCertificateChain().size());
diff --git a/xmltoolingtest/SignatureTest.h b/xmltoolingtest/SignatureTest.h
index dc72b2e..cabff60 100644
--- a/xmltoolingtest/SignatureTest.h
+++ b/xmltoolingtest/SignatureTest.h
@@ -177,6 +177,7 @@ public:
     }
 
     void testSignatureDSA() {
+#ifdef XMLTOOLING_OPENSSL_HAVE_SHA2
         xmltooling::QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME);
         const SimpleXMLObjectBuilder* b=dynamic_cast<const SimpleXMLObjectBuilder*>(XMLObjectBuilder::getBuilder(qname));
         TS_ASSERT(b!=nullptr);
@@ -235,10 +236,12 @@ public:
             TS_TRACE(e.what());
             throw;
         }
+#endif
     }
 
 
     void testSignatureEC() {
+#ifdef XMLTOOLING_OPENSSL_HAVE_EC
         xmltooling::QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME);
         const SimpleXMLObjectBuilder* b=dynamic_cast<const SimpleXMLObjectBuilder*>(XMLObjectBuilder::getBuilder(qname));
         TS_ASSERT(b!=nullptr);
@@ -297,6 +300,7 @@ public:
             TS_TRACE(e.what());
             throw;
         }
+#endif
     }
 
     void testSignatureRSA() {
@@ -359,5 +363,4 @@ public:
         }
     }
 
-
 };

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list