blob: eac8b0cf34d524e6e48ddddbb638de775437b4e3 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#!/bin/sh
# run test images through libnsbmp and count results
TEST_PATH=$1
TEST_OUT=${TEST_PATH}/ppm
TEST_LOG=${TEST_PATH}/test.log
mkdir -p ${TEST_OUT}
echo "Bitmap tests" > ${TEST_LOG}
# bitmap test directories
# standard bitmap suite
BMPTESTS="test/bmpsuite/*.bmp"
# netsurf test bitmaps
BMPTESTS="${BMPTESTS} test/bmp/*.bmp"
# afl bitmap suite
BMPTESTS="${BMPTESTS} test/afl-bmp/*.bmp"
# icon test directories
ICOTESTS="test/icons/*.ico"
# afl ico demo suite
ICOTESTS="${ICOTESTS} test/afl-ico/*.ico"
# netsurf afl generated icon corpus
ICOTESTS="${ICOTESTS} test/ns-afl-ico/*.ico"
bmpdecode()
{
OUTF=$(basename ${1} .bmp)
echo "Bitmap:${1}" >> ${TEST_LOG}
${TEST_PATH}/test_decode_bmp ${1} ${TEST_OUT}/${OUTF}.ppm 2>> ${TEST_LOG}
ECODE=$?
echo "Exit code:${ECODE}" >> ${TEST_LOG}
return ${ECODE}
}
icodecode()
{
OUTF=$(basename ${1} .ico)
CMPF=$(dirname ${1})/${OUTF}.ppm
echo "Icon:${1}" >> ${TEST_LOG}
${TEST_PATH}/test_decode_ico ${1} 255 255 ${TEST_OUT}/${OUTF}.ppm 2>> ${TEST_LOG}
if [ -f "${CMPF}" ]; then
cmp ${CMPF} ${TEST_OUT}/${OUTF}.ppm >> ${TEST_LOG} 2>> ${TEST_LOG}
if [ "$?" -ne 0 ]; then
return 128
fi
fi
}
# bitmap tests
BMPTESTTOTC=0
BMPTESTPASSC=0
BMPTESTERRC=0
for BMP in $(ls ${BMPTESTS});do
BMPTESTTOTC=$((BMPTESTTOTC+1))
bmpdecode ${BMP}
ECODE=$?
if [ "${ECODE}" -gt 127 ];then
BMPTESTERRC=$((BMPTESTERRC+1))
else
BMPTESTPASSC=$((BMPTESTPASSC+1))
fi
done
echo "Test bitmap decode"
echo "Tests:${BMPTESTTOTC} Pass:${BMPTESTPASSC} Error:${BMPTESTERRC}"
# icon tests
ICOTESTTOTC=0
ICOTESTPASSC=0
ICOTESTERRC=0
# netsurf test icons
for ICO in $(ls ${ICOTESTS});do
ICOTESTTOTC=$((ICOTESTTOTC+1))
icodecode ${ICO}
ECODE=$?
if [ "${ECODE}" -gt 127 ];then
ICOTESTERRC=$((ICOTESTERRC+1))
else
ICOTESTPASSC=$((ICOTESTPASSC+1))
fi
done
echo "Test icon decode"
echo "Tests:${ICOTESTTOTC} Pass:${ICOTESTPASSC} Error:${ICOTESTERRC}"
# exit code
if [ "${BMPTESTERRC}" -gt 0 -o "${ICOTESTERRC}" -gt 0 ]; then
exit 1
fi
exit 0
|