From 872837ebbfb186e2e2cdf39daac98257fcd18392 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 1 Sep 2017 16:45:34 +0200 Subject: [PATCH] btrfs-progs: tests: add testcase for 'fi du' and empty subvol Signed-off-by: David Sterba --- .../022-filesystem-du-on-empty-subvol/test.sh | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 tests/misc-tests/022-filesystem-du-on-empty-subvol/test.sh diff --git a/tests/misc-tests/022-filesystem-du-on-empty-subvol/test.sh b/tests/misc-tests/022-filesystem-du-on-empty-subvol/test.sh new file mode 100755 index 00000000..72cf076f --- /dev/null +++ b/tests/misc-tests/022-filesystem-du-on-empty-subvol/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# btrfs fi du should handle empty subvolumes (with ino == 2) + +source "$TOP/tests/common" + +check_prereq mkfs.btrfs +check_prereq btrfs +setup_root_helper +prepare_test_dev + +run_check "$TOP/mkfs.btrfs" -f "$TEST_DEV" +run_check_mount_test_dev + +cd "$TEST_MNT" + +run_check $SUDO_HELPER "$TOP/btrfs" subvolume create test1 +run_check $SUDO_HELPER "$TOP/btrfs" subvolume create test1/test2 +run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot test1 test1-snap +run_check $SUDO_HELPER "$TOP/btrfs" filesystem du -s test1 +run_check_stdout $SUDO_HELPER "$TOP/btrfs" filesystem du -s test1-snap | \ + grep -q "ERROR:.*ioctl" && _fail "empty subvolume not handled" + +cd .. + +run_check_umount_test_dev