summaryrefslogtreecommitdiff
path: root/test/test
blob: c018c325ba2f257c99a9e8e78c5b88a12c440ebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
set -e

BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${BASEDIR}"
. "./driver-lib.bash"

start="$(date +%s)"

check_prereqs || die "prerequisites unsatsfied."

# command line options
while [[ $# > 1 ]]
do
    key="${1}"
    case $key in
        -v|--version)
            VERSION="${2}"
            shift && shift
            ;;
        *)
            # unknown option
            break
            ;;
    esac
done
VERSION="${VERSION:-3.6.4}"

declare -a tests=()

if [ $# -eq 0 ]; then
    while read file; do
        tests+=("${file}")
    done < <(find tests -type f -name '*.bash')
else
    tests=("$@")
fi

initialize "${#tests[@]}" "${VERSION}"

for file in "${tests[@]}"; do
    run_test "$(basename "${file}")" "${VERSION}"
done

if report; then
    ret=0
else
    ret=1
fi

echo "(tests run in $(($(date +%s) - start)) seconds)"
exit ${ret}