forked from OpenTabletDriver/opentabletdriver.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tests.sh
executable file
·46 lines (34 loc) · 833 Bytes
/
run-tests.sh
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
#!/bin/bash
TESTSDIR="tests"
cd "$(dirname "${BASH_SOURCE[0]}")"
declare -A testParams # [testName]=>"testArgs"
testParams["check-site-paths"]="${PWD}/site ${PWD}/site/_site"
for testName in "$TESTSDIR"/*; do
name="$(basename "$testName")"
testExecutable="$testName"/"$name".sh
if [ ! -f $testExecutable ]; then
echo $testExecutable
echo "Invalid test '$testName', passing..."
continue
fi
if [ ! -z "${testParams[$name]}" ]; then
ARGS="${testParams[$name]}"
else
ARGS=""
fi
unset ERROR
echo "Running $testName:"
$testExecutable $ARGS || ERROR=$?
if [ ! -z "$ERROR" ]; then
echo "$testName FAIL, return value: $ERROR"
else
echo "$testName PASS"
fi
done
if [ -z "$ERROR" ]; then
echo "All tests passed!"
exit 0
else
echo "At least 1 test didn't pass"
exit 1
fi