2017-08-22 16:32:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# create a base image, convert to btrfs, remove all files, rollback the reiserfs image
|
|
|
|
|
2023-04-19 15:08:41 +00:00
|
|
|
source "$TEST_TOP/common" || exit
|
|
|
|
source "$TEST_TOP/common.convert" || exit
|
2017-08-22 16:32:57 +00:00
|
|
|
|
2017-09-07 15:29:51 +00:00
|
|
|
if ! check_kernel_support_reiserfs >/dev/null; then
|
|
|
|
_not_run "no reiserfs support"
|
|
|
|
fi
|
|
|
|
|
2017-08-22 16:32:57 +00:00
|
|
|
check_prereq btrfs-convert
|
2017-08-29 14:35:01 +00:00
|
|
|
check_global_prereq mkreiserfs
|
2017-08-22 16:32:57 +00:00
|
|
|
|
2023-04-13 18:40:23 +00:00
|
|
|
setup_root_helper
|
|
|
|
prepare_test_dev
|
|
|
|
|
2017-08-22 16:32:57 +00:00
|
|
|
# simple wrapper for a convert test
|
|
|
|
# $1: btrfs features, argument to -O
|
|
|
|
# $2: message
|
|
|
|
# $3: nodesize value
|
|
|
|
# $4 + rest: command to create the reiserfs image
|
|
|
|
do_test() {
|
|
|
|
local features
|
|
|
|
local msg
|
|
|
|
local nodesize
|
|
|
|
local CHECKSUMTMP
|
|
|
|
local here
|
|
|
|
|
|
|
|
features="$1"
|
|
|
|
msg="$2"
|
|
|
|
nodesize="$3"
|
|
|
|
shift 3
|
|
|
|
convert_test_preamble "$features" "$msg" "$nodesize" "$@"
|
|
|
|
convert_test_prep_fs reiserfs "$@"
|
|
|
|
populate_fs
|
2021-10-11 13:56:58 +00:00
|
|
|
CHECKSUMTMP=$(_mktemp convert)
|
2017-08-22 16:32:57 +00:00
|
|
|
convert_test_gen_checksums "$CHECKSUMTMP"
|
|
|
|
|
|
|
|
run_check_umount_test_dev
|
|
|
|
|
|
|
|
convert_test_do_convert "$features" "$nodesize"
|
|
|
|
|
2024-01-31 08:18:08 +00:00
|
|
|
if ! convert_can_mount "$features"; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2017-08-22 16:32:57 +00:00
|
|
|
run_check_mount_test_dev
|
|
|
|
convert_test_post_check_checksums "$CHECKSUMTMP"
|
|
|
|
|
|
|
|
here=$(pwd)
|
|
|
|
cd "$TEST_MNT" || _fail "cannot cd to TEST_MNT"
|
|
|
|
# reiserfs_saved/image must not be deleted
|
|
|
|
run_mayfail $SUDO_HELPER find "$TEST_MNT"/ -mindepth 1 -path '*reiserfs_saved' -prune -o -exec rm -vrf "{}" \;
|
|
|
|
cd "$here"
|
|
|
|
run_check "$TOP/btrfs" filesystem sync "$TEST_MNT"
|
|
|
|
run_check_umount_test_dev
|
2017-09-07 12:44:45 +00:00
|
|
|
convert_test_post_rollback reiserfs
|
2017-08-22 16:32:57 +00:00
|
|
|
|
|
|
|
run_check_mount_convert_dev reiserfs
|
|
|
|
convert_test_post_check_checksums "$CHECKSUMTMP"
|
|
|
|
run_check_umount_test_dev
|
|
|
|
|
|
|
|
# mount again and verify checksums
|
|
|
|
run_check_mount_convert_dev reiserfs
|
|
|
|
convert_test_post_check_checksums "$CHECKSUMTMP"
|
|
|
|
run_check_umount_test_dev
|
|
|
|
|
|
|
|
rm "$CHECKSUMTMP"
|
|
|
|
}
|
|
|
|
|
2023-04-19 14:50:22 +00:00
|
|
|
# Iterate over defaults and options that are not tied to hardware capabilities
|
|
|
|
# or number of devices
|
2024-06-12 22:30:32 +00:00
|
|
|
for feature in '' 'block-group-tree'; do
|
2017-08-22 16:32:57 +00:00
|
|
|
do_test "$feature" "reiserfs 4k nodesize" 4096 mkreiserfs -b 4096
|
|
|
|
do_test "$feature" "reiserfs 16k nodesize" 16384 mkreiserfs -b 4096
|
|
|
|
do_test "$feature" "reiserfs 64k nodesize" 65536 mkreiserfs -b 4096
|
|
|
|
done
|