Skip to content

Commit f195461

Browse files
committed
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>
1 parent 4e72154 commit f195461

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/common.convert

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ convert_test_prep_fs() {
8383
reiserfs)
8484
force=-ff
8585
mountopts="-o acl,user_xattr,attrs" ;;
86+
ntfs)
87+
force=-F ;;
8688
*)
8789
_fail "unknown filesystem to convert: $fstype"
8890
esac
@@ -235,6 +237,7 @@ convert_test_post_rollback() {
235237
case "$1" in
236238
ext[234]) types=ext2,ext3,ext4 ;;
237239
reiserfs) types=reiserfs ;;
240+
ntfs) types=ntfs ;;
238241
*) _fail "unknown filesystem type to check: $1" ;;
239242
esac
240243

@@ -295,3 +298,18 @@ check_kernel_support_reiserfs()
295298
fi
296299
return 0
297300
}
301+
302+
load_module_ntfs()
303+
{
304+
# Load NTFS3 that has write support
305+
$SUDO_HELPER modprobe ntfs3
306+
}
307+
308+
check_kernel_support_ntfs()
309+
{
310+
if ! grep -iq 'ntfs' /proc/filesystems; then
311+
echo "WARNING: ntfs filesystem not listed in /proc/filesystems, some tests might be skipped"
312+
return 1
313+
fi
314+
return 0
315+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# Really basic test of ntfs2btrfs conversion
3+
4+
source "$TEST_TOP/common" || exit
5+
source "$TEST_TOP/common.convert" || exit
6+
7+
if ! check_kernel_support_ntfs >/dev/null; then
8+
_not_run "no NTFS support"
9+
fi
10+
11+
check_prereq btrfs-convert
12+
check_global_prereq mkfs.ntfs
13+
check_global_prereq ntfs2btrfs
14+
15+
setup_root_helper
16+
prepare_test_dev
17+
18+
# Iterate over defaults and options that are not tied to hardware capabilities
19+
# or number of devices. Test only 4K block size as minimum.
20+
for feature in '' 'block-group-tree' ; do
21+
convert_test ntfs "$feature" "ntfs 4k nodesize" 4096 mkfs.ntfs -s 4096
22+
done

0 commit comments

Comments
 (0)