path: root/tests/convert-tests
diff options
authorQu Wenruo <>2016-10-10 11:00:13 +0800
committerDavid Sterba <>2016-10-24 14:58:15 +0200
commit8c663f9f3616e0de56e77ac4a91ef3db2d99bf34 (patch)
treea436e99539d44160dc8df7f91edc5699f1d2a615 /tests/convert-tests
parent8570a0c3a4f681bc5ae1f04c56730bea8fb6cdc9 (diff)
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 <> [ minor fixes ] Signed-off-by: David Sterba <>
Diffstat (limited to 'tests/convert-tests')
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/convert-tests/009-common-inode-flags/ b/tests/convert-tests/009-common-inode-flags/
new file mode 100755
index 00000000..6f26d187
--- /dev/null
+++ b/tests/convert-tests/009-common-inode-flags/
@@ -0,0 +1,34 @@
+# Check if btrfs-convert can copy common inode flags like SYNC/IMMUTABLE
+source $TOP/tests/common
+source $TOP/tests/common.convert
+prepare_test_dev 512M
+check_prereq btrfs-convert
+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
+# 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"