summaryrefslogtreecommitdiff
path: root/tests/misc-tests/013-subvolume-sync-crash
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2016-05-10 10:13:23 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2016-05-10 10:13:23 +0100
commit58e631d01823afd60e52f3a09887f270a91889a0 (patch)
tree6afbca5492c1ad1040608e01fe0c9d909482adeb /tests/misc-tests/013-subvolume-sync-crash
parentcec572daccafa1e912cbed363df6f84687778c6f (diff)
New upstream release 4.5.2.
* Thanks for NMU of package rename. * New upstream release 4.5.2. * Upload using dgit. * Source-only upload. * btrfs-convert should not be included in the initramfs, but should be compiled. Using btrfs-convert is not a trivial operation, and especially not from a minimal shell. Also it is known to fail, and for a sophisticated user it is trivial to include it in the initramfs. Thus won't fix Closes: #801192 * No sponsorship required Closes: #823474 * Add Provides btrfs-tools-udeb to the -progs-udeb package.
Diffstat (limited to 'tests/misc-tests/013-subvolume-sync-crash')
-rwxr-xr-xtests/misc-tests/013-subvolume-sync-crash/test.sh49
1 files changed, 49 insertions, 0 deletions
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..c7955269
--- /dev/null
+++ b/tests/misc-tests/013-subvolume-sync-crash/test.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# Verify that subovolume 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