MCPcopy Create free account
hub / github.com/axboe/liburing / test_basic

Function test_basic

test/reg-wait.c:170–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170static 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;
194err:
195 return T_EXIT_FAIL;
196}
197
198static int test_wait_arg(void)
199{

Callers 1

test_wait_argFunction · 0.70

Calls 2

mtime_since_nowFunction · 0.70

Tested by

no test coverage detected