diff mbox series

generic/590: fix test failure when running against fs other than xfs

Message ID bcb3d3adeb36c732e807d876b82219c3c1350e2e.1733914512.git.fdmanana@suse.com (mailing list archive)
State New
Headers show
Series generic/590: fix test failure when running against fs other than xfs | expand

Commit Message

Filipe Manana Dec. 11, 2024, 10:55 a.m. UTC
From: Filipe Manana <fdmanana@suse.com>

With commit ce79de11337e ("fstests: clean up loop device instantiation")
we started to always call _destroy_loop_device at the very end of the
test, but we only create a loop device if we are running against xfs,
so the call to _destroy_loop_device results in an error since no loop
device was setup.

For example running this test against btrfs or ext4 results in this
failure:

   $ ./check generic/590
   FSTYP         -- btrfs
   PLATFORM      -- Linux/x86_64 debian0 6.13.0-rc1-btrfs-next-181+ #1 SMP PREEMPT_DYNAMIC Tue Dec  3 13:03:23 WET 2024
   MKFS_OPTIONS  -- /dev/sdc
   MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

   generic/590 29s ... [failed, exit status 1]- output mismatch (see /home/fdmanana/git/hub/xfstests/results//generic/590.out.bad)
      --- tests/generic/590.out	2020-06-10 19:29:03.858520038 +0100
      +++ /home/fdmanana/git/hub/xfstests/results//generic/590.out.bad	2024-12-11 10:48:43.946205346 +0000
       @@ -1,2 +1,5 @@
       QA output created by 590
      -Silence is golden
      +losetup: option requires an argument -- 'd'
      +Try 'losetup --help' for more information.
      +Cannot destroy loop device
      +(see /home/fdmanana/git/hub/xfstests/results//generic/590.full for details)
      ...
      (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/590.out /home/fdmanana/git/hub/xfstests/results//generic/590.out.bad'  to see the entire diff)
   Ran: generic/590
   Failures: generic/590
   Failed 1 of 1 tests

Fix this by removing the call to _destroy_loop_device at the end of the
test, as it's unnecessary because we call it in the _cleanup function if
we have setup a loop device.

Fixes: ce79de11337e ("fstests: clean up loop device instantiation")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 tests/generic/590 | 2 --
 1 file changed, 2 deletions(-)

Comments

Dave Chinner Dec. 12, 2024, 2:19 a.m. UTC | #1
On Wed, Dec 11, 2024 at 10:55:25AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> With commit ce79de11337e ("fstests: clean up loop device instantiation")
> we started to always call _destroy_loop_device at the very end of the
> test, but we only create a loop device if we are running against xfs,
> so the call to _destroy_loop_device results in an error since no loop
> device was setup.
> 
> For example running this test against btrfs or ext4 results in this
> failure:
> 
>    $ ./check generic/590
>    FSTYP         -- btrfs
>    PLATFORM      -- Linux/x86_64 debian0 6.13.0-rc1-btrfs-next-181+ #1 SMP PREEMPT_DYNAMIC Tue Dec  3 13:03:23 WET 2024
>    MKFS_OPTIONS  -- /dev/sdc
>    MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1
> 
>    generic/590 29s ... [failed, exit status 1]- output mismatch (see /home/fdmanana/git/hub/xfstests/results//generic/590.out.bad)
>       --- tests/generic/590.out	2020-06-10 19:29:03.858520038 +0100
>       +++ /home/fdmanana/git/hub/xfstests/results//generic/590.out.bad	2024-12-11 10:48:43.946205346 +0000
>        @@ -1,2 +1,5 @@
>        QA output created by 590
>       -Silence is golden
>       +losetup: option requires an argument -- 'd'
>       +Try 'losetup --help' for more information.
>       +Cannot destroy loop device
>       +(see /home/fdmanana/git/hub/xfstests/results//generic/590.full for details)
>       ...
>       (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/590.out /home/fdmanana/git/hub/xfstests/results//generic/590.out.bad'  to see the entire diff)
>    Ran: generic/590
>    Failures: generic/590
>    Failed 1 of 1 tests
> 
> Fix this by removing the call to _destroy_loop_device at the end of the
> test, as it's unnecessary because we call it in the _cleanup function if
> we have setup a loop device.
> 
> Fixes: ce79de11337e ("fstests: clean up loop device instantiation")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
>  tests/generic/590 | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/tests/generic/590 b/tests/generic/590
> index 04d86e78..1adeef4c 100755
> --- a/tests/generic/590
> +++ b/tests/generic/590
> @@ -115,8 +115,6 @@ $XFS_IO_PROG -c "truncate 0" -c fsync "$SCRATCH_MNT/file"
>  # We need to do this before the loop device gets torn down.
>  _scratch_unmount
>  _check_scratch_fs
> -_destroy_loop_device $loop_dev
> -unset loop_dev
>  
>  echo "Silence is golden"
>  status=0
> -- 


Looks fine.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff mbox series

Patch

diff --git a/tests/generic/590 b/tests/generic/590
index 04d86e78..1adeef4c 100755
--- a/tests/generic/590
+++ b/tests/generic/590
@@ -115,8 +115,6 @@  $XFS_IO_PROG -c "truncate 0" -c fsync "$SCRATCH_MNT/file"
 # We need to do this before the loop device gets torn down.
 _scratch_unmount
 _check_scratch_fs
-_destroy_loop_device $loop_dev
-unset loop_dev
 
 echo "Silence is golden"
 status=0