btrfs-progs/tests/misc-tests/056-subvolume-list-uuid/test.sh
David Sterba f6bbe06c08 btrfs-progs: tests: add protection against running out of test suite
Executing the script inside the directories as './test.sh' is not
supposed to work but could happen accidentally. With an exit after
attempting to source the we can fix that.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-04-25 16:59:41 +02:00

29 lines
657 B
Bash

#!/bin/bash
#
# Make sure "btrfs subvolume list -u" shows uuid correctly
source "$TEST_TOP/common" || exit
check_prereq mkfs.btrfs
check_prereq btrfs
check_global_prereq uuidparse
setup_root_helper
prepare_test_dev
tmp=$(_mktemp_dir list_uuid)
run_check_mkfs_test_dev
run_check_mount_test_dev
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subv1"
run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume list -u "$TEST_MNT" | \
cut -d\ -f9 > "$tmp/output"
result=$(cat "$tmp/output" | uuidparse -o TYPE -n)
rm -rf -- "$tmp"
if [ "$result" == "invalid" ]; then
_fail "subvolume list failed to report uuid"
fi
run_check_umount_test_dev