Re: [PATCH fstests v2 3/3] generic/578: only run on filesystems that support FIEMAP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 24, 2023 at 12:44:19PM -0400, Jeff Layton wrote:
> Some filesystems (e.g. NFS) don't support FIEMAP. Limit generic/578 to
> filesystems that do.
> 
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---
>  common/rc         | 13 +++++++++++++
>  tests/generic/578 |  1 +
>  2 files changed, 14 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index 33e74d20c28b..98d27890f6f7 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3885,6 +3885,19 @@ _require_metadata_journaling()
>  	fi
>  }
>  
> +_require_fiemap()
> +{
> +	local testfile=$TEST_DIR/fiemaptest.$$
> +
> +	touch $testfile
> +	$XFS_IO_PROG -r -c "fiemap" $testfile 1>$testfile.out 2>&1
> +	if grep -q 'Operation not supported' $testfile.out; then
> +	  _notrun "FIEMAP is not supported by this filesystem"
> +	fi
> +
> +	rm -f $testfile $testfile.out
> +}

_require_xfs_io_command "fiemap" ?

--D

> +
>  _count_extents()
>  {
>  	$XFS_IO_PROG -r -c "fiemap" $1 | tail -n +2 | grep -v hole | wc -l
> diff --git a/tests/generic/578 b/tests/generic/578
> index b024f6ff90b4..903055b2ca58 100755
> --- a/tests/generic/578
> +++ b/tests/generic/578
> @@ -26,6 +26,7 @@ _require_test_program "mmap-write-concurrent"
>  _require_command "$FILEFRAG_PROG" filefrag
>  _require_test_reflink
>  _require_cp_reflink
> +_require_fiemap
>  
>  compare() {
>  	for i in $(seq 1 8); do
> 
> -- 
> 2.41.0
> 



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux