common/rc: decouple xfs_io flink check from xfs_io -T check
authorAmir Goldstein <amir73il@gmail.com>
Sun, 6 May 2018 06:36:07 +0000 (09:36 +0300)
committerEryu Guan <guaneryu@gmail.com>
Fri, 11 May 2018 10:40:04 +0000 (18:40 +0800)
The 3 tests that _require_xfs_io_command "flink", actually require
O_TMPFILE support and flink command, but the former is far unlikely
to be missing. The test btrfs/058 doesn't even use the flink
command.

When running these tests on a filesystem that does not support
O_TMPFILE (e.g. overlayfs) the result is not very infomative:

 generic/004 1s ... [not run] xfs_io flink failed (old kernel/wrong fs?)

Decouple the requirements for "flink" command and "-T" command line
flag and require the former explicitly in tests that use it.

As a result the report is now more informative:

 generic/004 1s ... [not run] O_TMPFILE is not supported

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc
tests/btrfs/058
tests/generic/004
tests/generic/389

index ee677e7dc6b2b5cab801846485d15bb3e329b375..ffe5323603ebbee930eeb8183ac15ba1e4537f18 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2126,13 +2126,20 @@ _require_xfs_io_command()
                        -c "fiemap -v $param" $testfile 2>&1`
                param_checked=1
                ;;
-       "flink" )
-               testio=`$XFS_IO_PROG -T -F -c "flink $testfile" \
-                       $TEST_DIR 2>&1`
+       "flink")
+               local testlink=$TEST_DIR/$$.link.xfs_io
+               testio=`$XFS_IO_PROG -F -f -c "flink $testlink" $testfile 2>&1`
+               rm -f $testlink > /dev/null 2>&1
+               ;;
+       "-T")
+               # Check O_TMPFILE support in xfs_io, kernel and fs
+               testio=`$XFS_IO_PROG -T -c quit $TEST_DIR 2>&1`
                echo $testio | egrep -q "invalid option|Is a directory" && \
                        _notrun "xfs_io $command support is missing"
+               echo $testio | grep -q "Operation not supported" && \
+                       _notrun "O_TMPFILE is not supported"
                ;;
-       "fsmap" )
+       "fsmap")
                testio=`$XFS_IO_PROG -f -c "fsmap" $testfile 2>&1`
                echo $testio | grep -q "Inappropriate ioctl" && \
                        _notrun "xfs_io $command support is missing"
index ed39f94332717517e4bd48dc17f92dd6533ce852..f139d0cc34c568717c5390fd2dcd94c2d70a33bc 100755 (executable)
@@ -53,9 +53,7 @@ _cleanup()
 _supported_fs btrfs
 _supported_os Linux
 _require_scratch
-# Requiring flink command tests for the presence of the -T option used
-# to pass O_TMPFILE to open(2).
-_require_xfs_io_command "flink"
+_require_xfs_io_command "-T"
 
 rm -f $seqres.full
 
index d0926f117c4b148f099e470dc1b1af39d2791470..df6f215a6d07ca57524b2b74eccf936236ce0836 100755 (executable)
@@ -45,6 +45,7 @@ _supported_fs generic
 _supported_os Linux
 
 _require_test
+_require_xfs_io_command "-T"
 _require_xfs_io_command "flink"
 
 rm -f $seqres.full
index 6d63eda1e2e1b360239eeb25cbdc95edd001ab6d..1b7bd770ef8ebe33c991b4f73b2d9776840f3534 100755 (executable)
@@ -47,6 +47,7 @@ _supported_fs generic
 _supported_os Linux
 
 _require_test
+_require_xfs_io_command "-T"
 _require_xfs_io_command "flink"
 _require_acls