Test Runner now supports running specific tests and choosing zsh bin

This commit is contained in:
Eric Freese 2016-03-15 09:03:57 -06:00
parent 87facd9b85
commit a28e72e84a
2 changed files with 35 additions and 10 deletions

View file

@ -56,4 +56,4 @@ clean:
.PHONY: test
test: all $(TEST_PREREQS)
script/test_runner.zsh
script/test_runner.zsh $(TESTS)

View file

@ -15,15 +15,40 @@ header() {
EOF
}
local -a tests
# ZSH binary to use
local zsh_bin="zsh"
# Test suites to run
tests=($TEST_DIR/**/*_test.zsh)
local retval=0
for suite in $tests; do
header "${suite#"$TEST_DIR"}"
zsh -f "$suite" || retval=$?
while getopts ":z:" opt; do
case $opt in
z)
zsh_bin="$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument" >&2
exit 1
;;
esac
done
exit retval
shift $((OPTIND -1))
# Test suites to run
local -a tests
if [ $#@ -gt 0 ]; then
tests=($@)
else
tests=($TEST_DIR/**/*_test.zsh)
fi
local -i retval=0
for suite in $tests; do
header "${suite#"$TEST_DIR"}"
"$zsh_bin" -f "$suite" || retval=$?
done
exit $retval