test_echo_tcp_sendmsg_recvmsg_fd: also test passing the same socket up to 6 times
authorStefan Metzmacher <metze@samba.org>
Fri, 5 Feb 2021 13:20:16 +0000 (14:20 +0100)
committerAndreas Schneider <asn@samba.org>
Mon, 8 Feb 2021 18:29:57 +0000 (19:29 +0100)
Note SWRAP_MAX_PASSED_FDS is currently 6.

This test demonstrates that even 64-bit systems required commit:
"swrap: fix fd-passing without 4 padding bytes"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
tests/test_echo_tcp_sendmsg_recvmsg_fd.c

index e1908ae70369039981a0adf2edeeceb4de991879..9f0ac85e1c342d1610dea90f624665360cc4a749 100644 (file)
@@ -277,13 +277,58 @@ static void test_tcp_sendmsg_recvmsg_fd_1(void **state)
        test_tcp_sendmsg_recvmsg_fd_same(1);
 }
 
+static void test_tcp_sendmsg_recvmsg_fd_2s(void **state)
+{
+       (void) state; /* unused */
+       test_tcp_sendmsg_recvmsg_fd_same(2);
+}
+
+static void test_tcp_sendmsg_recvmsg_fd_3s(void **state)
+{
+       (void) state; /* unused */
+       test_tcp_sendmsg_recvmsg_fd_same(3);
+}
+
+static void test_tcp_sendmsg_recvmsg_fd_4s(void **state)
+{
+       (void) state; /* unused */
+       test_tcp_sendmsg_recvmsg_fd_same(4);
+}
+
+static void test_tcp_sendmsg_recvmsg_fd_5s(void **state)
+{
+       (void) state; /* unused */
+       test_tcp_sendmsg_recvmsg_fd_same(5);
+}
+
+static void test_tcp_sendmsg_recvmsg_fd_6s(void **state)
+{
+       (void) state; /* unused */
+       test_tcp_sendmsg_recvmsg_fd_same(6);
+}
+
 int main(void) {
        int rc;
 
        const struct CMUnitTest tests[] = {
                cmocka_unit_test_setup_teardown(test_tcp_sendmsg_recvmsg_fd_1,
                                 setup_echo_srv_tcp_ipv4,
-                                teardown)
+                                teardown),
+               cmocka_unit_test_setup_teardown(test_tcp_sendmsg_recvmsg_fd_2s,
+                                setup_echo_srv_tcp_ipv4,
+                                teardown),
+               cmocka_unit_test_setup_teardown(test_tcp_sendmsg_recvmsg_fd_3s,
+                                setup_echo_srv_tcp_ipv4,
+                                teardown),
+               cmocka_unit_test_setup_teardown(test_tcp_sendmsg_recvmsg_fd_4s,
+                                setup_echo_srv_tcp_ipv4,
+                                teardown),
+               cmocka_unit_test_setup_teardown(test_tcp_sendmsg_recvmsg_fd_5s,
+                                setup_echo_srv_tcp_ipv4,
+                                teardown),
+               cmocka_unit_test_setup_teardown(test_tcp_sendmsg_recvmsg_fd_6s,
+                                setup_echo_srv_tcp_ipv4,
+                                teardown),
        };
 
        rc = cmocka_run_group_tests(tests, NULL, NULL);