forked from dosoudil/maven-repository-builder
-
Notifications
You must be signed in to change notification settings - Fork 12
/
tests.sh
executable file
·41 lines (35 loc) · 938 Bytes
/
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
#!/bin/bash
run_tests(){
FAILS=0
TESTS=0
for TESTNAME in $(declare -F | cut -c12- | grep "^test_"); do
echo -n "Running ${TESTNAME}..." && sync
let TESTS++
PREVFAILS=$FAILS
OUT="`$TESTNAME`"
RET=$?
if [ $RET -ne 0 ]; then
echo "FAIL"
echo "======================================================================"
echo "FAIL: $TESTNAME"
echo "----------------------------------------------------------------------"
echo "$OUT"
echo
let FAILS++
else
echo "OK"
fi
done
}
for TESTFILE in tests/*Tests.sh; do
. $TESTFILE
done
STARTTIME=`date +%s%N`
run_tests
ENDTIME=`date +%s%N`
DURSEC=$(( ( $ENDTIME - $STARTTIME ) / 1000000000 ))
DURNAN=$(( ( $ENDTIME - $STARTTIME ) - $DURSEC * 1000000000 ))
echo "----------------------------------------------------------------------"
echo "Ran $TESTS tests in $DURSEC.${DURNAN}s"
echo
[ $FAILS -eq 0 ] && echo "OK" || echo "FAILED (failures=$FAILS)"