diff mbox series

[3/4] generic/570: fix regression when SCRATCH_DEV is still formatted

Message ID 162743099423.3427426.15112820532966726474.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes | expand

Commit Message

Darrick J. Wong July 28, 2021, 12:09 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Newer versions of mkswap (or at least the one in util-linux 2.34)
complain to stderr when they're formatting over a device that seems to
contain existing data:

    mkswap: /dev/sdf: warning: wiping old btrfs signature.

This is harmless (since the swap image does get written!) but the extra
golden output is flagged as a regression.  Update the mkswap usage in
this test to dump the stderr output to $seqres.full, and complain if the
exit code is nonzero.

This fixes a regression that the author noticed when testing btrfs and
generic/507 and generic/570 run sequentially.  generic/507 calls
_require_scratch_shutdown to see if the shutdown call is supported.
btrfs does not support that, so the test is _notrun.  This leaves the
scratch filesystem mounted, causing the _try_wipe_scratch_devs between
tests to fail.  When g/570 starts up, the scratch device still contains
leftovers from the failed attempt to run g/507, which is why the mkswap
command outputs the above warning.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/570 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eryu Guan Aug. 1, 2021, 1:08 p.m. UTC | #1
On Tue, Jul 27, 2021 at 05:09:54PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Newer versions of mkswap (or at least the one in util-linux 2.34)
> complain to stderr when they're formatting over a device that seems to
> contain existing data:
> 
>     mkswap: /dev/sdf: warning: wiping old btrfs signature.
> 
> This is harmless (since the swap image does get written!) but the extra
> golden output is flagged as a regression.  Update the mkswap usage in
> this test to dump the stderr output to $seqres.full, and complain if the
> exit code is nonzero.
> 
> This fixes a regression that the author noticed when testing btrfs and
> generic/507 and generic/570 run sequentially.  generic/507 calls
> _require_scratch_shutdown to see if the shutdown call is supported.
> btrfs does not support that, so the test is _notrun.  This leaves the
> scratch filesystem mounted, causing the _try_wipe_scratch_devs between
> tests to fail.  When g/570 starts up, the scratch device still contains

Won't your previous patch "check: don't leave the scratch filesystem
mounted after _notrun" fix this issue as well? As _notrun won't leaves
scratch dev mounted & unwiped after that patch. Would you please confirm?

Thanks,
Eryu

> leftovers from the failed attempt to run g/507, which is why the mkswap
> command outputs the above warning.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/generic/570 |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> diff --git a/tests/generic/570 b/tests/generic/570
> index 7d03acfe..02c1d333 100755
> --- a/tests/generic/570
> +++ b/tests/generic/570
> @@ -27,7 +27,7 @@ _require_scratch_nocheck
>  _require_block_device $SCRATCH_DEV
>  test -e /dev/snapshot && _notrun "userspace hibernation to swap is enabled"
>  
> -$MKSWAP_PROG "$SCRATCH_DEV" >> $seqres.full
> +$MKSWAP_PROG -f "$SCRATCH_DEV" &>> $seqres.full || echo "mkswap failed?"
>  
>  # Can you modify the swap dev via previously open file descriptors?
>  for verb in 1 2 3 4; do
Darrick J. Wong Aug. 2, 2021, 10:15 p.m. UTC | #2
On Sun, Aug 01, 2021 at 09:08:32PM +0800, Eryu Guan wrote:
> On Tue, Jul 27, 2021 at 05:09:54PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Newer versions of mkswap (or at least the one in util-linux 2.34)
> > complain to stderr when they're formatting over a device that seems to
> > contain existing data:
> > 
> >     mkswap: /dev/sdf: warning: wiping old btrfs signature.
> > 
> > This is harmless (since the swap image does get written!) but the extra
> > golden output is flagged as a regression.  Update the mkswap usage in
> > this test to dump the stderr output to $seqres.full, and complain if the
> > exit code is nonzero.
> > 
> > This fixes a regression that the author noticed when testing btrfs and
> > generic/507 and generic/570 run sequentially.  generic/507 calls
> > _require_scratch_shutdown to see if the shutdown call is supported.
> > btrfs does not support that, so the test is _notrun.  This leaves the
> > scratch filesystem mounted, causing the _try_wipe_scratch_devs between
> > tests to fail.  When g/570 starts up, the scratch device still contains
> 
> Won't your previous patch "check: don't leave the scratch filesystem
> mounted after _notrun" fix this issue as well? As _notrun won't leaves
> scratch dev mounted & unwiped after that patch. Would you please confirm?

Yes.  In the end this patch becomes more about failing the test if
mkswap fails than anything else.

--D

> Thanks,
> Eryu
> 
> > leftovers from the failed attempt to run g/507, which is why the mkswap
> > command outputs the above warning.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/generic/570 |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > 
> > diff --git a/tests/generic/570 b/tests/generic/570
> > index 7d03acfe..02c1d333 100755
> > --- a/tests/generic/570
> > +++ b/tests/generic/570
> > @@ -27,7 +27,7 @@ _require_scratch_nocheck
> >  _require_block_device $SCRATCH_DEV
> >  test -e /dev/snapshot && _notrun "userspace hibernation to swap is enabled"
> >  
> > -$MKSWAP_PROG "$SCRATCH_DEV" >> $seqres.full
> > +$MKSWAP_PROG -f "$SCRATCH_DEV" &>> $seqres.full || echo "mkswap failed?"
> >  
> >  # Can you modify the swap dev via previously open file descriptors?
> >  for verb in 1 2 3 4; do
diff mbox series

Patch

diff --git a/tests/generic/570 b/tests/generic/570
index 7d03acfe..02c1d333 100755
--- a/tests/generic/570
+++ b/tests/generic/570
@@ -27,7 +27,7 @@  _require_scratch_nocheck
 _require_block_device $SCRATCH_DEV
 test -e /dev/snapshot && _notrun "userspace hibernation to swap is enabled"
 
-$MKSWAP_PROG "$SCRATCH_DEV" >> $seqres.full
+$MKSWAP_PROG -f "$SCRATCH_DEV" &>> $seqres.full || echo "mkswap failed?"
 
 # Can you modify the swap dev via previously open file descriptors?
 for verb in 1 2 3 4; do