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

Function test_basic

test/vec-regbuf.c:350–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350static void test_basic(struct buf_desc *bd)
351{
352 void *p = bd->buf_wr;
353 int ret;
354 struct iovec iov_page = { .iov_base = p,
355 .iov_len = page_sz, };
356 struct iovec iov_inner = { .iov_base = p + 1,
357 .iov_len = 3, };
358 struct iovec iov_maxbvec = { .iov_base = p + page_sz - 1,
359 .iov_len = page_sz + 2, };
360 struct iovec iov_big = { .iov_base = p,
361 .iov_len = page_sz * 12 + 33, };
362 struct iovec iov_big_unalign = { .iov_base = p + 10,
363 .iov_len = page_sz * 7 + 41, };
364 struct iovec iov_full = { .iov_base = p,
365 .iov_len = bd->size, };
366 struct iovec iov_right1 = { .iov_base = p + bd->size - page_sz + 5,
367 .iov_len = page_sz - 5 };
368 struct iovec iov_right2 = { .iov_base = p + bd->size - page_sz - 5,
369 .iov_len = page_sz + 5 };
370 struct iovec iov_full_unalign = { .iov_base = p + 1,
371 .iov_len = bd->size - 1, };
372 struct iovec vecs[] = {
373 iov_page,
374 iov_big,
375 iov_inner,
376 iov_big_unalign,
377 iov_big_unalign,
378 };
379 struct iovec vecs_basic[] = { iov_page, iov_page, iov_page };
380 struct iovec vecs_full[] = { iov_full, iov_full, iov_full };
381 struct iovec vecs_full_unalign[] = { iov_full_unalign, iov_full_unalign,
382 iov_full_unalign };
383 struct iovec vecs_maxsegs[] = { iov_maxbvec, iov_maxbvec, iov_maxbvec,
384 iov_maxbvec, iov_maxbvec, iov_maxbvec};
385
386 ret = test_sequence(bd, 1, (struct work[]) {
387 { &iov_page, 1 },
388 { vecs, 1 }});
389 if (ret) {
390 fprintf(stderr, "seq failure: basic aligned, %i\n", ret);
391 exit(1);
392 }
393
394 ret = test_sequence(bd, 2, (struct work[]) {
395 { vecs, 1 },
396 { vecs, 1 }});
397 if (ret) {
398 fprintf(stderr, "seq failure: basic aligned, %i\n", ret);
399 exit(1);
400 }
401
402 ret = test_sequence(bd, 2, (struct work[]) {
403 { vecs + 1, 1 },
404 { vecs + 1, 1 }});
405 if (ret) {
406 fprintf(stderr, "seq failure: multi page buffer, %i\n", ret);
407 exit(1);

Callers 1

mainFunction · 0.70

Calls 1

test_sequenceFunction · 0.85

Tested by

no test coverage detected