diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-06-09 11:55:21 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-06-09 12:07:55 +0300 |
commit | afd4899380eea1c70e2a68714b5da1c9919ccdbd (patch) | |
tree | cd5120708784139bc6a0f8881da1ed8389a065b3 /contrib/libs/liburing/test/xattr.c | |
parent | a83bd2dd3c21e38c6c0807ec5e679497ab567f24 (diff) | |
download | ydb-afd4899380eea1c70e2a68714b5da1c9919ccdbd.tar.gz |
Update contrib/libs/liburing to 2.6
3b51a9fb14de805208d11f1c077c78bb5d487e0f
Diffstat (limited to 'contrib/libs/liburing/test/xattr.c')
-rw-r--r-- | contrib/libs/liburing/test/xattr.c | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/contrib/libs/liburing/test/xattr.c b/contrib/libs/liburing/test/xattr.c index 0c5870d33d..fe2c9ee9ad 100644 --- a/contrib/libs/liburing/test/xattr.c +++ b/contrib/libs/liburing/test/xattr.c @@ -295,7 +295,6 @@ Exit: /* Test driver for failure cases of fsetxattr and fgetxattr. */ static int test_failure_fxattr(void) { - int rc = 0; struct io_uring ring; char value[XATTR_SIZE]; @@ -314,31 +313,36 @@ static int test_failure_fxattr(void) } /* Test writing attributes. */ - assert(io_uring_fsetxattr(&ring, -1, KEY1, VALUE1, strlen(VALUE1), 0) < 0); - assert(io_uring_fsetxattr(&ring, fd, NULL, VALUE1, strlen(VALUE1), 0) < 0); - assert(io_uring_fsetxattr(&ring, fd, KEY1, NULL, strlen(VALUE1), 0) < 0); - assert(io_uring_fsetxattr(&ring, fd, KEY1, VALUE1, 0, 0) == 0); - assert(io_uring_fsetxattr(&ring, fd, KEY1, VALUE1, -1, 0) < 0); + if (io_uring_fsetxattr(&ring, -1, KEY1, VALUE1, strlen(VALUE1), 0) >= 0) + return 1; + if (io_uring_fsetxattr(&ring, fd, NULL, VALUE1, strlen(VALUE1), 0) >= 0) + return 1; + if (io_uring_fsetxattr(&ring, fd, KEY1, NULL, strlen(VALUE1), 0) >= 0) + return 1; + if (io_uring_fsetxattr(&ring, fd, KEY1, VALUE1, 0, 0) != 0) + return 1; + if (io_uring_fsetxattr(&ring, fd, KEY1, VALUE1, -1, 0) >= 0) + return 1; /* Test reading attributes. */ - assert(io_uring_fgetxattr(&ring, -1, KEY1, value, XATTR_SIZE) < 0); - assert(io_uring_fgetxattr(&ring, fd, NULL, value, XATTR_SIZE) < 0); - assert(io_uring_fgetxattr(&ring, fd, KEY1, value, 0) == 0); + if (io_uring_fgetxattr(&ring, -1, KEY1, value, XATTR_SIZE) >= 0) + return 1; + if (io_uring_fgetxattr(&ring, fd, NULL, value, XATTR_SIZE) >= 0) + return 1; + if (io_uring_fgetxattr(&ring, fd, KEY1, value, 0) != 0) + return 1; /* Cleanup. */ close(fd); unlink(FILENAME); - io_uring_queue_exit(&ring); - - return rc; + return 0; } /* Test driver for failure cases for setxattr and getxattr. */ static int test_failure_xattr(void) { - int rc = 0; struct io_uring ring; char value[XATTR_SIZE]; @@ -353,24 +357,33 @@ static int test_failure_xattr(void) t_create_file(FILENAME, 0); /* Test writing attributes. */ - assert(io_uring_setxattr(&ring, "complete garbage", KEY1, VALUE1, strlen(VALUE1), 0) < 0); - assert(io_uring_setxattr(&ring, NULL, KEY1, VALUE1, strlen(VALUE1), 0) < 0); - assert(io_uring_setxattr(&ring, FILENAME, NULL, VALUE1, strlen(VALUE1), 0) < 0); - assert(io_uring_setxattr(&ring, FILENAME, KEY1, NULL, strlen(VALUE1), 0) < 0); - assert(io_uring_setxattr(&ring, FILENAME, KEY1, VALUE1, 0, 0) == 0); + if (io_uring_setxattr(&ring, "complete garbage", KEY1, VALUE1, strlen(VALUE1), 0) >= 0) + return 1; + if (io_uring_setxattr(&ring, NULL, KEY1, VALUE1, strlen(VALUE1), 0) >= 0) + return 1; + if (io_uring_setxattr(&ring, FILENAME, NULL, VALUE1, strlen(VALUE1), 0) >= 0) + return 1; + if (io_uring_setxattr(&ring, FILENAME, KEY1, NULL, strlen(VALUE1), 0) >= 0) + return 1; + if (io_uring_setxattr(&ring, FILENAME, KEY1, VALUE1, 0, 0) != 0) + return 1; /* Test reading attributes. */ - assert(io_uring_getxattr(&ring, "complete garbage", KEY1, value, XATTR_SIZE) < 0); - assert(io_uring_getxattr(&ring, NULL, KEY1, value, XATTR_SIZE) < 0); - assert(io_uring_getxattr(&ring, FILENAME, NULL, value, XATTR_SIZE) < 0); - assert(io_uring_getxattr(&ring, FILENAME, KEY1, NULL, XATTR_SIZE) == 0); - assert(io_uring_getxattr(&ring, FILENAME, KEY1, value, 0) == 0); + if (io_uring_getxattr(&ring, "complete garbage", KEY1, value, XATTR_SIZE) >= 0) + return 1; + if (io_uring_getxattr(&ring, NULL, KEY1, value, XATTR_SIZE) >= 0) + return 1; + if (io_uring_getxattr(&ring, FILENAME, NULL, value, XATTR_SIZE) >= 0) + return 1; + if (io_uring_getxattr(&ring, FILENAME, KEY1, NULL, XATTR_SIZE) != 0) + return 1; + if (io_uring_getxattr(&ring, FILENAME, KEY1, value, 0) != 0) + return 1; /* Cleanup. */ io_uring_queue_exit(&ring); unlink(FILENAME); - - return rc; + return 0; } /* Test for invalid SQE, this will cause a segmentation fault if enabled. */ |