]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
inject: skip tests when knob dir exists but knob doesn't
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 12 Feb 2019 02:17:48 +0000 (18:17 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sat, 16 Feb 2019 12:06:29 +0000 (20:06 +0800)
If the XFS error injection knob directory exists but the knob itself
doesn't, then we know that this kernel doesn't support the knob and
can skip the test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/inject

index 903fb3790b92f7b2096cbb5e46298273af1150a9..984ec209281da1cae8d9ee8e0ea9c57e3097059f 100644 (file)
@@ -62,6 +62,13 @@ _require_xfs_io_error_injection()
        knob="$(_find_xfs_mountdev_errortag_knob "${TEST_DEV}" "${type}")"
        test -w "${knob}" && return
 
+       # If the directory containing the sysfs error injection knob exists
+       # but the knob itself isn't usable, this kernel doesn't know about
+       # the knob.  Skip the test.
+       if [ -d "$(dirname "${knob}")" ]; then
+               _notrun "XFS error injection $type unknown on this kernel."
+       fi
+
        # NOTE: We can't actually test error injection here because xfs
        # hasn't always range checked the argument to xfs_errortag_add.
        # We also don't want to trip an error before we're ready to deal