File: test.sh

package info (click to toggle)
btrfs-progs 6.2-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,244 kB
  • sloc: ansic: 114,376; sh: 9,576; python: 1,242; makefile: 820
file content (48 lines) | stat: -rwxr-xr-x 1,626 bytes parent folder | download
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Look for warning about read-write subvolume with received_uuid set, on a crafted
# image

source "$TEST_TOP/common"

setup_root_helper
prepare_test_dev

ORIG_TEST_DEV="$TEST_DEV"
TEST_DEV=$(extract_image "subvol-rw-recv.img")
run_check_mount_test_dev
if ! run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume show "$TEST_MNT/subvol1" |
     grep -q "WARNING.*received_uuid"; then
	_fail "no warning found"
fi
if run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume show "$TEST_MNT/snap1" |
     grep -q "WARNING.*received_uuid"; then
	_fail "unexpected warning"
fi
run_check_umount_test_dev
rm -- "$TEST_DEV"

TEST_DEV="$ORIG_TEST_DEV"
run_check_mkfs_test_dev
run_check_mount_test_dev
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subvol1"
if run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume show "$TEST_MNT/subvol1" |
     grep -q "WARNING.*received_uuid"; then
	_fail "unexpected warning"
fi
run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot -r "$TEST_MNT/subvol1" "$TEST_MNT/snap1"
if run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume show "$TEST_MNT/snap1" |
     grep -q "WARNING.*received_uuid"; then
	_fail "unexpected warning"
fi

run_check $SUDO_HELPER mkdir "$TEST_MNT/recv"
_mktemp_local send.stream
run_check $SUDO_HELPER "$TOP/btrfs" send -f send.stream "$TEST_MNT/snap1"
run_check $SUDO_HELPER "$TOP/btrfs" receive -f send.stream -m "$TEST_MNT" "$TEST_MNT/recv"
if run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume show "$TEST_MNT/recv/snap1" |
     grep -q "WARNING.*received_uuid"; then
	_fail "unexpected warning"
fi
run_check_umount_test_dev

rm -- send.stream