File: test.sh

package info (click to toggle)
btrfs-progs 6.17.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,612 kB
  • sloc: ansic: 127,282; sh: 7,915; python: 1,384; makefile: 900; asm: 296
file content (44 lines) | stat: -rwxr-xr-x 1,168 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
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# test btrfstune options that enable filesystem features

source "$TEST_TOP/common" || exit

check_prereq mkfs.btrfs
check_prereq btrfstune
check_prereq btrfs

setup_root_helper
prepare_test_dev

# test whether fsck can rebuild a corrupted extent tree
# parameters:
# - option for mkfs.btrfs -O, empty for defaults
# - option for btrfstune
# - string representing the feature in dump-super output
test_feature()
{
	local mkfsfeatures
	local tuneopt
	local sbflag

	mkfsfeatures=$1
	tuneopt="$2"
	sbflag="$3"

	run_check_mkfs_test_dev ${mkfsfeatures:+-O ^"$mkfsfeatures"}
	if run_check_stdout "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" | \
			grep -q "$sbflag"; then
		_fail "FAIL: feature $sbflag must not be set on the base image"
	fi
	run_check "$TOP/btrfstune" "$tuneopt" "$TEST_DEV"
	if ! run_check_stdout "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" | \
			grep -q "$sbflag"; then
		_fail "FAIL: feature $sbflag not set"
	fi
	run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
}

test_feature extref -r EXTENDED_IREF
test_feature skinny-metadata -x SKINNY_METADATA
test_feature no-holes -n NO_HOLES
test_feature '' '-S 1' SEEDING