[1/2] inject: skip tests when knob dir exists but knob doesn't
diff mbox series

Message ID 154993786856.2062.15965021741779968907.stgit@magnolia
State Accepted
Headers show
Series
  • fstests: incore unlinked list
Related show

Commit Message

Darrick J. Wong Feb. 12, 2019, 2:17 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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>
---
 common/inject |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Brian Foster Feb. 12, 2019, 2:03 p.m. UTC | #1
On Mon, Feb 11, 2019 at 06:17:48PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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>

>  common/inject |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> 
> diff --git a/common/inject b/common/inject
> index 903fb379..984ec209 100644
> --- a/common/inject
> +++ b/common/inject
> @@ -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
>

Patch
diff mbox series

diff --git a/common/inject b/common/inject
index 903fb379..984ec209 100644
--- a/common/inject
+++ b/common/inject
@@ -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