]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
fixed compilation
authorRazvan Becheriu <ravan@isc.org>
Mon, 4 Mar 2019 15:46:43 +0000 (17:46 +0200)
committerRazvan Becheriu <ravan@isc.org>
Mon, 4 Mar 2019 15:46:43 +0000 (17:46 +0200)
src/lib/dhcpsrv/benchmarks/Makefile.am
src/lib/dhcpsrv/benchmarks/generic_host_data_source_benchmark.cc
src/lib/dhcpsrv/benchmarks/generic_host_data_source_benchmark.h
src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.cc
src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h

index c99b884fac97ad3359337559e59de43658dba45e..14c52a5c2b1198161109c72fa388b5d8977c3162 100644 (file)
@@ -70,15 +70,28 @@ if HAVE_CQL
 run_benchmarks_LDFLAGS += $(CQL_LIBS)
 endif
 
-run_benchmarks_LDADD  = $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
-run_benchmarks_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+run_benchmarks_LDADD  = $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 run_benchmarks_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 run_benchmarks_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
+run_benchmarks_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
 run_benchmarks_LDADD += $(BENCHMARK_LDADD)
 run_benchmarks_LDADD += $(LOG4CPLUS_LIBS)
 run_benchmarks_LDADD += $(CRYPTO_LIBS)
 run_benchmarks_LDADD += $(BOOST_LIBS)
 run_benchmarks_LDADD += $(GTEST_LDADD)
+
+if HAVE_MYSQL
+run_benchmarks_LDADD += $(top_builddir)/src/lib/mysql/testutils/libmysqltest.la
+endif
+
+if HAVE_PGSQL
+run_benchmarks_LDADD += $(top_builddir)/src/lib/pgsql/testutils/libpgsqltest.la
+endif
+
+if HAVE_CQL
+run_benchmarks_LDADD += $(top_builddir)/src/lib/cql/testutils/libcqltest.la
+endif
+
 endif
 
 noinst_PROGRAMS = $(BENCHMARKS)
index 9c899b79bfd567f01562f951377df348fbc4d9cb..00e9e0af415c29f52d3da7a5379f45b0135f51a9 100644 (file)
 
 #include <config.h>
 
-#include <dhcpsrv/benchmarks/generic_host_data_source_benchmark.h>
-
 #include <asiolink/io_address.h>
+
+#include <database/testutils/schema.h>
+
 #include <dhcp/dhcp6.h>
 #include <dhcp/libdhcp++.h>
 #include <dhcp/option4_addrlst.h>
@@ -27,8 +28,9 @@
 #include <dhcp/option_int.h>
 #include <dhcp/option_string.h>
 #include <dhcp/option_vendor.h>
+
+#include <dhcpsrv/benchmarks/generic_host_data_source_benchmark.h>
 #include <dhcpsrv/host_data_source_factory.h>
-#include <dhcpsrv/testutils/schema.h>
 #include <dhcpsrv/testutils/host_data_source_utils.h>
 
 using isc::asiolink::IOAddress;
@@ -40,8 +42,7 @@ namespace isc {
 namespace dhcp {
 namespace bench {
 
-GenericHostDataSourceBenchmark::GenericHostDataSourceBenchmark()
-    : hdsptr_() {
+GenericHostDataSourceBenchmark::GenericHostDataSourceBenchmark() : hdsptr_() {
     LibDHCP::clearRuntimeOptionDefs();
 }
 
@@ -51,8 +52,7 @@ GenericHostDataSourceBenchmark::~GenericHostDataSourceBenchmark() {
 }
 
 void
-GenericHostDataSourceBenchmark::setUp(::benchmark::State& state,
-                                      size_t const& host_count) {
+GenericHostDataSourceBenchmark::setUp(::benchmark::State& state, size_t const& host_count) {
     state.PauseTiming();
     SetUp(state);
     prepareHosts(host_count);
@@ -97,7 +97,8 @@ GenericHostDataSourceBenchmark::createVendorOption(const Option::Universe& unive
 }
 
 void
-GenericHostDataSourceBenchmark::addTestOptions(const HostPtr& host, const bool formatted,
+GenericHostDataSourceBenchmark::addTestOptions(const HostPtr& host,
+                                               const bool formatted,
                                                const AddedOptions& added_options) const {
     OptionDefSpaceContainer defs;
 
@@ -105,22 +106,26 @@ GenericHostDataSourceBenchmark::addTestOptions(const HostPtr& host, const bool f
         // Add DHCPv4 options.
         CfgOptionPtr opts = host->getCfgOption4();
         opts->add(createOption<OptionString>(Option::V4, DHO_BOOT_FILE_NAME, true, formatted,
-                                             "my-boot-file"), DHCP4_OPTION_SPACE);
-        opts->add(createOption<OptionUint8>(Option::V4, DHO_DEFAULT_IP_TTL,
-                                            false, formatted, 64), DHCP4_OPTION_SPACE);
+                                             "my-boot-file"),
+                  DHCP4_OPTION_SPACE);
+        opts->add(createOption<OptionUint8>(Option::V4, DHO_DEFAULT_IP_TTL, false, formatted, 64),
+                  DHCP4_OPTION_SPACE);
         opts->add(createOption<OptionUint32>(Option::V4, 1, false, formatted, 312131),
                   "vendor-encapsulated-options");
         opts->add(createAddressOption<Option4AddrLst>(254, false, formatted, "192.0.2.3"),
                   DHCP4_OPTION_SPACE);
         opts->add(createEmptyOption(Option::V4, 1, true), "isc");
-        opts->add(createAddressOption<Option4AddrLst>(2, false, formatted, "10.0.0.5",
-                                                      "10.0.0.3", "10.0.3.4"), "isc");
+        opts->add(createAddressOption<Option4AddrLst>(2, false, formatted, "10.0.0.5", "10.0.0.3",
+                                                      "10.0.3.4"),
+                  "isc");
 
         // Add definitions for DHCPv4 non-standard options.
-        defs.addItem(OptionDefinitionPtr(new OptionDefinition("vendor-encapsulated-1", 1,
-                                         "uint32")), "vendor-encapsulated-options");
-        defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-254", 254, "ipv4-address",
-                                         true)), DHCP4_OPTION_SPACE);
+        defs.addItem(
+            OptionDefinitionPtr(new OptionDefinition("vendor-encapsulated-1", 1, "uint32")),
+            "vendor-encapsulated-options");
+        defs.addItem(
+            OptionDefinitionPtr(new OptionDefinition("option-254", 254, "ipv4-address", true)),
+            DHCP4_OPTION_SPACE);
         defs.addItem(OptionDefinitionPtr(new OptionDefinition("isc-1", 1, "empty")), "isc");
         defs.addItem(OptionDefinitionPtr(new OptionDefinition("isc-2", 2, "ipv4-address", true)),
                      "isc");
@@ -129,23 +134,27 @@ GenericHostDataSourceBenchmark::addTestOptions(const HostPtr& host, const bool f
     if ((added_options == DHCP6_ONLY) || (added_options == DHCP4_AND_DHCP6)) {
         // Add DHCPv6 options.
         CfgOptionPtr opts = host->getCfgOption6();
-        opts->add(createOption<OptionString>(Option::V6, D6O_BOOTFILE_URL, true,
-                                             formatted, "my-boot-file"), DHCP6_OPTION_SPACE);
-        opts->add(createOption<OptionUint32>(Option::V6, D6O_INFORMATION_REFRESH_TIME,
-                                             false, formatted, 3600), DHCP6_OPTION_SPACE);
+        opts->add(createOption<OptionString>(Option::V6, D6O_BOOTFILE_URL, true, formatted,
+                                             "my-boot-file"),
+                  DHCP6_OPTION_SPACE);
+        opts->add(createOption<OptionUint32>(Option::V6, D6O_INFORMATION_REFRESH_TIME, false,
+                                             formatted, 3600),
+                  DHCP6_OPTION_SPACE);
         opts->add(createVendorOption(Option::V6, false, formatted, 2495), DHCP6_OPTION_SPACE);
         opts->add(createAddressOption<Option6AddrLst>(1024, false, formatted, "2001:db8:1::1"),
                   DHCP6_OPTION_SPACE);
         opts->add(createEmptyOption(Option::V6, 1, true), "isc2");
         opts->add(createAddressOption<Option6AddrLst>(2, false, formatted, "3000::1", "3000::2",
-                                                      "3000::3"), "isc2");
+                                                      "3000::3"),
+                  "isc2");
 
         // Add definitions for DHCPv6 non-standard options.
-        defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-1024", 1024, "ipv6-address",
-                                                              true)), DHCP6_OPTION_SPACE);
+        defs.addItem(
+            OptionDefinitionPtr(new OptionDefinition("option-1024", 1024, "ipv6-address", true)),
+            DHCP6_OPTION_SPACE);
         defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-1", 1, "empty")), "isc2");
-        defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-2", 2, "ipv6-address",
-                                                              true)), "isc2");
+        defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-2", 2, "ipv6-address", true)),
+                     "isc2");
     }
 
     // Register created "runtime" option definitions. They will be used by a
@@ -208,8 +217,8 @@ void
 GenericHostDataSourceBenchmark::benchGet4IdentifierSubnetId() {
     for (HostPtr host : hosts_) {
         std::vector<uint8_t> hwaddr = host->getIdentifier();
-        hdsptr_->get4(host->getIPv4SubnetID(), host->getIdentifierType(),
-                      &hwaddr[0], hwaddr.size());
+        hdsptr_->get4(host->getIPv4SubnetID(), host->getIdentifierType(), &hwaddr[0],
+                      hwaddr.size());
     }
 }
 
@@ -224,8 +233,8 @@ void
 GenericHostDataSourceBenchmark::benchGet6IdentifierSubnetId() {
     for (HostPtr host : hosts_) {
         std::vector<uint8_t> hwaddr = host->getIdentifier();
-        hdsptr_->get6(host->getIPv6SubnetID(), host->getIdentifierType(),
-                      &hwaddr[0], hwaddr.size());
+        hdsptr_->get6(host->getIPv6SubnetID(), host->getIdentifierType(), &hwaddr[0],
+                      hwaddr.size());
     }
 }
 
@@ -241,8 +250,7 @@ void
 GenericHostDataSourceBenchmark::benchGet6Prefix() {
     for (HostPtr host : hosts_) {
         const IPv6ResrvRange range = host->getIPv6Reservations();
-        hdsptr_->get6(range.first->second.getPrefix(),
-                      range.first->second.getPrefixLen());
+        hdsptr_->get6(range.first->second.getPrefix(), range.first->second.getPrefixLen());
     }
 }
 
index ceb6b4c7f69846dcc4fbf0c12f9c4938b7daf3a0..d445e55a2743d48d8cbb33eba3a1216e996ad5e2 100644 (file)
@@ -28,16 +28,14 @@ namespace dhcp {
 namespace bench {
 
 /// @brief Base fixture class for benchmarking host backends.
-class GenericHostDataSourceBenchmark : public ::benchmark::Fixture {
-public:
-
+struct GenericHostDataSourceBenchmark : public ::benchmark::Fixture {
     /// @brief Defines universe (IPv4 or IPv6)
     enum Universe { V4, V6 };
 
     /// @brief Defines what kind of options should be added for a host
     enum AddedOptions {
-        DHCP4_ONLY,      ///< DHCPv4-only options
-        DHCP6_ONLY,      ///< DHCPv6-only options
+        DHCP4_ONLY,  ///< DHCPv4-only options
+        DHCP6_ONLY,  ///< DHCPv6-only options
         DHCP4_AND_DHCP6  ///< Both DHCPv4 and DHCPv6 options
     };
 
@@ -99,11 +97,12 @@ public:
     /// @param address3 third address to be used (optional)
     /// @return the option created wrapped in an option descriptor structure
     template <typename OptionType>
-    OptionDescriptor
-    createAddressOption(const uint16_t option_type, const bool persist,
-                        const bool formatted, const std::string& address1 = "",
-                        const std::string& address2 = "",
-                        const std::string& address3 = "") const {
+    OptionDescriptor createAddressOption(const uint16_t option_type,
+                                         const bool persist,
+                                         const bool formatted,
+                                         const std::string& address1 = "",
+                                         const std::string& address2 = "",
+                                         const std::string& address3 = "") const {
 
         std::ostringstream s;
         // First address.
@@ -158,7 +157,8 @@ public:
     /// @param host host reservation to be extended with options
     /// @param formatted whether to generate text representation
     /// @param added_options v4, v6 or both
-    void addTestOptions(const HostPtr& host,const bool formatted,
+    void addTestOptions(const HostPtr& host,
+                        const bool formatted,
                         const AddedOptions& added_options) const;
 
     /// @brief Sets up timers, creates and inserts hosts.
index 19160a2b8256f03a088c01aaa171921a1630f77b..7cb0bf0b3af2f0ea69aab3c376e536a748575035 100644 (file)
@@ -18,9 +18,7 @@
 #include <config.h>
 
 #include <dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h>
-
 #include <dhcpsrv/lease_mgr_factory.h>
-#include <dhcpsrv/testutils/cql_schema.h>
 
 #include <chrono>
 #include <iomanip>
@@ -29,7 +27,6 @@
 #include <vector>
 
 using namespace isc::asiolink;
-using namespace isc::dhcp::test;
 using namespace std;
 using namespace std::chrono;
 
@@ -37,8 +34,7 @@ namespace isc {
 namespace dhcp {
 namespace bench {
 
-GenericLeaseMgrBenchmark::GenericLeaseMgrBenchmark()
-    : lmptr_(NULL) {
+GenericLeaseMgrBenchmark::GenericLeaseMgrBenchmark() : lmptr_(NULL) {
 }
 
 GenericLeaseMgrBenchmark::~GenericLeaseMgrBenchmark() {
@@ -217,8 +213,7 @@ GenericLeaseMgrBenchmark::benchGetLease6_type_duid_iaid() {
 void
 GenericLeaseMgrBenchmark::benchGetLease6_type_duid_iaid_subnetid() {
     for (Lease6Ptr const& lease : leases6_) {
-        lmptr_->getLease6(lease->type_, *lease->duid_, lease->iaid_,
-                          lease->subnet_id_);
+        lmptr_->getLease6(lease->type_, *lease->duid_, lease->iaid_, lease->subnet_id_);
     }
 }
 
index eb4de3926e3e0a363a1a7f2e9a107d2e40b69ef8..d636e28cca74da8120f7cb9182039675119bbe0c 100644 (file)
@@ -27,9 +27,7 @@ namespace dhcp {
 namespace bench {
 
 /// @brief A base class for a fixture for specific lease manager benchmarks
-class GenericLeaseMgrBenchmark : public benchmark::Fixture {
-public:
-
+struct GenericLeaseMgrBenchmark : public benchmark::Fixture {
     /// Specifies the IP protocol family to be bested.
     enum Universe { V4, V6 };