]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3230] Added UTs for isSocketReceiveTimeSupported
authorThomas Markwalder <tmark@isc.org>
Fri, 16 Feb 2024 14:51:43 +0000 (09:51 -0500)
committerThomas Markwalder <tmark@isc.org>
Fri, 16 Feb 2024 14:51:43 +0000 (09:51 -0500)
src/lib/dhcp/tests/pkt_filter_inet6_unittest.cc
src/lib/dhcp/tests/pkt_filter_inet_unittest.cc
src/lib/dhcp/tests/pkt_filter_lpf_unittest.cc
    Added test for isSocketReceivedTimeSupported)

src/lib/dhcp/tests/pkt_filter_inet6_unittest.cc
src/lib/dhcp/tests/pkt_filter_inet_unittest.cc
src/lib/dhcp/tests/pkt_filter_lpf_unittest.cc

index d3fea68792f68f3df3c9b79df55e82cd5651d3d9..62636c178dc60e23d59b0cddb6910709fe11d178 100644 (file)
@@ -31,6 +31,18 @@ public:
     }
 };
 
+// This test verifies that the PktFilterInet6 class reports its capability
+// to create SOCKET_RECEIVED events.
+TEST_F(PktFilterInet6Test, isSocketReceivedTimeSupported) {
+    // Create object under test.
+    PktFilterInet6 pkt_filter;
+#ifdef SO_TIMESTAMP
+    EXPECT_TRUE(pkt_filter.isSocketReceivedTimeSupported());
+#else
+    EXPECT_FALSE(pkt_filter.isSocketReceivedTimeSupported());
+#endif
+}
+
 // This test verifies that the INET6 datagram socket is correctly opened and
 // bound to the appropriate address and port.
 TEST_F(PktFilterInet6Test, openSocket) {
index b0b75344d42047c3f88b73cd93837fabe76a8c96..f9dbc66cd8295b0784aa911dba07b04360b287c6 100644 (file)
@@ -44,6 +44,18 @@ TEST_F(PktFilterInetTest, isDirectResponseSupported) {
     EXPECT_FALSE(pkt_filter.isDirectResponseSupported());
 }
 
+// This test verifies that the PktFilterInet class reports its capability
+// to create SOCKET_RECEIVED events.
+TEST_F(PktFilterInetTest, isSocketReceivedTimeSupported) {
+    // Create object under test.
+    PktFilterInet pkt_filter;
+#ifdef SO_TIMESTAMP
+    EXPECT_TRUE(pkt_filter.isSocketReceivedTimeSupported());
+#else
+    EXPECT_FALSE(pkt_filter.isSocketReceivedTimeSupported());
+#endif
+}
+
 // This test verifies that the INET datagram socket is correctly opened and
 // bound to the appropriate address and port.
 TEST_F(PktFilterInetTest, openSocket) {
index e2e0b4ff56b248e937ea4bff93b936ca3d3d5efc..56d6f72297fd988c10a08ead6ef182f8bda65894 100644 (file)
@@ -47,6 +47,18 @@ TEST_F(PktFilterLPFTest, isDirectResponseSupported) {
     EXPECT_TRUE(pkt_filter.isDirectResponseSupported());
 }
 
+// This test verifies that the PktFilterLPF class reports its capability
+// to create SOCKET_RECEIVED events.
+TEST_F(PktFilterLPFTest, isSocketReceivedTimeSupported) {
+    // Create object under test.
+    PktFilterLPF pkt_filter;
+#ifdef SO_TIMESTAMP
+    EXPECT_TRUE(pkt_filter.isSocketReceivedTimeSupported());
+#else
+    EXPECT_FALSE(pkt_filter.isSocketReceivedTimeSupported());
+#endif
+}
+
 // All tests below require root privileges to execute successfully. If they
 // are run as non-root they will be skipped via SKIP_IF(notRoot()).