-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.sh
executable file
·43 lines (37 loc) · 1.24 KB
/
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
#!/bin/sh
export LD_LIBRARY_PATH=/usr/lib:./lib/
cp=$(echo "$1" | sed 's@ @:@g')
from="$2"
failures=""
passed=""
tests=""
function runTest() {
echo "Running test $i"
testClass=$(echo "$1" | sed 's@/@.@g' | sed '[email protected]$@@g')
echo java -cp "$cp":dist/jOMiSCID.jar "${testClass}"
rm ,,output-"${testClass}"
out=$(java -cp "$cp":dist/jOMiSCID.jar "${testClass}" 2>&1 | tee ,,output-"${testClass}")
echo "$out" | grep 'Test Failed' > /dev/null
if test $? -eq 0
then
failures=$(echo "${failures}" ; echo "$1")
echo "FAILED"
fi
echo "$out" | grep 'Test Passed' > /dev/null
if test $? -eq 0
then
passed=$(echo "${passed}" ; echo "$1")
echo "Passed"
fi
tests=$(echo "${tests}" ; echo "$1")
}
for i in $(find test -name \*.java | sed 's@^test/@@g' | sort | sed -n ${from},'$'p)
do
(grep '/\*- IGNORE -\*/' "test/$i" >/dev/null && echo "Skipping $i") || runTest "$i"
done
failuresCount=$(printf "%s" "$failures" | wc -l)
passedCount=$(printf "%s" "$passed" | wc -l)
testsCount=$(printf "%s" "$tests" | wc -l)
echo "Passed: ${passedCount}/${testsCount}"
echo "Failures: ${failuresCount}/${testsCount}"
printf "%s\\n" "$failures" | egrep -v -e '^$' | sed 's@^@ @g'