]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2474] fixed unittests for different compilation flags
authorRazvan Becheriu <razvan@isc.org>
Fri, 22 Jul 2022 13:35:35 +0000 (16:35 +0300)
committerRazvan Becheriu <razvan@isc.org>
Fri, 22 Jul 2022 19:05:50 +0000 (22:05 +0300)
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc

index 2a81215d96372603fbd04fbfa04598cc99631648..4e5f05f44b51da2af8da68613fb6f0830ddab3b0 100644 (file)
@@ -2840,30 +2840,45 @@ void
 Dhcpv4SrvTest::checkConfigFiles() {
     IfaceMgrTestConfig test_config(true);
     string path = CFG_EXAMPLES;
-
-    DIR* dir = opendir(path.c_str());
-    if (!dir) {
-        return;
-    }
-
-    // Set of sorted files by name.
-    std::set<std::string> files;
-
-    for (struct dirent* dent = readdir(dir); dent; dent = readdir(dir)) {
-        std::string name(dent->d_name);
-        // Skip current and parent directory and files with no extension.
-        if (name.size() < (sizeof(".json") - 1)) {
-            continue;
-        }
-
-        // Skip non .json files.
-        if (name.substr(name.size() - (sizeof(".json") - 1)) != ".json") {
-            continue;
-        }
-        name = path + "/" + name;
-        files.emplace(name);
+    vector<string> examples = {
+        "advanced.json",
+#if defined (HAVE_MYSQL) && defined (HAVE_PGSQL)
+        "all-keys-netconf.json",
+        "all-options.json",
+#endif
+        "backends.json",
+        "classify.json",
+        "classify2.json",
+        "comments.json",
+#if defined (HAVE_MYSQL)
+        "config-backend.json",
+#endif
+        "dhcpv4-over-dhcpv6.json",
+        "global-reservations.json",
+        "ha-load-balancing-primary.json",
+        "hooks.json",
+        "hooks-radius.json",
+        "leases-expiration.json",
+        "multiple-options.json",
+#if defined (HAVE_MYSQL)
+        "mysql-reservations.json",
+#endif
+#if defined (HAVE_PGSQL)
+        "pgsql-reservations.json",
+#endif
+        "reservations.json",
+        "several-subnets.json",
+        "shared-network.json",
+        "single-subnet.json",
+        "vendor-specific.json",
+        "vivso.json",
+        "with-ddns.json",
+    };
+    vector<string> files;
+    for (string example : examples) {
+        string file = path + "/" + example;
+        files.push_back(file);
     }
-
     for (const auto& file: files) {
         string label("Checking configuration from file: ");
         label += file;
index 3dc887a0c05040bfaedeeacb238d3dc776bd0760..6026aec818471032f82a5164125f7d1a14672a46 100644 (file)
@@ -224,30 +224,47 @@ void
 Dhcpv6SrvTest::checkConfigFiles() {
     IfaceMgrTestConfig test_config(true);
     string path = CFG_EXAMPLES;
-
-    DIR* dir = opendir(path.c_str());
-    if (!dir) {
-        return;
-    }
-
-    // Set of sorted files by name.
-    std::set<std::string> files;
-
-    for (struct dirent* dent = readdir(dir); dent; dent = readdir(dir)) {
-        std::string name(dent->d_name);
-        // Skip current and parent directory and files with no extension.
-        if (name.size() < (sizeof(".json") - 1)) {
-            continue;
-        }
-
-        // Skip non .json files.
-        if (name.substr(name.size() - (sizeof(".json") - 1)) != ".json") {
-            continue;
-        }
-        name = path + "/" + name;
-        files.emplace(name);
+    vector<string> examples = {
+        "advanced.json",
+#if defined (HAVE_MYSQL) && defined (HAVE_PGSQL)
+        "all-keys-netconf.json",
+        "all-options.json",
+#endif
+        "backends.json",
+        "classify.json",
+        "classify2.json",
+        "comments.json",
+#if defined (HAVE_MYSQL)
+        "config-backend.json",
+#endif
+        "dhcpv4-over-dhcpv6.json",
+        "duid.json",
+        "global-reservations.json",
+        "ha-hot-standby.json",
+        "hooks.json",
+        "iPXE.json",
+        "leases-expiration.json",
+        "multiple-options.json",
+#if defined (HAVE_MYSQL)
+        "mysql-reservations.json",
+#endif
+#if defined (HAVE_PGSQL)
+        "pgsql-reservations.json",
+#endif
+        "reservations.json",
+        "several-subnets.json",
+        "shared-network.json",
+        "simple.json",
+        "softwire46.json",
+        "stateless.json",
+        "tee-times.json",
+        "with-ddns.json",
+    };
+    vector<string> files;
+    for (string example : examples) {
+        string file = path + "/" + example;
+        files.push_back(file);
     }
-
     for (const auto& file: files) {
         string label("Checking configuration from file: ");
         label += file;