Skip to contentSkip to conversation

fstests: btrfs/315: fix golden output mismatch caused by newer util-linux

PATCH Superseded Qu Wenruo 2 participants 3 messages Apr 24, 2025 Btrfs file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 fstests: btrfs/315: fix golden output mismatch caused by newer util-linux

[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 existing filter on error message is doomed from day one. I'm fed up with the stupid catch-up game depending on util-linux, so let's just stripe everything between "mount" and " failed", just leaving the golden output to:

mount failed: File exists.

---
 tests/btrfs/315     | 14 +++++++++-----
 tests/btrfs/315.out |  2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)
tests/btrfs/315 +9 -5
index e6589abe..9b5bc789 100755
@@ -30,9 +30,8 @@ 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.
+	# There are different errors that occur at the output when
+	# mounting fails:
 
 	# mount: <mnt-point>: mount(2) system call failed: File exists.
 
@@ -41,10 +40,15 @@ _filter_mount_error()
 
 	# For util-linux v2.4 and later:
 	# mount: <mountpoint>: mount system call failed: File exists.
+	#
+	# For util-linux v2.41 and later:
+	# mount: <mountpoint>: fsconfig() failed: File exists.
+	#
+	# Instead of playing the stupid catchup game, removed everything
+	# between ":" and "failed:".
 
 	grep -v dmesg | _filter_test_dir | \
-		sed -e "s/mount(2)\|fsconfig//g" \
-		    -e "s/mount\( system call failed:\)/\1/"
+		sed -e "s/: TEST_DIR\/315\/tempfsid_mnt: .* failed:/ failed:/g"
 }
 
 seed_device_must_fail()
tests/btrfs/315.out +1 -1
index 3ea7a35a..fb493e90 100644
@@ -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 failed: 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)
Signature · 1 line
2.49.0
#1 lore raw
Quoted 25 lines · Qu Wenruo

[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".

Quoted 7 lines

[FIX]
The existing filter on error message is doomed from day one. I'm fed up with the stupid catch-up game depending on util-linux, so let's just stripe everything between "mount" and " failed", just leaving the golden output to:

mount failed: File exists.

Hi Qu,

Thanks for helping fstests works with lastest until-linux.

Quoted 12 lines
---
 tests/btrfs/315     | 14 +++++++++-----
 tests/btrfs/315.out |  2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)
tests/btrfs/315 +0 -0
index e6589abe..9b5bc789 100755

tests/btrfs/315 tempfsid_mnt=$TEST_DIR/$seq/tempfsid_mnt · line 31

Quoted 2 lines
tests/btrfs/315 +0 -0
@@ -30,9 +30,8 @@ tempfsid_mnt=$TEST_DIR/$seq/tempfsid_mnt
 
 _filter_mount_error()

I thought it's a common helper in common/filter, but I found it's a local function of btrfs/315 with "_" prefix ... it's not recommended using "_" prefix for a local function.

And there's a _filter_error_mount() in common/filter, could you help to merge this _filter_mount_error function onto common/filter:_filter_error_mount, then turn to use the common one? Then we don't need to maintain two different functions to filter mount errors :)

Thanks,
Zorro

Quoted 44 lines
tests/btrfs/315 +9 -5
 {
-	# 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.
+	# There are different errors that occur at the output when
+	# mounting fails:
 
 	# mount: <mnt-point>: mount(2) system call failed: File exists.
 
@@ -41,10 +40,15 @@ _filter_mount_error()
 
 	# For util-linux v2.4 and later:
 	# mount: <mountpoint>: mount system call failed: File exists.
+	#
+	# For util-linux v2.41 and later:
+	# mount: <mountpoint>: fsconfig() failed: File exists.
+	#
+	# Instead of playing the stupid catchup game, removed everything
+	# between ":" and "failed:".
 
 	grep -v dmesg | _filter_test_dir | \
-		sed -e "s/mount(2)\|fsconfig//g" \
-		    -e "s/mount\( system call failed:\)/\1/"
+		sed -e "s/: TEST_DIR\/315\/tempfsid_mnt: .* failed:/ failed:/g"
 }
 
 seed_device_must_fail()
tests/btrfs/315.out +1 -1
index 3ea7a35a..fb493e90 100644
@@ -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 failed: 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)
Signature · 1 line
2.49.0
author
#2 lore raw
Quoted 57 lines · Zorro Lang
Quoted 25 lines · Qu Wenruo

[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".

Quoted 7 lines

[FIX]
The existing filter on error message is doomed from day one. I'm fed up with the stupid catch-up game depending on util-linux, so let's just stripe everything between "mount" and " failed", just leaving the golden output to:

mount failed: File exists.

Hi Qu,

Thanks for helping fstests works with lastest until-linux.

Quoted 12 lines
---
  tests/btrfs/315     | 14 +++++++++-----
  tests/btrfs/315.out |  2 +-
  2 files changed, 10 insertions(+), 6 deletions(-)
tests/btrfs/315 +0 -0
index e6589abe..9b5bc789 100755

tests/btrfs/315 tempfsid_mnt=$TEST_DIR/$seq/tempfsid_mnt · line 31

Quoted 2 lines
tests/btrfs/315 +0 -0
@@ -30,9 +30,8 @@ tempfsid_mnt=$TEST_DIR/$seq/tempfsid_mnt
 
  _filter_mount_error()

I thought it's a common helper in common/filter, but I found it's a local function of btrfs/315 with "_" prefix ... it's not recommended using "_" prefix for a local function.

Quoted 4 lines

And there's a _filter_error_mount() in common/filter, could you help to merge this _filter_mount_error function onto common/filter:_filter_error_mount, then turn to use the common one? Then we don't need to maintain two different functions to filter mount errors :)

Thanks a lot for pointing out the common one, I had the exactly same initial thought and went into common/filter for the function but failed to locate it (they have different names), and just continue fixing the local one.

In fact the test case itself should use the common one, which can already handle the case very well.

Thanks,
Qu

Quoted 49 lines

Thanks,
Zorro

Quoted 44 lines
tests/btrfs/315 +9 -5
  {
-	# 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.
+	# There are different errors that occur at the output when
+	# mounting fails:
 
  	# mount: <mnt-point>: mount(2) system call failed: File exists.
 
@@ -41,10 +40,15 @@ _filter_mount_error()
 
  	# For util-linux v2.4 and later:
  	# mount: <mountpoint>: mount system call failed: File exists.
+	#
+	# For util-linux v2.41 and later:
+	# mount: <mountpoint>: fsconfig() failed: File exists.
+	#
+	# Instead of playing the stupid catchup game, removed everything
+	# between ":" and "failed:".
 
  	grep -v dmesg | _filter_test_dir | \
-		sed -e "s/mount(2)\|fsconfig//g" \
-		    -e "s/mount\( system call failed:\)/\1/"
+		sed -e "s/: TEST_DIR\/315\/tempfsid_mnt: .* failed:/ failed:/g"
  }
 
  seed_device_must_fail()
tests/btrfs/315.out +1 -1
index 3ea7a35a..fb493e90 100644
@@ -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 failed: 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)
Signature · 1 line
2.49.0