archive_image_diff.sh
2.9 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
#!/bin/sh -f
SIM="all"
##################################################
#
# Usage message
#
##################################################
usage()
{
echo "Usage: nightly_image_diff.sh <-s> simulator"
echo " Simulator: c, cv, io, gate, all, default = all"
exit 0
}
##################################################
#
# Compare .rgb, .cov, and .z files
#
# $1 = file prefix
# $2 = compare type
#
##################################################
compare_function()
{
for sufx in rgb cov z
do
f1=OutData/${1}_${2}_0.${sufx}
if [ $2 -eq "gate" ]
then
f2=OutData/${1}_io_0.${sufx}.archive
else
f2=${f1}.archive
fi
df=${1}_${2}_idf.${sufx}
if [ -r $f1 -a -r $f2 ]
then
../../tools/iclr $f1
if cmp -s $f1 $f2
then
echo "INFO: ${sufx} equate."
else
echo "ERROR: ${sufx} differ. Diff generated as $df."
idf -d $f1 $f2 $df
if [ $? -eq 0 ]
then
echo "HINT: Differences probably SOLELY due to dithering."
fi
fi
else
if [ ! -r $f1 ]
then
echo "ERROR: $f1 not present or not readable."
fi
if [ ! -r $f2 ]
then
echo "ERROR: $f2 not present or not readable."
fi
fi
done
}
##################################################
#
# 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.
#
###############################################################################
echo "\n"
echo "#"
echo "# Compare of image files generated from ${SIM}sim to archived files"
echo "# `date`"
echo "#"
for fprefix do
echo "INFO: ============== $fprefix =============="
#
# C compares
#
if [ $SIM = "c" -o $SIM = "all" ]
then
compare_function $fprefix "c"
fi
#
# IO compares
#
if [ $SIM = "io" -o $SIM = "all" ]
then
compare_function $fprefix "io"
fi
#
# GATE compares
#
if [ $SIM = "gate" -o $SIM = "all" ]
then
compare_function $fprefix "gate"
fi
#
# CV compares
#
if [ $SIM = "cv" -o $SIM = "all" ]
then
compare_function $fprefix "cv"
fi
echo "\n"
done