aboutsummaryrefslogtreecommitdiff
path: root/plugins/tpm/tests/helpers/tpm.sh
blob: 1594afb9e75b4ab001d3ef5efd2210d3fd88524f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
check_dir_exists_helper() {
	[ -d "$1" ]
}

# runs the scripts and asserts it has the correct output and exit code
script_run_helper() {
	local script="$1"
	local expected_output="$2"
	local expected_exit_code="${3:-0}"
	$script 2>&1 |
		grep "$expected_output" >/dev/null 2>&1 && # grep -q flag quits the script early
		[ "${PIPESTATUS[0]}" -eq "$expected_exit_code" ]
}