* [LTP] [PATCH v1] tst_filesystems01.c: Add test for .filesystems @ 2025-05-29 10:51 Wei Gao via ltp 2025-09-16 11:02 ` Petr Vorel 2025-09-24 8:42 ` [LTP] [PATCH v2] " Wei Gao via ltp 0 siblings, 2 replies; 33+ messages in thread From: Wei Gao via ltp @ 2025-05-29 10:51 UTC (permalink / raw) To: ltp Fixes: https://github.com/linux-test-project/ltp/issues/1243 Signed-off-by: Wei Gao <wegao@suse.com> --- lib/newlib_tests/tst_filesystems01.c | 118 +++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 lib/newlib_tests/tst_filesystems01.c diff --git a/lib/newlib_tests/tst_filesystems01.c b/lib/newlib_tests/tst_filesystems01.c new file mode 100644 index 000000000..96f4b2d93 --- /dev/null +++ b/lib/newlib_tests/tst_filesystems01.c @@ -0,0 +1,118 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2025 Wei Gao <wegao@suse.com> + */ + +#include "tst_test.h" +#include "tst_safe_stdio.h" + +#define MOUNT_POINT "mount_test_filesystems" + +static int check_inode_size(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *tune2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "tune2fs -l %s 2>&1", tst_device->dev); + tune2fs = SAFE_POPEN(path, "r"); + if (tune2fs == NULL) + tst_brk(TBROK, "Can not popen %s", path); + + while (fgets(line, PATH_MAX, tune2fs)) { + if (*line && strstr(line, "Inode size:") && strstr(line, str_size)) { + tst_res(TPASS, "check inode size pass"); + return 0; + } + } + + pclose(tune2fs); + tst_res(TFAIL, "check inode size failed"); + return -1; +} + +static int check_mnt_data(char *opt) +{ + FILE *fp; + char line[PATH_MAX]; + + fp = SAFE_FOPEN("/proc/mounts", "r"); + if (fp == NULL) + tst_brk(TBROK, "Can not open /proc/mounts"); + while (fgets(line, PATH_MAX, fp)) { + if (*line && strstr(line, tst_device->dev) && strstr(line, opt)) { + tst_res(TPASS, "check mnt data pass"); + return 0; + } + } + SAFE_FCLOSE(fp); + tst_res(TFAIL, "check mnt data failed"); + return -1; +} + +static int check_mkfs_size_opt(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *dumpe2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "dumpe2fs -h %s 2>&1", tst_device->dev); + dumpe2fs = SAFE_POPEN(path, "r"); + if (dumpe2fs == NULL) + tst_brk(TBROK, "Can not popen %s", path); + + while (fgets(line, PATH_MAX, dumpe2fs)) { + if (*line && strstr(line, "Block count:") && strstr(line, str_size)) { + tst_res(TPASS, "check mkfs size opt pass"); + return 0; + } + } + + pclose(dumpe2fs); + tst_res(TFAIL, "check mkfs size opt failed"); + return -1; +} + +static void do_test(void) +{ + long fs_type; + + fs_type = tst_fs_type(MOUNT_POINT); + + if (fs_type == TST_EXT234_MAGIC) { + check_inode_size(128); + check_mkfs_size_opt(10240); + } + + if (fs_type == TST_XFS_MAGIC) + check_mnt_data("usrquota"); +} + +static struct tst_test test = { + .test_all = do_test, + .needs_root = 1, + .mntpoint = MOUNT_POINT, + .mount_device = 1, + .needs_cmds = (const char *[]) { + "tune2fs", + "dumpe2fs", + NULL + }, + .filesystems = (struct tst_fs []) { + { + .type = "ext3", + .mkfs_opts = (const char *const []){"-I", "128", NULL}, + .mkfs_size_opt = "10240", + }, + { + .type = "xfs", + .mnt_data = "usrquota", + }, + {} + }, + +}; -- 2.49.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v1] tst_filesystems01.c: Add test for .filesystems 2025-05-29 10:51 [LTP] [PATCH v1] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp @ 2025-09-16 11:02 ` Petr Vorel 2025-09-24 8:42 ` [LTP] [PATCH v2] " Wei Gao via ltp 1 sibling, 0 replies; 33+ messages in thread From: Petr Vorel @ 2025-09-16 11:02 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, Cyril, Cyril, single note below can wait after the release. Also, please have look if this fulfils your idea about testing the feature. > Fixes: https://github.com/linux-test-project/ltp/issues/1243 > Signed-off-by: Wei Gao <wegao@suse.com> > --- > lib/newlib_tests/tst_filesystems01.c | 118 +++++++++++++++++++++++++++ > 1 file changed, 118 insertions(+) > create mode 100644 lib/newlib_tests/tst_filesystems01.c The test is running fine on github, please add it to lib/newlib_tests/runtest.sh. +++ lib/newlib_tests/runtest.sh @@ -24,6 +24,7 @@ tst_checkpoint_wait_timeout tst_checkpoint_wake_timeout tst_device tst_expiration_timer +tst_filesystems01 tst_fuzzy_sync0[1-3] tst_needs_cmds0[1-36-8] tst_res_hexd ... > + snprintf(str_size, sizeof(str_size), "%u", size); > + snprintf(path, sizeof(path), "tune2fs -l %s 2>&1", tst_device->dev); > + tune2fs = SAFE_POPEN(path, "r"); > + if (tune2fs == NULL) > + tst_brk(TBROK, "Can not popen %s", path); The point of SAFE_* functions/macros is to avoid having to check in the tests :). Please remove these 2 lines. > + while (fgets(line, PATH_MAX, tune2fs)) { > + if (*line && strstr(line, "Inode size:") && strstr(line, str_size)) { Common patter for fgets() is to check for != NULL, then you don't need "*line &&": while (fgets(line, PATH_MAX, tune2fs) != NULL) { if (strstr(line, "Inode size:") && strstr(line, str_size)) { > + tst_res(TPASS, "check inode size pass"); > + return 0; > + } > + } > + > + pclose(tune2fs); > + tst_res(TFAIL, "check inode size failed"); > + return -1; > +} > + > +static int check_mnt_data(char *opt) > +{ > + FILE *fp; > + char line[PATH_MAX]; > + > + fp = SAFE_FOPEN("/proc/mounts", "r"); > + if (fp == NULL) > + tst_brk(TBROK, "Can not open /proc/mounts"); Also here. > + while (fgets(line, PATH_MAX, fp)) { > + if (*line && strstr(line, tst_device->dev) && strstr(line, opt)) { Also here. > + tst_res(TPASS, "check mnt data pass"); > + return 0; > + } > + } > + SAFE_FCLOSE(fp); > + tst_res(TFAIL, "check mnt data failed"); > + return -1; > +} > + > +static int check_mkfs_size_opt(unsigned int size) > +{ > + char path[PATH_MAX]; > + char line[PATH_MAX]; > + FILE *dumpe2fs; > + char str_size[NAME_MAX]; > + > + snprintf(str_size, sizeof(str_size), "%u", size); > + snprintf(path, sizeof(path), "dumpe2fs -h %s 2>&1", tst_device->dev); > + dumpe2fs = SAFE_POPEN(path, "r"); > + if (dumpe2fs == NULL) > + tst_brk(TBROK, "Can not popen %s", path); And here. > + > + while (fgets(line, PATH_MAX, dumpe2fs)) { > + if (*line && strstr(line, "Block count:") && strstr(line, str_size)) { And here. > + tst_res(TPASS, "check mkfs size opt pass"); > + return 0; > + } > + } > + > + pclose(dumpe2fs); > + tst_res(TFAIL, "check mkfs size opt failed"); > + return -1; > +} > + > +static void do_test(void) > +{ > + long fs_type; > + > + fs_type = tst_fs_type(MOUNT_POINT); > + > + if (fs_type == TST_EXT234_MAGIC) { > + check_inode_size(128); check_inode_size() and the other 2 test functions return int but you don't use the return value. Either use it or change return type to void. > + check_mkfs_size_opt(10240); > + } > + > + if (fs_type == TST_XFS_MAGIC) > + check_mnt_data("usrquota"); While this works, it expect that nobody changes .filesystems below. @Cyril: wouldn't be useful if the test itself had it's struct tst_fs member from filesystems[i] available? Static variable, either pointer to the member or instance of i from run_tcases_per_fs()? Because we always expect filesystems (.type) is unique in .filesystems. But in the future we might have test which uses several items in .filesystems with a different data but an unique filesystem (not needed so far). Kind regards, Petr > +} > + > +static struct tst_test test = { > + .test_all = do_test, > + .needs_root = 1, > + .mntpoint = MOUNT_POINT, > + .mount_device = 1, > + .needs_cmds = (const char *[]) { > + "tune2fs", > + "dumpe2fs", > + NULL > + }, > + .filesystems = (struct tst_fs []) { > + { > + .type = "ext3", > + .mkfs_opts = (const char *const []){"-I", "128", NULL}, > + .mkfs_size_opt = "10240", > + }, > + { > + .type = "xfs", > + .mnt_data = "usrquota", > + }, > + {} > + }, > + > +}; -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v2] tst_filesystems01.c: Add test for .filesystems 2025-05-29 10:51 [LTP] [PATCH v1] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2025-09-16 11:02 ` Petr Vorel @ 2025-09-24 8:42 ` Wei Gao via ltp 2025-10-30 20:17 ` Petr Vorel 2025-11-01 1:20 ` [LTP] [PATCH v3 0/2] " Wei Gao via ltp 1 sibling, 2 replies; 33+ messages in thread From: Wei Gao via ltp @ 2025-09-24 8:42 UTC (permalink / raw) To: ltp Fixes: https://github.com/linux-test-project/ltp/issues/1243 Signed-off-by: Wei Gao <wegao@suse.com> --- lib/newlib_tests/runtest.sh | 1 + lib/newlib_tests/tst_filesystems01.c | 104 +++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 lib/newlib_tests/tst_filesystems01.c diff --git a/lib/newlib_tests/runtest.sh b/lib/newlib_tests/runtest.sh index d87751c2f..71808ef8b 100755 --- a/lib/newlib_tests/runtest.sh +++ b/lib/newlib_tests/runtest.sh @@ -24,6 +24,7 @@ tst_checkpoint_wait_timeout tst_checkpoint_wake_timeout tst_device tst_expiration_timer +tst_filesystems01 tst_fuzzy_sync0[1-3] tst_needs_cmds0[1-36-8] tst_res_hexd diff --git a/lib/newlib_tests/tst_filesystems01.c b/lib/newlib_tests/tst_filesystems01.c new file mode 100644 index 000000000..4eca0af0e --- /dev/null +++ b/lib/newlib_tests/tst_filesystems01.c @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2025 Wei Gao <wegao@suse.com> + */ + +#include "tst_test.h" +#include "tst_safe_stdio.h" + +#define MOUNT_POINT "mount_test_filesystems" + +static int check_inode_size(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *tune2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "tune2fs -l %s 2>&1", tst_device->dev); + tune2fs = SAFE_POPEN(path, "r"); + + while (fgets(line, PATH_MAX, tune2fs) != NULL) { + if (strstr(line, "Inode size:") && strstr(line, str_size)) + return 0; + } + + pclose(tune2fs); + return -1; +} + +static int check_mnt_data(char *opt) +{ + FILE *fp; + char line[PATH_MAX]; + + fp = SAFE_FOPEN("/proc/mounts", "r"); + + while (fgets(line, PATH_MAX, fp) != NULL) { + if (strstr(line, tst_device->dev) && strstr(line, opt)) + return 0; + } + SAFE_FCLOSE(fp); + return -1; +} + +static int check_mkfs_size_opt(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *dumpe2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "dumpe2fs -h %s 2>&1", tst_device->dev); + dumpe2fs = SAFE_POPEN(path, "r"); + + while (fgets(line, PATH_MAX, dumpe2fs) != NULL) { + if (strstr(line, "Block count:") && strstr(line, str_size)) + return 0; + } + + pclose(dumpe2fs); + return -1; +} + +static void do_test(void) +{ + long fs_type; + + fs_type = tst_fs_type(MOUNT_POINT); + + if (fs_type == TST_EXT234_MAGIC) { + TST_EXP_PASS((check_inode_size(128))); + TST_EXP_PASS((check_mkfs_size_opt(10240))); + } + + if (fs_type == TST_XFS_MAGIC) + TST_EXP_PASS((check_mnt_data("usrquota"))); +} + +static struct tst_test test = { + .test_all = do_test, + .needs_root = 1, + .mntpoint = MOUNT_POINT, + .mount_device = 1, + .needs_cmds = (const char *[]) { + "tune2fs", + "dumpe2fs", + NULL + }, + .filesystems = (struct tst_fs []) { + { + .type = "ext3", + .mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}, + .mkfs_size_opt = "10240", + }, + { + .type = "xfs", + .mnt_data = "usrquota", + }, + {} + }, + +}; -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v2] tst_filesystems01.c: Add test for .filesystems 2025-09-24 8:42 ` [LTP] [PATCH v2] " Wei Gao via ltp @ 2025-10-30 20:17 ` Petr Vorel 2025-10-31 6:33 ` Wei Gao via ltp 2025-11-01 1:20 ` [LTP] [PATCH v3 0/2] " Wei Gao via ltp 1 sibling, 1 reply; 33+ messages in thread From: Petr Vorel @ 2025-10-30 20:17 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, ... > + .needs_cmds = (const char *[]) { > + "tune2fs", > + "dumpe2fs", If you don't add packages required in these 2 binaries into scripts in ci/ it will not be tested in GitHub Actions. See https://github.com/linux-test-project/ltp/actions/runs/17971580970/job/51115261638: 2025-09-24T09:00:56.9304198Z tst_cmd.c:268: TCONF: Couldn't find 'tune2fs' in $PATH Alpine: e2fsprogs-extra Debian, openSUSE, Fedora (hopefully): e2fsprogs Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v2] tst_filesystems01.c: Add test for .filesystems 2025-10-30 20:17 ` Petr Vorel @ 2025-10-31 6:33 ` Wei Gao via ltp 2025-10-31 9:13 ` Petr Vorel 0 siblings, 1 reply; 33+ messages in thread From: Wei Gao via ltp @ 2025-10-31 6:33 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp On Thu, Oct 30, 2025 at 09:17:34PM +0100, Petr Vorel wrote: > Hi Wei, > > ... > > + .needs_cmds = (const char *[]) { > > + "tune2fs", > > + "dumpe2fs", > If you don't add packages required in these 2 binaries into scripts in ci/ it > will not be tested in GitHub Actions. > > See > https://github.com/linux-test-project/ltp/actions/runs/17971580970/job/51115261638: > 2025-09-24T09:00:56.9304198Z tst_cmd.c:268: TCONF: Couldn't find 'tune2fs' in $PATH > > Alpine: e2fsprogs-extra > Debian, openSUSE, Fedora (hopefully): e2fsprogs when i add following diff another CI error triggered on alpine, it seems /dev/not mounted. further check. diff --git a/ci/alpine.sh b/ci/alpine.sh index f3a1bf528..254f4aaec 100755 --- a/ci/alpine.sh +++ b/ci/alpine.sh @@ -25,7 +25,6 @@ apk add \ musl-dev \ numactl-dev \ openssl-dev \ - e2fsprogs-extra \ pkgconfig https://github.com/coolgw/ltp/actions/runs/18960845023/job/54148138737 2025-10-31T02:50:14.5257746Z runtest TINFO: * shell/tst_format_device.sh 2025-10-31T02:50:14.5260052Z tst_format_device 1 TINFO: Running: tst_format_device.sh 2025-10-31T02:50:14.5268691Z tst_format_device 1 TINFO: Tested kernel: Linux 0ba9f024d6b7 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 Linux 2025-10-31T02:50:14.5329045Z tst_format_device 1 TINFO: Using /tmp/LTP_tst_format_device.XXXXOajpgN as tmpdir (UNKNOWN filesystem) 2025-10-31T02:50:14.5352954Z tst_device.c:98: TINFO: Found free device 0 '/dev/loop0' 2025-10-31T02:50:14.5491591Z tst_format_device 1 TINFO: Formatting ext2 with opts='-b 1024 /dev/loop0 5m' 2025-10-31T02:50:14.5555250Z tst_format_device 1 TINFO: timeout per run is 0h 5m 0s 2025-10-31T02:50:14.5571366Z tst_format_device 1 TPASS: device formatted 2025-10-31T02:50:14.5594507Z df: /dev/loop0: can't find mount point << 2025-10-31T02:50:14.5598211Z tst_format_device 2 TFAIL: df /dev/loop0 | grep -q /dev failed unexpectedly 2025-10-31T02:50:14.6127085Z tst_format_device 3 TINFO: AppArmor enabled, this may affect test results 2025-10-31T02:50:14.6128036Z tst_format_device 3 TINFO: it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root) 2025-10-31T02:50:14.6128824Z tst_format_device 3 TINFO: loaded AppArmor profiles: none > > Kind regards, > Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v2] tst_filesystems01.c: Add test for .filesystems 2025-10-31 6:33 ` Wei Gao via ltp @ 2025-10-31 9:13 ` Petr Vorel 0 siblings, 0 replies; 33+ messages in thread From: Petr Vorel @ 2025-10-31 9:13 UTC (permalink / raw) To: Wei Gao; +Cc: ltp ... > > Alpine: e2fsprogs-extra > > Debian, openSUSE, Fedora (hopefully): e2fsprogs > when i add following diff another CI error triggered on alpine, it > seems /dev/not mounted. > further check. > diff --git a/ci/alpine.sh b/ci/alpine.sh > index f3a1bf528..254f4aaec 100755 > --- a/ci/alpine.sh > +++ b/ci/alpine.sh > @@ -25,7 +25,6 @@ apk add \ > musl-dev \ > numactl-dev \ > openssl-dev \ > - e2fsprogs-extra \ > pkgconfig > https://github.com/coolgw/ltp/actions/runs/18960845023/job/54148138737 > 2025-10-31T02:50:14.5257746Z runtest TINFO: * shell/tst_format_device.sh > 2025-10-31T02:50:14.5260052Z tst_format_device 1 TINFO: Running: tst_format_device.sh > 2025-10-31T02:50:14.5268691Z tst_format_device 1 TINFO: Tested kernel: Linux 0ba9f024d6b7 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 Linux > 2025-10-31T02:50:14.5329045Z tst_format_device 1 TINFO: Using /tmp/LTP_tst_format_device.XXXXOajpgN as tmpdir (UNKNOWN filesystem) > 2025-10-31T02:50:14.5352954Z tst_device.c:98: TINFO: Found free device 0 '/dev/loop0' > 2025-10-31T02:50:14.5491591Z tst_format_device 1 TINFO: Formatting ext2 with opts='-b 1024 /dev/loop0 5m' > 2025-10-31T02:50:14.5555250Z tst_format_device 1 TINFO: timeout per run is 0h 5m 0s > 2025-10-31T02:50:14.5571366Z tst_format_device 1 TPASS: device formatted > 2025-10-31T02:50:14.5594507Z df: /dev/loop0: can't find mount point << > 2025-10-31T02:50:14.5598211Z tst_format_device 2 TFAIL: df /dev/loop0 | grep -q /dev failed unexpectedly > 2025-10-31T02:50:14.6127085Z tst_format_device 3 TINFO: AppArmor enabled, this may affect test results > 2025-10-31T02:50:14.6128036Z tst_format_device 3 TINFO: it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root) > 2025-10-31T02:50:14.6128824Z tst_format_device 3 TINFO: loaded AppArmor profiles: none Strange, because previous shell/tst_mount_device.sh works: runtest TINFO: * shell/tst_mount_device.sh tst_mount_device 1 TINFO: Running: tst_mount_device.sh tst_mount_device 1 TINFO: Tested kernel: Linux 0ba9f024d6b7 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 Linux tst_mount_device 1 TINFO: Using /tmp/LTP_tst_mount_device.XXXXmbKhac as tmpdir (UNKNOWN filesystem) tst_device.c:98: TINFO: Found free device 0 '/dev/loop0' tst_mount_device 1 TINFO: Formatting ext4 with opts='/dev/loop0' tst_mount_device 1 TINFO: Mounting device: mount -t ext4 /dev/loop0 /tmp/LTP_tst_mount_device.XXXXmbKhac/mntpoint tst_mount_device 1 TINFO: timeout per run is 0h 5m 0s tst_mount_device 1 TPASS: cd /tmp/LTP_tst_mount_device.XXXXmbKhac/mntpoint passed as expected Kind regards, Petr > > Kind regards, > > Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v3 0/2] tst_filesystems01.c: Add test for .filesystems 2025-09-24 8:42 ` [LTP] [PATCH v2] " Wei Gao via ltp 2025-10-30 20:17 ` Petr Vorel @ 2025-11-01 1:20 ` Wei Gao via ltp 2025-11-01 1:20 ` [LTP] [PATCH v3 1/2] " Wei Gao via ltp ` (2 more replies) 1 sibling, 3 replies; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-01 1:20 UTC (permalink / raw) To: ltp v2->v3: add e2fsprogs for CI check Wei Gao (2): tst_filesystems01.c: Add test for .filesystems tst_format_device.sh: Add e2fsprogs package for CI test ci/alpine.sh | 1 + ci/debian.sh | 1 + ci/fedora.sh | 1 + ci/tumbleweed.sh | 1 + lib/newlib_tests/runtest.sh | 1 + lib/newlib_tests/shell/tst_format_device.sh | 1 + lib/newlib_tests/tst_filesystems01.c | 104 ++++++++++++++++++++ 7 files changed, 110 insertions(+) create mode 100644 lib/newlib_tests/tst_filesystems01.c -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-01 1:20 ` [LTP] [PATCH v3 0/2] " Wei Gao via ltp @ 2025-11-01 1:20 ` Wei Gao via ltp 2025-11-11 12:06 ` Petr Vorel 2025-11-01 1:20 ` [LTP] [PATCH v3 2/2] tst_format_device.sh: Add e2fsprogs package for CI test Wei Gao via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2 siblings, 1 reply; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-01 1:20 UTC (permalink / raw) To: ltp Fixes: https://github.com/linux-test-project/ltp/issues/1243 Signed-off-by: Wei Gao <wegao@suse.com> --- lib/newlib_tests/runtest.sh | 1 + lib/newlib_tests/tst_filesystems01.c | 104 +++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 lib/newlib_tests/tst_filesystems01.c diff --git a/lib/newlib_tests/runtest.sh b/lib/newlib_tests/runtest.sh index d87751c2f..71808ef8b 100755 --- a/lib/newlib_tests/runtest.sh +++ b/lib/newlib_tests/runtest.sh @@ -24,6 +24,7 @@ tst_checkpoint_wait_timeout tst_checkpoint_wake_timeout tst_device tst_expiration_timer +tst_filesystems01 tst_fuzzy_sync0[1-3] tst_needs_cmds0[1-36-8] tst_res_hexd diff --git a/lib/newlib_tests/tst_filesystems01.c b/lib/newlib_tests/tst_filesystems01.c new file mode 100644 index 000000000..4eca0af0e --- /dev/null +++ b/lib/newlib_tests/tst_filesystems01.c @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2025 Wei Gao <wegao@suse.com> + */ + +#include "tst_test.h" +#include "tst_safe_stdio.h" + +#define MOUNT_POINT "mount_test_filesystems" + +static int check_inode_size(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *tune2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "tune2fs -l %s 2>&1", tst_device->dev); + tune2fs = SAFE_POPEN(path, "r"); + + while (fgets(line, PATH_MAX, tune2fs) != NULL) { + if (strstr(line, "Inode size:") && strstr(line, str_size)) + return 0; + } + + pclose(tune2fs); + return -1; +} + +static int check_mnt_data(char *opt) +{ + FILE *fp; + char line[PATH_MAX]; + + fp = SAFE_FOPEN("/proc/mounts", "r"); + + while (fgets(line, PATH_MAX, fp) != NULL) { + if (strstr(line, tst_device->dev) && strstr(line, opt)) + return 0; + } + SAFE_FCLOSE(fp); + return -1; +} + +static int check_mkfs_size_opt(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *dumpe2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "dumpe2fs -h %s 2>&1", tst_device->dev); + dumpe2fs = SAFE_POPEN(path, "r"); + + while (fgets(line, PATH_MAX, dumpe2fs) != NULL) { + if (strstr(line, "Block count:") && strstr(line, str_size)) + return 0; + } + + pclose(dumpe2fs); + return -1; +} + +static void do_test(void) +{ + long fs_type; + + fs_type = tst_fs_type(MOUNT_POINT); + + if (fs_type == TST_EXT234_MAGIC) { + TST_EXP_PASS((check_inode_size(128))); + TST_EXP_PASS((check_mkfs_size_opt(10240))); + } + + if (fs_type == TST_XFS_MAGIC) + TST_EXP_PASS((check_mnt_data("usrquota"))); +} + +static struct tst_test test = { + .test_all = do_test, + .needs_root = 1, + .mntpoint = MOUNT_POINT, + .mount_device = 1, + .needs_cmds = (const char *[]) { + "tune2fs", + "dumpe2fs", + NULL + }, + .filesystems = (struct tst_fs []) { + { + .type = "ext3", + .mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}, + .mkfs_size_opt = "10240", + }, + { + .type = "xfs", + .mnt_data = "usrquota", + }, + {} + }, + +}; -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-01 1:20 ` [LTP] [PATCH v3 1/2] " Wei Gao via ltp @ 2025-11-11 12:06 ` Petr Vorel 2025-11-12 6:51 ` Wei Gao via ltp 0 siblings, 1 reply; 33+ messages in thread From: Petr Vorel @ 2025-11-11 12:06 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, ... > +static void do_test(void) > +{ > + long fs_type; > + > + fs_type = tst_fs_type(MOUNT_POINT); > + > + if (fs_type == TST_EXT234_MAGIC) { > + TST_EXP_PASS((check_inode_size(128))); > + TST_EXP_PASS((check_mkfs_size_opt(10240))); very nit: I would personally add #define for 128 and 10240, but sure it's ok to keep it hardcoded on 2 places. Reviewed-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr > + } > + > + if (fs_type == TST_XFS_MAGIC) > + TST_EXP_PASS((check_mnt_data("usrquota"))); > +} > + > +static struct tst_test test = { > + .test_all = do_test, > + .needs_root = 1, > + .mntpoint = MOUNT_POINT, > + .mount_device = 1, > + .needs_cmds = (const char *[]) { > + "tune2fs", > + "dumpe2fs", > + NULL > + }, > + .filesystems = (struct tst_fs []) { > + { > + .type = "ext3", > + .mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}, > + .mkfs_size_opt = "10240", > + }, > + { > + .type = "xfs", > + .mnt_data = "usrquota", > + }, > + {} > + }, > + > +}; -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-11 12:06 ` Petr Vorel @ 2025-11-12 6:51 ` Wei Gao via ltp 2025-11-12 9:22 ` Petr Vorel 0 siblings, 1 reply; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-12 6:51 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp On Tue, Nov 11, 2025 at 01:06:00PM +0100, Petr Vorel wrote: > Hi Wei, > > ... > > +static void do_test(void) > > +{ > > + long fs_type; > > + > > + fs_type = tst_fs_type(MOUNT_POINT); > > + > > + if (fs_type == TST_EXT234_MAGIC) { > > + TST_EXP_PASS((check_inode_size(128))); > > + TST_EXP_PASS((check_mkfs_size_opt(10240))); > > very nit: I would personally add #define for 128 and 10240, but sure it's ok to > keep it hardcoded on 2 places. I thought also use #define but i found and can not replace it in "mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}", so i keep hardcoded number here. > > Reviewed-by: Petr Vorel <pvorel@suse.cz> > > Kind regards, > Petr > > > + } > > + > > + if (fs_type == TST_XFS_MAGIC) > > + TST_EXP_PASS((check_mnt_data("usrquota"))); > > +} > > + > > +static struct tst_test test = { > > + .test_all = do_test, > > + .needs_root = 1, > > + .mntpoint = MOUNT_POINT, > > + .mount_device = 1, > > + .needs_cmds = (const char *[]) { > > + "tune2fs", > > + "dumpe2fs", > > + NULL > > + }, > > + .filesystems = (struct tst_fs []) { > > + { > > + .type = "ext3", > > + .mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}, > > + .mkfs_size_opt = "10240", > > + }, > > + { > > + .type = "xfs", > > + .mnt_data = "usrquota", > > + }, > > + {} > > + }, > > + > > +}; -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-12 6:51 ` Wei Gao via ltp @ 2025-11-12 9:22 ` Petr Vorel 2025-11-12 10:32 ` Cyril Hrubis 0 siblings, 1 reply; 33+ messages in thread From: Petr Vorel @ 2025-11-12 9:22 UTC (permalink / raw) To: Wei Gao; +Cc: ltp > On Tue, Nov 11, 2025 at 01:06:00PM +0100, Petr Vorel wrote: > > Hi Wei, > > ... > > > +static void do_test(void) > > > +{ > > > + long fs_type; > > > + > > > + fs_type = tst_fs_type(MOUNT_POINT); > > > + > > > + if (fs_type == TST_EXT234_MAGIC) { > > > + TST_EXP_PASS((check_inode_size(128))); > > > + TST_EXP_PASS((check_mkfs_size_opt(10240))); > > very nit: I would personally add #define for 128 and 10240, but sure it's ok to > > keep it hardcoded on 2 places. > I thought also use #define but i found and can not replace it in > "mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}", > so i keep hardcoded number here. Thanks for info. Sure, no problem. Cc Cyril in case it's worth to fix it in metaparse.c. Kind regards, Petr > > Kind regards, > > Petr > > > + } > > > + > > > + if (fs_type == TST_XFS_MAGIC) > > > + TST_EXP_PASS((check_mnt_data("usrquota"))); > > > +} > > > + > > > +static struct tst_test test = { > > > + .test_all = do_test, > > > + .needs_root = 1, > > > + .mntpoint = MOUNT_POINT, > > > + .mount_device = 1, > > > + .needs_cmds = (const char *[]) { > > > + "tune2fs", > > > + "dumpe2fs", > > > + NULL > > > + }, > > > + .filesystems = (struct tst_fs []) { > > > + { > > > + .type = "ext3", > > > + .mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}, > > > + .mkfs_size_opt = "10240", > > > + }, > > > + { > > > + .type = "xfs", > > > + .mnt_data = "usrquota", > > > + }, > > > + {} > > > + }, > > > + > > > +}; -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-12 9:22 ` Petr Vorel @ 2025-11-12 10:32 ` Cyril Hrubis 2025-11-12 11:34 ` Wei Gao via ltp 2025-11-12 12:21 ` Petr Vorel 0 siblings, 2 replies; 33+ messages in thread From: Cyril Hrubis @ 2025-11-12 10:32 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp Hi! > > > > +static void do_test(void) > > > > +{ > > > > + long fs_type; > > > > + > > > > + fs_type = tst_fs_type(MOUNT_POINT); > > > > + > > > > + if (fs_type == TST_EXT234_MAGIC) { > > > > + TST_EXP_PASS((check_inode_size(128))); > > > > + TST_EXP_PASS((check_mkfs_size_opt(10240))); > > > > very nit: I would personally add #define for 128 and 10240, but sure it's ok to > > > keep it hardcoded on 2 places. > > I thought also use #define but i found and can not replace it in > > "mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}", > > so i keep hardcoded number here. > > Thanks for info. Sure, no problem. > > Cc Cyril in case it's worth to fix it in metaparse.c. The metaparse tool does macro expansion, that shouldn't be a problem. Also metaparse only scans testcases/ directory during the build. The lib/ directory is not parsed at all. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-12 10:32 ` Cyril Hrubis @ 2025-11-12 11:34 ` Wei Gao via ltp 2025-11-12 11:44 ` Cyril Hrubis 2025-11-12 12:21 ` Petr Vorel 1 sibling, 1 reply; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-12 11:34 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp On Wed, Nov 12, 2025 at 11:32:13AM +0100, Cyril Hrubis wrote: > Hi! > > > > > +static void do_test(void) > > > > > +{ > > > > > + long fs_type; > > > > > + > > > > > + fs_type = tst_fs_type(MOUNT_POINT); > > > > > + > > > > > + if (fs_type == TST_EXT234_MAGIC) { > > > > > + TST_EXP_PASS((check_inode_size(128))); > > > > > + TST_EXP_PASS((check_mkfs_size_opt(10240))); > > > > > > very nit: I would personally add #define for 128 and 10240, but sure it's ok to > > > > keep it hardcoded on 2 places. > > > I thought also use #define but i found and can not replace it in > > > "mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}", > > > so i keep hardcoded number here. > > > > Thanks for info. Sure, no problem. > > > > Cc Cyril in case it's worth to fix it in metaparse.c. > > The metaparse tool does macro expansion, that shouldn't be a problem. > > Also metaparse only scans testcases/ directory during the build. The > lib/ directory is not parsed at all. @Cyril Could you help confirm following is the correct way use ? diff --git a/lib/newlib_tests/tst_filesystems01.c b/lib/newlib_tests/tst_filesystems01.c index 4eca0af0e..b2a2ce050 100644 --- a/lib/newlib_tests/tst_filesystems01.c +++ b/lib/newlib_tests/tst_filesystems01.c @@ -6,6 +6,12 @@ #include "tst_test.h" #include "tst_safe_stdio.h" +#define INODE_SIZE 128 +#define MKFS_SIZE_VAL 10240 + +#define __STR(x) #x +#define STR(x) __STR(x) + #define MOUNT_POINT "mount_test_filesystems" static int check_inode_size(unsigned int size) @@ -91,8 +97,8 @@ static struct tst_test test = { .filesystems = (struct tst_fs []) { { .type = "ext3", - .mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}, - .mkfs_size_opt = "10240", + .mkfs_opts = (const char *const []){"-I", STR(INODE_SIZE), "-b", "1024", NULL}, + .mkfs_size_opt = STR(MKFS_SIZE_VAL), }, { .type = "xfs", > > -- > Cyril Hrubis > chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-12 11:34 ` Wei Gao via ltp @ 2025-11-12 11:44 ` Cyril Hrubis 2025-11-12 12:14 ` Wei Gao via ltp 0 siblings, 1 reply; 33+ messages in thread From: Cyril Hrubis @ 2025-11-12 11:44 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi! > > > Thanks for info. Sure, no problem. > > > > > > Cc Cyril in case it's worth to fix it in metaparse.c. > > > > The metaparse tool does macro expansion, that shouldn't be a problem. > > > > Also metaparse only scans testcases/ directory during the build. The > > lib/ directory is not parsed at all. > > @Cyril > Could you help confirm following is the correct way use ? Yes, forcing double pass for the macro preprocessor is the correct solution and We already have the same code in TST_TO_STR() in tst_common.h -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-12 11:44 ` Cyril Hrubis @ 2025-11-12 12:14 ` Wei Gao via ltp 0 siblings, 0 replies; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-12 12:14 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp On Wed, Nov 12, 2025 at 12:44:03PM +0100, Cyril Hrubis wrote: > Hi! > > > > Thanks for info. Sure, no problem. > > > > > > > > Cc Cyril in case it's worth to fix it in metaparse.c. > > > > > > The metaparse tool does macro expansion, that shouldn't be a problem. > > > > > > Also metaparse only scans testcases/ directory during the build. The > > > lib/ directory is not parsed at all. > > > > @Cyril > > Could you help confirm following is the correct way use ? > > Yes, forcing double pass for the macro preprocessor is the correct > solution and We already have the same code in TST_TO_STR() in > tst_common.h > Thanks Cyril / Petr, i will update it in next version. > -- > Cyril Hrubis > chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-12 10:32 ` Cyril Hrubis 2025-11-12 11:34 ` Wei Gao via ltp @ 2025-11-12 12:21 ` Petr Vorel 2025-11-13 1:28 ` Wei Gao via ltp 1 sibling, 1 reply; 33+ messages in thread From: Petr Vorel @ 2025-11-12 12:21 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp > Hi! > > > > > +static void do_test(void) > > > > > +{ > > > > > + long fs_type; > > > > > + > > > > > + fs_type = tst_fs_type(MOUNT_POINT); > > > > > + > > > > > + if (fs_type == TST_EXT234_MAGIC) { > > > > > + TST_EXP_PASS((check_inode_size(128))); > > > > > + TST_EXP_PASS((check_mkfs_size_opt(10240))); > > > > very nit: I would personally add #define for 128 and 10240, but sure it's ok to > > > > keep it hardcoded on 2 places. > > > I thought also use #define but i found and can not replace it in > > > "mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}", > > > so i keep hardcoded number here. > > Thanks for info. Sure, no problem. > > Cc Cyril in case it's worth to fix it in metaparse.c. > The metaparse tool does macro expansion, that shouldn't be a problem. > Also metaparse only scans testcases/ directory during the build. The > lib/ directory is not parsed at all. @Cyril Ah, I'm sorry I forget it's a library test, not an ordinary test. @Wei I thought tested and see the problem, but you probably just suspect it would be a problem. Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems 2025-11-12 12:21 ` Petr Vorel @ 2025-11-13 1:28 ` Wei Gao via ltp 0 siblings, 0 replies; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-13 1:28 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp On Wed, Nov 12, 2025 at 01:21:26PM +0100, Petr Vorel wrote: > > Hi! > > > > > > +static void do_test(void) > > > > > > +{ > > > > > > + long fs_type; > > > > > > + > > > > > > + fs_type = tst_fs_type(MOUNT_POINT); > > > > > > + > > > > > > + if (fs_type == TST_EXT234_MAGIC) { > > > > > > + TST_EXP_PASS((check_inode_size(128))); > > > > > > + TST_EXP_PASS((check_mkfs_size_opt(10240))); > > > > > > very nit: I would personally add #define for 128 and 10240, but sure it's ok to > > > > > keep it hardcoded on 2 places. > > > > I thought also use #define but i found and can not replace it in > > > > "mkfs_opts = (const char *const []){"-I", "128", "-b", "1024", NULL}", > > > > so i keep hardcoded number here. > > > > Thanks for info. Sure, no problem. > > > > Cc Cyril in case it's worth to fix it in metaparse.c. > > > The metaparse tool does macro expansion, that shouldn't be a problem. > > > Also metaparse only scans testcases/ directory during the build. The > > lib/ directory is not parsed at all. > > @Cyril Ah, I'm sorry I forget it's a library test, not an ordinary test. > > @Wei I thought tested and see the problem, but you probably just suspect it > would be a problem. Sorry i have not deep checked, since i put "INODE_SIZE" into mkfs_opts and error report so i guess it not support it. > > Kind regards, > Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v3 2/2] tst_format_device.sh: Add e2fsprogs package for CI test 2025-11-01 1:20 ` [LTP] [PATCH v3 0/2] " Wei Gao via ltp 2025-11-01 1:20 ` [LTP] [PATCH v3 1/2] " Wei Gao via ltp @ 2025-11-01 1:20 ` Wei Gao via ltp 2025-11-11 12:22 ` Petr Vorel 2025-11-13 1:52 ` [LTP] [PATCH v4 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2 siblings, 1 reply; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-01 1:20 UTC (permalink / raw) To: ltp For alpine platform we should mount /dev/loop device before df check. Otherwise following error will be triggered runtest TINFO: * shell/tst_format_device.sh tst_format_device 1 TINFO: Running: tst_format_device.sh tst_format_device 1 TINFO: Tested kernel: Linux 0ba9f024d6b7 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 Linux tst_format_device 1 TINFO: Using /tmp/LTP_tst_format_device.XXXXOajpgN as tmpdir (UNKNOWN filesystem) tst_device.c:98: TINFO: Found free device 0 '/dev/loop0' tst_format_device 1 TINFO: Formatting ext2 with opts='-b 1024 /dev/loop0 5m' tst_format_device 1 TINFO: timeout per run is 0h 5m 0s tst_format_device 1 TPASS: device formatted df: /dev/loop0: can't find mount point tst_format_device 2 TFAIL: df /dev/loop0 | grep -q /dev failed unexpectedly tst_format_device 3 TINFO: AppArmor enabled, this may affect test results tst_format_device 3 TINFO: it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root) tst_format_device 3 TINFO: loaded AppArmor profiles: none Signed-off-by: Wei Gao <wegao@suse.com> --- ci/alpine.sh | 1 + ci/debian.sh | 1 + ci/fedora.sh | 1 + ci/tumbleweed.sh | 1 + lib/newlib_tests/shell/tst_format_device.sh | 1 + 5 files changed, 5 insertions(+) diff --git a/ci/alpine.sh b/ci/alpine.sh index 254f4aaec..f3a1bf528 100755 --- a/ci/alpine.sh +++ b/ci/alpine.sh @@ -25,6 +25,7 @@ apk add \ musl-dev \ numactl-dev \ openssl-dev \ + e2fsprogs-extra \ pkgconfig cat /etc/os-release diff --git a/ci/debian.sh b/ci/debian.sh index 0445c92ec..767c9b985 100755 --- a/ci/debian.sh +++ b/ci/debian.sh @@ -33,6 +33,7 @@ pkg_minimal=" linux-libc-dev lsb-release pkg-config + e2fsprogs " pkg_nonessential=" diff --git a/ci/fedora.sh b/ci/fedora.sh index f57806ebf..f4482a1da 100755 --- a/ci/fedora.sh +++ b/ci/fedora.sh @@ -26,6 +26,7 @@ $yum \ libtirpc \ libtirpc-devel \ pkg-config \ + e2fsprogs \ redhat-lsb-core # CentOS 8 fixes diff --git a/ci/tumbleweed.sh b/ci/tumbleweed.sh index 8a30b02c2..8f23229df 100755 --- a/ci/tumbleweed.sh +++ b/ci/tumbleweed.sh @@ -30,6 +30,7 @@ while [ $i != 0 ]; do libtirpc-devel \ linux-glibc-devel \ lsb-release \ + e2fsprogs \ pkg-config ret=$? diff --git a/lib/newlib_tests/shell/tst_format_device.sh b/lib/newlib_tests/shell/tst_format_device.sh index dbe4ea9e7..bd4aa2ed9 100755 --- a/lib/newlib_tests/shell/tst_format_device.sh +++ b/lib/newlib_tests/shell/tst_format_device.sh @@ -3,6 +3,7 @@ # Copyright (c) 2022 Petr Vorel <pvorel@suse.cz> TST_FORMAT_DEVICE=1 +TST_MOUNT_DEVICE=1 TST_NEEDS_ROOT=1 TST_TESTFUNC=test TST_CNT=2 -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v3 2/2] tst_format_device.sh: Add e2fsprogs package for CI test 2025-11-01 1:20 ` [LTP] [PATCH v3 2/2] tst_format_device.sh: Add e2fsprogs package for CI test Wei Gao via ltp @ 2025-11-11 12:22 ` Petr Vorel 0 siblings, 0 replies; 33+ messages in thread From: Petr Vorel @ 2025-11-11 12:22 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, > For alpine platform we should mount /dev/loop device before df check. > Otherwise following error will be triggered > runtest TINFO: * shell/tst_format_device.sh > tst_format_device 1 TINFO: Running: tst_format_device.sh > tst_format_device 1 TINFO: Tested kernel: Linux 0ba9f024d6b7 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 Linux > tst_format_device 1 TINFO: Using /tmp/LTP_tst_format_device.XXXXOajpgN as tmpdir (UNKNOWN filesystem) > tst_device.c:98: TINFO: Found free device 0 '/dev/loop0' > tst_format_device 1 TINFO: Formatting ext2 with opts='-b 1024 /dev/loop0 5m' > tst_format_device 1 TINFO: timeout per run is 0h 5m 0s > tst_format_device 1 TPASS: device formatted > df: /dev/loop0: can't find mount point > tst_format_device 2 TFAIL: df /dev/loop0 | grep -q /dev failed unexpectedly > tst_format_device 3 TINFO: AppArmor enabled, this may affect test results > tst_format_device 3 TINFO: it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root) > tst_format_device 3 TINFO: loaded AppArmor profiles: none I see busybox df implementation require mounting (unlike coreutils implementation). nit: As this is clearly completely unrelated change (but most of the git commit message is in the description) it would be clearer to have it as a separate change (as a previous commit, before adding packages). + mention in the commit message it's due busybox. The subject of commit with ci/* changes could have prefix 'ci' (it's due tst_format_device.sh, but you modify our CI). > --- > ci/alpine.sh | 1 + > ci/debian.sh | 1 + > ci/fedora.sh | 1 + > ci/tumbleweed.sh | 1 + > lib/newlib_tests/shell/tst_format_device.sh | 1 + > 5 files changed, 5 insertions(+) ... > diff --git a/lib/newlib_tests/shell/tst_format_device.sh b/lib/newlib_tests/shell/tst_format_device.sh > index dbe4ea9e7..bd4aa2ed9 100755 > --- a/lib/newlib_tests/shell/tst_format_device.sh > +++ b/lib/newlib_tests/shell/tst_format_device.sh > @@ -3,6 +3,7 @@ > # Copyright (c) 2022 Petr Vorel <pvorel@suse.cz> > TST_FORMAT_DEVICE=1 > +TST_MOUNT_DEVICE=1 nit: TST_MOUNT_DEVICE=1 implies TST_FORMAT_DEVICE=1 (not a mistake, but TST_FORMAT_DEVICE=1 is not necessary). Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v4 0/3] tst_filesystems01.c: Add test for .filesystems 2025-11-01 1:20 ` [LTP] [PATCH v3 0/2] " Wei Gao via ltp 2025-11-01 1:20 ` [LTP] [PATCH v3 1/2] " Wei Gao via ltp 2025-11-01 1:20 ` [LTP] [PATCH v3 2/2] tst_format_device.sh: Add e2fsprogs package for CI test Wei Gao via ltp @ 2025-11-13 1:52 ` Wei Gao via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 1/3] " Wei Gao via ltp ` (3 more replies) 2 siblings, 4 replies; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-13 1:52 UTC (permalink / raw) To: ltp v3->v4: - Use #define for 128 and 10240 - Change commit subject with ci prefix if ci related changed - Separate change which unrelated Wei Gao (3): tst_filesystems01.c: Add test for .filesystems ci: Add mount operation for busybox ci: Add e2fsprogs package for CI test ci/alpine.sh | 1 + ci/debian.sh | 1 + ci/fedora.sh | 1 + ci/tumbleweed.sh | 1 + lib/newlib_tests/runtest.sh | 1 + lib/newlib_tests/shell/tst_format_device.sh | 2 +- lib/newlib_tests/tst_filesystems01.c | 108 ++++++++++++++++++++ 7 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 lib/newlib_tests/tst_filesystems01.c -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v4 1/3] tst_filesystems01.c: Add test for .filesystems 2025-11-13 1:52 ` [LTP] [PATCH v4 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp @ 2025-11-13 1:52 ` Wei Gao via ltp 2026-01-22 3:37 ` Li Wang via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 2/3] ci: Add mount operation for busybox Wei Gao via ltp ` (2 subsequent siblings) 3 siblings, 1 reply; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-13 1:52 UTC (permalink / raw) To: ltp Fixes: https://github.com/linux-test-project/ltp/issues/1243 Signed-off-by: Wei Gao <wegao@suse.com> Reviewed-by: Petr Vorel <petr.vorel@gmail.com> --- lib/newlib_tests/runtest.sh | 1 + lib/newlib_tests/tst_filesystems01.c | 108 +++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 lib/newlib_tests/tst_filesystems01.c diff --git a/lib/newlib_tests/runtest.sh b/lib/newlib_tests/runtest.sh index d87751c2f..71808ef8b 100755 --- a/lib/newlib_tests/runtest.sh +++ b/lib/newlib_tests/runtest.sh @@ -24,6 +24,7 @@ tst_checkpoint_wait_timeout tst_checkpoint_wake_timeout tst_device tst_expiration_timer +tst_filesystems01 tst_fuzzy_sync0[1-3] tst_needs_cmds0[1-36-8] tst_res_hexd diff --git a/lib/newlib_tests/tst_filesystems01.c b/lib/newlib_tests/tst_filesystems01.c new file mode 100644 index 000000000..dd24abca2 --- /dev/null +++ b/lib/newlib_tests/tst_filesystems01.c @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2025 Wei Gao <wegao@suse.com> + */ + +#include "tst_test.h" +#include "tst_safe_stdio.h" + +#define INODE_SIZE 128 +#define BLOCK_SIZE 1024 +#define MKFS_SIZE_VAL 10240 + +#define MOUNT_POINT "mount_test_filesystems" + +static int check_inode_size(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *tune2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "tune2fs -l %s 2>&1", tst_device->dev); + tune2fs = SAFE_POPEN(path, "r"); + + while (fgets(line, PATH_MAX, tune2fs) != NULL) { + if (strstr(line, "Inode size:") && strstr(line, str_size)) + return 0; + } + + pclose(tune2fs); + return -1; +} + +static int check_mnt_data(char *opt) +{ + FILE *fp; + char line[PATH_MAX]; + + fp = SAFE_FOPEN("/proc/mounts", "r"); + + while (fgets(line, PATH_MAX, fp) != NULL) { + if (strstr(line, tst_device->dev) && strstr(line, opt)) + return 0; + } + SAFE_FCLOSE(fp); + return -1; +} + +static int check_mkfs_size_opt(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *dumpe2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "dumpe2fs -h %s 2>&1", tst_device->dev); + dumpe2fs = SAFE_POPEN(path, "r"); + + while (fgets(line, PATH_MAX, dumpe2fs) != NULL) { + if (strstr(line, "Block count:") && strstr(line, str_size)) + return 0; + } + + pclose(dumpe2fs); + return -1; +} + +static void do_test(void) +{ + long fs_type; + + fs_type = tst_fs_type(MOUNT_POINT); + + if (fs_type == TST_EXT234_MAGIC) { + TST_EXP_PASS((check_inode_size(INODE_SIZE))); + TST_EXP_PASS((check_mkfs_size_opt(MKFS_SIZE_VAL))); + } + + if (fs_type == TST_XFS_MAGIC) + TST_EXP_PASS((check_mnt_data("usrquota"))); +} + +static struct tst_test test = { + .test_all = do_test, + .needs_root = 1, + .mntpoint = MOUNT_POINT, + .mount_device = 1, + .needs_cmds = (const char *[]) { + "tune2fs", + "dumpe2fs", + NULL + }, + .filesystems = (struct tst_fs []) { + { + .type = "ext3", + .mkfs_opts = (const char *const []){"-I", TST_TO_STR(INODE_SIZE), "-b", TST_TO_STR(BLOCK_SIZE), NULL}, + .mkfs_size_opt = TST_TO_STR(MKFS_SIZE_VAL), + }, + { + .type = "xfs", + .mnt_data = "usrquota", + }, + {} + }, + +}; -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v4 1/3] tst_filesystems01.c: Add test for .filesystems 2025-11-13 1:52 ` [LTP] [PATCH v4 1/3] " Wei Gao via ltp @ 2026-01-22 3:37 ` Li Wang via ltp 2026-01-22 8:02 ` Petr Vorel 0 siblings, 1 reply; 33+ messages in thread From: Li Wang via ltp @ 2026-01-22 3:37 UTC (permalink / raw) To: Wei Gao; +Cc: ltp > +static struct tst_test test = { > + .test_all = do_test, > + .needs_root = 1, > + .mntpoint = MOUNT_POINT, > + .mount_device = 1, > + .needs_cmds = (const char *[]) { > + "tune2fs", > + "dumpe2fs", > + NULL > + }, We need to adjust 'char*[]' to new 'struct tst_cmd[]' since commit 39a284442. Otherwise for the whole patchset: Reviewed-by: Li Wang <liwang@redhat.com> -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v4 1/3] tst_filesystems01.c: Add test for .filesystems 2026-01-22 3:37 ` Li Wang via ltp @ 2026-01-22 8:02 ` Petr Vorel 2026-01-22 8:54 ` Wei Gao via ltp 0 siblings, 1 reply; 33+ messages in thread From: Petr Vorel @ 2026-01-22 8:02 UTC (permalink / raw) To: Li Wang; +Cc: ltp Hi all, > > + .needs_cmds = (const char *[]) { > > + "tune2fs", > > + "dumpe2fs", > > + NULL > > + }, > We need to adjust 'char*[]' to new 'struct tst_cmd[]' since commit 39a284442. Good point, Li. Wei, will you send v5? Also whole patchset LGTM. Reviewed-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v4 1/3] tst_filesystems01.c: Add test for .filesystems 2026-01-22 8:02 ` Petr Vorel @ 2026-01-22 8:54 ` Wei Gao via ltp 0 siblings, 0 replies; 33+ messages in thread From: Wei Gao via ltp @ 2026-01-22 8:54 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp On Thu, Jan 22, 2026 at 09:02:04AM +0100, Petr Vorel wrote: > Hi all, > > > > + .needs_cmds = (const char *[]) { > > > + "tune2fs", > > > + "dumpe2fs", > > > + NULL > > > + }, > > > We need to adjust 'char*[]' to new 'struct tst_cmd[]' since commit 39a284442. > > Good point, Li. Wei, will you send v5? Thansk Li, Petr Will sent it. > > Also whole patchset LGTM. > Reviewed-by: Petr Vorel <pvorel@suse.cz> > > Kind regards, > Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v4 2/3] ci: Add mount operation for busybox 2025-11-13 1:52 ` [LTP] [PATCH v4 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 1/3] " Wei Gao via ltp @ 2025-11-13 1:52 ` Wei Gao via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 3/3] ci: Add e2fsprogs package for CI test Wei Gao via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 3 siblings, 0 replies; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-13 1:52 UTC (permalink / raw) To: ltp Busybox df implementation require mounting (unlike coreutils implementation). Following error can be found during alpine ci: runtest TINFO: * shell/tst_format_device.sh tst_format_device 1 TINFO: Running: tst_format_device.sh tst_format_device 1 TINFO: Tested kernel: Linux 0ba9f024d6b7 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 Linux tst_format_device 1 TINFO: Using /tmp/LTP_tst_format_device.XXXXOajpgN as tmpdir (UNKNOWN filesystem) tst_device.c:98: TINFO: Found free device 0 '/dev/loop0' tst_format_device 1 TINFO: Formatting ext2 with opts='-b 1024 /dev/loop0 5m' tst_format_device 1 TINFO: timeout per run is 0h 5m 0s tst_format_device 1 TPASS: device formatted df: /dev/loop0: can't find mount point tst_format_device 2 TFAIL: df /dev/loop0 | grep -q /dev failed unexpectedly tst_format_device 3 TINFO: AppArmor enabled, this may affect test results tst_format_device 3 TINFO: it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root) tst_format_device 3 TINFO: loaded AppArmor profiles: none Signed-off-by: Wei Gao <wegao@suse.com> --- lib/newlib_tests/shell/tst_format_device.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/newlib_tests/shell/tst_format_device.sh b/lib/newlib_tests/shell/tst_format_device.sh index dbe4ea9e7..b7366517e 100755 --- a/lib/newlib_tests/shell/tst_format_device.sh +++ b/lib/newlib_tests/shell/tst_format_device.sh @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2022 Petr Vorel <pvorel@suse.cz> -TST_FORMAT_DEVICE=1 +TST_MOUNT_DEVICE=1 TST_NEEDS_ROOT=1 TST_TESTFUNC=test TST_CNT=2 -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* [LTP] [PATCH v4 3/3] ci: Add e2fsprogs package for CI test 2025-11-13 1:52 ` [LTP] [PATCH v4 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 1/3] " Wei Gao via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 2/3] ci: Add mount operation for busybox Wei Gao via ltp @ 2025-11-13 1:52 ` Wei Gao via ltp 2025-12-18 13:49 ` Andrea Cervesato via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 3 siblings, 1 reply; 33+ messages in thread From: Wei Gao via ltp @ 2025-11-13 1:52 UTC (permalink / raw) To: ltp We should add e2fsprogs to ci env otherwise test cases which need tune2fs/dumpe2fs in ci will be skipped. For example following message: 2025-09-24T09:00:56.9304198Z tst_cmd.c:268: TCONF: Couldn't find 'tune2fs' in $PATH Signed-off-by: Wei Gao <wegao@suse.com> --- ci/alpine.sh | 1 + ci/debian.sh | 1 + ci/fedora.sh | 1 + ci/tumbleweed.sh | 1 + 4 files changed, 4 insertions(+) diff --git a/ci/alpine.sh b/ci/alpine.sh index 254f4aaec..f3a1bf528 100755 --- a/ci/alpine.sh +++ b/ci/alpine.sh @@ -25,6 +25,7 @@ apk add \ musl-dev \ numactl-dev \ openssl-dev \ + e2fsprogs-extra \ pkgconfig cat /etc/os-release diff --git a/ci/debian.sh b/ci/debian.sh index 0445c92ec..767c9b985 100755 --- a/ci/debian.sh +++ b/ci/debian.sh @@ -33,6 +33,7 @@ pkg_minimal=" linux-libc-dev lsb-release pkg-config + e2fsprogs " pkg_nonessential=" diff --git a/ci/fedora.sh b/ci/fedora.sh index f57806ebf..f4482a1da 100755 --- a/ci/fedora.sh +++ b/ci/fedora.sh @@ -26,6 +26,7 @@ $yum \ libtirpc \ libtirpc-devel \ pkg-config \ + e2fsprogs \ redhat-lsb-core # CentOS 8 fixes diff --git a/ci/tumbleweed.sh b/ci/tumbleweed.sh index 8a30b02c2..8f23229df 100755 --- a/ci/tumbleweed.sh +++ b/ci/tumbleweed.sh @@ -30,6 +30,7 @@ while [ $i != 0 ]; do libtirpc-devel \ linux-glibc-devel \ lsb-release \ + e2fsprogs \ pkg-config ret=$? -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v4 3/3] ci: Add e2fsprogs package for CI test 2025-11-13 1:52 ` [LTP] [PATCH v4 3/3] ci: Add e2fsprogs package for CI test Wei Gao via ltp @ 2025-12-18 13:49 ` Andrea Cervesato via ltp 2025-12-18 13:51 ` Andrea Cervesato via ltp 0 siblings, 1 reply; 33+ messages in thread From: Andrea Cervesato via ltp @ 2025-12-18 13:49 UTC (permalink / raw) To: Wei Gao, ltp Hi! The commit message talks about tune2fs/dumpe2fs, but I couldn't find tests using them. Am I missing something? -- Andrea Cervesato SUSE QE Automation Engineer Linux andrea.cervesato@suse.com -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v4 3/3] ci: Add e2fsprogs package for CI test 2025-12-18 13:49 ` Andrea Cervesato via ltp @ 2025-12-18 13:51 ` Andrea Cervesato via ltp 0 siblings, 0 replies; 33+ messages in thread From: Andrea Cervesato via ltp @ 2025-12-18 13:51 UTC (permalink / raw) To: Andrea Cervesato, Wei Gao, ltp Please ignore the following message, I missed the patch-series while doing `git am`. On Thu Dec 18, 2025 at 2:49 PM CET, Andrea Cervesato wrote: > Hi! > > The commit message talks about tune2fs/dumpe2fs, but I couldn't find > tests using them. > > Am I missing something? -- Andrea Cervesato SUSE QE Automation Engineer Linux andrea.cervesato@suse.com -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v5 0/3] tst_filesystems01.c: Add test for .filesystems 2025-11-13 1:52 ` [LTP] [PATCH v4 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp ` (2 preceding siblings ...) 2025-11-13 1:52 ` [LTP] [PATCH v4 3/3] ci: Add e2fsprogs package for CI test Wei Gao via ltp @ 2026-01-23 2:36 ` Wei Gao via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 1/3] " Wei Gao via ltp ` (2 more replies) 3 siblings, 3 replies; 33+ messages in thread From: Wei Gao via ltp @ 2026-01-23 2:36 UTC (permalink / raw) To: ltp v4->v5: - Adjust 'char*[]' to new 'struct tst_cmd[]' since commit 39a284442 v3->v4: - Use #define for 128 and 10240 - Change commit subject with ci prefix if ci related changed - Separate change which unrelated Wei Gao (3): tst_filesystems01.c: Add test for .filesystems ci: Add mount operation for busybox ci: Add e2fsprogs package for CI test ci/alpine.sh | 1 + ci/debian.sh | 1 + ci/fedora.sh | 1 + ci/tumbleweed.sh | 1 + lib/newlib_tests/runtest.sh | 1 + lib/newlib_tests/shell/tst_format_device.sh | 2 +- lib/newlib_tests/tst_filesystems01.c | 108 ++++++++++++++++++++ 7 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 lib/newlib_tests/tst_filesystems01.c -- 2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v5 1/3] tst_filesystems01.c: Add test for .filesystems 2026-01-23 2:36 ` [LTP] [PATCH v5 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp @ 2026-01-23 2:36 ` Wei Gao via ltp 2026-01-28 0:49 ` Li Wang via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 2/3] ci: Add mount operation for busybox Wei Gao via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 3/3] ci: Add e2fsprogs package for CI test Wei Gao via ltp 2 siblings, 1 reply; 33+ messages in thread From: Wei Gao via ltp @ 2026-01-23 2:36 UTC (permalink / raw) To: ltp Fixes: https://github.com/linux-test-project/ltp/issues/1243 Signed-off-by: Wei Gao <wegao@suse.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Li Wang <liwang@redhat.com> --- lib/newlib_tests/runtest.sh | 1 + lib/newlib_tests/tst_filesystems01.c | 108 +++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 lib/newlib_tests/tst_filesystems01.c diff --git a/lib/newlib_tests/runtest.sh b/lib/newlib_tests/runtest.sh index d87751c2f..71808ef8b 100755 --- a/lib/newlib_tests/runtest.sh +++ b/lib/newlib_tests/runtest.sh @@ -24,6 +24,7 @@ tst_checkpoint_wait_timeout tst_checkpoint_wake_timeout tst_device tst_expiration_timer +tst_filesystems01 tst_fuzzy_sync0[1-3] tst_needs_cmds0[1-36-8] tst_res_hexd diff --git a/lib/newlib_tests/tst_filesystems01.c b/lib/newlib_tests/tst_filesystems01.c new file mode 100644 index 000000000..177ce1e33 --- /dev/null +++ b/lib/newlib_tests/tst_filesystems01.c @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2025 Wei Gao <wegao@suse.com> + */ + +#include "tst_test.h" +#include "tst_safe_stdio.h" + +#define INODE_SIZE 128 +#define BLOCK_SIZE 1024 +#define MKFS_SIZE_VAL 10240 + +#define MOUNT_POINT "mount_test_filesystems" + +static int check_inode_size(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *tune2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "tune2fs -l %s 2>&1", tst_device->dev); + tune2fs = SAFE_POPEN(path, "r"); + + while (fgets(line, PATH_MAX, tune2fs) != NULL) { + if (strstr(line, "Inode size:") && strstr(line, str_size)) + return 0; + } + + pclose(tune2fs); + return -1; +} + +static int check_mnt_data(char *opt) +{ + FILE *fp; + char line[PATH_MAX]; + + fp = SAFE_FOPEN("/proc/mounts", "r"); + + while (fgets(line, PATH_MAX, fp) != NULL) { + if (strstr(line, tst_device->dev) && strstr(line, opt)) + return 0; + } + SAFE_FCLOSE(fp); + return -1; +} + +static int check_mkfs_size_opt(unsigned int size) +{ + char path[PATH_MAX]; + char line[PATH_MAX]; + FILE *dumpe2fs; + char str_size[NAME_MAX]; + + snprintf(str_size, sizeof(str_size), "%u", size); + snprintf(path, sizeof(path), "dumpe2fs -h %s 2>&1", tst_device->dev); + dumpe2fs = SAFE_POPEN(path, "r"); + + while (fgets(line, PATH_MAX, dumpe2fs) != NULL) { + if (strstr(line, "Block count:") && strstr(line, str_size)) + return 0; + } + + pclose(dumpe2fs); + return -1; +} + +static void do_test(void) +{ + long fs_type; + + fs_type = tst_fs_type(MOUNT_POINT); + + if (fs_type == TST_EXT234_MAGIC) { + TST_EXP_PASS((check_inode_size(INODE_SIZE))); + TST_EXP_PASS((check_mkfs_size_opt(MKFS_SIZE_VAL))); + } + + if (fs_type == TST_XFS_MAGIC) + TST_EXP_PASS((check_mnt_data("usrquota"))); +} + +static struct tst_test test = { + .test_all = do_test, + .needs_root = 1, + .mntpoint = MOUNT_POINT, + .mount_device = 1, + .needs_cmds = (struct tst_cmd[]) { + {.cmd = "tune2fs"}, + {.cmd = "dumpe2fs"}, + {} + }, + .filesystems = (struct tst_fs []) { + { + .type = "ext3", + .mkfs_opts = (const char *const []){"-I", TST_TO_STR(INODE_SIZE), "-b", TST_TO_STR(BLOCK_SIZE), NULL}, + .mkfs_size_opt = TST_TO_STR(MKFS_SIZE_VAL), + }, + { + .type = "xfs", + .mnt_data = "usrquota", + }, + {} + }, + +}; -- 2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [LTP] [PATCH v5 1/3] tst_filesystems01.c: Add test for .filesystems 2026-01-23 2:36 ` [LTP] [PATCH v5 1/3] " Wei Gao via ltp @ 2026-01-28 0:49 ` Li Wang via ltp 0 siblings, 0 replies; 33+ messages in thread From: Li Wang via ltp @ 2026-01-28 0:49 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, All, Patchset merged, thanks! -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 33+ messages in thread
* [LTP] [PATCH v5 2/3] ci: Add mount operation for busybox 2026-01-23 2:36 ` [LTP] [PATCH v5 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 1/3] " Wei Gao via ltp @ 2026-01-23 2:36 ` Wei Gao via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 3/3] ci: Add e2fsprogs package for CI test Wei Gao via ltp 2 siblings, 0 replies; 33+ messages in thread From: Wei Gao via ltp @ 2026-01-23 2:36 UTC (permalink / raw) To: ltp Busybox df implementation require mounting (unlike coreutils implementation). Following error can be found during alpine ci: runtest TINFO: * shell/tst_format_device.sh tst_format_device 1 TINFO: Running: tst_format_device.sh tst_format_device 1 TINFO: Tested kernel: Linux 0ba9f024d6b7 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 Linux tst_format_device 1 TINFO: Using /tmp/LTP_tst_format_device.XXXXOajpgN as tmpdir (UNKNOWN filesystem) tst_device.c:98: TINFO: Found free device 0 '/dev/loop0' tst_format_device 1 TINFO: Formatting ext2 with opts='-b 1024 /dev/loop0 5m' tst_format_device 1 TINFO: timeout per run is 0h 5m 0s tst_format_device 1 TPASS: device formatted df: /dev/loop0: can't find mount point tst_format_device 2 TFAIL: df /dev/loop0 | grep -q /dev failed unexpectedly tst_format_device 3 TINFO: AppArmor enabled, this may affect test results tst_format_device 3 TINFO: it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root) tst_format_device 3 TINFO: loaded AppArmor profiles: none Signed-off-by: Wei Gao <wegao@suse.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Li Wang <liwang@redhat.com> --- lib/newlib_tests/shell/tst_format_device.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/newlib_tests/shell/tst_format_device.sh b/lib/newlib_tests/shell/tst_format_device.sh index dbe4ea9e7..b7366517e 100755 --- a/lib/newlib_tests/shell/tst_format_device.sh +++ b/lib/newlib_tests/shell/tst_format_device.sh @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2022 Petr Vorel <pvorel@suse.cz> -TST_FORMAT_DEVICE=1 +TST_MOUNT_DEVICE=1 TST_NEEDS_ROOT=1 TST_TESTFUNC=test TST_CNT=2 -- 2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
* [LTP] [PATCH v5 3/3] ci: Add e2fsprogs package for CI test 2026-01-23 2:36 ` [LTP] [PATCH v5 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 1/3] " Wei Gao via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 2/3] ci: Add mount operation for busybox Wei Gao via ltp @ 2026-01-23 2:36 ` Wei Gao via ltp 2 siblings, 0 replies; 33+ messages in thread From: Wei Gao via ltp @ 2026-01-23 2:36 UTC (permalink / raw) To: ltp We should add e2fsprogs to ci env otherwise test cases which need tune2fs/dumpe2fs in ci will be skipped. For example following message: 2025-09-24T09:00:56.9304198Z tst_cmd.c:268: TCONF: Couldn't find 'tune2fs' in $PATH Signed-off-by: Wei Gao <wegao@suse.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Li Wang <liwang@redhat.com> --- ci/alpine.sh | 1 + ci/debian.sh | 1 + ci/fedora.sh | 1 + ci/tumbleweed.sh | 1 + 4 files changed, 4 insertions(+) diff --git a/ci/alpine.sh b/ci/alpine.sh index 254f4aaec..f3a1bf528 100755 --- a/ci/alpine.sh +++ b/ci/alpine.sh @@ -25,6 +25,7 @@ apk add \ musl-dev \ numactl-dev \ openssl-dev \ + e2fsprogs-extra \ pkgconfig cat /etc/os-release diff --git a/ci/debian.sh b/ci/debian.sh index 0445c92ec..767c9b985 100755 --- a/ci/debian.sh +++ b/ci/debian.sh @@ -33,6 +33,7 @@ pkg_minimal=" linux-libc-dev lsb-release pkg-config + e2fsprogs " pkg_nonessential=" diff --git a/ci/fedora.sh b/ci/fedora.sh index f57806ebf..f4482a1da 100755 --- a/ci/fedora.sh +++ b/ci/fedora.sh @@ -26,6 +26,7 @@ $yum \ libtirpc \ libtirpc-devel \ pkg-config \ + e2fsprogs \ redhat-lsb-core # CentOS 8 fixes diff --git a/ci/tumbleweed.sh b/ci/tumbleweed.sh index 8a30b02c2..8f23229df 100755 --- a/ci/tumbleweed.sh +++ b/ci/tumbleweed.sh @@ -30,6 +30,7 @@ while [ $i != 0 ]; do libtirpc-devel \ linux-glibc-devel \ lsb-release \ + e2fsprogs \ pkg-config ret=$? -- 2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 33+ messages in thread
end of thread, other threads:[~2026-01-28 0:50 UTC | newest] Thread overview: 33+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-05-29 10:51 [LTP] [PATCH v1] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2025-09-16 11:02 ` Petr Vorel 2025-09-24 8:42 ` [LTP] [PATCH v2] " Wei Gao via ltp 2025-10-30 20:17 ` Petr Vorel 2025-10-31 6:33 ` Wei Gao via ltp 2025-10-31 9:13 ` Petr Vorel 2025-11-01 1:20 ` [LTP] [PATCH v3 0/2] " Wei Gao via ltp 2025-11-01 1:20 ` [LTP] [PATCH v3 1/2] " Wei Gao via ltp 2025-11-11 12:06 ` Petr Vorel 2025-11-12 6:51 ` Wei Gao via ltp 2025-11-12 9:22 ` Petr Vorel 2025-11-12 10:32 ` Cyril Hrubis 2025-11-12 11:34 ` Wei Gao via ltp 2025-11-12 11:44 ` Cyril Hrubis 2025-11-12 12:14 ` Wei Gao via ltp 2025-11-12 12:21 ` Petr Vorel 2025-11-13 1:28 ` Wei Gao via ltp 2025-11-01 1:20 ` [LTP] [PATCH v3 2/2] tst_format_device.sh: Add e2fsprogs package for CI test Wei Gao via ltp 2025-11-11 12:22 ` Petr Vorel 2025-11-13 1:52 ` [LTP] [PATCH v4 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 1/3] " Wei Gao via ltp 2026-01-22 3:37 ` Li Wang via ltp 2026-01-22 8:02 ` Petr Vorel 2026-01-22 8:54 ` Wei Gao via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 2/3] ci: Add mount operation for busybox Wei Gao via ltp 2025-11-13 1:52 ` [LTP] [PATCH v4 3/3] ci: Add e2fsprogs package for CI test Wei Gao via ltp 2025-12-18 13:49 ` Andrea Cervesato via ltp 2025-12-18 13:51 ` Andrea Cervesato via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 0/3] tst_filesystems01.c: Add test for .filesystems Wei Gao via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 1/3] " Wei Gao via ltp 2026-01-28 0:49 ` Li Wang via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 2/3] ci: Add mount operation for busybox Wei Gao via ltp 2026-01-23 2:36 ` [LTP] [PATCH v5 3/3] ci: Add e2fsprogs package for CI test Wei Gao via ltp
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox