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

Function main

test/fdinfo.c:393–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393int main(int argc, char *argv[])
394{
395 int i, ret, nr;
396 char buf[256];
397 char *fname;
398
399 if (argc > 1) {
400 fname = argv[1];
401 } else {
402 srand((unsigned)time(NULL));
403 snprintf(buf, sizeof(buf), ".basic-rw-%u-%u",
404 (unsigned)rand(), (unsigned)getpid());
405 fname = buf;
406 t_create_file(fname, FILE_SIZE);
407 }
408
409 signal(SIGXFSZ, SIG_IGN);
410
411 vecs = t_create_buffers(BUFFERS, BS);
412
413 /* if we don't have nonvec read, skip testing that */
414 nr = has_nonvec_read() ? 64 : 32;
415
416 for (i = 0; i < nr; i++) {
417 int write = (i & 1) != 0;
418 int buffered = (i & 2) != 0;
419 int sqthread = (i & 4) != 0;
420 int fixed = (i & 8) != 0;
421 int mixed = (i & 16) != 0;
422 int nonvec = (i & 32) != 0;
423
424 ret = test_io(fname, write, buffered, sqthread, fixed, nonvec,
425 BS, mixed);
426 if (ret == T_EXIT_SKIP)
427 continue;
428 if (ret) {
429 fprintf(stderr, "test_io failed %d/%d/%d/%d/%d\n",
430 write, buffered, sqthread, fixed, nonvec);
431 goto err;
432 }
433 }
434
435 ret = test_eventfd_read(0);
436 if (ret) {
437 fprintf(stderr, "eventfd read 0 failed\n");
438 goto err;
439 }
440
441 ret = test_eventfd_read(IORING_SETUP_DEFER_TASKRUN|IORING_SETUP_SINGLE_ISSUER);
442 if (ret) {
443 fprintf(stderr, "eventfd read defer failed\n");
444 goto err;
445 }
446
447 ret = test_eventfd_read(IORING_SETUP_SQPOLL);
448 if (ret) {
449 fprintf(stderr, "eventfd read sqpoll failed\n");
450 goto err;

Callers

nothing calls this directly

Calls 5

t_create_fileFunction · 0.85
t_create_buffersFunction · 0.85
has_nonvec_readFunction · 0.70
test_ioFunction · 0.70
test_eventfd_readFunction · 0.70

Tested by

no test coverage detected