File: test.sh

package info (click to toggle)
btrfs-progs 6.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,596 kB
  • sloc: ansic: 127,198; sh: 7,836; python: 1,385; makefile: 900; asm: 296
file content (31 lines) | stat: -rwxr-xr-x 1,066 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Create subvolume failure cases to make sure the return value is correct

source "$TEST_TOP/common" || exit

setup_root_helper
prepare_test_dev

run_check_mkfs_test_dev
run_check_mount_test_dev

# Create one subvolume and one file as place holder for later subvolume
# creation to fail.
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subv1"
run_check $SUDO_HELPER touch "$TEST_MNT/subv2"

# Using existing path to create a subvolume must fail
run_mustfail "should report error when target path already exists" \
	$SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subv1"

run_mustfail "should report error when target path already exists" \
	$SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subv2"

# Using multiple subvolumes in one create go, the good one "subv3" should be created
run_mustfail "should report error when target path already exists" \
	$SUDO_HELPER "$TOP/btrfs" subvolume create \
	"$TEST_MNT/subv1" "$TEST_MNT/subv2" "$TEST_MNT/subv3"

run_check $SUDO_HELPER stat "$TEST_MNT/subv3"

run_check_umount_test_dev