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

Function main

test/read-write.c:920–1085  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

918}
919
920int main(int argc, char *argv[])
921{
922 int i, ret, nr;
923 char buf[256];
924 char *fname;
925
926 if (argc > 1) {
927 fname = argv[1];
928 } else {
929 srand((unsigned)time(NULL));
930 snprintf(buf, sizeof(buf), ".basic-rw-%u-%u",
931 (unsigned)rand(), (unsigned)getpid());
932 fname = buf;
933 t_create_file(fname, FILE_SIZE);
934 }
935
936 signal(SIGXFSZ, SIG_IGN);
937
938 vecs = t_create_buffers(2 * BUFFERS, BS);
939
940 /* if we don't have nonvec read, skip testing that */
941 nr = has_nonvec_read() ? 64 : 32;
942
943 for (i = 0; i < nr; i++) {
944 int write = (i & 1) != 0;
945 int buffered = (i & 2) != 0;
946 int sqthread = (i & 4) != 0;
947 int fixed = (i & 8) != 0;
948 int offload = (i & 16) != 0;
949 int nonvec = (i & 32) != 0;
950
951 ret = test_io(fname, write, buffered, sqthread, fixed, nonvec,
952 BS, offload);
953 if (ret) {
954 fprintf(stderr, "test_io failed %d/%d/%d/%d/%d\n",
955 write, buffered, sqthread, fixed, nonvec);
956 goto err;
957 }
958 }
959
960 ret = test_buf_select(fname, 1);
961 if (ret) {
962 fprintf(stderr, "test_buf_select nonvec failed\n");
963 goto err;
964 }
965
966 ret = test_buf_select(fname, 0);
967 if (ret) {
968 fprintf(stderr, "test_buf_select vec failed\n");
969 goto err;
970 }
971
972 ret = test_buf_select_short(fname, 1);
973 if (ret) {
974 fprintf(stderr, "test_buf_select_short nonvec failed\n");
975 goto err;
976 }
977

Callers

nothing calls this directly

Calls 14

t_create_fileFunction · 0.85
t_create_buffersFunction · 0.85
test_buf_selectFunction · 0.85
test_buf_select_shortFunction · 0.85
test_buf_select_pipeFunction · 0.85
read_poll_linkFunction · 0.85
test_io_linkFunction · 0.85
test_write_efbigFunction · 0.85
test_rem_bufFunction · 0.85
test_rem_buf_singleFunction · 0.85
has_nonvec_readFunction · 0.70

Tested by

no test coverage detected