btrfs-progs: tests: simple test for subvol show output

Test the recent changes in 'subvol show' that prints quota information.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2019-06-19 21:31:23 +02:00
parent f0aab17fc0
commit 604ffe8876

View File

@ -0,0 +1,36 @@
#!/bin/bash
# simple test for 'subvol show' output
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs
setup_root_helper
prepare_test_dev
run_check_mkfs_test_dev
run_check_mount_test_dev
# quotas not enabled, no qgroup associated to subv2
run_check $SUDO_HELPER "$TOP"/btrfs subvolume create "$TEST_MNT"/subv2
run_check $SUDO_HELPER "$TOP"/btrfs subvolume show "$TEST_MNT"/subv2
# enable
run_check $SUDO_HELPER "$TOP"/btrfs quota enable "$TEST_MNT"
# autocreated qgroup
run_check $SUDO_HELPER "$TOP"/btrfs subvolume create "$TEST_MNT"/subv1
rootid=$(run_check_stdout $SUDO_HELPER "$TOP"/btrfs inspect rootid "$TEST_MNT"/subv1)
run_check $SUDO_HELPER "$TOP"/btrfs qgroup limit -e 1G "0/$rootid" "$TEST_MNT"
run_check $SUDO_HELPER "$TOP"/btrfs qgroup show "$TEST_MNT"
# no limits
run_check $SUDO_HELPER "$TOP"/btrfs subvolume show "$TEST_MNT"
# 1G limit for exclusive
run_check $SUDO_HELPER "$TOP"/btrfs subvolume show "$TEST_MNT"/subv1
# no limits
run_check $SUDO_HELPER "$TOP"/btrfs subvolume show "$TEST_MNT"/subv2
run_check_umount_test_dev