]> granicus.if.org Git - pdns/commitdiff
run pdnssec test-algorithms in travis
authorKees Monshouwer <mind04@monshouwer.org>
Sat, 8 Aug 2015 19:33:10 +0000 (21:33 +0200)
committermind04 <mind04@monshouwer.org>
Sun, 9 Aug 2015 20:15:04 +0000 (22:15 +0200)
.travis.yml
pdns/dnssecinfra.cc
pdns/dnssecinfra.hh
pdns/pdnssec.cc

index 2e18f945777905c00c1869b3e0bd0d722f675f30..24f7c2840ec221c17fc51f1de210beb9e08dbfa3 100644 (file)
@@ -109,6 +109,7 @@ script:
  - cd pdns
  - make -k -j 4 pdns_recursor
  - rm -f pdns_recursor
+ - ./pdnssec test-algorithms
  - cd ..
  - ./build-scripts/dist-recursor
  - cd pdns/pdns-recursor-*/
index 6262b82fcd62074b7f2f05c11969747d72ebd8c5..9547f7e3a489234fdd996df9a93d7691d28706cd 100644 (file)
@@ -134,8 +134,10 @@ void DNSCryptoKeyEngine::report(unsigned int algo, maker_t* maker, bool fallback
   getMakers()[algo]=maker;
 }
 
-void DNSCryptoKeyEngine::testAll()
+bool DNSCryptoKeyEngine::testAll()
 {
+  bool ret=true;
+
   BOOST_FOREACH(const allmakers_t::value_type& value, getAllMakers())
   {
     BOOST_FOREACH(maker_t* creator, value.second) {
@@ -150,15 +152,19 @@ void DNSCryptoKeyEngine::testAll()
           catch(std::exception& e)
           {
             cerr<<e.what()<<endl;
+            ret=false;
           }
         }
       }
     }
   }
+  return ret;
 }
 
-void DNSCryptoKeyEngine::testOne(int algo)
+bool DNSCryptoKeyEngine::testOne(int algo)
 {
+  bool ret=true;
+
   BOOST_FOREACH(maker_t* creator, getAllMakers()[algo]) {
 
     BOOST_FOREACH(maker_t* signer, getAllMakers()[algo]) {
@@ -171,10 +177,12 @@ void DNSCryptoKeyEngine::testOne(int algo)
         catch(std::exception& e)
         {
           cerr<<e.what()<<endl;
+          ret=false;
         }
       }
     }
   }
+  return ret;
 }
 // returns times it took to sign and verify
 pair<unsigned int, unsigned int> DNSCryptoKeyEngine::testMakers(unsigned int algo, maker_t* creator, maker_t* signer, maker_t* verifier)
index 6aa726318413ecd3d1b8f57a29272bcd8e0859bd..31ff2936e25aafebcf77cc6f236682a75fac8520 100644 (file)
@@ -48,8 +48,8 @@ class DNSCryptoKeyEngine
     
     static void report(unsigned int algorithm, maker_t* maker, bool fallback=false);
     static std::pair<unsigned int, unsigned int> testMakers(unsigned int algorithm, maker_t* creator, maker_t* signer, maker_t* verifier);
-    static void testAll();
-    static void testOne(int algo);
+    static bool testAll();
+    static bool testOne(int algo);
   private:
     
     typedef std::map<unsigned int, maker_t*> makers_t;
index b83968fa8c110e60fdb027bf13350df5bb820950..da017d841ae21d69e7e383ba01518f4ee0271422 100644 (file)
@@ -854,14 +854,14 @@ int listAllZones(const string &type="") {
   return 0;
 }
 
-void testAlgorithm(int algo) 
+bool testAlgorithm(int algo)
 {
-  DNSCryptoKeyEngine::testOne(algo);
+  return DNSCryptoKeyEngine::testOne(algo);
 }
 
-void testAlgorithms()
+bool testAlgorithms()
 {
-  DNSCryptoKeyEngine::testAll();
+  return DNSCryptoKeyEngine::testAll();
 }
 
 void testSpeed(DNSSECKeeper& dk, const string& zone, const string& remote, int cores)
@@ -1351,13 +1351,15 @@ try
       cerr << "Syntax: pdnssec test-algorithm algonum"<<endl;
       return 0;
     }
-    testAlgorithm(lexical_cast<int>(cmds[1]));
-    return 0; 
+    if (testAlgorithm(lexical_cast<int>(cmds[1])))
+      return 0;
+    return 1;
   }
 
   if(cmds[0] == "test-algorithms") {
-    testAlgorithms();
-    return 0;
+    if (testAlgorithms())
+      return 0;
+    return 1;
   }
 
   loadMainConfig(g_vm["config-dir"].as<string>());