Skip to contentSkip to conversation

xfstests: fix flink test

PATCH In review Josef Bacik 3 participants 3 messages May 7, 2014 – May 8, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: fix flink test

I don't have flink support in my xfsprogs, but it doesn't fail with "command not found" or whatever, it fails because I don't have the -T option. So fix _require_xfs_io_command to check for an invalid option and not run. This way I get notrun instead of a failure. Thanks,

---
 common/rc | 2 ++
 1 file changed, 2 insertions(+)
common/rc +2 -0
index 5c13db5..4fa7e63 100644
@@ -1258,6 +1258,8 @@ _require_xfs_io_command()
 		_notrun "xfs_io $command support is missing"
 	echo $testio | grep -q "Operation not supported" && \
 		_notrun "xfs_io $command failed (old kernel/wrong fs?)"
+	echo $testio | grep -q "invalid option" && \
+		_notrun "xfs_io $command support is missing"
 }
 
 # Check that a fs has enough free space (in 1024b blocks)
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 15 lines · Josef Bacik

I don't have flink support in my xfsprogs, but it doesn't fail with "command not found" or whatever, it fails because I don't have the -T option. So fix _require_xfs_io_command to check for an invalid option and not run. This way I get notrun instead of a failure. Thanks,

---
 common/rc | 2 ++
 1 file changed, 2 insertions(+)
common/rc +0 -0
index 5c13db5..4fa7e63 100644

common/rc _require_xfs_io_command() · line 1263

Quoted 6 lines
common/rc +2 -0
@@ -1258,6 +1258,8 @@ _require_xfs_io_command()
 		_notrun "xfs_io $command support is missing"
 	echo $testio | grep -q "Operation not supported" && \
 		_notrun "xfs_io $command failed (old kernel/wrong fs?)"
+	echo $testio | grep -q "invalid option" && \
+		_notrun "xfs_io $command support is missing"
 }

Yeah, looks like it throws a different error - it treats -T as an option, not a command. Rather than multiple checks that result in the same error, why not just:

- echo $testio | grep -q "not found" && \
+ echo $testio | egrep -q 'not found|invalid option' && \
_notrun "xfs_io $command support is missing"

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#2 lore raw
In reply to Josef Bacik
Quoted 4 lines · Josef Bacik

I don't have flink support in my xfsprogs, but it doesn't fail with "command not found" or whatever, it fails because I don't have the -T option. So fix _require_xfs_io_command to check for an invalid option and not run. This way I get notrun instead of a failure. Thanks,

This actually doesn't work for me on an old kernel, if that matters; it fails with:

/mnt/test: Is a directory

and nothing catches that. Old xfsprogs tries to open the file in question RDWR even before it gets to the -T option (which would fail, I guess), and you can't do that for directories.

So I suppose we could explicitly test for that when checking flink:

[ $command = "flink" ] && echo $testio | grep -q "Is a directory" && \
_notrun "xfs_io flink support is missing"

or alternately, first just run xfs_io w/ the command but no file; today, at least, that works:

[root@bp-05 xfstests]# xfs_io -c flink
command "flink" not found
[root@bp-05 xfstests]# xfs_io -c pread
[root@bp-05 xfstests]#

so could do this before the case statement:

$XFS_IO_PROG -c $command 2>&1 | grep -q "not found" && \
_notrun "xfs_io $command support is missing"

but that might be subject to future changes in xfs_io command parsing...

-Eric

Quoted 20 lines
---
 common/rc | 2 ++
 1 file changed, 2 insertions(+)
common/rc +2 -1
index 5c13db5..4fa7e63 100644
@@ -1258,6 +1258,8 @@ _require_xfs_io_command()
 		_notrun "xfs_io $command support is missing"
 	echo $testio | grep -q "Operation not supported" && \
 		_notrun "xfs_io $command failed (old kernel/wrong fs?)"
+	echo $testio | grep -q "invalid option" && \
+		_notrun "xfs_io $command support is missing"
 }
 
 # Check that a fs has enough free space (in 1024b blocks)
-- 1.8.3.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs