Skip to contentSkip to conversation

tst_filesystems01.c: Add test for .filesystems

PATCH Superseded Wei Gao via ltp 3 participants 33 messages May 28, 2025 – Jan 28

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tst_filesystems01.c: Add test for .filesystems

---
 lib/newlib_tests/tst_filesystems01.c | 118 +++++++++++++++++++++++++++
 1 file changed, 118 insertions(+)
 create mode 100644 lib/newlib_tests/tst_filesystems01.c
lib/newlib_tests/tst_filesystems01.c new file +118 -0
new file mode 100644
index 000000000..96f4b2d93
@@ -0,0 +1,118 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2025 Wei Gao <[email protected]>
+ */
+
+#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",
+		},
+		{}
+	},
+
+};
Signature · 5 lines
2.49.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

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.

Quoted 6 lines
---
 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

...

lib/newlib_tests/tst_filesystems01.c line 22

Quoted 5 lines
lib/newlib_tests/tst_filesystems01.c new file +5 -0
+	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.

lib/newlib_tests/tst_filesystems01.c line 25

Quoted 2 lines
lib/newlib_tests/tst_filesystems01.c new file +2 -0
+	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)) {
Quoted 8 lines
lib/newlib_tests/tst_filesystems01.c new file +8 -0
+			tst_res(TPASS, "check inode size pass");
+			return 0;
+		}
+	}
+
+	pclose(tune2fs);
+	tst_res(TFAIL, "check inode size failed");
+	return -1;

lib/newlib_tests/tst_filesystems01.c line 43

Quoted 10 lines
lib/newlib_tests/tst_filesystems01.c new file +10 -0
+}
+
+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.

lib/newlib_tests/tst_filesystems01.c line 45

Quoted 2 lines
lib/newlib_tests/tst_filesystems01.c new file +2 -0
+	while (fgets(line, PATH_MAX, fp)) {
+		if (*line && strstr(line, tst_device->dev) && strstr(line, opt)) {

Also here.

Quoted 11 lines
lib/newlib_tests/tst_filesystems01.c new file +11 -0
+			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)
+{

lib/newlib_tests/tst_filesystems01.c line 66

Quoted 10 lines
lib/newlib_tests/tst_filesystems01.c new file +10 -0
+	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.

lib/newlib_tests/tst_filesystems01.c line 69

Quoted 3 lines
lib/newlib_tests/tst_filesystems01.c new file +3 -0
+
+	while (fgets(line, PATH_MAX, dumpe2fs)) {
+		if (*line && strstr(line, "Block count:") && strstr(line, str_size)) {

And here.

Quoted 8 lines
lib/newlib_tests/tst_filesystems01.c new file +8 -0
+			tst_res(TPASS, "check mkfs size opt pass");
+			return 0;
+		}
+	}
+
+	pclose(dumpe2fs);
+	tst_res(TFAIL, "check mkfs size opt failed");
+	return -1;

lib/newlib_tests/tst_filesystems01.c line 87

Quoted 10 lines
lib/newlib_tests/tst_filesystems01.c new file +10 -0
+}
+
+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.

lib/newlib_tests/tst_filesystems01.c line 92

Quoted 5 lines
lib/newlib_tests/tst_filesystems01.c new file +5 -0
+		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

Quoted 26 lines
lib/newlib_tests/tst_filesystems01.c new file +26 -0
+}
+
+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",
+		},
+		{}
+	},
+
+};
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

PATCH v2 1/1 tst_filesystems01.c: Add test for .filesystems

In reply to Wei Gao via ltp
---
 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
lib/newlib_tests/runtest.sh +1 -0
index d87751c2f..71808ef8b 100755
@@ -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
lib/newlib_tests/tst_filesystems01.c new file +104 -0

104 lines not on this page · raw message

Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi Wei,

...

lib/newlib_tests/tst_filesystems01.c line 88

Quoted 3 lines
lib/newlib_tests/tst_filesystems01.c new file +3 -0
+	.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

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw
Quoted 9 lines · Petr Vorel

Hi Wei,

...

Review

Quoted 3 lines
(quoted diff) +3 -0
+	.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.

Quoted 6 lines

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.

ci/alpine.sh +0 -1
index f3a1bf528..254f4aaec 100755
@@ -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
Quoted 3 lines

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

...

Quoted 19 lines
Quoted 2 lines

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.

ci/alpine.sh +0 -1
index f3a1bf528..254f4aaec 100755
@@ -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

Quoted 13 lines
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

Quoted 2 lines
Quoted 2 lines

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

v3 cover tst_filesystems01.c: Add test for .filesystems

In reply to Wei Gao via 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
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw

PATCH v3 1/2 tst_filesystems01.c: Add test for .filesystems

---
 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
lib/newlib_tests/runtest.sh +1 -0
index d87751c2f..71808ef8b 100755
@@ -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
lib/newlib_tests/tst_filesystems01.c new file +104 -0

104 lines not on this page · raw message

Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v3 1/2
#8 lore raw

Hi Wei,

...

lib/newlib_tests/tst_filesystems01.c line 74

Quoted 9 lines
lib/newlib_tests/tst_filesystems01.c new file +9 -0
+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.

Kind regards,
Petr

Quoted 30 lines
lib/newlib_tests/tst_filesystems01.c new file +30 -0
+	}
+
+	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",
+		},
+		{}
+	},
+
+};
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw
Quoted 15 lines · Petr Vorel

Hi Wei,

...

lib/newlib_tests/tst_filesystems01.c line 74

Quoted 9 lines
lib/newlib_tests/tst_filesystems01.c new file +9 -0
+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.

Quoted 36 lines

Kind regards,
Petr

Quoted 30 lines
lib/newlib_tests/tst_filesystems01.c new file +30 -0
+	}
+
+	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",
+		},
+		{}
+	},
+
+};
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw
Quoted 16 lines · Petr Vorel
Quoted 15 lines

Hi Wei,

...

lib/newlib_tests/tst_filesystems01.c line 74

Quoted 9 lines
lib/newlib_tests/tst_filesystems01.c new file +9 -0
+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.

Quoted 3 lines

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

Quoted 33 lines
Quoted 33 lines

Kind regards,
Petr

Quoted 30 lines
lib/newlib_tests/tst_filesystems01.c new file +30 -0
+	}
+
+	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",
+		},
+		{}
+	},
+
+};
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#11 lore raw

Hi!

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

lib/newlib_tests/tst_filesystems01.c line 74

Quoted 9 lines
lib/newlib_tests/tst_filesystems01.c new file +9 -0
+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.

Quoted 7 lines
Quoted 3 lines

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.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#12 lore raw
Quoted 17 lines · Cyril Hrubis

Hi!

Quoted 16 lines
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
(quoted diff) +4 -0
+static void do_test(void)
+{
+	long fs_type;
+
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+	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.

Quoted 8 lines
Quoted 3 lines

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 ?

lib/newlib_tests/tst_filesystems01.c +8 -2
index 4eca0af0e..b2a2ce050 100644
@@ -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",
Quoted 4 lines
Signature · 3 lines
-- 
Cyril Hrubis
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#13 lore raw

Hi!

Quoted 11 lines
Quoted 8 lines
Quoted 3 lines

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

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#14 lore raw
Quoted 10 lines · Cyril Hrubis

Hi!

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

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.

Quoted 7 lines
Quoted 2 lines

@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.

Quoted 3 lines
Signature · 2 lines
Cyril Hrubis
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#15 lore raw
In reply to Cyril Hrubis
Quoted 17 lines

Hi!

Quoted 15 lines
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
lib/newlib_tests/tst_filesystems01.c new file +4 -0
+static void do_test(void)
+{
+	long fs_type;
+
Quoted 8 lines

lib/newlib_tests/tst_filesystems01.c line 74

Quoted 5 lines
lib/newlib_tests/tst_filesystems01.c new file +5 -0
+	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.

Quoted 8 lines
Quoted 3 lines

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

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#16 lore raw
Quoted 23 lines · Petr Vorel
Quoted 22 lines

Hi!

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

lib/newlib_tests/tst_filesystems01.c line 74

Quoted 9 lines
lib/newlib_tests/tst_filesystems01.c new file +9 -0
+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.

Quoted 7 lines
Quoted 3 lines

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.

Quoted 7 lines
Quoted 2 lines

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.

Quoted 3 lines

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#17 lore raw

PATCH v3 2/2 tst_format_device.sh: Add e2fsprogs package for CI test

In reply to Wei Gao via 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

---
 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(+)
ci/alpine.sh +1 -0
index 254f4aaec..f3a1bf528 100755
@@ -25,6 +25,7 @@ apk add \
 	musl-dev \
 	numactl-dev \
 	openssl-dev \
+	e2fsprogs-extra \
 	pkgconfig
 
 cat /etc/os-release
ci/debian.sh +1 -0
index 0445c92ec..767c9b985 100755
@@ -33,6 +33,7 @@ pkg_minimal="
 	linux-libc-dev
 	lsb-release
 	pkg-config
+	e2fsprogs
 "
 
 pkg_nonessential="
ci/fedora.sh +1 -0
index f57806ebf..f4482a1da 100755
@@ -26,6 +26,7 @@ $yum \
 	libtirpc \
 	libtirpc-devel \
 	pkg-config \
+	e2fsprogs \
 	redhat-lsb-core
 
 # CentOS 8 fixes
ci/tumbleweed.sh +1 -0
index 8a30b02c2..8f23229df 100755
@@ -30,6 +30,7 @@ while [ $i != 0 ]; do
 		libtirpc-devel \
 		linux-glibc-devel \
 		lsb-release \
+		e2fsprogs \
 		pkg-config
 
 	ret=$?
lib/newlib_tests/shell/tst_format_device.sh +1 -0
index dbe4ea9e7..bd4aa2ed9 100755
@@ -3,6 +3,7 @@
 # Copyright (c) 2022 Petr Vorel <[email protected]>
 
 TST_FORMAT_DEVICE=1
+TST_MOUNT_DEVICE=1
 TST_NEEDS_ROOT=1
 TST_TESTFUNC=test
 TST_CNT=2
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#18 lore raw

Re: [LTP] [PATCH v3 2/2] tst_format_device.sh: Add e2fsprogs package for CI test

Hi Wei,

Quoted 16 lines

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).

Quoted 7 lines
---
 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(+)

...

lib/newlib_tests/shell/tst_format_device.sh line 6

Quoted 9 lines
lib/newlib_tests/shell/tst_format_device.sh +1 -0
index dbe4ea9e7..bd4aa2ed9 100755
@@ -3,6 +3,7 @@
 # Copyright (c) 2022 Petr Vorel <[email protected]>
 
 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

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#19 lore raw

v4 cover tst_filesystems01.c: Add test for .filesystems

In reply to Wei Gao via 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
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#20 lore raw

PATCH v4 1/3 tst_filesystems01.c: Add test for .filesystems

---
 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
lib/newlib_tests/runtest.sh +1 -0
index d87751c2f..71808ef8b 100755
@@ -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
lib/newlib_tests/tst_filesystems01.c new file +108 -0

108 lines not on this page · raw message

Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author Reviewed-by Li Wang on v4 1/3
#21 lore raw

lib/newlib_tests/tst_filesystems01.c line 94

Quoted 11 lines
lib/newlib_tests/tst_filesystems01.c new file +10 -0
+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:

Signature · 6 lines
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by
#22 lore raw

Hi all,

Quoted 7 lines

lib/newlib_tests/tst_filesystems01.c line 94

Quoted 5 lines
lib/newlib_tests/tst_filesystems01.c new file +5 -0
+       .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.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#23 lore raw
Quoted 11 lines · Petr Vorel

Hi all,

Quoted 7 lines

lib/newlib_tests/tst_filesystems01.c line 94

Quoted 5 lines
lib/newlib_tests/tst_filesystems01.c new file +5 -0
+       .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.

Quoted 6 lines

Also whole patchset LGTM.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#24 lore raw

PATCH v4 2/3 ci: Add mount operation for busybox

In reply to Wei Gao via 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

---
 lib/newlib_tests/shell/tst_format_device.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/newlib_tests/shell/tst_format_device.sh +1 -1
index dbe4ea9e7..b7366517e 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2022 Petr Vorel <[email protected]>
 
-TST_FORMAT_DEVICE=1
+TST_MOUNT_DEVICE=1
 TST_NEEDS_ROOT=1
 TST_TESTFUNC=test
 TST_CNT=2
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#25 lore raw

PATCH v4 3/3 ci: Add e2fsprogs package for CI test

In reply to Wei Gao via 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
---
 ci/alpine.sh     | 1 +
 ci/debian.sh     | 1 +
 ci/fedora.sh     | 1 +
 ci/tumbleweed.sh | 1 +
 4 files changed, 4 insertions(+)
ci/alpine.sh +1 -0
index 254f4aaec..f3a1bf528 100755
@@ -25,6 +25,7 @@ apk add \
 	musl-dev \
 	numactl-dev \
 	openssl-dev \
+	e2fsprogs-extra \
 	pkgconfig
 
 cat /etc/os-release
ci/debian.sh +1 -0
index 0445c92ec..767c9b985 100755
@@ -33,6 +33,7 @@ pkg_minimal="
 	linux-libc-dev
 	lsb-release
 	pkg-config
+	e2fsprogs
 "
 
 pkg_nonessential="
ci/fedora.sh +1 -0
index f57806ebf..f4482a1da 100755
@@ -26,6 +26,7 @@ $yum \
 	libtirpc \
 	libtirpc-devel \
 	pkg-config \
+	e2fsprogs \
 	redhat-lsb-core
 
 # CentOS 8 fixes
ci/tumbleweed.sh +1 -0
index 8a30b02c2..8f23229df 100755
@@ -30,6 +30,7 @@ while [ $i != 0 ]; do
 		libtirpc-devel \
 		linux-glibc-devel \
 		lsb-release \
+		e2fsprogs \
 		pkg-config
 
 	ret=$?
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#26 lore raw

Re: [LTP] [PATCH v4 3/3] ci: Add e2fsprogs package for CI test

Hi!

The commit message talks about tune2fs/dumpe2fs, but I couldn't find tests using them.

Am I missing something?

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#27 lore raw

Re: [LTP] [PATCH v4 3/3] ci: Add e2fsprogs package for CI test

Please ignore the following message, I missed the patch-series while doing git am.

Quoted 6 lines · Andrea Cervesato

Hi!

The commit message talks about tune2fs/dumpe2fs, but I couldn't find tests using them.

Am I missing something?

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#28 lore raw

v5 cover tst_filesystems01.c: Add test for .filesystems

In reply to Wei Gao via 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
Signature · 5 lines
2.52.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#29 lore raw

PATCH v5 1/3 tst_filesystems01.c: Add test for .filesystems

---
 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
lib/newlib_tests/runtest.sh +1 -0
index d87751c2f..71808ef8b 100755
@@ -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
lib/newlib_tests/tst_filesystems01.c new file +108 -0

108 lines not on this page · raw message

Signature · 5 lines
2.52.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#30 lore raw

Hi Wei, All,

Patchset merged, thanks!

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#31 lore raw

PATCH v5 2/3 ci: Add mount operation for busybox

In reply to Wei Gao via 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

---
 lib/newlib_tests/shell/tst_format_device.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/newlib_tests/shell/tst_format_device.sh +1 -1
index dbe4ea9e7..b7366517e 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2022 Petr Vorel <[email protected]>
 
-TST_FORMAT_DEVICE=1
+TST_MOUNT_DEVICE=1
 TST_NEEDS_ROOT=1
 TST_TESTFUNC=test
 TST_CNT=2
Signature · 5 lines
2.52.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#32 lore raw

PATCH v5 3/3 ci: Add e2fsprogs package for CI test

In reply to Wei Gao via 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
---
 ci/alpine.sh     | 1 +
 ci/debian.sh     | 1 +
 ci/fedora.sh     | 1 +
 ci/tumbleweed.sh | 1 +
 4 files changed, 4 insertions(+)
ci/alpine.sh +1 -0
index 254f4aaec..f3a1bf528 100755
@@ -25,6 +25,7 @@ apk add \
 	musl-dev \
 	numactl-dev \
 	openssl-dev \
+	e2fsprogs-extra \
 	pkgconfig
 
 cat /etc/os-release
ci/debian.sh +1 -0
index 0445c92ec..767c9b985 100755
@@ -33,6 +33,7 @@ pkg_minimal="
 	linux-libc-dev
 	lsb-release
 	pkg-config
+	e2fsprogs
 "
 
 pkg_nonessential="
ci/fedora.sh +1 -0
index f57806ebf..f4482a1da 100755
@@ -26,6 +26,7 @@ $yum \
 	libtirpc \
 	libtirpc-devel \
 	pkg-config \
+	e2fsprogs \
 	redhat-lsb-core
 
 # CentOS 8 fixes
ci/tumbleweed.sh +1 -0
index 8a30b02c2..8f23229df 100755
@@ -30,6 +30,7 @@ while [ $i != 0 ]; do
 		libtirpc-devel \
 		linux-glibc-devel \
 		lsb-release \
+		e2fsprogs \
 		pkg-config
 
 	ret=$?
Signature · 5 lines
2.52.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp