summaryrefslogtreecommitdiff
path: root/tests/misc-tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc-tests')
-rwxr-xr-xtests/misc-tests/031-qgroup-parent-child-relation/test.sh27
-rw-r--r--tests/misc-tests/032-bad-item-ptr/bad_item_ptr.raw.xzbin0 -> 21964 bytes
-rwxr-xr-xtests/misc-tests/032-bad-item-ptr/test.sh17
3 files changed, 44 insertions, 0 deletions
diff --git a/tests/misc-tests/031-qgroup-parent-child-relation/test.sh b/tests/misc-tests/031-qgroup-parent-child-relation/test.sh
new file mode 100755
index 00000000..2d66fd60
--- /dev/null
+++ b/tests/misc-tests/031-qgroup-parent-child-relation/test.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# Test that btrfs 'qgroup show' outputs the correct parent-child qgroup relation
+
+source "$TEST_TOP/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
+
+run_check $SUDO_HELPER "$TOP/btrfs" quota enable "$TEST_MNT"
+run_check $SUDO_HELPER "$TOP/btrfs" qgroup create 1/0 "$TEST_MNT"
+run_check $SUDO_HELPER "$TOP/btrfs" qgroup assign 0/5 1/0 "$TEST_MNT"
+run_check $SUDO_HELPER "$TOP/btrfs" quota rescan -w "$TEST_MNT"
+
+run_check_stdout $SUDO_HELPER "$TOP/btrfs" qgroup show --sort=-qgroupid \
+ -p "$TEST_MNT" | tail -n 1 | grep -q "1/0" \
+ || _fail "parent qgroup check failed, please check the log"
+run_check_stdout $SUDO_HELPER "$TOP/btrfs" qgroup show --sort=qgroupid \
+ -c "$TEST_MNT" | tail -n 1 | grep -q "0/5" \
+ || _fail "child qgroup check failed, please check the log"
+
+run_check_umount_test_dev "$TEST_MNT"
diff --git a/tests/misc-tests/032-bad-item-ptr/bad_item_ptr.raw.xz b/tests/misc-tests/032-bad-item-ptr/bad_item_ptr.raw.xz
new file mode 100644
index 00000000..7cf2e89f
--- /dev/null
+++ b/tests/misc-tests/032-bad-item-ptr/bad_item_ptr.raw.xz
Binary files differ
diff --git a/tests/misc-tests/032-bad-item-ptr/test.sh b/tests/misc-tests/032-bad-item-ptr/test.sh
new file mode 100755
index 00000000..cfbfe1a5
--- /dev/null
+++ b/tests/misc-tests/032-bad-item-ptr/test.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Verify that btrfs inspect dump-tree won't segfault on heavily corrupted
+# tree leaf
+# Issue: #128
+
+source "$TEST_TOP/common"
+
+check_prereq btrfs
+
+check_image() {
+ run_check "$TOP/btrfs" inspect-internal dump-tree "$1"
+ run_mustfail "btrfs check failed to detect such corruption" \
+ "$TOP/btrfs" check "$1"
+}
+
+check_all_images