3 /* buffer for send/recv */
6 /* macro to display information about a failed test and increment the errct */
7 void test_fail_fl(char *msg
, char *file
, int line
);
8 #define test_fail(msg) test_fail_fl(msg, __FILE__, __LINE__)
11 /* macros to display debugging information */
12 void debug_fl(char *msg
, char *file
, int line
);
13 #define debug(msg) debug_fl(msg, __FILE__, __LINE__)
18 #define SOCKET(sd,domain,type,protocol) \
21 sd = socket(domain, type, protocol); \
23 test_fail("sd = socket(domain, type, protocol) failed");\
27 #define UNLINK(path) \
32 if (rc == -1 && errno != ENOENT) { \
33 test_fail("unlink(path) failed"); \
37 #define SYMLINK(oldpath,newpath) \
41 rc = symlink(oldpath,newpath); \
43 test_fail("symlink(oldpath,newpath) failed"); \
53 test_fail("close(sd) failed"); \
57 extern int server_ready
;
58 void test_xfer_sighdlr(int sig
);
60 struct socket_test_info
{
61 const struct sockaddr
*clientaddr
;
62 socklen_t clientaddrlen
;
63 const struct sockaddr
*clientaddr2
;
64 socklen_t clientaddr2len
;
65 const struct sockaddr
*clientaddrsym
;
66 socklen_t clientaddrsymlen
;
70 const struct sockaddr
*serveraddr
;
71 socklen_t serveraddrlen
;
72 const struct sockaddr
*serveraddr2
;
73 socklen_t serveraddr2len
;
78 int ignore_accept_delay
; /* success from accept after aborted connect */
79 int ignore_connect_delay
; /* nb connect not instant */
80 int ignore_connect_unaccepted
; /* connect succeeds without accept */
81 int ignore_select_delay
; /* select delay reflecting other side nb op */
82 int ignore_send_waiting
; /* can send while waiting for nb recv */
83 int ignore_write_conn_reset
; /* write does not guarantee ECONNRESET */
85 void (* callback_check_sockaddr
)(const struct sockaddr
*sockaddr
,
86 socklen_t sockaddrlen
, const char *callname
, int addridx
);
87 void (* callback_cleanup
)(void);
88 void (* callback_xfer_peercred
)(int sd
); /* can be NULL */
89 void (* callback_xfer_prepclient
)(void); /* can be NULL */
90 void (* callback_set_listen_opt
)(int sd
); /* can be NULL */
93 void test_abort_client_server(const struct socket_test_info
*info
,
95 void test_bind(const struct socket_test_info
*info
);
96 void test_close(const struct socket_test_info
*info
);
97 void test_connect_close(const struct socket_test_info
*info
);
98 void test_connect_nb(const struct socket_test_info
*info
);
99 void test_dup(const struct socket_test_info
*info
);
100 void test_dup2(const struct socket_test_info
*info
);
101 void test_getsockname(const struct socket_test_info
*info
);
102 void test_intr(const struct socket_test_info
*info
);
103 void test_listen(const struct socket_test_info
*info
);
104 void test_listen_close(const struct socket_test_info
*info
);
105 void test_listen_close_nb(const struct socket_test_info
*info
);
106 void test_msg_dgram(const struct socket_test_info
*info
);
107 void test_nonblock(const struct socket_test_info
*info
);
108 void test_read(const struct socket_test_info
*info
);
109 void test_shutdown(const struct socket_test_info
*info
);
110 void test_simple_client_server(const struct socket_test_info
*info
, int type
);
111 void test_sockopts(const struct socket_test_info
*info
);
112 void test_socket(const struct socket_test_info
*info
);
113 void test_write(const struct socket_test_info
*info
);
114 void test_xfer(const struct socket_test_info
*info
);