syscalls/ustat: Skip tests on Btrfs using TCONF
PATCH 1/1 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.
Changes:
- Added sys/vfs.h for statfs support.
- Implemented Btrfs magic number detection in setup().
- Used tst_brk(TCONF, ...) to skip the test if Btrfs is detected.
Verified on:
- SLES (Btrfs): Result is now TCONF (Skipped)
- RHEL (XFS): Result remains TPASS
--- testcases/kernel/syscalls/ustat/ustat01.c | 8 +++++++- testcases/kernel/syscalls/ustat/ustat02.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/ustat/ustat01.c +7 -1
@@ -13,6 +13,7 @@#include <errno.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/vfs.h> #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 = {
testcases/kernel/syscalls/ustat/ustat02.c +7 -1
@@ -14,6 +14,7 @@#include <errno.h> #include <sys/stat.h> #include <sys/types.h> +#include <sys/vfs.h> #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 = {
Signature · 5 lines
2.45.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 8 lines
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 usestst_brk(TCONF, ...)to gracefully skip the test on Btrfs.
That's why the test has known-fail tag, but maybe it's time to accept that ustat() is broken on Btrfs and it's not going to get fixed.
However we do have .skip_filesystems in tst_test structure exactly for cases like that, so it should be used instead.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 10 lines · Cyril Hrubis
Hi!
Quoted 8 lines
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 usestst_brk(TCONF, ...)to gracefully skip the test on Btrfs.
Quoted 6 lines
That's why the test has known-fail tag, but maybe it's time to accept that
ustat()is broken on Btrfs and it's not going to get fixed.However we do have .skip_filesystems in
tst_teststructure exactly for cases like that, so it should be used instead.
Hi Cyril,
Thank you for the review.
I will refactor both ustat01 and ustat02 to use .skip_filesystems and send a v2.
Signature · 6 lines
Regards, Disha -- Mailing list info: https://lists.linux.it/listinfo/ltp