dac7a9bc88
This is easier than the old method of adding `DEBUG=true` to the top of test files.
53 lines
945 B
Bash
Executable file
53 lines
945 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
export BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "${BASEDIR}/test"
|
|
. "./driver-lib.bash"
|
|
|
|
date_stamp="$(date --rfc-3339=ns)"
|
|
start="$(date +%s)"
|
|
|
|
check_env
|
|
|
|
# parse flags; must come before positional arguments
|
|
POSITIONAL=()
|
|
DEBUG=false
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
-d|--debug)
|
|
DEBUG=true
|
|
shift
|
|
;;
|
|
*)
|
|
POSITIONAL+=("$1")
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
set -- "${POSITIONAL[@]}" # restore positional arguments
|
|
|
|
declare -a tests=()
|
|
|
|
if [ $# -eq 0 ]; then
|
|
while read file; do
|
|
tests+=("${file}")
|
|
done < <(find tests -type f -name '*.bash' | sort)
|
|
else
|
|
tests=("$@")
|
|
fi
|
|
|
|
initialize "${#tests[@]}"
|
|
|
|
for file in "${tests[@]}"; do
|
|
run_test "$(basename "${file}")" "${DEBUG}"
|
|
done
|
|
|
|
if report; then
|
|
ret=0
|
|
else
|
|
ret=1
|
|
fi
|
|
|
|
echo "(tests run in $(($(date +%s) - start)) seconds)"
|
|
exit ${ret}
|