| 168 | } |
| 169 | |
| 170 | static int test_basic(struct io_uring *ring) |
| 171 | { |
| 172 | struct io_uring_cqe *cqe; |
| 173 | struct timeval tv; |
| 174 | int ret; |
| 175 | |
| 176 | memset(reg, 0, sizeof(*reg)); |
| 177 | reg->ts.tv_sec = 1; |
| 178 | reg->ts.tv_nsec = 100000000ULL; |
| 179 | reg->flags = IORING_REG_WAIT_TS; |
| 180 | |
| 181 | gettimeofday(&tv, NULL); |
| 182 | ret = io_uring_submit_and_wait_reg(ring, &cqe, 2, 0); |
| 183 | if (ret != -ETIME) { |
| 184 | fprintf(stderr, "submit_and_wait_reg: %d\n", ret); |
| 185 | goto err; |
| 186 | } |
| 187 | ret = mtime_since_now(&tv); |
| 188 | /* allow some slack, should be around 1.1s */ |
| 189 | if (ret < 1000 || ret > 1200) { |
| 190 | fprintf(stderr, "wait too long or short: %d\n", ret); |
| 191 | goto err; |
| 192 | } |
| 193 | return T_EXIT_PASS; |
| 194 | err: |
| 195 | return T_EXIT_FAIL; |
| 196 | } |
| 197 | |
| 198 | static int test_wait_arg(void) |
| 199 | { |
no test coverage detected