diff mbox series

generic/077: ignore errors occurred while accessing the filler files

Message ID 20240605163210.18450-1-luis.henriques@linux.dev (mailing list archive)
State New
Headers show
Series generic/077: ignore errors occurred while accessing the filler files | expand

Commit Message

Luis Henriques June 5, 2024, 4:32 p.m. UTC
When looking for data to fill in the filesystem, errors accessing files
may occur.  This will cause the test to fail as it'll show in the output
lines such as:

    du: cannot read directory '/usr/etc/sudoers.d': Permission denied

Ignoring these errors should be safe, so simply redirecting the stderr of
'du' to $seqres.full fixes it.  Unfortunately, this exposed a different
issue, which was the truncation of the $seqres.full file while copying files
into the filesystem.  This patch also fixes that.

Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>
---
 tests/generic/077 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Zorro Lang June 7, 2024, 4:51 a.m. UTC | #1
On Wed, Jun 05, 2024 at 05:32:10PM +0100, Luis Henriques (SUSE) wrote:
> When looking for data to fill in the filesystem, errors accessing files
> may occur.  This will cause the test to fail as it'll show in the output
> lines such as:
> 
>     du: cannot read directory '/usr/etc/sudoers.d': Permission denied
> 
> Ignoring these errors should be safe, so simply redirecting the stderr of
> 'du' to $seqres.full fixes it.  Unfortunately, this exposed a different
> issue, which was the truncation of the $seqres.full file while copying files
> into the filesystem.  This patch also fixes that.
> 
> Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>

Makes sense to me,
Reviewed-by: Zorro Lang <zlang@redhat.com>

> ---
>  tests/generic/077 | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/generic/077 b/tests/generic/077
> index 2624e88f1456..4d66f1055403 100755
> --- a/tests/generic/077
> +++ b/tests/generic/077
> @@ -12,13 +12,13 @@ _begin_fstest acl attr auto enospc
>  # Something w/ enough data to fill 256M of fs...
>  filler=""
>  [ -d /lib/modules ] && \
> -	[ $(( $(du -h -m /lib/modules | tail -1| cut -f1) * 2 )) -ge 256 ] && \
> +	[ $(( $(du -h -m /lib/modules 2>> $seqres.full | tail -1| cut -f1) * 2 )) -ge 256 ] && \
>  	filler=/lib/modules
>  
>  # fall back in case /lib/modules doesn't exist or smaller
>  [[ -z $filler ]] && \
>  	[ -d /usr ] && \
> -	[ $(( $(du -h -m /usr | tail -1| cut -f1) * 2 )) -ge 256 ] && \
> +	[ $(( $(du -h -m /usr 2>> $seqres.full | tail -1| cut -f1) * 2 )) -ge 256 ] && \
>  	filler=/usr
>  
>  # Override the default cleanup function.
> @@ -58,10 +58,10 @@ echo "*** set default ACL"
>  setfacl -R -dm u:fsgqa:rwx,g::rwx,o::r-x,m::rwx $SCRATCH_MNT/subdir
>  
>  echo "*** populate filesystem, pass #1" | tee -a $seqres.full
> -cp -rf $filler $SCRATCH_MNT/subdir >$seqres.full 2>&1
> +cp -rf $filler $SCRATCH_MNT/subdir >>$seqres.full 2>&1
>  
>  echo "*** populate filesystem, pass #2" | tee -a $seqres.full
> -cp -rf $filler $SCRATCH_MNT/subdir >$seqres.full 2>&1
> +cp -rf $filler $SCRATCH_MNT/subdir >>$seqres.full 2>&1
>  
>  _check_scratch_fs
>  
>
diff mbox series

Patch

diff --git a/tests/generic/077 b/tests/generic/077
index 2624e88f1456..4d66f1055403 100755
--- a/tests/generic/077
+++ b/tests/generic/077
@@ -12,13 +12,13 @@  _begin_fstest acl attr auto enospc
 # Something w/ enough data to fill 256M of fs...
 filler=""
 [ -d /lib/modules ] && \
-	[ $(( $(du -h -m /lib/modules | tail -1| cut -f1) * 2 )) -ge 256 ] && \
+	[ $(( $(du -h -m /lib/modules 2>> $seqres.full | tail -1| cut -f1) * 2 )) -ge 256 ] && \
 	filler=/lib/modules
 
 # fall back in case /lib/modules doesn't exist or smaller
 [[ -z $filler ]] && \
 	[ -d /usr ] && \
-	[ $(( $(du -h -m /usr | tail -1| cut -f1) * 2 )) -ge 256 ] && \
+	[ $(( $(du -h -m /usr 2>> $seqres.full | tail -1| cut -f1) * 2 )) -ge 256 ] && \
 	filler=/usr
 
 # Override the default cleanup function.
@@ -58,10 +58,10 @@  echo "*** set default ACL"
 setfacl -R -dm u:fsgqa:rwx,g::rwx,o::r-x,m::rwx $SCRATCH_MNT/subdir
 
 echo "*** populate filesystem, pass #1" | tee -a $seqres.full
-cp -rf $filler $SCRATCH_MNT/subdir >$seqres.full 2>&1
+cp -rf $filler $SCRATCH_MNT/subdir >>$seqres.full 2>&1
 
 echo "*** populate filesystem, pass #2" | tee -a $seqres.full
-cp -rf $filler $SCRATCH_MNT/subdir >$seqres.full 2>&1
+cp -rf $filler $SCRATCH_MNT/subdir >>$seqres.full 2>&1
 
 _check_scratch_fs