Re: [PATCH 2/2] fstests: add _require_hardlinks for all necessary tests

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



On Thu, Apr 09, 2020 at 02:10:36PM -0500, Eric Sandeen wrote:
> Add a new _require function for hardlinks, to test hardlink support
> in all tests which need it.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---
> 
> diff --git a/common/rc b/common/rc
> index 476d3d07..8bb9aa1f 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3493,6 +3493,18 @@ _require_symlinks()
>  	rm -f $target $link
>  }
>  
> +_require_hardlinks()
> +{
> +	local target=`mktemp -p $TEST_DIR`
> +	local link=`mktemp -p $TEST_DIR -u`
> +	ln `basename $target` $link

I really doubt if it works. Why we need the basename of the $target? It cause we
create a link in *current* directory, and the current directory isn't the
$TEST_DIR.

The _require_symlinks won't fail due to symlink can be created cross filesystems,
but hardlink can't. But that's not the _require_symlinks want to test, right?

So why we need the basename? Please correct me if I'm wrong.

Thanks,
Zorro

> +	if [ "$?" -ne 0 ]; then
> +		rm -f $target
> +		_notrun "No hardlink support"
> +	fi
> +	rm -f $target $link
> +}
> +
>  _require_test_fcntl_advisory_locks()
>  {
>  	[ "$FSTYP" != "cifs" ] && return 0
> diff --git a/tests/generic/002 b/tests/generic/002
> index 575ac42b..480b77bc 100755
> --- a/tests/generic/002
> +++ b/tests/generic/002
> @@ -28,6 +28,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_test
> +_require_hardlinks
>  
>  rm -f $seqres.full
>  
> diff --git a/tests/generic/039 b/tests/generic/039
> index daa2e353..27cd6bf5 100755
> --- a/tests/generic/039
> +++ b/tests/generic/039
> @@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/040 b/tests/generic/040
> index 712ae595..b69d8127 100755
> --- a/tests/generic/040
> +++ b/tests/generic/040
> @@ -44,6 +44,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/041 b/tests/generic/041
> index 8001e8ce..1674d544 100755
> --- a/tests/generic/041
> +++ b/tests/generic/041
> @@ -48,6 +48,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/056 b/tests/generic/056
> index 9caf1166..28920d36 100755
> --- a/tests/generic/056
> +++ b/tests/generic/056
> @@ -37,6 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/057 b/tests/generic/057
> index ba51dbb9..91e1d98e 100755
> --- a/tests/generic/057
> +++ b/tests/generic/057
> @@ -37,6 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/065 b/tests/generic/065
> index d6a1670b..30f3c32e 100755
> --- a/tests/generic/065
> +++ b/tests/generic/065
> @@ -38,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/089 b/tests/generic/089
> index 3d608269..52649596 100755
> --- a/tests/generic/089
> +++ b/tests/generic/089
> @@ -36,6 +36,7 @@ addentries()
>  _supported_fs generic
>  _supported_os Linux
>  _require_test
> +_require_hardlinks
>  
>  rm -f $seqres.full
>  [ "X$TEST_DIR" = "X" ] && exit 1
> diff --git a/tests/generic/090 b/tests/generic/090
> index bf38d1c8..db1aeef3 100755
> --- a/tests/generic/090
> +++ b/tests/generic/090
> @@ -36,6 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/104 b/tests/generic/104
> index d78689f4..4b6256db 100755
> --- a/tests/generic/104
> +++ b/tests/generic/104
> @@ -31,6 +31,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/106 b/tests/generic/106
> index 74d5dc30..e1c859e5 100755
> --- a/tests/generic/106
> +++ b/tests/generic/106
> @@ -30,6 +30,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/107 b/tests/generic/107
> index 5c6bbfca..214f3389 100755
> --- a/tests/generic/107
> +++ b/tests/generic/107
> @@ -33,6 +33,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/236 b/tests/generic/236
> index f207165f..2110b053 100755
> --- a/tests/generic/236
> +++ b/tests/generic/236
> @@ -25,8 +25,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  # real QA test starts here
>  _supported_fs generic
> -# only Linux supports fallocate
>  _supported_os Linux
> +_require_hardlinks
>  _require_test
>  
>  rm -f $TEST_DIR/ouch*
> diff --git a/tests/generic/336 b/tests/generic/336
> index e007552c..6832ccde 100755
> --- a/tests/generic/336
> +++ b/tests/generic/336
> @@ -32,6 +32,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/343 b/tests/generic/343
> index e35488dd..2034197e 100755
> --- a/tests/generic/343
> +++ b/tests/generic/343
> @@ -32,6 +32,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/378 b/tests/generic/378
> index 393d1ce7..ea776949 100755
> --- a/tests/generic/378
> +++ b/tests/generic/378
> @@ -39,6 +39,7 @@ _supported_fs generic
>  _supported_os Linux
>  _require_test
>  _require_user
> +_require_hardlinks
>  
>  # Setup testfile and its hardlink
>  testfile=$TEST_DIR/testfile.$seq
> diff --git a/tests/generic/480 b/tests/generic/480
> index ba2c34ad..63a87519 100755
> --- a/tests/generic/480
> +++ b/tests/generic/480
> @@ -32,6 +32,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/498 b/tests/generic/498
> index 71f5091c..7adf0b32 100755
> --- a/tests/generic/498
> +++ b/tests/generic/498
> @@ -31,6 +31,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/502 b/tests/generic/502
> index a60ac9a7..a49ee0b3 100755
> --- a/tests/generic/502
> +++ b/tests/generic/502
> @@ -34,6 +34,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/526 b/tests/generic/526
> index d0b51f87..934d263f 100755
> --- a/tests/generic/526
> +++ b/tests/generic/526
> @@ -32,6 +32,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> diff --git a/tests/generic/527 b/tests/generic/527
> index 61dd4f0b..4b664da9 100755
> --- a/tests/generic/527
> +++ b/tests/generic/527
> @@ -32,6 +32,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> +_require_hardlinks
>  _require_dm_target flakey
>  
>  rm -f $seqres.full
> 




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux