diff mbox series

[v2,3/4] generic/554: hide permision warning on exfat

Message ID 20210330220005.56019-4-preichl@redhat.com (mailing list archive)
State New
Headers show
Series Fix some tests that fail for exfat FS | expand

Commit Message

Pavel Reichl March 30, 2021, 10 p.m. UTC
Signed-off-by: Pavel Reichl <preichl@redhat.com>
---
 common/rc         | 13 +++++++++++++
 tests/generic/554 |  3 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

Comments

Eryu Guan April 1, 2021, 3:40 a.m. UTC | #1
On Wed, Mar 31, 2021 at 12:00:04AM +0200, Pavel Reichl wrote:
> Signed-off-by: Pavel Reichl <preichl@redhat.com>
> ---
>  common/rc         | 13 +++++++++++++
>  tests/generic/554 |  3 ++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/common/rc b/common/rc
> index 2d658711..379140ea 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2401,6 +2401,19 @@ _format_swapfile() {
>  	fi
>  }
>  
> +_format_swapon_file() {

It's not a "format" action anymore, the _format prefix seems misleading.
I think _swapon_file seems fine.

Thanks,
Eryu

> +	local fname="$1"
> +
> +	if [ "$FSTYP" = "exfat" ]; then
> +		# exfat does not support posix file permisions, so warning is
> +		# to be expected
> +		swapon "$fname" |& grep -v "insecure permissions"
> +	else
> +		swapon "$fname"
> +	fi
> +
> +}
> +
>  # Check that the filesystem supports swapfiles
>  _require_scratch_swapfile()
>  {
> diff --git a/tests/generic/554 b/tests/generic/554
> index fa4f97d2..c2f9eee8 100755
> --- a/tests/generic/554
> +++ b/tests/generic/554
> @@ -46,7 +46,8 @@ $XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $SCRATCH_MNT/file >> $seqres.full 2>&
>  
>  echo swap files return ETXTBUSY
>  _format_swapfile $SCRATCH_MNT/swapfile 16m
> -swapon $SCRATCH_MNT/swapfile
> +_format_swapon_file $SCRATCH_MNT/swapfile
> +
>  $XFS_IO_PROG -f -c "copy_range -l 32k $SCRATCH_MNT/file" $SCRATCH_MNT/swapfile
>  swapoff $SCRATCH_MNT/swapfile
>  
> -- 
> 2.30.2
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 2d658711..379140ea 100644
--- a/common/rc
+++ b/common/rc
@@ -2401,6 +2401,19 @@  _format_swapfile() {
 	fi
 }
 
+_format_swapon_file() {
+	local fname="$1"
+
+	if [ "$FSTYP" = "exfat" ]; then
+		# exfat does not support posix file permisions, so warning is
+		# to be expected
+		swapon "$fname" |& grep -v "insecure permissions"
+	else
+		swapon "$fname"
+	fi
+
+}
+
 # Check that the filesystem supports swapfiles
 _require_scratch_swapfile()
 {
diff --git a/tests/generic/554 b/tests/generic/554
index fa4f97d2..c2f9eee8 100755
--- a/tests/generic/554
+++ b/tests/generic/554
@@ -46,7 +46,8 @@  $XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $SCRATCH_MNT/file >> $seqres.full 2>&
 
 echo swap files return ETXTBUSY
 _format_swapfile $SCRATCH_MNT/swapfile 16m
-swapon $SCRATCH_MNT/swapfile
+_format_swapon_file $SCRATCH_MNT/swapfile
+
 $XFS_IO_PROG -f -c "copy_range -l 32k $SCRATCH_MNT/file" $SCRATCH_MNT/swapfile
 swapoff $SCRATCH_MNT/swapfile