diff mbox series

[2/2] generic/682: update and fix-up golden output

Message ID 20240201161732.6126-3-ailiop@suse.com (mailing list archive)
State New, archived
Headers show
Series generic/681 and generic/682 fixes | expand

Commit Message

Anthony Iliopoulos Feb. 1, 2024, 4:17 p.m. UTC
coreutils v9.4 introduced a change in the error output of mv under
certain errno values via commit 3cb862ce5f10 ("mv: better diagnostic for
'mv dir x' failure"), which broke the golden output.

Update golden output to match the change, and further add an output
filter to avoid having the test fail on environments that ran with an
older coreutils release, taken from commit d9323ad7a05e ("generic/245:
Filter mv error message").

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 tests/generic/682     | 8 +++++++-
 tests/generic/682.out | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Andrey Albershteyn Feb. 2, 2024, 11 a.m. UTC | #1
On 2024-02-01 17:17:32, Anthony Iliopoulos wrote:
> coreutils v9.4 introduced a change in the error output of mv under
> certain errno values via commit 3cb862ce5f10 ("mv: better diagnostic for
> 'mv dir x' failure"), which broke the golden output.
> 
> Update golden output to match the change, and further add an output
> filter to avoid having the test fail on environments that ran with an
> older coreutils release, taken from commit d9323ad7a05e ("generic/245:
> Filter mv error message").
> 
> Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
> ---

LGTM
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
Zorro Lang Feb. 2, 2024, 11:56 a.m. UTC | #2
On Thu, Feb 01, 2024 at 05:17:32PM +0100, Anthony Iliopoulos wrote:
> coreutils v9.4 introduced a change in the error output of mv under
> certain errno values via commit 3cb862ce5f10 ("mv: better diagnostic for
> 'mv dir x' failure"), which broke the golden output.
> 
> Update golden output to match the change, and further add an output
> filter to avoid having the test fail on environments that ran with an
> older coreutils release, taken from commit d9323ad7a05e ("generic/245:
> Filter mv error message").
> 
> Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
> ---
>  tests/generic/682     | 8 +++++++-
>  tests/generic/682.out | 2 +-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/682 b/tests/generic/682
> index a51d18338742..417598804bde 100755
> --- a/tests/generic/682
> +++ b/tests/generic/682
> @@ -54,6 +54,12 @@ repquota -upn $SCRATCH_MNT >> $seqres.full
>  echo $(ls $scratchdir | wc -l) files in $scratchdir  >> $seqres.full
>  ls -sld $scratchdir  >> $seqres.full
>  
> +_filter_mv_output()
> +{
> +	sed -e "s,cannot move .* to \(.*\):\(.*\),cannot overwrite \1:\2,g" \

Hi Anthony,

Thanks for this fix, I remember there's a mv filter in generic/245, we
just merged a patch same with above line:
  d9323ad7a05e ("generic/245: Filter mv error message")

I think you can merge the _filter_directory_not_empty() of g/245 with
this patch into one _filter_mv_output() function, and call it in g/245
and g/682 (check if there're more cases need mv output).

Thanks,
Zorro

> +	    -e 's/y[0-9]*/yXXX/g'
> +}
> +
>  # Fail at renaming into the directory as qa_user to ensure quota enforcement
>  # works
>  chmod a+rwx $stagedir
> @@ -62,7 +68,7 @@ for ((i = 0; i < dirents; i++)); do
>  	name=$(printf "y%0254d" $i)
>  	ln $scratchfile $stagedir/$name
>  	su - "$qa_user" -c "mv $stagedir/$name $scratchdir/$name" 2>&1 | \
> -		_filter_scratch | sed -e 's/y[0-9]*/yXXX/g'
> +		_filter_scratch | _filter_mv_output
>  	test "${PIPESTATUS[0]}" -ne 0 && break
>  done
>  repquota -upn $SCRATCH_MNT >> $seqres.full
> diff --git a/tests/generic/682.out b/tests/generic/682.out
> index b74708117237..db22d5f60487 100644
> --- a/tests/generic/682.out
> +++ b/tests/generic/682.out
> @@ -1,3 +1,3 @@
>  QA output created by 682
> -mv: cannot move 'SCRATCH_MNT/staging/yXXX' to 'SCRATCH_MNT/dir/yXXX': Disk quota exceeded
> +mv: cannot overwrite 'SCRATCH_MNT/dir/yXXX': Disk quota exceeded
>  Silence is golden
> -- 
> 2.41.0
> 
>
Anthony Iliopoulos Feb. 6, 2024, 5:31 p.m. UTC | #3
On Fri, Feb 02, 2024 at 07:56:05PM +0800, Zorro Lang wrote:
> On Thu, Feb 01, 2024 at 05:17:32PM +0100, Anthony Iliopoulos wrote:
> > coreutils v9.4 introduced a change in the error output of mv under
> > certain errno values via commit 3cb862ce5f10 ("mv: better diagnostic for
> > 'mv dir x' failure"), which broke the golden output.
> > 
> > Update golden output to match the change, and further add an output
> > filter to avoid having the test fail on environments that ran with an
> > older coreutils release, taken from commit d9323ad7a05e ("generic/245:
> > Filter mv error message").
> > 
> > Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
> > ---
> >  tests/generic/682     | 8 +++++++-
> >  tests/generic/682.out | 2 +-
> >  2 files changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tests/generic/682 b/tests/generic/682
> > index a51d18338742..417598804bde 100755
> > --- a/tests/generic/682
> > +++ b/tests/generic/682
> > @@ -54,6 +54,12 @@ repquota -upn $SCRATCH_MNT >> $seqres.full
> >  echo $(ls $scratchdir | wc -l) files in $scratchdir  >> $seqres.full
> >  ls -sld $scratchdir  >> $seqres.full
> >  
> > +_filter_mv_output()
> > +{
> > +	sed -e "s,cannot move .* to \(.*\):\(.*\),cannot overwrite \1:\2,g" \
> 
> Hi Anthony,
> 
> Thanks for this fix, I remember there's a mv filter in generic/245, we
> just merged a patch same with above line:
>   d9323ad7a05e ("generic/245: Filter mv error message")
> 
> I think you can merge the _filter_directory_not_empty() of g/245 with
> this patch into one _filter_mv_output() function, and call it in g/245
> and g/682 (check if there're more cases need mv output).

Make sense, I'll send out a v2 shortly with the filters consolidated.

AFAICT only g/245 and g/682 are affected by the particular coreutils mv
error output change, due to their golden output.

The only other tests are g/{369,419}:

$ git grep 'cannot move' tests/
tests/generic/369.out:mv: cannot move 'h' to 'd7/h': Permission denied
tests/generic/369.out:mv: cannot move 'h' to 's7/h': Permission denied
tests/generic/419.out:mv: cannot move 'SCRATCH_MNT/edir/NOKEY_NAME' to
'SCRATCH_MNT/edir/NOKEY_NAME': Required key not available

but those aren't affected as coreutils commit 3cb862ce5f10 only changed
the error output for specific err codes (EDQUOT, EEXIST, EISDIR, EMLINK,
ENOSPC, ENOTEMPTY, ETXTBSY), while g/369 is expecting EPERM and g/419 is
ENOKEY.

Regards,
Anthony
diff mbox series

Patch

diff --git a/tests/generic/682 b/tests/generic/682
index a51d18338742..417598804bde 100755
--- a/tests/generic/682
+++ b/tests/generic/682
@@ -54,6 +54,12 @@  repquota -upn $SCRATCH_MNT >> $seqres.full
 echo $(ls $scratchdir | wc -l) files in $scratchdir  >> $seqres.full
 ls -sld $scratchdir  >> $seqres.full
 
+_filter_mv_output()
+{
+	sed -e "s,cannot move .* to \(.*\):\(.*\),cannot overwrite \1:\2,g" \
+	    -e 's/y[0-9]*/yXXX/g'
+}
+
 # Fail at renaming into the directory as qa_user to ensure quota enforcement
 # works
 chmod a+rwx $stagedir
@@ -62,7 +68,7 @@  for ((i = 0; i < dirents; i++)); do
 	name=$(printf "y%0254d" $i)
 	ln $scratchfile $stagedir/$name
 	su - "$qa_user" -c "mv $stagedir/$name $scratchdir/$name" 2>&1 | \
-		_filter_scratch | sed -e 's/y[0-9]*/yXXX/g'
+		_filter_scratch | _filter_mv_output
 	test "${PIPESTATUS[0]}" -ne 0 && break
 done
 repquota -upn $SCRATCH_MNT >> $seqres.full
diff --git a/tests/generic/682.out b/tests/generic/682.out
index b74708117237..db22d5f60487 100644
--- a/tests/generic/682.out
+++ b/tests/generic/682.out
@@ -1,3 +1,3 @@ 
 QA output created by 682
-mv: cannot move 'SCRATCH_MNT/staging/yXXX' to 'SCRATCH_MNT/dir/yXXX': Disk quota exceeded
+mv: cannot overwrite 'SCRATCH_MNT/dir/yXXX': Disk quota exceeded
 Silence is golden