summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-12-20 11:24:21 -0700
committerJens Axboe <axboe@kernel.dk>2021-12-22 07:17:19 -0700
commit7cc81e17c036e383cef7129e5027b76f35ff46e2 (patch)
treef57a0f4ae79d3710f5388ca4537f875e617cc424
parenteeeaa3ed4ce574fd4ddfa13738e7ca000cc14449 (diff)
downloadliburing-7cc81e17c036e383cef7129e5027b76f35ff46e2.tar.gz
liburing-7cc81e17c036e383cef7129e5027b76f35ff46e2.tar.bz2
test/getdents: don't fail on kernels not supporting the feature
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/getdents.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/getdents.c b/test/getdents.c
index d23f4cb..d4f4c8b 100644
--- a/test/getdents.c
+++ b/test/getdents.c
@@ -11,6 +11,8 @@
#include "helpers.h"
#include "liburing.h"
+static int no_getdents;
+
#define BUFFER_SIZE 512
#define LIST_INIT(name) { &(name), &(name) }
@@ -174,6 +176,11 @@ static void readdir_completion(struct dir *dir, int ret)
uint8_t *end;
if (ret < 0) {
+ if (ret == -EINVAL) {
+ fprintf(stdout, "Kernel doesn't support getdents, skipping\n");
+ no_getdents = 1;
+ return;
+ }
fprintf(stderr, "error reading ");
fprintf(stderr, ": %s (%d)\n", strerror(-ret), ret);
return;
@@ -249,9 +256,14 @@ int main(int argc, char *argv[])
opendir_completion(dir, dir->ret);
else
readdir_completion(dir, dir->ret);
+ if (no_getdents) {
+ num_dir_entries = 50;
+ goto done;
+ }
}
}
+done:
io_uring_queue_exit(&ring);
return num_dir_entries < 50;
}