btrfs-progs/tests/cli-tests/010-subvol-show-qgroup/test.sh
David Sterba 604ffe8876 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>
2019-07-03 13:31:15 +02:00

37 lines
1.0 KiB
Bash
Executable File

#!/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