public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] lib/tst_mkfs.c: fix -f option for mkfs.btrfs
@ 2014-05-12  5:54 Xing Gu
  2014-05-12 13:27 ` chrubis
  2014-05-13  3:37 ` [LTP] [PATCH v2] " Xing Gu
  0 siblings, 2 replies; 4+ messages in thread
From: Xing Gu @ 2014-05-12  5:54 UTC (permalink / raw)
  To: ltp-list

In the earlier version of btrfs-progs, mkfs.btrfs doesn't
support -f option. So it should be judged in advance before
the command is called.

Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
---
 lib/tst_mkfs.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
index 7357cd9..92b4b54 100644
--- a/lib/tst_mkfs.c
+++ b/lib/tst_mkfs.c
@@ -35,11 +35,19 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,
 	 * superblock on the device, which is the case here as we
 	 * reuse one device for all tests.
 	 */
-	if (!strcmp(fs_type, "xfs") || !strcmp(fs_type, "btrfs")) {
+	if (!strcmp(fs_type, "xfs")) {
 		tst_resm(TINFO, "Appending '-f' flag to mkfs.%s", fs_type);
 		argv[pos++] = "-f";
 	}
 
+	if (!strcmp(fs_type, "btrfs")) {
+		if (system("mkfs.btrfs 2>&1 | grep '\\-f ' >/dev/null") == 0) {
+			tst_resm(TINFO, "Appending '-f' flag to mkfs.%s",
+				fs_type);
+			argv[pos++] = "-f";
+		}
+	}
+
 	if (fs_opts) {
 		for (i = 0; fs_opts[i]; i++) {
 			argv[pos++] = fs_opts[i];
-- 
1.9.0


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2014-05-13 11:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12  5:54 [LTP] [PATCH] lib/tst_mkfs.c: fix -f option for mkfs.btrfs Xing Gu
2014-05-12 13:27 ` chrubis
2014-05-13  3:37 ` [LTP] [PATCH v2] " Xing Gu
2014-05-13 11:33   ` chrubis

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