public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] fstests: btrfs/315: fix golden output mismatch caused by newer util-linux
@ 2025-04-24  7:29 Qu Wenruo
  2025-04-25 12:15 ` Zorro Lang
  2025-04-25 15:10 ` Anand Jain
  0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2025-04-24  7:29 UTC (permalink / raw)
  To: linux-btrfs, fstests

[BUG]
With util-linux v2.41.0 and newer, test case btrfs/315 will fail like
the following:

btrfs/315 1s ... - output mismatch (see /home/adam/xfstests-dev/results//btrfs/315.out.bad)
    --- tests/btrfs/315.out	2025-04-24 15:31:28.684112371 +0930
    +++ /home/adam/xfstests-dev/results//btrfs/315.out.bad	2025-04-24 15:31:31.854883557 +0930
    @@ -1,7 +1,7 @@
     QA output created by 315
     ---- seed_device_must_fail ----
     mount: SCRATCH_MNT: WARNING: source write-protected, mounted read-only.
    -mount: TEST_DIR/315/tempfsid_mnt:  system call failed: File exists.
    +mount: TEST_DIR/315/tempfsid_mnt: () failed: File exists.
     ---- device_add_must_fail ----
     wrote 9000/9000 bytes at offset 0

[CAUSE]

With util-linux v2.41.0, the mount failure error message changed to the following:

  mount: /mnt/test/315/tempfsid_mnt: fsconfig() failed: File exists.

Thus the existing filter only striped the "fsconfig" part, leaving the
"()" without changing it to " system call".

[FIX]
The test case is doomed in day one by using a local filter, which
requires stupid catch-up game against util-linux.

Meanwhile we already have a much better filter, _filter_error_mount().
That helper can already handle the newer v2.41 output.

Let's use the superior common filter and update the golden output to:

  mount: File exists.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
Changelog:
v2:
- Remove the cursed local filter and use the generic one instead
---
 tests/btrfs/315     | 22 ++--------------------
 tests/btrfs/315.out |  2 +-
 2 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/tests/btrfs/315 b/tests/btrfs/315
index e6589abe..9071e152 100755
--- a/tests/btrfs/315
+++ b/tests/btrfs/315
@@ -19,6 +19,7 @@ _cleanup()
 }
 
 . ./common/filter.btrfs
+. ./common/filter
 
 _require_scratch_dev_pool 3
 _require_btrfs_fs_feature temp_fsid
@@ -28,25 +29,6 @@ _scratch_dev_pool_get 3
 # mount point for the tempfsid device
 tempfsid_mnt=$TEST_DIR/$seq/tempfsid_mnt
 
-_filter_mount_error()
-{
-	# There are two different errors that occur at the output when
-	# mounting fails; as shown below, pick out the common part. And,
-	# remove the dmesg line.
-
-	# mount: <mnt-point>: mount(2) system call failed: File exists.
-
-	# mount: <mnt-point>: fsconfig system call failed: File exists.
-	# dmesg(1) may have more information after failed mount system call.
-
-	# For util-linux v2.4 and later:
-	# mount: <mountpoint>: mount system call failed: File exists.
-
-	grep -v dmesg | _filter_test_dir | \
-		sed -e "s/mount(2)\|fsconfig//g" \
-		    -e "s/mount\( system call failed:\)/\1/"
-}
-
 seed_device_must_fail()
 {
 	echo ---- $FUNCNAME ----
@@ -57,7 +39,7 @@ seed_device_must_fail()
 	$BTRFS_TUNE_PROG -S 1 ${SCRATCH_DEV_NAME[1]}
 
 	_scratch_mount 2>&1 | _filter_scratch
-	_mount ${SCRATCH_DEV_NAME[1]} ${tempfsid_mnt} 2>&1 | _filter_mount_error
+	_mount ${SCRATCH_DEV_NAME[1]} ${tempfsid_mnt} 2>&1 | _filter_error_mount
 }
 
 device_add_must_fail()
diff --git a/tests/btrfs/315.out b/tests/btrfs/315.out
index 3ea7a35a..ae77d4fd 100644
--- a/tests/btrfs/315.out
+++ b/tests/btrfs/315.out
@@ -1,7 +1,7 @@
 QA output created by 315
 ---- seed_device_must_fail ----
 mount: SCRATCH_MNT: WARNING: source write-protected, mounted read-only.
-mount: TEST_DIR/315/tempfsid_mnt:  system call failed: File exists.
+mount: File exists
 ---- device_add_must_fail ----
 wrote 9000/9000 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] fstests: btrfs/315: fix golden output mismatch caused by newer util-linux
  2025-04-24  7:29 [PATCH v2] fstests: btrfs/315: fix golden output mismatch caused by newer util-linux Qu Wenruo
@ 2025-04-25 12:15 ` Zorro Lang
  2025-04-25 15:10 ` Anand Jain
  1 sibling, 0 replies; 3+ messages in thread
From: Zorro Lang @ 2025-04-25 12:15 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs, fstests

On Thu, Apr 24, 2025 at 04:59:07PM +0930, Qu Wenruo wrote:
> [BUG]
> With util-linux v2.41.0 and newer, test case btrfs/315 will fail like
> the following:
> 
> btrfs/315 1s ... - output mismatch (see /home/adam/xfstests-dev/results//btrfs/315.out.bad)
>     --- tests/btrfs/315.out	2025-04-24 15:31:28.684112371 +0930
>     +++ /home/adam/xfstests-dev/results//btrfs/315.out.bad	2025-04-24 15:31:31.854883557 +0930
>     @@ -1,7 +1,7 @@
>      QA output created by 315
>      ---- seed_device_must_fail ----
>      mount: SCRATCH_MNT: WARNING: source write-protected, mounted read-only.
>     -mount: TEST_DIR/315/tempfsid_mnt:  system call failed: File exists.
>     +mount: TEST_DIR/315/tempfsid_mnt: () failed: File exists.
>      ---- device_add_must_fail ----
>      wrote 9000/9000 bytes at offset 0
> 
> [CAUSE]
> 
> With util-linux v2.41.0, the mount failure error message changed to the following:
> 
>   mount: /mnt/test/315/tempfsid_mnt: fsconfig() failed: File exists.
> 
> Thus the existing filter only striped the "fsconfig" part, leaving the
> "()" without changing it to " system call".
> 
> [FIX]
> The test case is doomed in day one by using a local filter, which
> requires stupid catch-up game against util-linux.
> 
> Meanwhile we already have a much better filter, _filter_error_mount().
> That helper can already handle the newer v2.41 output.
> 
> Let's use the superior common filter and update the golden output to:
> 
>   mount: File exists.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> Changelog:
> v2:
> - Remove the cursed local filter and use the generic one instead

I think this's good to me, although I've forgotten why this case didn't
use the common helper at beginning. If anyone find something wrong,
please feel free to tell me.

Reviewed-by: Zorro Lang <zlang@redhat.com>

> ---
>  tests/btrfs/315     | 22 ++--------------------
>  tests/btrfs/315.out |  2 +-
>  2 files changed, 3 insertions(+), 21 deletions(-)
> 
> diff --git a/tests/btrfs/315 b/tests/btrfs/315
> index e6589abe..9071e152 100755
> --- a/tests/btrfs/315
> +++ b/tests/btrfs/315
> @@ -19,6 +19,7 @@ _cleanup()
>  }
>  
>  . ./common/filter.btrfs
> +. ./common/filter
>  
>  _require_scratch_dev_pool 3
>  _require_btrfs_fs_feature temp_fsid
> @@ -28,25 +29,6 @@ _scratch_dev_pool_get 3
>  # mount point for the tempfsid device
>  tempfsid_mnt=$TEST_DIR/$seq/tempfsid_mnt
>  
> -_filter_mount_error()
> -{
> -	# There are two different errors that occur at the output when
> -	# mounting fails; as shown below, pick out the common part. And,
> -	# remove the dmesg line.
> -
> -	# mount: <mnt-point>: mount(2) system call failed: File exists.
> -
> -	# mount: <mnt-point>: fsconfig system call failed: File exists.
> -	# dmesg(1) may have more information after failed mount system call.
> -
> -	# For util-linux v2.4 and later:
> -	# mount: <mountpoint>: mount system call failed: File exists.
> -
> -	grep -v dmesg | _filter_test_dir | \
> -		sed -e "s/mount(2)\|fsconfig//g" \
> -		    -e "s/mount\( system call failed:\)/\1/"
> -}
> -
>  seed_device_must_fail()
>  {
>  	echo ---- $FUNCNAME ----
> @@ -57,7 +39,7 @@ seed_device_must_fail()
>  	$BTRFS_TUNE_PROG -S 1 ${SCRATCH_DEV_NAME[1]}
>  
>  	_scratch_mount 2>&1 | _filter_scratch
> -	_mount ${SCRATCH_DEV_NAME[1]} ${tempfsid_mnt} 2>&1 | _filter_mount_error
> +	_mount ${SCRATCH_DEV_NAME[1]} ${tempfsid_mnt} 2>&1 | _filter_error_mount
>  }
>  
>  device_add_must_fail()
> diff --git a/tests/btrfs/315.out b/tests/btrfs/315.out
> index 3ea7a35a..ae77d4fd 100644
> --- a/tests/btrfs/315.out
> +++ b/tests/btrfs/315.out
> @@ -1,7 +1,7 @@
>  QA output created by 315
>  ---- seed_device_must_fail ----
>  mount: SCRATCH_MNT: WARNING: source write-protected, mounted read-only.
> -mount: TEST_DIR/315/tempfsid_mnt:  system call failed: File exists.
> +mount: File exists
>  ---- device_add_must_fail ----
>  wrote 9000/9000 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -- 
> 2.49.0
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] fstests: btrfs/315: fix golden output mismatch caused by newer util-linux
  2025-04-24  7:29 [PATCH v2] fstests: btrfs/315: fix golden output mismatch caused by newer util-linux Qu Wenruo
  2025-04-25 12:15 ` Zorro Lang
@ 2025-04-25 15:10 ` Anand Jain
  1 sibling, 0 replies; 3+ messages in thread
From: Anand Jain @ 2025-04-25 15:10 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs, fstests

On 24/4/25 12:59, Qu Wenruo wrote:
> [BUG]
> With util-linux v2.41.0 and newer, test case btrfs/315 will fail like
> the following:
> 
> btrfs/315 1s ... - output mismatch (see /home/adam/xfstests-dev/results//btrfs/315.out.bad)
>      --- tests/btrfs/315.out	2025-04-24 15:31:28.684112371 +0930
>      +++ /home/adam/xfstests-dev/results//btrfs/315.out.bad	2025-04-24 15:31:31.854883557 +0930
>      @@ -1,7 +1,7 @@
>       QA output created by 315
>       ---- seed_device_must_fail ----
>       mount: SCRATCH_MNT: WARNING: source write-protected, mounted read-only.
>      -mount: TEST_DIR/315/tempfsid_mnt:  system call failed: File exists.
>      +mount: TEST_DIR/315/tempfsid_mnt: () failed: File exists.
>       ---- device_add_must_fail ----
>       wrote 9000/9000 bytes at offset 0
> 
> [CAUSE]
> 
> With util-linux v2.41.0, the mount failure error message changed to the following:
> 
>    mount: /mnt/test/315/tempfsid_mnt: fsconfig() failed: File exists.
> 
> Thus the existing filter only striped the "fsconfig" part, leaving the
> "()" without changing it to " system call".
> 
> [FIX]
> The test case is doomed in day one by using a local filter, which
> requires stupid catch-up game against util-linux.
> 
> Meanwhile we already have a much better filter, _filter_error_mount().
> That helper can already handle the newer v2.41 output.
> 
> Let's use the superior common filter and update the golden output to:
> 
>    mount: File exists.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> Changelog:
> v2:
> - Remove the cursed local filter and use the generic one instead
> ---
>   tests/btrfs/315     | 22 ++--------------------
>   tests/btrfs/315.out |  2 +-
>   2 files changed, 3 insertions(+), 21 deletions(-)
> 
> diff --git a/tests/btrfs/315 b/tests/btrfs/315
> index e6589abe..9071e152 100755
> --- a/tests/btrfs/315
> +++ b/tests/btrfs/315
> @@ -19,6 +19,7 @@ _cleanup()
>   }
>   

>   . ./common/filter.btrfs
> +. ./common/filter

common/filter.btrfs calls common/filter, so we don't need common/filter
again. However, upon closer inspection, there isn't a filter originating
from filter.btrfs, so it can be removed.

Fixed and applied.

Reviewed-by: Anand Jain <anand.jain@oracle.com>

Thanks. Anand

>   _require_scratch_dev_pool 3
>   _require_btrfs_fs_feature temp_fsid
> @@ -28,25 +29,6 @@ _scratch_dev_pool_get 3
>   # mount point for the tempfsid device
>   tempfsid_mnt=$TEST_DIR/$seq/tempfsid_mnt
>   
> -_filter_mount_error()
> -{
> -	# There are two different errors that occur at the output when
> -	# mounting fails; as shown below, pick out the common part. And,
> -	# remove the dmesg line.
> -
> -	# mount: <mnt-point>: mount(2) system call failed: File exists.
> -
> -	# mount: <mnt-point>: fsconfig system call failed: File exists.
> -	# dmesg(1) may have more information after failed mount system call.
> -
> -	# For util-linux v2.4 and later:
> -	# mount: <mountpoint>: mount system call failed: File exists.
> -
> -	grep -v dmesg | _filter_test_dir | \
> -		sed -e "s/mount(2)\|fsconfig//g" \
> -		    -e "s/mount\( system call failed:\)/\1/"
> -}
> -
>   seed_device_must_fail()
>   {
>   	echo ---- $FUNCNAME ----
> @@ -57,7 +39,7 @@ seed_device_must_fail()
>   	$BTRFS_TUNE_PROG -S 1 ${SCRATCH_DEV_NAME[1]}
>   
>   	_scratch_mount 2>&1 | _filter_scratch
> -	_mount ${SCRATCH_DEV_NAME[1]} ${tempfsid_mnt} 2>&1 | _filter_mount_error
> +	_mount ${SCRATCH_DEV_NAME[1]} ${tempfsid_mnt} 2>&1 | _filter_error_mount
>   }
>   
>   device_add_must_fail()
> diff --git a/tests/btrfs/315.out b/tests/btrfs/315.out
> index 3ea7a35a..ae77d4fd 100644
> --- a/tests/btrfs/315.out
> +++ b/tests/btrfs/315.out
> @@ -1,7 +1,7 @@
>   QA output created by 315
>   ---- seed_device_must_fail ----
>   mount: SCRATCH_MNT: WARNING: source write-protected, mounted read-only.
> -mount: TEST_DIR/315/tempfsid_mnt:  system call failed: File exists.
> +mount: File exists
>   ---- device_add_must_fail ----
>   wrote 9000/9000 bytes at offset 0
>   XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-25 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24  7:29 [PATCH v2] fstests: btrfs/315: fix golden output mismatch caused by newer util-linux Qu Wenruo
2025-04-25 12:15 ` Zorro Lang
2025-04-25 15:10 ` Anand Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox