diff options
author | Cody Hiar <codyfh@gmail.com> | 2017-02-13 09:54:26 -0700 |
---|---|---|
committer | Cody Hiar <codyfh@gmail.com> | 2017-02-13 09:54:26 -0700 |
commit | 783ab79ab721593b0ac85ab4d8ea9b74fa5fe72e (patch) | |
tree | 03ac1d680ab401874ed95a78887c56d6eb268a61 /plugins/tpm/tests/helpers/tpm.sh | |
parent | 2eede125238144e9d37cf856aaaeda3c5de5aab3 (diff) |
Adding tpm
Diffstat (limited to 'plugins/tpm/tests/helpers/tpm.sh')
-rw-r--r-- | plugins/tpm/tests/helpers/tpm.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/tpm/tests/helpers/tpm.sh b/plugins/tpm/tests/helpers/tpm.sh new file mode 100644 index 0000000..1594afb --- /dev/null +++ b/plugins/tpm/tests/helpers/tpm.sh @@ -0,0 +1,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" ] +} |