Skip to contentSkip to conversation

Improve generic test coverage for overlayfs

PATCH New Amir Goldstein 1 participant 3 messages May 6, 2018

lore
Share & tools
lore
#0 lore raw

cover Improve generic test coverage for overlayfs

Eryu,

With current upstream kernel and xfs base FSTYP, this is the test coverage I got from running: ./check -overlay -g generic/auto

Ran: 495; Not run: 192; Failures: 0

These patches improve test coverage by running and passing two more tests and improving the reason in report for not running two of the tests.

Thanks,
Amir.

Amir Goldstein (2):
common/rc: decouple xfs_io flink check from xfs_io -T check generic/{159,160}: require chattr instead of lsattr

 common/rc         | 15 +++++++++++----
 tests/btrfs/058   |  4 +---
 tests/generic/004 |  1 +
 tests/generic/159 |  2 +-
 tests/generic/160 |  2 +-
 tests/generic/389 |  1 +
 6 files changed, 16 insertions(+), 9 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 common/rc: decouple xfs_io flink check from xfs_io -T check

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

---
 common/rc         | 15 +++++++++++----
 tests/btrfs/058   |  4 +---
 tests/generic/004 |  1 +
 tests/generic/389 |  1 +
 4 files changed, 14 insertions(+), 7 deletions(-)
common/rc +11 -4
index 9ffab7f..3dabdc9 100644
@@ -2147,13 +2147,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"
tests/btrfs/058 +1 -3
index ed39f94..f139d0c 100755
@@ -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
 
tests/generic/004 +1 -0
index d0926f1..df6f215 100755
@@ -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
tests/generic/389 +1 -0
index 6d63eda..1b7bd77 100755
@@ -47,6 +47,7 @@ _supported_fs generic
 _supported_os Linux
 
 _require_test
+_require_xfs_io_command "-T"
 _require_xfs_io_command "flink"
 _require_acls
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 generic/{159,160}: require chattr instead of lsattr

In reply to Amir Goldstein

The tests _require_test_lsattr, but don't actually use lsattr. They use chattr +i/-i, so require the appropriate command.

_require_test_lsattr checks the FS_IOC_GETFLAGS ioctl on a directory and that is not supported in overlayfs. _require_chattr checks the ioctl on a file, which is supported in overlayfs, so this change makes the tests run and pass on overlayfs.

---
 tests/generic/159 | 2 +-
 tests/generic/160 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/generic/159 +1 -1
index 7e52d5c..f517b55 100755
@@ -43,7 +43,7 @@ _cleanup()
 
 # real QA test starts here
 _supported_os Linux
-_require_test_lsattr
+_require_chattr i
 _require_test_reflink
 
 rm -f $seqres.full
tests/generic/160 +1 -1
index 409b15e..cd1044d 100755
@@ -43,7 +43,7 @@ _cleanup()
 
 # real QA test starts here
 _supported_os Linux
-_require_test_lsattr
+_require_chattr i
 _require_test_dedupe
 
 rm -f $seqres.full
Signature · 1 line
2.7.4