swrap: don't read the callers msg_control buffer in swrap_recvmsg_before_unix()
[socket_wrapper.git] / tests / test_close_failure.c
1 #include "torture.h"
2
3 #include <errno.h>
4 #include <stdio.h>
5 #include <cmocka.h>
6 #include <unistd.h>
7 #include <stdlib.h>
8
9 static int setup(void **state)
10 {
11         torture_setup_socket_dir(state);
12
13         return 0;
14 }
15
16 static int teardown(void **state)
17 {
18         torture_teardown_socket_dir(state);
19
20         return 0;
21 }
22
23 static void test_close_failure(void **state)
24 {
25         int s;
26
27         (void) state; /* unused */
28
29         s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
30
31         assert_int_not_equal(s, -1);
32
33         /* Do not close the socket here so that destructor
34          * handles it and no hang should be observed.*/
35 }
36
37 int main(void) {
38         int rc;
39
40         const struct CMUnitTest close_failure_tests[] = {
41                 cmocka_unit_test_setup_teardown(test_close_failure,
42                                                 setup, teardown),
43         };
44
45         rc = cmocka_run_group_tests(close_failure_tests, NULL, NULL);
46
47         return rc;
48 }