btrfs/048: amend property validation cases

Add more property validation cases which are fixed by the patches [1]
 [1]
  btrfs: fix vanished compression property after failed set
  btrfs: fix zstd compression parameter

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Anand Jain
2019-04-04 01:04:37 +08:00
committed by Eryu Guan
parent 2516e6cd4e
commit 4529b20e1a
2 changed files with 39 additions and 0 deletions
+23
View File
@@ -6,6 +6,9 @@
#
# Btrfs properties test. The btrfs properties feature was introduced in the
# linux kernel 3.14.
# Fails without the kernel patches:
# btrfs: fix vanished compression property after failed set
# btrfs: fix zstd compression parameter
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
@@ -34,6 +37,7 @@ _supported_os Linux
_require_test
_require_scratch
_require_btrfs_command "property"
_require_btrfs_command inspect-internal dump-super
send_files_dir=$TEST_DIR/btrfs-test-$seq
@@ -203,5 +207,24 @@ $BTRFS_UTIL_PROG property get $SCRATCH_MNT/sv1 compression
touch $SCRATCH_MNT/sv1/file2
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/sv1/file2 compression
echo -e "\nTesting argument validation, should fail"
$BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'lz' | _filter_scratch
echo "***"
$BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'zli' | _filter_scratch
echo "***"
$BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'zst' | _filter_scratch
echo -e "\nTesting if property is persistent across failed validation"
$BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'lzo'
$BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'zli' | _filter_scratch
$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'
$BTRFS_UTIL_PROG property set $SCRATCH_MNT compression 'lz' | _filter_scratch
$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT
$BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep '^generation'
status=0
exit
+16
View File
@@ -76,3 +76,19 @@ compression=zlib
Testing subvolume property inheritance
compression=lzo
compression=lzo
Testing argument validation, should fail
ERROR: failed to set compression for /mnt/scratch: Invalid argument
***
ERROR: failed to set compression for /mnt/scratch: Invalid argument
***
ERROR: failed to set compression for /mnt/scratch: Invalid argument
Testing if property is persistent across failed validation
ERROR: failed to set compression for /mnt/scratch: Invalid argument
compression=lzo
Testing generation is unchanged after failed validation
generation 7
ERROR: failed to set compression for /mnt/scratch: Invalid argument
generation 7