-
Notifications
You must be signed in to change notification settings - Fork 0
/
report_html.sh.format
executable file
·301 lines (268 loc) · 8.96 KB
/
report_html.sh.format
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
#!/bin/bash
# This contains all the information relating to the format of the html bug reports.
# It has been split from report_html.sh so that when report_html.sh is updated,
# we know that we do not need to update the html bug reports, unless this file has
# also been modified
GEOM=320x200
QUALITY=85
OUT_SUFFIX=html_out/$OUT_NAME/html
OUT=$LT/$OUT_SUFFIX
KEYTEST_HTML_HOST=gmatht.homelinux.net
KEYTEST_HTML_DIR=xp/keytest
#URL_OF_OUT=http://gmatht.homelinux.net/xp/keytest/$OUT_SUFFIX/
URL_OF_OUT=http://$KEYTEST_HTML_HOST/$KEYTEST_HTML_DIR/$OUT_SUFFIX/
CPP_HTML_DIR_REL=cpp_html
CPP_HTML_DIR=$OUT/cpp_html
LYX_VER=`$GET_VERSION_COMMAND 2>&1 | head -n1 | sed s/^LyX\ // | sed s/\ .*// | sed s/1svn/0/ | sed s/2svn/1/ | sed s/3svn/2/ | sed s/4svn/3/ | sed s/5svn/4/ | sed s/6svn/5/ | sed s/7svn/6/ | sed s/8svn/7/ | sed s/9svn/8/`
BOILER_PLATE=`(cd $SRC_DIR ; svn info 2>&1 | grep Revision || git --no-pager log --max-count=1 | head -n1 | sed s/.*\ //g) || echo NO_SRC dir?`
tidy_keycode () {
#sed 's/\\/\\\\/g' |
while read -r k
do
if [ "$k" = Raiselyx ]
then
echo -n '\[!Raiselyx]'
elif [ "$k" = Loop ]
then
echo -n '\[!Loop]'
else
printf '%s' "$k" | sed 's/^KK: //' | sed 's/^KO: //'
fi
done
}
html_keycode() {
cat "$f_base.KEYCODEpure" | tidy_keycode
echo -n '<font color=gray>'
cat "$f_base.KEYCODEpure+" | tidy_keycode
echo -n '</font>'
}
trac_keycode() {
echo -n "'''"
cat "$f_base.KEYCODEpure" | tidy_keycode
echo -n "'''"
#echo -n '""'
#echo -n '<font color=gray>'
cat "$f_base.KEYCODEpure+" | tidy_keycode
#echo -n '</font>'
}
line2url() {
printf '%s' "$*" | sed 's/&/%26/g
s/"/%22/g
s/#/%23/g
s/;/%3B/g
s/</%3C/g
s/>/%3E/g'
#printf '%s' "$*" | sed 's/&/%26/g' | sed 's/"/%22/g' | sed 's/#/%23/g' | sed 's/;/%3B/g' | sed 's/</</g' | sed 's/>/>/g' #| sed 's/\\//g'
}
#s/</</g
#s/>/>/g'
text2url() {
#echo "$@" |
###sed 's/\\/\\\\/g' | sed 's/%/\\%/g' |
while read -r L
do
###echo -n FFF `echo "$L" | line2url`'%0A' 1>&2
###printf '%s' `line2url "$L"`'%0A'
###printf '%s' "L2U"`line2url "$L"`'%0A' 1>&2
line2url "$L"
echo -n "%0A"
done
}
report_bug_url () {
#Examples of URLs used to report a bug
#https://bugzilla.gnome.org/enter_bug.cgi?product=Gnumeric&version=GIT&comment=Description&short_desc=summary
#http://www.lyx.org/trac/newticket?description=bar%0Abar2&summary=foo%13oo&keywords=crash&version=1.6.5
#http://www.lyx.org/trac/newticket?summary=foo%13oo&description=bar%0Abar2&version=1.6.5&keywords=crash
#ver=`echo $3 | sed s/1svn/0/ | sed s/2svn/1/ | sed s/3svn/2/ | sed s/4svn/3/ | sed s/5svn/4/ | sed s/6svn/5/ | sed s/7svn/6/ | sed s/8svn/7/ | sed s/9svn/8/`
#echo 'http://www.lyx.org/trac/newticket?summary='`line2url "$1"`'&description='`text2url "$2"`'&version='"$LYX_VER"'&keywords=crash'
DESC=`get_description | text2url`
#DESC=`text2url "$DESC"`
if echo $DESC | grep SIGSEGV > /dev/null
then
KEYWORDSTR="&keywords=crash%20keytest"
else
if echo $DESC | grep SIGABRT > /dev/null
then
KEYWORDSTR="&keywords=assertion%20keytest"
elif echo $DESC | grep SIGSEGV > /dev/null
then
KEYWORDSTR="crash"
fi
fi
#printf '%s' 'http://www.lyx.org/trac/newticket?summary='`line2url "$TITLE"`"&description=$DESC&version=$LYX_VER$KEYWORDSTR"
printf "$BUG_REPORT_ENGINE" "$(line2url $TITLE)" "$DESC" "$LYX_VER$KEYWORDSTR"
}
search_bug_url () {
#http://www.lyx.org/trac/search?q=Foo%20bar
echo "$BUG_SEARCH_ENGINE"`line2url "$TITLE" | sed 's/:[0-9][0-9]*//g' `
}
gdb2html() {
echo g $g'<br/>'
#cat $g
(head $g -n 100 | sed 's/&/\&/g' | sed 's/</\</g' | sed 's/ /\  /g'; echo --------; $GET_VERSION_COMMAND 2>&1) | while read -r l
do
#We may want to support slashes later, but we'd have to support browsing
#Qt source for that to be useful for LyX
c=`echo "$l" | grep -i -o "at [[:alnum:].]*:[0-9]*"` || true
if [ -z "$c" ]
then
echo -- "$l" | sed s/--//
else
cpp=`echo "$c" | sed 's/at //' | sed 's/:.*//g'`
#cpp=`basename $cpp`
echo cpp $cpp
lineno=`echo "$c" | sed 's/.*://g'`
echo $cpp,$lineno 1>&2
if [ -e "$CPP_HTML_DIR/$cpp.html" ]
#if true
then
#echo "$l" | sed "s/$c/<a href=$CPP_HTML_DIR_REL\/$cpp.html\#line$lineno>$c<\/a>/"
echo "$l" | sed "s?$c?<a href=$CPP_HTML_DIR_REL\/$cpp.html\#line$lineno>$c<\/a>?"
else
echo "$l"
fi
fi
done | sed 's/^/<br\/>/'
}
get_description() {
( echo "Keycodes: "
trac_keycode
ii=1
echo
echo To reproduce:
cat "$f_base.KEYCODEpure" "$f_base.KEYCODEpure+" | while read -r L
do
printf '%s' "$ii) ... ($L)
"
ii=$((ii+1))
done
#if ls $f_base.s*.png > /dev/null
#then
# echo
# echo "Alternatively, see the [[$URL_OF_OUT/$SEC.screenshot.html Screenshots]]"
#fi
if [ -e out/cache-bisect/store/$SEC.KEYCODEpure ]
then
echo
echo -n 'Regression in: '
grep "Relevant Versions" out/cache-bisect/store/$SEC.KEYCODEpure | grep -o ". '[0-9]*'" | sed 's/[^0-9]//g' | while read r
do
echo -n r"$r "
done
fi
echo
echo Arch: `arch`
svn_revision $f_base
echo
echo '{{{'
cat $g | head -n 22 # If we do not limit length we may get "too long url" errors.
echo '}}}'
echo
echo For more info see the "[[$URL_OF_OUT/$HTML_NAME Keytest Report]]" ) | tee $OUT/$SEC.txt
}
svn_revision() {
#| grep ^Revision | sed s/'Revision: '/r/
echo KEYCODE $1 ... `dirname $1` 1>&2
#cat `dirname $1`/last_crash_sec.info.svn | grep ^Revision
cat $f_base.info.svn | grep ^Revision
echo _KEYCODE $KEYCODE ... 1>&2
}
make_one_bug_page () {
( echo '<html>'
echo "<title>$TITLE</title>"
html_keycode
echo "<br/><a href=$SEC.KEYCODE>KEYCODES</a> "
echo " <a href=$SEC.KEYCODEpure>pure</a> "
echo "<a href=$SEC.GDB>GDB</a>"
if ls $f_base.s*.png > /dev/null
then
echo "<a href=\"$SEC.screenshot.html\">screenshots</a>"
else
echo '(no screenshots)'
fi
echo "<br/>"
#echo -n '<br/> '
#echo "<a href=$SEC.GDB.png><img src=$SEC.small.png/></a><br/><br/>"
#echo "<a href=$SEC.screenshot.html><img src=$SEC.small.png/></a><br/><br/>"
gdb2html
) > $OUT/$SEC.html
( echo ----
svn_revision $f_base
echo arch `arch`
dpkg -l | egrep '(libqt4-dbg|libc6 |libboost-dev )'
lsb_release -a) | sed 's/&/\&/g' | sed 's/</\</g' | sed 's/ /\  /g' | sed 's/^/<br\/>/' >> $OUT/$SEC.html
}
make_one_bug () {
echo f_base $f_base
f=$f_base.GDB
echo $f
g=$f.short
#egrep '([Ii][Nn] .*[:[:alnum:]][:][0-9]*[^0-9]|#0 | signal SIG[^T]| ASSERTION .* VIOLATED IN )' -A9999 <$f >$g
(egrep '([Ii][Nn] .*[:[:alnum:]][:][0-9]*[^0-9]|#0 | signal SIG[^T]| ASSERTION .* VIOLATED IN |:error:)' -A9999 | grep -v '^(gdb) (gdb)' | grep -v 'will be killed' | sed 's/^[(]gdb[)] //' | grep -v '^Quit anyway') <$f >$g
if [ ! -e $g ]
then
echo CRITICAL $g does not exist. Perhaps we do not have rights to write to it?
exit 1
fi
if true
then
IN_AT=`egrep -o '([Ii][Nn]|at) ([[:lower:]]* )?[:_[:alnum:]]*(::[:_[:alnum:]]*|:[0-9]*)' <$f | grep -v lyx_exit | grep -v [Aa]ssert | head -n 1 `
if [ -z "$IN_AT" ]
then
IN_AT=`egrep -o '(In|IN|in|at) [[:alnum:]].*' <$f | head -n1`
fi
SIGNAL=`grep -o ' signal SIG[[:alnum:]_]*[, ]' <$g | sed s/[^[:upper:]]//g | head -n 1`
TITLE="$SIGNAL $IN_AT"
if grep ' ASSERTION .* VIOLATED IN ' $g
then
TITLE=`grep -o ' ASSERTION .* VIOLATED IN .*$' $g`
elif grep :error: $g
then
#TITLE="error `grep :error: $g | head -n1`"
TITLE="error at `grep -o lyx::[:[:alnum:]]* $g | head -n1`"
fi
TITLE_=`echo $TITLE|sed s/[^[:alnum:]]/_/g`
INDEX="index.html"
HTML_NAME=$SEC.html # name of html report for this bug
echo TITLE $TITLE
###echo INDEX $INDEX
echo NEW $INDEX
###echo '<html>' >> $LT/$OUT_NAME/$INDEX
(echo -n "<br/><a href=\"$SEC.html\">$TITLE</a> "
html_keycode
#echo -n " [<a href=\"`search_bug_url`\">search</a>] [<a href=\"`report_bug_url`\">report</a>] <a href=\"$SEC.screenshot.html\">screenshots</a>"
echo -n " [<a href=\"`search_bug_url`\">search</a>] [<a href=\"`report_bug_url`\">report</a>] [<a href=\"$SEC.txt\">txt</a>]"
if ls $f_base.s*.png > /dev/null
then
echo -n " <a href=\"$SEC.screenshot.html\">screenshots</a>"
fi
if [ -e out/cache-bisect/store/$SEC.KEYCODEpure ]
then
echo ' [Regression in:'
grep "Relevant Versions" out/cache-bisect/store/$SEC.KEYCODEpure | grep -o ". '[0-9]*'" | sed 's/[^0-9]//g' | while read r
do
echo "<a href=\"http://www.lyx.org/trac/changeset/$r\">$r</a> "
done | sed 's/ $//g'
echo ']'
fi
echo
#echo -n '<br/> '
#echo ) >> $OUT/indexreport.html
echo ) > $INDEX_FILE
###echo -n '<br> '>> $LT/$OUT_NAME/$INDEX
###echo >> $LT/$OUT_NAME/$INDEX
make_one_bug_page
###echo '<a href="'"$SEC.html"'">'$SEC'</a><br/>' >> $OUT/$INDEX
echo '<a href="'"$SEC.html"'">'$SEC'</a><br/>'
#if [ ! -e $OUT/$SEC.small.png ]
#then
# convert -normalize -scale $GEOM $f.png $OUT/$SEC.small.png -quality 85
#fi
chmod a+r $f $f.png $f_base.KEYCODE* $f_base.html $OUT/indexreport.html || true
ln $f $f.png $f_base.KEYCODE* $f_base.html $f_base.s*.png $OUT/ || true
if ls $f_base.s*.png
then
$LT/make_screenshot_html.py $OUT $SEC > $OUT/$SEC.screenshot.html
fi
fi
}