| 133 | } |
| 134 | |
| 135 | static int test(int flags) |
| 136 | { |
| 137 | struct io_uring_params params = { .flags = flags, }; |
| 138 | struct sockaddr_in serv_addr = {}; |
| 139 | struct io_uring ring; |
| 140 | int ret, clientfd, s_fd, i; |
| 141 | |
| 142 | if (flags & IORING_SETUP_SQPOLL) |
| 143 | params.sq_thread_idle = 50; |
| 144 | |
| 145 | ret = io_uring_queue_init_params(8, &ring, ¶ms); |
| 146 | if (ret < 0) { |
| 147 | fprintf(stderr, "Queue init: %d\n", ret); |
| 148 | return T_EXIT_FAIL; |
| 149 | } |
| 150 | |
| 151 | s_fd = init_test_server(&serv_addr); |
| 152 | if (s_fd < 0) |
| 153 | return T_EXIT_FAIL; |
| 154 | |
| 155 | clientfd = init_test_client(); |
| 156 | if (clientfd < 0) { |
| 157 | close(s_fd); |
| 158 | return T_EXIT_FAIL; |
| 159 | } |
| 160 | |
| 161 | /* make sure SQPOLL thread is sleeping */ |
| 162 | if (flags & IORING_SETUP_SQPOLL) |
| 163 | usleep(100000); |
| 164 | |
| 165 | for (i = 0; i < 32; i++) { |
| 166 | ret = test_connect(&ring, clientfd, &serv_addr); |
| 167 | if (ret == T_EXIT_SKIP) |
| 168 | return T_EXIT_SKIP; |
| 169 | else if (ret == T_EXIT_PASS) |
| 170 | continue; |
| 171 | |
| 172 | return T_EXIT_FAIL; |
| 173 | } |
| 174 | |
| 175 | close(s_fd); |
| 176 | close(clientfd); |
| 177 | return T_EXIT_PASS; |
| 178 | } |
| 179 | |
| 180 | int main(int argc, char *argv[]) |
| 181 | { |
no test coverage detected