nightly_image_diff.sh
6.71 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
#!/bin/sh -f
SIM="all"
##################################################
#
# Usage message
#
##################################################
usage()
{
echo "Usage: nightly_image_diff.sh <-s> simulator"
echo " Simulator: cio, ccv, cvio, all, default = all"
exit 0
}
##################################################
#
# Parse options
#
##################################################
while getopts "s:" a
do
case $a in
s) SIM=$OPTARG;;
\?) usage ;;
esac
done
shift `expr $OPTIND - 1`
###############################################################################
#
# For each incoming arg, generate file names by appending appropriate suffixes,
# use iclr to strip out garbage from the image file header, then use cmp to
# compare the resulting binary data. If a difference is detected, use idf -d
# to generate a viewable difference file, and to determine whether or not the
# differences are == 0x08, which are usually attributable to dithering.
#
###############################################################################
for fprefix do
if [ $SIM = "ccv" -o $SIM = "cio" -o $SIM = "all" ]
then
../../tools/iclr OutData/${fprefix}_cf_0.rgb
../../tools/iclr OutData/${fprefix}_c_0.cov
../../tools/iclr OutData/${fprefix}_c_0.z
fi
if [ $SIM = "ccv" -o $SIM = "cvio" -o $SIM = "all" ]
then
../../tools/iclr OutData/${fprefix}_cvf_0.rgb
../../tools/iclr OutData/${fprefix}_cv_0.cov
../../tools/iclr OutData/${fprefix}_cv_0.z
fi
if [ $SIM = "cvio" -o $SIM = "cio" -o $SIM = "all" ]
then
../../tools/iclr OutData/${fprefix}_iof_0.rgb
../../tools/iclr OutData/${fprefix}_io_0.cov
../../tools/iclr OutData/${fprefix}_io_0.z
fi
#
# C/CV compares
#
if [ $SIM = "ccv" -o $SIM = "all" ]
then
#
# Compare RGB pixel values, rdp_c vs rdp_cv.
#
if cmp -s OutData/${fprefix}_cf_0.rgb OutData/${fprefix}_cvf_0.rgb
then
echo "INFO: Image files ${fprefix}_cf_0.rgb and ${fprefix}_cvf_0.rgb equate."
else
echo "ERROR: Image files ${fprefix}_cf_0.rgb and ${fprefix}_cvf_0.rgb differ."
echo " difference file generated as ${fprefix}_idf_c_cv.rgb"
idf -d OutData/${fprefix}_cf_0.rgb OutData/${fprefix}_cvf_0.rgb OutData/${fprefix}_idf_c_cv.rgb
if test $? -eq 0
then
echo " differences probably SOLELY due to dithering."
fi
fi
#
# Compare z buffer values, rdp_c vs rdp_cv.
#
if cmp -s OutData/${fprefix}_c_0.z OutData/${fprefix}_cv_0.z
then
echo "INFO: Image files ${fprefix}_c_0.z and ${fprefix}_cv_0.z equate."
else
echo "ERROR: Image files ${fprefix}_c_0.z and ${fprefix}_cv_0.z differ."
fi
#
# Compare filter program's coverage values, rdp_c vs rdp_cv.
#
if cmp -s OutData/${fprefix}_c_0.cov OutData/${fprefix}_cv_0.cov
then
echo "INFO: Image files ${fprefix}_c_0.cov and ${fprefix}_cv_0.cov equate."
else
echo "ERROR: Image files ${fprefix}_c_0.cov and ${fprefix}_cv_0.cov differ."
fi
# Don't do this until raw coverage files compare (need to clear the header).
####
#### Compare raw coverage values, rdp_c vs rdp_cv.
####
###
### if cmp -s OutData/${fprefix}_c_0.cvg OutData/${fprefix}_cv_0.cvg
### then
### echo "INFO: Coverage files ${fprefix}_c_0.cvg and ${fprefix}_cv_0.cvg equate."
### else
### echo "ERROR: Coverage files ${fprefix}_c_0.cvg and ${fprefix}_cv_0.cvg differ."
### fi
###
####
fi
#
# C/IO compares
#
if [ $SIM = "cio" -o $SIM = "all" ]
then
#
# Compare RGB pixel values, rdp_c vs iosim.
#
if cmp -s OutData/${fprefix}_cf_0.rgb OutData/${fprefix}_iof_0.rgb
then
echo "INFO: Image files ${fprefix}_cf_0.rgb and ${fprefix}_iof_0.rgb equate."
else
echo "ERROR: Image files ${fprefix}_cf_0.rgb and ${fprefix}_iof_0.rgb differ."
echo " difference file generated as ${fprefix}_idf_c_io.rgb"
idf -d OutData/${fprefix}_cf_0.rgb OutData/${fprefix}_iof_0.rgb OutData/${fprefix}_idf_c_io.rgb
if test $? -eq 0
then
echo " differences probably SOLELY due to dithering."
fi
fi
#
# Compare z buffer values, rdp_c vs iosim.
#
if cmp -s OutData/${fprefix}_c_0.z OutData/${fprefix}_io_0.z
then
echo "INFO: Image files ${fprefix}_c_0.z and ${fprefix}_io_0.z equate."
else
echo "ERROR: Image files ${fprefix}_c_0.z and ${fprefix}_io_0.z differ."
fi
#
# Compare filter program's coverage values, rdp_c vs iosim.
#
if cmp -s OutData/${fprefix}_c_0.cov OutData/${fprefix}_io_0.cov
then
echo "INFO: Image files ${fprefix}_c_0.cov and ${fprefix}_io_0.cov equate."
else
echo "ERROR: Image files ${fprefix}_c_0.cov and ${fprefix}_io_0.cov differ."
fi
#### Compare raw coverage values, rdp_c vs iosim.
####
###
### if cmp -s OutData/${fprefix}_c_0.cvg OutData/${fprefix}_io_0.cvg
### then
### echo "INFO: Coverage files ${fprefix}_c_0.cvg and ${fprefix}_io_0.cvg equate."
### else
### echo "ERROR: Coverage files ${fprefix}_c_0.cvg and ${fprefix}_io_0.cvg differ."
### fi
###
###
####
fi
#
# CV/IO compares
#
if [ $SIM = "cvio" -o $SIM = "all" ]
then
#
# Compare RGB pixel values, rdp_cv vs iosim.
#
if cmp -s OutData/${fprefix}_cvf_0.rgb OutData/${fprefix}_iof_0.rgb
then
echo "INFO: Image files ${fprefix}_cvf_0.rgb and ${fprefix}_iof_0.rgb equate."
else
echo "ERROR: Image files ${fprefix}_cvf_0.rgb and ${fprefix}_iof_0.rgb differ."
echo " difference file generated as ${fprefix}_idf_cv_io.rgb"
idf -d OutData/${fprefix}_cvf_0.rgb OutData/${fprefix}_iof_0.rgb OutData/${fprefix}_idf_cv_io.rgb
if test $? -eq 0
then
echo " differences probably SOLELY due to dithering."
fi
fi
#
# Compare z buffer values, rdp_cv vs iosim.
#
if cmp -s OutData/${fprefix}_cv_0.z OutData/${fprefix}_io_0.z
then
echo "INFO: Image files ${fprefix}_cv_0.z and ${fprefix}_io_0.z equate."
else
echo "ERROR: Image files ${fprefix}_cv_0.z and ${fprefix}_io_0.z differ."
fi
#
# Compare filter program's coverage values, rdp_cv vs iosim.
#
if cmp -s OutData/${fprefix}_cv_0.cov OutData/${fprefix}_io_0.cov
then
echo "INFO: Image files ${fprefix}_cv_0.cov and ${fprefix}_io_0.cov equate."
else
echo "ERROR: Image files ${fprefix}_cv_0.cov and ${fprefix}_io_0.cov differ."
fi
#### Compare raw coverage values, rdp_cv vs iosim.
####
###
### if cmp -s OutData/${fprefix}_cv_0.cvg OutData/${fprefix}_io_0.cvg
### then
### echo "INFO: Coverage files ${fprefix}_cv_0.cvg and ${fprefix}_io_0.cvg equate."
### else
### echo "ERROR: Coverage files ${fprefix}_cv_0.cvg and ${fprefix}_io_0.cvg differ."
### fi
fi
#
# Print a space between each prefix for readability.
#
echo ""
done