btrfs-progs: tests: add basic test for ntrfs conversion
The ntfs2btrfs tool recently found a bug in 'check', add the conversion test support to our testsuite. It's optional and depends on kernel support of the 'ntfs3' driver and the availability of mkntfs and ntfs2btrfs, which might not be available everywhere. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
4e721549cd
commit
f195461b0e
|
@ -83,6 +83,8 @@ convert_test_prep_fs() {
|
||||||
reiserfs)
|
reiserfs)
|
||||||
force=-ff
|
force=-ff
|
||||||
mountopts="-o acl,user_xattr,attrs" ;;
|
mountopts="-o acl,user_xattr,attrs" ;;
|
||||||
|
ntfs)
|
||||||
|
force=-F ;;
|
||||||
*)
|
*)
|
||||||
_fail "unknown filesystem to convert: $fstype"
|
_fail "unknown filesystem to convert: $fstype"
|
||||||
esac
|
esac
|
||||||
|
@ -235,6 +237,7 @@ convert_test_post_rollback() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
ext[234]) types=ext2,ext3,ext4 ;;
|
ext[234]) types=ext2,ext3,ext4 ;;
|
||||||
reiserfs) types=reiserfs ;;
|
reiserfs) types=reiserfs ;;
|
||||||
|
ntfs) types=ntfs ;;
|
||||||
*) _fail "unknown filesystem type to check: $1" ;;
|
*) _fail "unknown filesystem type to check: $1" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -295,3 +298,18 @@ check_kernel_support_reiserfs()
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
load_module_ntfs()
|
||||||
|
{
|
||||||
|
# Load NTFS3 that has write support
|
||||||
|
$SUDO_HELPER modprobe ntfs3
|
||||||
|
}
|
||||||
|
|
||||||
|
check_kernel_support_ntfs()
|
||||||
|
{
|
||||||
|
if ! grep -iq 'ntfs' /proc/filesystems; then
|
||||||
|
echo "WARNING: ntfs filesystem not listed in /proc/filesystems, some tests might be skipped"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Really basic test of ntfs2btrfs conversion
|
||||||
|
|
||||||
|
source "$TEST_TOP/common" || exit
|
||||||
|
source "$TEST_TOP/common.convert" || exit
|
||||||
|
|
||||||
|
if ! check_kernel_support_ntfs >/dev/null; then
|
||||||
|
_not_run "no NTFS support"
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_prereq btrfs-convert
|
||||||
|
check_global_prereq mkfs.ntfs
|
||||||
|
check_global_prereq ntfs2btrfs
|
||||||
|
|
||||||
|
setup_root_helper
|
||||||
|
prepare_test_dev
|
||||||
|
|
||||||
|
# Iterate over defaults and options that are not tied to hardware capabilities
|
||||||
|
# or number of devices. Test only 4K block size as minimum.
|
||||||
|
for feature in '' 'block-group-tree' ; do
|
||||||
|
convert_test ntfs "$feature" "ntfs 4k nodesize" 4096 mkfs.ntfs -s 4096
|
||||||
|
done
|
Loading…
Reference in New Issue