Skip to contentSkip to conversation

btrfs/048: fix test failure when fs mounted with v2 space cache option

PATCH In review [email protected] 2 participants 2 messages Sep 5, 2019 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs/048: fix test failure when fs mounted with v2 space cache option

From: Filipe Manana <[email protected]>

In order to check that the filesystem generation does not change after failure to set a property, the test expects a specific generation number of 7 in its golden output. That currently works except when using the v2 space cache mount option (MOUNT_OPTIONS="-o space_cache=v2"), since the filesystem generation is 8 because creating a v2 space cache adds an additional transaction commit. So update the test to not hardcode specific generation numbers in its golden output and just output an unexpected message if the generation number changes.

---
 tests/btrfs/048     | 5 +++--
 tests/btrfs/048.out | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)
tests/btrfs/048 +3 -2
index 7294f231..7c9eaa05 100755
@@ -221,10 +221,11 @@ $BTRFS_UTIL_PROG property get $SCRATCH_MNT compression
 
 echo -e "\nTesting generation is unchanged after failed validation"
 $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT
-$BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep '^generation'
+gen_before=$($BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep '^generation')
 $BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'lz' 2>&1 | _filter_scratch
 $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT
-$BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep '^generation'
+gen_after=$($BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep '^generation')
+[ "$gen_after" == "$gen_before" ] || echo "filesystem generation changed"
 
 echo -e "\nTesting argument validation with options"
 $BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'zlib:3'
tests/btrfs/048.out +0 -2
index 0923b00c..cc12e329 100644
@@ -89,9 +89,7 @@ ERROR: failed to set compression for SCRATCH_MNT: Invalid argument
 compression=lzo
 
 Testing generation is unchanged after failed validation
-generation		7
 ERROR: failed to set compression for SCRATCH_MNT: Invalid argument
-generation		7
 
 Testing argument validation with options
 ***
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · On 5.09.19 г. 18:37 ч., [email protected] wrote:

From: Filipe Manana <[email protected]>

In order to check that the filesystem generation does not change after failure to set a property, the test expects a specific generation number of 7 in its golden output. That currently works except when using the v2 space cache mount option (MOUNT_OPTIONS="-o space_cache=v2"), since the filesystem generation is 8 because creating a v2 space cache adds an additional transaction commit. So update the test to not hardcode specific generation numbers in its golden output and just output an unexpected message if the generation number changes.

Quoted 1 line