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 (39 lines) | stat: -rwxr-xr-x 1,001 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# test zero-log

source "$TEST_TOP/common"

check_prereq mkfs.btrfs
check_prereq btrfs
prepare_test_dev

get_log_root()
{
	"$TOP/btrfs" inspect-internal dump-super "$1" | \
		grep '^log_root\>' | awk '{print $2}'
}
get_log_root_level() {
	"$TOP/btrfs" inspect-internal dump-super "$1" | \
		grep '^log_root_level' | awk '{print $2}'
}

test_zero_log()
{
	# FIXME: we need an image with existing log_root
	run_check_mkfs_test_dev --rootdir "$INTERNAL_BIN/Documentation"
	run_check "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV"
	run_check "$TOP/btrfs" rescue zero-log "$TEST_DEV"
	log_root=$(get_log_root "$TEST_DEV")
	log_root_level=$(get_log_root "$TEST_DEV")
	if [ "$log_root" != 0 ]; then
		_fail "FAIL: log_root not reset"
	fi
	if [ "$log_root_level" != 0 ]; then
		_fail "FAIL: log_root_level not reset"
	fi
	run_check "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV"
	run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
}

test_zero_log standalone
test_zero_log internal