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 (24 lines) | stat: -rwxr-xr-x 707 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
# Regression test for case btrfs-find-root may print no result on a
# recent fs or balanced fs, whose metadata chunk is the first chunk
# and the only metadata chunk

source "$TEST_TOP/common"

check_prereq btrfs-find-root
check_prereq btrfs-image

run_check "$TOP/btrfs-image" -r first_meta_chunk.btrfs-image test.img || \
	_fail "failed to extract first_meta_chunk.btrfs-image"

result=$(run_check_stdout "$INTERNAL_BIN/btrfs-find-root" test.img | sed '/^Superblock/d')

if [ -z "$result" ]; then
	_fail "btrfs-find-root failed to find tree root"
fi

if ! echo "$result" | grep -q 'Found tree root at'; then
	_fail "btrfs-find-root failed to find tree root, unexpected output"
fi

rm test.img