From 63a970d8f5afafd25b4342905ee11a1a59e9176d Mon Sep 17 00:00:00 2001 From: Disha Goel Date: Wed, 11 Mar 2026 23:28:44 +0530 Subject: [PATCH] syscalls/ustat: Skip tests on Btrfs using TCONF The ustat(2) system call is known to fail with EINVAL on Btrfs because it uses anonymous device IDs for subvolumes, which the legacy syscall cannot resolve to a physical block device. Currently, this results in a TFAIL, which causes false negatives in automated CI environments (e.g., SLES). This patch adds dynamic filesystem detection in setup() and uses tst_brk(TCONF, ...) to gracefully skip the test on Btrfs. Signed-off-by: Disha Goel --- testcases/kernel/syscalls/ustat/ustat01.c | 8 +++++++- testcases/kernel/syscalls/ustat/ustat02.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/syscalls/ustat/ustat01.c b/testcases/kernel/syscalls/ustat/ustat01.c index 161006058cf..07ee2faf78d 100644 --- a/testcases/kernel/syscalls/ustat/ustat01.c +++ b/testcases/kernel/syscalls/ustat/ustat01.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "lapi/syscalls.h" #include "lapi/ustat.h" @@ -34,11 +35,16 @@ void run(void) static void setup(void) { struct stat buf; + struct statfs fs_buf; /* Find a valid device number */ SAFE_STAT("/", &buf); - dev_num = buf.st_dev; + + statfs("/", &fs_buf); + if (fs_buf.f_type == 0x9123683E) { + tst_brk(TCONF, "%s", test.tags[0].value); + } } static struct tst_test test = { diff --git a/testcases/kernel/syscalls/ustat/ustat02.c b/testcases/kernel/syscalls/ustat/ustat02.c index 84becaa1f7b..789ef57fce7 100644 --- a/testcases/kernel/syscalls/ustat/ustat02.c +++ b/testcases/kernel/syscalls/ustat/ustat02.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "lapi/syscalls.h" #include "lapi/ustat.h" @@ -50,11 +51,16 @@ void run(unsigned int test) static void setup(void) { struct stat buf; + struct statfs fs_buf; /* Find a valid device number */ SAFE_STAT("/", &buf); - root_dev = buf.st_dev; + + statfs("/", &fs_buf); + if (fs_buf.f_type == 0x9123683E) { + tst_brk(TCONF, "%s", test.tags[0].value); + } } static struct tst_test test = {