summaryrefslogtreecommitdiff
path: root/tests/common.local
blob: f5e96f5b73ac7d7be04179a0de53ad8e4d82fa18 (plain)
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
#!/bin/bash
#
# additional arguments to various commands

# already defined, eg. via make argument
if [ -z "$TEST_ENABLE_OVERRIDE" ]; then
    # set to 'true'
    TEST_ENABLE_OVERRIDE=false

    TEST_ARGS_CHECK=--mode=lowmem
fi


# gets arguments of a current command and can decide if the argument insertion
# should happen, eg. if some option combination does not make sense or would
# break tests
#
# Return 0 if we need to skip option override
# Return 1 if we don't need to skip option override
_skip_spec()
{
	local beacon

	beacon=.lowmem_repairable

	# For lowmem repair, only support fs tree repair for now
	# So we place lowmem repair beacon in the same dir of the test case
	if echo "$TEST_ARGS_CHECK" | grep -q 'mode=lowmem' &&
	   echo "$@" | grep -q -- '--repair'; then
		dir="$(dirname ${@: -1})"
		if [ -f ${dir}/${beacon} ]; then
			return 1;
		fi
		return 0;
	fi
	return 1
}