public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] tst_mkfs: Add -I option to mkfs.vfat
@ 2021-03-29 14:57 Petr Vorel
  2021-03-30 10:00 ` Richard Palethorpe
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2021-03-29 14:57 UTC (permalink / raw)
  To: ltp

to workaround occasional error on tests with .all_filesystems flag:

tst_test.c:888: TINFO: Formatting /dev/loop0 with vfat opts='' extra opts=''
mkfs.vfat: Partitions or virtual mappings on device '/dev/loop0',
 not making filesystem (use -I to override)
tst_test.c:888: TBROK: mkfs.vfat failed with exit code 1

Tested also on BusyBox v1.33.0, which accept but ignores -I since
beginning (1.14.0).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Richard also suggested to wipe the device, but not sure how to do it
quickly and don't bring any more dependency.

Kind regards,
Petr

 lib/tst_mkfs.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
index 736324f04..2d335a3ad 100644
--- a/lib/tst_mkfs.c
+++ b/lib/tst_mkfs.c
@@ -52,6 +52,16 @@ void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void),
 
 	snprintf(mkfs, sizeof(mkfs), "mkfs.%s", fs_type);
 
+	/*
+	 * Workaround a problem:
+	 * mkfs.vfat: Partitions or virtual mappings on device '/dev/loop0', not
+	 * making filesystem (use -I to override)
+	 */
+	if (!strcmp(fs_type, "vfat")) {
+		argv[pos] = "-I";
+		strcat(fs_opts_str, argv[pos++]);
+	}
+
 	if (fs_opts) {
 		for (i = 0; fs_opts[i]; i++) {
 			argv[pos++] = fs_opts[i];
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-31  7:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-29 14:57 [LTP] [PATCH 1/1] tst_mkfs: Add -I option to mkfs.vfat Petr Vorel
2021-03-30 10:00 ` Richard Palethorpe
2021-03-30 10:36   ` Martin Doucha
2021-03-30 12:25   ` Petr Vorel
2021-03-30 12:36     ` Richard Palethorpe
2021-03-31  7:58       ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox