[LTP] [PATCH v3 1/2] tst_filesystems01.c: Add test for .filesystems
Wei Gao
wegao@suse.com
Wed Nov 12 12:34:16 CET 2025
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
More information about the ltp
mailing list