summaryrefslogtreecommitdiff
path: root/tests/convert-tests/011-reiserfs-delete-all-rollback
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2017-10-18 13:15:59 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2017-10-18 13:15:59 +0100
commit74d288e05c2d0cb97186f51049813b3e5b5bb0cd (patch)
tree4fc213398dc89e053d53ff7d42102942470e9cb5 /tests/convert-tests/011-reiserfs-delete-all-rollback
parent569a646293cd782de7665b6158514f3b48d229d3 (diff)
New upstream release.
Diffstat (limited to 'tests/convert-tests/011-reiserfs-delete-all-rollback')
-rwxr-xr-xtests/convert-tests/011-reiserfs-delete-all-rollback/test.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/convert-tests/011-reiserfs-delete-all-rollback/test.sh b/tests/convert-tests/011-reiserfs-delete-all-rollback/test.sh
new file mode 100755
index 00000000..c6c3119e
--- /dev/null
+++ b/tests/convert-tests/011-reiserfs-delete-all-rollback/test.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+# create a base image, convert to btrfs, remove all files, rollback the reiserfs image
+
+source "$TOP/tests/common"
+source "$TOP/tests/common.convert"
+
+if ! check_kernel_support_reiserfs >/dev/null; then
+ _not_run "no reiserfs support"
+fi
+
+setup_root_helper
+prepare_test_dev 512M
+check_prereq btrfs-convert
+check_global_prereq mkreiserfs
+
+# 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
+ CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXXXXXX)
+ convert_test_gen_checksums "$CHECKSUMTMP"
+
+ run_check_umount_test_dev
+
+ convert_test_do_convert "$features" "$nodesize"
+
+ 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
+ convert_test_post_rollback reiserfs
+
+ 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"
+}
+
+for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
+ do_test "$feature" "reiserfs 4k nodesize" 4096 mkreiserfs -b 4096
+ do_test "$feature" "reiserfs 8k nodesize" 8192 mkreiserfs -b 4096
+ do_test "$feature" "reiserfs 16k nodesize" 16384 mkreiserfs -b 4096
+ do_test "$feature" "reiserfs 32k nodesize" 32768 mkreiserfs -b 4096
+ do_test "$feature" "reiserfs 64k nodesize" 65536 mkreiserfs -b 4096
+done