summaryrefslogtreecommitdiff
path: root/tests/misc-tests
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2016-07-26 13:24:39 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2016-07-26 13:24:39 +0100
commit3d69435ee3292b4b1db2d61c4784789d75883821 (patch)
tree2c0edc9d9501374799875af36259089feb99d48c /tests/misc-tests
Imported Upstream version 4.6.1
Diffstat (limited to 'tests/misc-tests')
-rwxr-xr-xtests/misc-tests/001-btrfstune-features/test.sh46
-rwxr-xr-xtests/misc-tests/002-uuid-rewrite/test.sh66
-rwxr-xr-xtests/misc-tests/003-zero-log/test.sh52
-rwxr-xr-xtests/misc-tests/004-shrink-fs/test.sh72
-rwxr-xr-xtests/misc-tests/005-convert-progress-thread-crash/test.sh15
-rwxr-xr-xtests/misc-tests/006-image-on-missing-device/test.sh78
-rwxr-xr-xtests/misc-tests/007-subvolume-sync/test.sh32
-rwxr-xr-xtests/misc-tests/008-leaf-crossing-stripes/test.sh25
-rwxr-xr-xtests/misc-tests/009-subvolume-sync-must-wait/test.sh52
-rwxr-xr-xtests/misc-tests/010-convert-delete-ext2-subvol/test.sh26
-rwxr-xr-xtests/misc-tests/011-delete-missing-device/test.sh83
-rw-r--r--tests/misc-tests/012-find-root-no-result/first_meta_chunk.btrfs-imagebin0 -> 4096 bytes
-rwxr-xr-xtests/misc-tests/012-find-root-no-result/test.sh24
-rwxr-xr-xtests/misc-tests/013-subvolume-sync-crash/test.sh49
-rwxr-xr-xtests/misc-tests/014-filesystem-label/test.sh69
15 files changed, 689 insertions, 0 deletions
diff --git a/tests/misc-tests/001-btrfstune-features/test.sh b/tests/misc-tests/001-btrfstune-features/test.sh
new file mode 100755
index 00000000..c858d701
--- /dev/null
+++ b/tests/misc-tests/001-btrfstune-features/test.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# test btrfstune options that enable filesystem features
+
+source $TOP/tests/common
+
+check_prereq btrfs-debug-tree
+check_prereq btrfs-show-super
+check_prereq mkfs.btrfs
+check_prereq btrfstune
+check_prereq btrfs
+
+setup_root_helper
+prepare_test_dev
+
+# test whether fsck can rebuild a corrupted extent tree
+# parameters:
+# - option for mkfs.btrfs -O, empty for defaults
+# - option for btrfstune
+# - string representing the feature in btrfs-show-super dump
+test_feature()
+{
+ local mkfsfeatures
+ local tuneopt
+ local sbflag
+
+ mkfsfeatures=${1:+-O ^$1}
+ tuneopt="$2"
+ sbflag="$3"
+
+ run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $mkfsfeatures $TEST_DEV
+ if run_check_stdout $TOP/btrfs-show-super $TEST_DEV | \
+ grep -q "$sbflag"; then
+ _fail "FAIL: feature $sbflag must not be set on the base image"
+ fi
+ run_check $TOP/btrfstune $tuneopt $TEST_DEV
+ if ! run_check_stdout $TOP/btrfs-show-super $TEST_DEV | \
+ grep -q "$sbflag"; then
+ _fail "FAIL: feature $sbflag not set"
+ fi
+ run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV
+}
+
+test_feature extref -r EXTENDED_IREF
+test_feature skinny-metadata -x SKINNY_METADATA
+test_feature no-holes -n NO_HOLES
+test_feature '' '-S 1' SEEDING
diff --git a/tests/misc-tests/002-uuid-rewrite/test.sh b/tests/misc-tests/002-uuid-rewrite/test.sh
new file mode 100755
index 00000000..d84ec6ca
--- /dev/null
+++ b/tests/misc-tests/002-uuid-rewrite/test.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# test btrfstune uuid rewriting options
+
+source $TOP/tests/common
+
+check_prereq btrfs-debug-tree
+check_prereq btrfs-show-super
+check_prereq mkfs.btrfs
+check_prereq btrfstune
+check_prereq btrfs
+
+prepare_test_dev
+
+get_fs_uuid() {
+ local image
+
+ image="$1"
+ run_check_stdout $TOP/btrfs-show-super "$image" | \
+ grep '^fsid' | awk '{print $2}'
+}
+
+test_uuid_random()
+{
+ local origuuid
+
+ origuuid=11111111-a101-4031-b29a-379d4f8b7a2d
+
+ run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
+ --uuid $origuuid \
+ --rootdir $TOP/Documentation \
+ $TEST_DEV
+ run_check $TOP/btrfs-show-super "$TEST_DEV"
+ currentfsid=$(run_check_stdout $TOP/btrfstune -f -u $TEST_DEV | \
+ grep -i 'current fsid:' | awk '{print $3}')
+ if ! [ $currentfsid = $origuuid ]; then
+ _fail "FAIL: current UUID mismatch"
+ fi
+ run_check $TOP/btrfs-show-super "$TEST_DEV"
+ run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV
+}
+
+test_uuid_user()
+{
+ local origuuid
+ local newuuid
+
+ origuuid=22222222-d324-4f92-80e9-7658bf3b845f
+ newuuid=33333333-bfc9-4045-9399-a396dc6893b3
+
+ run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
+ --uuid $origuuid \
+ --rootdir $TOP/Documentation \
+ $TEST_DEV
+ run_check $TOP/btrfs-show-super "$TEST_DEV"
+ run_check $TOP/btrfstune -f -U $newuuid \
+ $TEST_DEV
+ # btrfs-show-super is called within get_fs_uuid
+ fsid=$(get_fs_uuid $TEST_DEV)
+ if ! [ $fsid = $newuuid ]; then
+ _fail "FAIL: UUID not rewritten"
+ fi
+ run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV
+}
+
+test_uuid_random
+test_uuid_user
diff --git a/tests/misc-tests/003-zero-log/test.sh b/tests/misc-tests/003-zero-log/test.sh
new file mode 100755
index 00000000..b650930e
--- /dev/null
+++ b/tests/misc-tests/003-zero-log/test.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# test zero-log
+
+source $TOP/tests/common
+
+check_prereq btrfs-show-super
+check_prereq mkfs.btrfs
+check_prereq btrfs
+prepare_test_dev
+
+get_log_root()
+{
+ local image
+
+ image="$1"
+ $TOP/btrfs-show-super "$image" | \
+ grep '^log_root\>' | awk '{print $2}'
+}
+get_log_root_level() {
+ local image
+
+ image="$1"
+ $TOP/btrfs-show-super "$image" | \
+ grep '^log_root_level' | awk '{print $2}'
+}
+
+test_zero_log()
+{
+ # FIXME: we need an image with existing log_root
+ run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
+ --rootdir $TOP/Documentation \
+ $TEST_DEV
+ run_check $TOP/btrfs-show-super $TEST_DEV
+ if [ "$1" = 'standalone' ]; then
+ run_check $TOP/btrfs rescue zero-log $TEST_DEV
+ else
+ run_check $TOP/btrfs-zero-log $TEST_DEV
+ fi
+ log_root=$(get_log_root $TEST_DEV)
+ log_root_level=$(get_log_root $TEST_DEV)
+ if [ "$log_root" != 0 ]; then
+ _fail "FAIL: log_root not reset"
+ fi
+ if [ "$log_root_level" != 0 ]; then
+ _fail "FAIL: log_root_level not reset"
+ fi
+ run_check $TOP/btrfs-show-super $TEST_DEV
+ run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV
+}
+
+test_zero_log standalone
+test_zero_log internal
diff --git a/tests/misc-tests/004-shrink-fs/test.sh b/tests/misc-tests/004-shrink-fs/test.sh
new file mode 100755
index 00000000..88740358
--- /dev/null
+++ b/tests/misc-tests/004-shrink-fs/test.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+#
+# Test getting the minimum size a filesystem can be resized to and verify we
+# are able to resize (shrink) it to that size.
+#
+
+source $TOP/tests/common
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper
+
+# Optionally take id of the device to shrink
+shrink_test()
+{
+ min_size=$(run_check_stdout $SUDO_HELPER $TOP/btrfs inspect-internal min-dev-size ${1:+--id $1} $TEST_MNT)
+ min_size=$(echo $min_size | cut -d ' ' -f 1)
+ echo "min size = ${min_size}" >> $RESULTS
+ if [ -z "$min_size" ]; then
+ _fail "Failed to parse minimum size"
+ fi
+ run_check $SUDO_HELPER $TOP/btrfs filesystem resize $min_size $TEST_MNT
+}
+
+run_check truncate -s 20G $IMAGE
+run_check $TOP/mkfs.btrfs -f $IMAGE
+run_check $SUDO_HELPER mount $IMAGE $TEST_MNT
+run_check $SUDO_HELPER chmod a+rw $TEST_MNT
+
+# Create 7 data block groups, each with a size of 1Gb.
+for ((i = 1; i <= 7; i++)); do
+ run_check fallocate -l 1G $TEST_MNT/foo$i
+done
+
+# Make sure they are persisted (all the chunk, device and block group items
+# added to the chunk/dev/extent trees).
+run_check $TOP/btrfs filesystem sync $TEST_MNT
+
+# Now remove 3 of those 1G files. This will result in 3 block groups becoming
+# unused, which will be automatically deleted by the cleaner kthread, and this
+# will result in 3 holes (unallocated space) in the device (each with a size
+# of 1Gb).
+
+run_check rm -f $TEST_MNT/foo2
+run_check rm -f $TEST_MNT/foo4
+run_check rm -f $TEST_MNT/foo6
+
+# Sync once to wake up the cleaner kthread which will delete the unused block
+# groups - it could have been sleeping when they became unused. Then wait a bit
+# to allow the cleaner kthread to delete them and then finally ensure the
+# transaction started by the cleaner kthread is committed.
+run_check $TOP/btrfs filesystem sync $TEST_MNT
+sleep 3
+run_check $TOP/btrfs filesystem sync $TEST_MNT
+
+# Now attempt to get the minimum size we can resize the filesystem to and verify
+# the resize operation succeeds. This size closely matches the sum of the size
+# of all the allocated device extents.
+for ((i = 1; i <= 3; i++)); do
+ shrink_test
+done
+
+# Now convert metadata and system chunks to the single profile and check we are
+# still able to get a correct minimum size and shrink to that size.
+run_check $SUDO_HELPER $TOP/btrfs balance start -mconvert=single \
+ -sconvert=single -f $TEST_MNT
+for ((i = 1; i <= 3; i++)); do
+ shrink_test 1
+done
+
+run_check $SUDO_HELPER umount $TEST_MNT
diff --git a/tests/misc-tests/005-convert-progress-thread-crash/test.sh b/tests/misc-tests/005-convert-progress-thread-crash/test.sh
new file mode 100755
index 00000000..054069c2
--- /dev/null
+++ b/tests/misc-tests/005-convert-progress-thread-crash/test.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+# test convert-thread-conflict
+
+source $TOP/tests/common
+
+check_prereq btrfs-convert
+
+mkfs.ext4 -V &>/dev/null || _not_run "mkfs.ext4 not found"
+prepare_test_dev 1G
+
+for ((i = 0; i < 20; i++)); do
+ echo "loop $i" >>$RESULTS
+ mkfs.ext4 -F "$TEST_DEV" &>>$RESULTS || _not_run "mkfs.ext4 failed"
+ run_check $TOP/btrfs-convert "$TEST_DEV"
+done
diff --git a/tests/misc-tests/006-image-on-missing-device/test.sh b/tests/misc-tests/006-image-on-missing-device/test.sh
new file mode 100755
index 00000000..8680a707
--- /dev/null
+++ b/tests/misc-tests/006-image-on-missing-device/test.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+# test btrfs-image with a missing device (uses loop devices)
+#
+# - btrfs-image must not loop indefinetelly
+# - btrfs-image will expectedly fail to produce the dump
+
+source $TOP/tests/common
+
+check_prereq btrfs-show-super
+check_prereq btrfs-image
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+ndevs=2
+declare -a devs
+dev1=
+dev2=
+
+setup_root_helper
+
+
+# TODO: move the helpers to common
+
+prepare_devices()
+{
+ for i in `seq $ndevs`; do
+ touch img$i
+ chmod a+rw img$i
+ truncate -s0 img$i
+ truncate -s2g img$i
+ devs[$i]=`run_check_stdout $SUDO_HELPER losetup --find --show img$i`
+ done
+}
+
+cleanup_devices()
+{
+ for dev in ${devs[@]}; do
+ run_mayfail $SUDO_HELPER losetup -d $dev
+ done
+ for i in `seq $ndevs`; do
+ truncate -s0 img$i
+ done
+ run_check $SUDO_HELPER losetup --list
+}
+
+test_image_dump()
+{
+ run_check $SUDO_HELPER $TOP/btrfs check $dev1
+ # the output file will be deleted
+ run_mayfail $SUDO_HELPER $TOP/btrfs-image $dev1 /tmp/test-img.dump
+}
+
+test_run()
+{
+ run_check $SUDO_HELPER $TOP/mkfs.btrfs -f -d raid1 -m raid1 $dev1 $dev2
+
+ # we need extents to trigger reading from all devices
+ run_check $SUDO_HELPER mount $dev1 $TEST_MNT
+ run_check $SUDO_HELPER dd if=/dev/zero of=$TEST_MNT/a bs=1M count=10
+ run_check $SUDO_HELPER dd if=/dev/zero of=$TEST_MNT/b bs=4k count=1000 conv=sync
+ run_check $SUDO_HELPER umount $TEST_MNT
+
+ test_image_dump
+ run_check btrfs fi show $dev1
+ # create a degraded raid1 filesystem, check must succeed
+ # btrfs-image must not loop
+ run_mayfail wipefs -a $dev2
+ run_check $SUDO_HELPER losetup -d $dev2
+ run_check btrfs fi show $dev1
+
+ test_image_dump
+}
+
+prepare_devices
+dev1=${devs[1]}
+dev2=${devs[2]}
+test_run
+cleanup_devices
diff --git a/tests/misc-tests/007-subvolume-sync/test.sh b/tests/misc-tests/007-subvolume-sync/test.sh
new file mode 100755
index 00000000..243bb8cc
--- /dev/null
+++ b/tests/misc-tests/007-subvolume-sync/test.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# test btrfs subvolume run normally with more than one subvolume
+#
+# - btrfs subvolume must not loop indefinitely
+# - btrfs subvolume return 0 in normal case
+
+source $TOP/tests/common
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper
+prepare_test_dev
+
+run_check $SUDO_HELPER $TOP/mkfs.btrfs -f "$TEST_DEV"
+run_check_mount_test_dev
+
+# to check following thing in both 1 and multiple subvolume case:
+# 1: is subvolume sync loop indefinitely
+# 2: is return value right
+#
+run_check $SUDO_HELPER $TOP/btrfs subvolume create "$TEST_MNT"/mysubvol1
+run_check $SUDO_HELPER $TOP/btrfs subvolume create "$TEST_MNT"/mysubvol2
+run_check $SUDO_HELPER $TOP/btrfs subvolume delete "$TEST_MNT"/mysubvol1
+run_check $SUDO_HELPER $TOP/btrfs subvolume delete "$TEST_MNT"/mysubvol2
+run_check $SUDO_HELPER $TOP/btrfs subvolume sync "$TEST_MNT"
+
+run_check $SUDO_HELPER $TOP/btrfs subvolume create "$TEST_MNT"/mysubvol
+run_check $SUDO_HELPER $TOP/btrfs subvolume delete "$TEST_MNT"/mysubvol
+run_check $SUDO_HELPER $TOP/btrfs subvolume sync "$TEST_MNT"
+
+run_check_umount_test_dev
diff --git a/tests/misc-tests/008-leaf-crossing-stripes/test.sh b/tests/misc-tests/008-leaf-crossing-stripes/test.sh
new file mode 100755
index 00000000..03818062
--- /dev/null
+++ b/tests/misc-tests/008-leaf-crossing-stripes/test.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# test if btrfs-convert creates a filesystem without leaf crossing stripes
+
+source $TOP/tests/common
+
+check_prereq btrfs-convert
+check_prereq btrfs
+
+# In my test, it happened in 514M~560M, 737M~769M, 929M~917M,
+# and HAVE_ERROR=((size + 1) / 2) % 2 if size >= 970
+#
+SIZE_FROM=514
+SIZE_END=560
+A_PRIME_NUM=17
+for ((size = SIZE_FROM; size <= SIZE_END; size += A_PRIME_NUM)); do
+ run_check truncate -s "$size"M "$IMAGE"
+ run_check mkfs.ext4 -F "$IMAGE"
+ run_check $TOP/btrfs-convert "$IMAGE"
+ run_check_stdout $TOP/btrfs check "$IMAGE" 2>&1 |
+ grep -q "crossing stripe boundary" &&
+ _fail "leaf crossing stripes after btrfs-convert"
+done
+
+# grep will expectedly fail
+exit 0
diff --git a/tests/misc-tests/009-subvolume-sync-must-wait/test.sh b/tests/misc-tests/009-subvolume-sync-must-wait/test.sh
new file mode 100755
index 00000000..92c896f9
--- /dev/null
+++ b/tests/misc-tests/009-subvolume-sync-must-wait/test.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# Verify that subvolume sync waits until the subvolume is cleaned
+
+source $TOP/tests/common
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper
+
+run_check truncate -s 2G $IMAGE
+run_check $TOP/mkfs.btrfs -f $IMAGE
+run_check $SUDO_HELPER mount $IMAGE $TEST_MNT
+run_check $SUDO_HELPER chmod a+rw $TEST_MNT
+
+cd $TEST_MNT
+
+for i in `seq 5`; do
+ run_check dd if=/dev/zero of=file$i bs=1M count=10
+done
+
+for sn in `seq 4`;do
+ run_check $SUDO_HELPER $TOP/btrfs subvolume snapshot . snap$sn
+ for i in `seq 10`; do
+ run_check dd if=/dev/zero of=snap$sn/file$i bs=1M count=10
+ done
+done
+
+run_check $SUDO_HELPER $TOP/btrfs subvolume list .
+run_check $SUDO_HELPER $TOP/btrfs subvolume list -d .
+
+idtodel=`run_check_stdout $SUDO_HELPER $TOP/btrfs inspect-internal rootid snap3`
+
+# delete, sync after some time
+run_check $SUDO_HELPER $TOP/btrfs subvolume delete -c snap3
+{ sleep 5; run_check $TOP/btrfs filesystem sync $TEST_MNT; } &
+
+run_check $SUDO_HELPER $TOP/btrfs subvolume sync . $idtodel
+
+if run_check_stdout $SUDO_HELPER $TOP/btrfs subvolume list -d . |
+ grep -q "ID $idtodel.*DELETED"; then
+ _fail "sync did not wait for the subvolume cleanup"
+fi
+
+run_check $TOP/btrfs filesystem sync $TEST_MNT
+run_check $SUDO_HELPER $TOP/btrfs subvolume list -d .
+
+wait
+cd ..
+
+run_check $SUDO_HELPER umount $TEST_MNT
diff --git a/tests/misc-tests/010-convert-delete-ext2-subvol/test.sh b/tests/misc-tests/010-convert-delete-ext2-subvol/test.sh
new file mode 100755
index 00000000..451e453a
--- /dev/null
+++ b/tests/misc-tests/010-convert-delete-ext2-subvol/test.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# verify that convert rollback finds the ext2_subvolume intact and fails if it
+# was partially deleted
+
+source $TOP/tests/common
+
+check_prereq btrfs-convert
+check_prereq btrfs-debug-tree
+check_prereq btrfs
+
+setup_root_helper
+prepare_test_dev
+
+run_check truncate -s 2G "$TEST_DEV"
+run_check mkfs.ext4 -F "$TEST_DEV"
+run_check $TOP/btrfs-convert "$TEST_DEV"
+run_check $TOP/btrfs-debug-tree "$TEST_DEV"
+run_check_mount_test_dev
+run_check $SUDO_HELPER $TOP/btrfs subvolume delete -c "$TEST_MNT/ext2_saved"
+run_check_umount_test_dev
+run_check $TOP/btrfs-debug-tree "$TEST_DEV"
+run_check_stdout $TOP/btrfs-convert --rollback "$TEST_DEV" |
+ grep -q 'is it deleted' || _fail "unexpected rollback"
+
+exit 0
diff --git a/tests/misc-tests/011-delete-missing-device/test.sh b/tests/misc-tests/011-delete-missing-device/test.sh
new file mode 100755
index 00000000..26645f10
--- /dev/null
+++ b/tests/misc-tests/011-delete-missing-device/test.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+# make sure that 'missing' is accepted for device deletion
+
+source $TOP/tests/common
+
+check_prereq btrfs-show-super
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+ndevs=4
+declare -a devs
+dev1=
+devtodel=
+
+setup_root_helper
+
+prepare_devices()
+{
+ for i in `seq $ndevs`; do
+ touch img$i
+ chmod a+rw img$i
+ truncate -s0 img$i
+ truncate -s2g img$i
+ devs[$i]=`run_check_stdout $SUDO_HELPER losetup --find --show img$i`
+ done
+}
+
+cleanup_devices()
+{
+ for dev in ${devs[@]}; do
+ run_mayfail $SUDO_HELPER losetup -d $dev
+ done
+ for i in `seq $ndevs`; do
+ truncate -s0 img$i
+ done
+ run_check $SUDO_HELPER losetup --list
+}
+
+test_do_mkfs()
+{
+ run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $@ ${devs[@]}
+ run_check $TOP/btrfs-show-super $dev1
+ run_check $SUDO_HELPER $TOP/btrfs check $dev1
+ run_check $TOP/btrfs filesystem show
+}
+
+test_wipefs()
+{
+ run_check wipefs -a $devtodel
+ run_check $SUDO_HELPER losetup -d $devtodel
+ run_check losetup -a
+ run_check $TOP/btrfs filesystem show
+}
+test_delete_missing()
+{
+ run_check_mount_test_dev -o degraded
+ run_check $SUDO_HELPER $TOP/btrfs filesystem show $TEST_MNT
+ run_check $SUDO_HELPER $TOP/btrfs device delete missing $TEST_MNT
+ run_check $SUDO_HELPER $TOP/btrfs filesystem show $TEST_MNT
+ run_check_umount_test_dev
+
+ run_check_mount_test_dev
+ local out
+ out="$(run_check_stdout $SUDO_HELPER $TOP/btrfs filesystem show $TEST_MNT)"
+ if echo "$out" | grep -q -- "$devtodel"; then
+ _fail "device $devtodel not deleted"
+ fi
+ if echo "$out" | grep -q missing; then
+ _fail "missing device still present"
+ fi
+ run_check_umount_test_dev
+}
+
+prepare_devices
+dev1=${devs[1]}
+devtodel=${devs[3]}
+TEST_DEV=$dev1
+
+test_do_mkfs
+test_wipefs
+test_delete_missing
+
+cleanup_devices
diff --git a/tests/misc-tests/012-find-root-no-result/first_meta_chunk.btrfs-image b/tests/misc-tests/012-find-root-no-result/first_meta_chunk.btrfs-image
new file mode 100644
index 00000000..7bf6c509
--- /dev/null
+++ b/tests/misc-tests/012-find-root-no-result/first_meta_chunk.btrfs-image
Binary files differ
diff --git a/tests/misc-tests/012-find-root-no-result/test.sh b/tests/misc-tests/012-find-root-no-result/test.sh
new file mode 100755
index 00000000..983a8a1e
--- /dev/null
+++ b/tests/misc-tests/012-find-root-no-result/test.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# Regression test for case btrfs-find-root may print no result on a
+# recent fs or balanced fs, whose metadata chunk is the first chunk
+# and the only metadata chunk
+
+source $TOP/tests/common
+
+check_prereq btrfs-find-root
+check_prereq btrfs-image
+
+run_check $TOP/btrfs-image -r first_meta_chunk.btrfs-image test.img || \
+ _fail "failed to extract first_meta_chunk.btrfs-image"
+
+result=$(run_check_stdout $TOP/btrfs-find-root test.img | sed '/^Superblock/d')
+
+if [ -z "$result" ]; then
+ _fail "btrfs-find-root failed to find tree root"
+fi
+
+if ! echo "$result" | grep -q 'Found tree root at'; then
+ _fail "btrfs-find-root failed to find tree root, unexpected output"
+fi
+
+rm test.img
diff --git a/tests/misc-tests/013-subvolume-sync-crash/test.sh b/tests/misc-tests/013-subvolume-sync-crash/test.sh
new file mode 100755
index 00000000..4cb1b4e7
--- /dev/null
+++ b/tests/misc-tests/013-subvolume-sync-crash/test.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# Verify that subvolume sync waits until the subvolume is cleaned and does not
+# crash at the end
+
+source $TOP/tests/common
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper
+
+run_check truncate -s 2G $IMAGE
+run_check $TOP/mkfs.btrfs -f $IMAGE
+run_check $SUDO_HELPER mount $IMAGE $TEST_MNT
+run_check $SUDO_HELPER chmod a+rw $TEST_MNT
+
+cd $TEST_MNT
+
+for i in `seq 5`; do
+ run_check dd if=/dev/zero of=file$i bs=1M count=10
+done
+
+# 128 is minimum
+for sn in `seq 130`;do
+ run_check $SUDO_HELPER $TOP/btrfs subvolume snapshot . snap$sn
+ for i in `seq 10`; do
+ run_check dd if=/dev/zero of=snap$sn/file$i bs=1M count=1
+ done
+done
+
+run_check $SUDO_HELPER $TOP/btrfs subvolume list .
+run_check $SUDO_HELPER $TOP/btrfs subvolume list -d .
+
+idtodel=`run_check_stdout $SUDO_HELPER $TOP/btrfs inspect-internal rootid snap3`
+
+# delete, sync after some time
+run_check $SUDO_HELPER $TOP/btrfs subvolume delete -c snap*
+{ sleep 5; run_check $TOP/btrfs filesystem sync $TEST_MNT; } &
+
+run_check $SUDO_HELPER $TOP/btrfs subvolume sync .
+
+run_check $TOP/btrfs filesystem sync $TEST_MNT
+run_check $SUDO_HELPER $TOP/btrfs subvolume list -d .
+
+wait
+cd ..
+
+run_check $SUDO_HELPER umount $TEST_MNT
diff --git a/tests/misc-tests/014-filesystem-label/test.sh b/tests/misc-tests/014-filesystem-label/test.sh
new file mode 100755
index 00000000..a5e08ccc
--- /dev/null
+++ b/tests/misc-tests/014-filesystem-label/test.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+#
+# test label settings
+
+source $TOP/tests/common
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper
+
+run_check truncate -s 2G $IMAGE
+run_check $TOP/mkfs.btrfs -L BTRFS-TEST-LABEL -f $IMAGE
+run_check $SUDO_HELPER mount $IMAGE $TEST_MNT
+run_check $SUDO_HELPER chmod a+rw $TEST_MNT
+
+cd $TEST_MNT
+run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT
+# shortest label
+run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT a
+run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT
+run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT ''
+
+longlabel=\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+0123456789\
+\
+01234
+
+run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT "$longlabel"
+run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT
+# 256, must fail
+run_mustfail "label 256 bytes long succeeded" \
+ $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT "$longlabel"5
+run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT
+run_mustfail "label 2 * 255 bytes long succeeded" \
+ $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT "$longlabel$longlabel"
+run_check $SUDO_HELPER $TOP/btrfs filesystem label $TEST_MNT
+
+cd ..
+
+run_check $SUDO_HELPER umount $TEST_MNT