forked from MapServer/MapServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint-test-results.sh
executable file
·66 lines (59 loc) · 1.65 KB
/
print-test-results.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
ret=0
tests=( query misc gdal wxs renderers sld )
command_exists () {
type "$1" &> /dev/null ;
}
DIFF=diff
COMPARE=
if command_exists colordiff ; then
DIFF="colordiff"
fi
if command_exists compare ; then
COMPARE="compare"
fi
#leftover .aux.xml files are valid for some gdal tests
rm -f msautotest/*/result/*.aux.xml
for testcase in "${tests[@]}"; do
cd msautotest/$testcase
if [ ! -d result ]; then
#"result" directory does not exist, all tests passed
cd ../..
continue
fi
cd result
failedtests=`find . -type f -printf "%f\n" `
if [ -z "$failedtests" ]; then
cd ../../..
continue
fi
#we have some failing tests
ret=1
for failedtest in $failedtests; do
echo ""
echo "######################################"
echo "# $testcase => $failedtest"
echo "######################################"
if echo "$failedtest" | egrep -q "asan.txt"; then
cat "$failedtest"
#for txt, gml and xml files, print a diff
elif echo "$failedtest" | egrep -q "(txt|xml|gml|html|json)$"; then
$DIFF -u "../expected/$failedtest" "$failedtest"
elif echo "$failedtest" | egrep -q "(png|gif|tif)$"; then
if echo "$failedtest" | egrep -v -q "\\.diff\\.png$"; then
if [ -n "$COMPARE" ]; then
$COMPARE ../expected/$failedtest $failedtest -compose Src $failedtest.diff.png
fi
fi
fi
done
cd ../../..
done
if test "$ret" -eq "0"; then
echo ""
echo "######################################"
echo "# All tests passed #"
echo "######################################"
echo ""
fi
exit $ret