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

Function test

test/epwait.c:339–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339static int test(int flags)
340{
341 struct epoll_event ev = { };
342 struct io_uring ring;
343 int epollfd, ret, i;
344
345 ret = t_create_ring(8, &ring, flags);
346 if (ret == T_SETUP_SKIP) {
347 return T_EXIT_SKIP;
348 } else if (ret != T_SETUP_OK) {
349 fprintf(stderr, "ring create failed %x -> %d\n", flags, ret);
350 return T_EXIT_FAIL;
351 }
352
353 for (i = 0; i < 2; i++) {
354 if (pipe(fds[i]) < 0) {
355 perror("pipe");
356 return T_EXIT_FAIL;
357 }
358 }
359
360 epollfd = epoll_create1(0);
361 if (epollfd < 0) {
362 perror("epoll_create");
363 return T_EXIT_FAIL;
364 }
365
366 for (i = 0; i < 2; i++) {
367 ev.events = EPOLLIN;
368 ev.data.fd = fds[i][0];
369 ret = epoll_ctl(epollfd, EPOLL_CTL_ADD, fds[i][0], &ev);
370 if (ret < 0) {
371 perror("epoll_ctl");
372 return T_EXIT_FAIL;
373 }
374 }
375
376 ret = test_ready(&ring, epollfd);
377 if (ret) {
378 fprintf(stderr, "test_ready failed\n");
379 return T_EXIT_FAIL;
380 }
381 if (no_epoll_wait)
382 return T_EXIT_SKIP;
383
384 ret = test_not_ready(&ring, epollfd);
385 if (ret) {
386 fprintf(stderr, "test_not_ready failed\n");
387 return T_EXIT_FAIL;
388 }
389
390 ret = test_del(&ring, epollfd);
391 if (ret) {
392 fprintf(stderr, "test_del failed\n");
393 return T_EXIT_FAIL;
394 }
395
396 /* keep last */

Callers 1

mainFunction · 0.70

Calls 6

t_create_ringFunction · 0.85
test_not_readyFunction · 0.85
test_delFunction · 0.85
test_removeFunction · 0.85
test_raceFunction · 0.85
test_readyFunction · 0.70

Tested by

no test coverage detected