diff mbox

[xfstests-bld] test-appliance: support f2fs-tools v1.9 and later

Message ID 20180405222141.42376-1-ebiggers@google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Biggers April 5, 2018, 10:21 p.m. UTC
Pass the -f option to mkfs.f2fs when it appears to support it.  This is
required by f2fs-tools v1.9 and later in order to format the filesystem
even when an existing filesystem is detected.  But earlier versions did
not accept this option.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 kvm-xfstests/test-appliance/files/root/fs/f2fs/config | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Theodore Ts'o April 6, 2018, 1:30 p.m. UTC | #1
On Thu, Apr 05, 2018 at 03:21:41PM -0700, Eric Biggers wrote:
> Pass the -f option to mkfs.f2fs when it appears to support it.  This is
> required by f2fs-tools v1.9 and later in order to format the filesystem
> even when an existing filesystem is detected.  But earlier versions did
> not accept this option.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Applied for now, but ugh.  Grepping strings out of binaries is not
something I really like to depend upon.  Can we convince the f2fs
folks to provide a "/sbin/mkfs.f2fs -V" which prints a version string,
or some such?

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Biggers April 9, 2018, 7 p.m. UTC | #2
On Fri, Apr 06, 2018 at 09:30:36AM -0400, Theodore Y. Ts'o wrote:
> On Thu, Apr 05, 2018 at 03:21:41PM -0700, Eric Biggers wrote:
> > Pass the -f option to mkfs.f2fs when it appears to support it.  This is
> > required by f2fs-tools v1.9 and later in order to format the filesystem
> > even when an existing filesystem is detected.  But earlier versions did
> > not accept this option.
> > 
> > Signed-off-by: Eric Biggers <ebiggers@google.com>
> 
> Applied for now, but ugh.  Grepping strings out of binaries is not
> something I really like to depend upon.  Can we convince the f2fs
> folks to provide a "/sbin/mkfs.f2fs -V" which prints a version string,
> or some such?
> 

Yes, it's ugly.  As something maybe a bit better, I've proposed

	mkfs.f2fs --help |& grep -q "[[:space:]]-f[[:space:]|]"
	
in v2 of the xfstests patch to common/config.  So if that gets accepted into
xfstests I'll change this to use the same method.

Thanks,

Eric
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/kvm-xfstests/test-appliance/files/root/fs/f2fs/config b/kvm-xfstests/test-appliance/files/root/fs/f2fs/config
index 45fb2dd..0efcb76 100644
--- a/kvm-xfstests/test-appliance/files/root/fs/f2fs/config
+++ b/kvm-xfstests/test-appliance/files/root/fs/f2fs/config
@@ -20,6 +20,10 @@  function format_filesystem()
     local dev="$1"
     local opts="$2"
 
+    if grep -q 'force overwrite' /sbin/mkfs.f2fs; then
+	# f2fs-tools v1.9+
+	opts+=" -f"
+    fi
     /sbin/mkfs.f2fs -q $opts "$dev"
     return $?
 }