6 static int setup(void **state)
8 torture_setup_socket_dir(state);
13 static int teardown(void **state)
15 torture_teardown_socket_dir(state);
20 static void test_dup2_existing_open_fd(void **state)
24 (void) state; /* unused */
26 s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
27 assert_int_not_equal(s, -1);
30 * Here we try to duplicate the existing socket fd to itself
31 * and as per man page for dup2() it must return the already
32 * open fd without any failure.
35 assert_int_equal(dup_s, s);
43 const struct CMUnitTest tcp_dup2_tests[] = {
44 cmocka_unit_test(test_dup2_existing_open_fd),
47 rc = cmocka_run_group_tests(tcp_dup2_tests, setup, teardown);