summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmmar Faizi <ammar.faizi@students.amikom.ac.id>2021-10-07 13:31:54 +0700
committerJens Axboe <axboe@kernel.dk>2021-10-07 06:23:44 -0600
commitabd495348b5e0efee0a87b9206174a232932c21e (patch)
tree61e9bee20fc21eee059632975e46d1360a030296
parentc6f063cff1291c9972d0563dfc1ce3f1ebc8859c (diff)
downloadliburing-abd495348b5e0efee0a87b9206174a232932c21e.tar.gz
liburing-abd495348b5e0efee0a87b9206174a232932c21e.tar.bz2
test/cq-size: Don't use `errno` to check liburing's functions
When we build liburing without libc, we can't check `errno` variable with respect to liburing's functions. Don't do that it in test. Note: The tests themselves can still use `errno` to check error from functions that come from the libc, but not liburing. Link: https://github.com/axboe/liburing/issues/443 Fixes: https://github.com/axboe/liburing/issues/449 Signed-off-by: Ammar Faizi <ammar.faizi@students.amikom.ac.id> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/cq-size.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/cq-size.c b/test/cq-size.c
index b7dd5b4..4e6e3d1 100644
--- a/test/cq-size.c
+++ b/test/cq-size.c
@@ -45,14 +45,20 @@ int main(int argc, char *argv[])
p.cq_entries = 0;
ret = io_uring_queue_init_params(4, &ring, &p);
- if (ret >= 0 || errno != EINVAL) {
+ if (ret >= 0) {
printf("zero sized cq ring succeeded\n");
+ io_uring_queue_exit(&ring);
+ goto err;
+ }
+
+ if (ret != -EINVAL) {
+ printf("io_uring_queue_init_params failed, but not with -EINVAL"
+ ", returned error %d (%s)\n", ret, strerror(-ret));
goto err;
}
done:
return 0;
err:
- io_uring_queue_exit(&ring);
return 1;
}