diff options
author | Razvan Becheriu <razvan@isc.org> | 2022-07-22 15:35:35 +0200 |
---|---|---|
committer | Razvan Becheriu <razvan@isc.org> | 2022-07-22 21:05:50 +0200 |
commit | fecc912765528fc7128523c4afc5be91ad515f37 (patch) | |
tree | c907b62d06a6f0d90047ccf902090049d2575d08 /src/bin | |
parent | [#2474] fixed comments (diff) | |
download | kea-fecc912765528fc7128523c4afc5be91ad515f37.tar.xz kea-fecc912765528fc7128523c4afc5be91ad515f37.zip |
[#2474] fixed unittests for different compilation flags
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/dhcp4/tests/dhcp4_srv_unittest.cc | 61 | ||||
-rw-r--r-- | src/bin/dhcp6/tests/dhcp6_srv_unittest.cc | 63 |
2 files changed, 78 insertions, 46 deletions
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<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; 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<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; |