aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-05-01 14:02:59 -0600
committerJens Axboe <axboe@kernel.dk>2024-05-01 14:02:59 -0600
commit149c7e1d715dbcb1b1c8f555e7428d64d33f215a (patch)
treeae273a573a25d2836889b9f180e7d9f275268d50
parentf7dcc1ea60819475dffd3a45059e16f04381bee7 (diff)
downloadliburing-149c7e1d715dbcb1b1c8f555e7428d64d33f215a.tar.gz
test: skip test case if underlying filesystem doesn't support O_DIRECT
This is a bad test setup as you need O_DIRECT for full coverage, but just skip tests if we fail opening a file with O_DIRECT. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/defer-tw-timeout.c5
-rw-r--r--test/fixed-buf-merge.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/test/defer-tw-timeout.c b/test/defer-tw-timeout.c
index f754ec8..4313eae 100644
--- a/test/defer-tw-timeout.c
+++ b/test/defer-tw-timeout.c
@@ -99,6 +99,11 @@ static int test_file(struct io_uring *ring, char *__fname)
fd = open(fname, O_RDONLY | O_DIRECT);
if (fd < 0) {
+ if (errno == EINVAL) {
+ if (!__fname)
+ unlink(fname);
+ return T_EXIT_SKIP;
+ }
perror("open");
if (!__fname)
unlink(fname);
diff --git a/test/fixed-buf-merge.c b/test/fixed-buf-merge.c
index 98943b5..fbc94a4 100644
--- a/test/fixed-buf-merge.c
+++ b/test/fixed-buf-merge.c
@@ -36,6 +36,10 @@ int main(int argc, char *argv[])
fd = open(filename, O_RDONLY | O_DIRECT, 0644);
if (fd < 0) {
+ if (errno == EINVAL) {
+ unlink(filename);
+ return T_EXIT_SKIP;
+ }
perror("open");
goto err_unlink;
}