From: Razvan Becheriu Date: Fri, 22 Jul 2022 13:35:35 +0000 (+0300) Subject: [#2474] fixed unittests for different compilation flags X-Git-Tag: Kea-2.2.0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fecc912765528fc7128523c4afc5be91ad515f37;p=thirdparty%2Fkea.git [#2474] fixed unittests for different compilation flags --- diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc index 2a81215d96..4e5f05f44b 100644 --- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc @@ -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 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 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 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; diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc index 3dc887a0c0..6026aec818 100644 --- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc @@ -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 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 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 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;