btrfs-progs: convert-test: Add test case for common inode flags

Add a new test case to check if btrfs-convert copies common inode flags
like append(a), immutable(i).

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor fixes ]
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2016-10-10 11:00:13 +08:00 committed by David Sterba
parent 8570a0c3a4
commit 8c663f9f36
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
#!/bin/bash
# Check if btrfs-convert can copy common inode flags like SYNC/IMMUTABLE
source $TOP/tests/common
source $TOP/tests/common.convert
setup_root_helper
prepare_test_dev 512M
check_prereq btrfs-convert
fail=0
default_mke2fs="mke2fs -t ext4 -b 4096"
convert_test_preamble '' 'common inode flags test' 16k "$default_mke2fs"
convert_test_prep_fs $default_mke2fs
# create file with specific flags
run_check $SUDO_HELPER touch $TEST_MNT/flag_test
run_check $SUDO_HELPER chattr +aAdSi $TEST_MNT/flag_test
run_check_umount_test_dev
convert_test_do_convert
run_check_mount_test_dev
# Log the status
run_check lsattr $TEST_MNT/flag_test
# Above flags should be copied to btrfs flags, and lsattr should get them
run_check_stdout lsattr $TEST_MNT/flag_test | cut -f1 -d\ | grep "[aAdiS]" -q
if [ $? -ne 0 ]; then
rm tmp_output
_fail "no common inode flags are copied after convert"
fi
run_check_umount_test_dev
convert_test_post_rollback