2015-05-05 19:58:25 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2020-01-03 15:20:00 -05:00
|
|
|
export BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
cd "${BASEDIR}/test"
|
2015-05-05 19:58:25 -04:00
|
|
|
. "./driver-lib.bash"
|
|
|
|
|
2020-01-03 15:20:00 -05:00
|
|
|
date_stamp="$(date --rfc-3339=ns)"
|
2015-05-05 19:58:25 -04:00
|
|
|
start="$(date +%s)"
|
|
|
|
|
2020-01-03 15:20:00 -05:00
|
|
|
check_env
|
2015-10-22 21:46:28 -04:00
|
|
|
|
2021-02-25 08:14:34 -05:00
|
|
|
# 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
|
|
|
|
|
2015-05-05 19:58:25 -04:00
|
|
|
declare -a tests=()
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
while read file; do
|
|
|
|
tests+=("${file}")
|
2020-01-03 15:20:00 -05:00
|
|
|
done < <(find tests -type f -name '*.bash' | sort)
|
2015-05-05 19:58:25 -04:00
|
|
|
else
|
|
|
|
tests=("$@")
|
|
|
|
fi
|
|
|
|
|
2021-02-25 08:14:34 -05:00
|
|
|
initialize "${#tests[@]}"
|
2015-05-05 19:58:25 -04:00
|
|
|
|
|
|
|
for file in "${tests[@]}"; do
|
2021-02-25 08:14:34 -05:00
|
|
|
run_test "$(basename "${file}")" "${DEBUG}"
|
2015-05-05 19:58:25 -04:00
|
|
|
done
|
|
|
|
|
|
|
|
if report; then
|
|
|
|
ret=0
|
|
|
|
else
|
|
|
|
ret=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "(tests run in $(($(date +%s) - start)) seconds)"
|
|
|
|
exit ${ret}
|