2009-06-17 17:56:56 +00:00
#!/bin/bash
2009-10-03 23:07:44 +00:00
#LT=development/keystest
LT = ` dirname $0 `
2010-01-02 21:46:11 +00:00
. $LT /shared_variables.sh
2009-06-17 17:56:56 +00:00
2009-07-10 15:52:43 +00:00
GEOM = 320x200
2009-10-03 23:07:44 +00:00
QUALITY = 85
if [ -z " $KEYCODE_DIR " ]
then
2010-01-02 21:46:11 +00:00
KEYCODE_DIR = $ROOT_OUTDIR
2009-06-17 17:56:56 +00:00
fi
2009-10-03 23:07:44 +00:00
#convert -normalize -scale $GEOM -quality $QUALITY $f $GEOM/$f
2009-06-17 17:56:56 +00:00
2009-10-03 23:07:44 +00:00
UNIQUE_LINE = 1
2009-06-17 17:56:56 +00:00
2010-01-02 21:46:11 +00:00
OUT = $LT /$OUT_NAME /html
URL_OF_OUT = http://gmatht.homelinux.net/xp/$OUT_NAME /html/
2009-07-10 15:52:43 +00:00
mkdir -p $OUT
2009-06-17 17:56:56 +00:00
rm $OUT /index*.html
ls $OUT /*.html
2009-07-10 15:52:43 +00:00
CPP_HTML_DIR_REL = cpp_html
2010-01-02 21:46:11 +00:00
CPP_HTML_DIR = $OUT /cpp_html
2009-07-10 15:52:43 +00:00
2010-01-02 21:46:11 +00:00
LYX_VER = ` src/lyx -version 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 ; svn info 2>& 1 | grep Revision`
strings $LT /$OUT_NAME /GDB.* > $LT /$OUT_NAME /GDBs
grep " # $UNIQUE_LINE " $LT /$OUT_NAME /GDBs > $LT /$OUT_NAME /list
cat $LT /$OUT_NAME /list | sed 's/0x[^ )]*[ )]/.*/g' | sort | uniq | tee $LT /$OUT_NAME /listuniq
2009-06-17 17:56:56 +00:00
2009-07-10 15:52:43 +00:00
echo '<html>' >> $OUT /indexreport.html
2009-06-17 17:56:56 +00:00
2010-01-02 21:46:11 +00:00
list_keycode_files ( ) {
2010-01-06 22:11:59 +00:00
#echo for f in $OUT_NAME/*y/last_crash_sec $OUT_NAME/toreplay/replayed/*y/last_crash_sec
for f in $OUT_NAME /*y/last_crash_sec $OUT_NAME /toreplay/replayed/*y/last_crash_sec $OUT_NAME /toreproduce/replayed/*y/last_crash_sec $OUT_NAME /toreplay/*y/last_crash_sec $OUT_NAME /toreplay/final/*y/last_crash_sec
#for f in $OUT_NAME/*y/*y/last_crash_sec $OUT_NAME/toreplay/replayed/*y/*y/last_crash_sec $OUT_NAME/toreplay/*y/*y/last_crash_sec $OUT_NAME/toreplay/final/*y/last_crash_sec
2010-01-02 21:46:11 +00:00
do
keycode_file = $( echo $f | sed s/last_crash_sec/$( cat $f ) .KEYCODEpure/)
2010-01-06 22:11:59 +00:00
if test -e $keycode_file .replay/last_crash_sec
then
f = $keycode_file .replay/last_crash_sec
keycode_file = $( echo $f | sed s/last_crash_sec/$( cat $f ) .KEYCODEpure/)
fi
2010-01-02 21:46:11 +00:00
echo $keycode_file
done
}
2009-07-10 15:52:43 +00:00
tidy_keycode ( ) {
while read -r k
do
if [ " $k " = Raiselyx ]
then
echo -n '\[!Raiselyx]'
elif [ " $k " = Loop ]
then
echo -n '\[!Loop]'
else
2009-10-03 23:07:44 +00:00
echo -n " $k " | sed 's/^KK: //'
2009-07-10 15:52:43 +00:00
fi
done
}
2009-06-17 17:56:56 +00:00
2009-07-10 15:52:43 +00:00
html_keycode( ) {
cat " $f_base .KEYCODEpure " | tidy_keycode
echo -n '<font color=gray>'
cat " $f_base .KEYCODEpure+ " | tidy_keycode
2009-10-03 23:07:44 +00:00
echo -n '</font>'
2009-07-10 15:52:43 +00:00
}
2009-06-17 17:56:56 +00:00
2010-01-02 21:46:11 +00:00
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( ) {
echo " $@ " | sed 's/&/%26/g' | sed 's/"/%22/g' | sed 's/#/%23/g' | sed 's/;/%3B/g'
}
text2url( ) {
#echo "$@" |
while read -r L
do
#echo -n `echo "$L" | line2url`'%0A'
echo -n ` line2url " $L " ` '%0A'
done
}
report_bug_url ( ) {
#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"
else
if echo $DESC | grep SIGABRT > /dev/null
then
KEYWORDSTR = "&keywords=assertion"
elif echo $DESC | grep SIGSEGV > /dev/null
then
KEYWORDSTR = "crash"
fi
fi
echo 'http://www.lyx.org/trac/newticket?summary=' ` line2url " $TITLE " ` " &description= $DESC &version= $LYX_VER $KEYWORDSTR "
#echo 'http://www.lyx.org/trac/newticket?description='"$1"'&summary=foo%13oo&keywords=crash&version=1.6.
}
search_bug_url ( ) {
#http://www.lyx.org/trac/search?q=Foo%20bar
echo 'http://www.lyx.org/trac/search?q=' ` line2url " $TITLE " `
}
2009-07-10 15:52:43 +00:00
gdb2html( ) {
2010-01-02 21:46:11 +00:00
echo g $g '<br/>'
head $g -n 100 | sed 's/&/\&/g' | sed 's/</\</g' | sed 's/ /\  /g' | while read -r l
2009-06-17 17:56:56 +00:00
do
2009-10-03 23:07:44 +00:00
#c=`echo $l | grep -i -o "at [[:alnum:]./]*:[0-9]*"`
#We may want to support slashes later, but we'd have to support browsing
#Qt source for that to be useful for LyX
2009-07-10 15:52:43 +00:00
c = ` echo $l | grep -i -o "at [[:alnum:].]*:[0-9]*" `
if [ -z " $c " ]
then
echo -- " $l " | sed s/--//
else
2009-10-03 23:07:44 +00:00
cpp = ` echo " $c " | sed 's/at //' | sed 's/:.*//g' `
#cpp=`basename $cpp`
echo cpp $cpp
lineno = ` echo " $c " | sed 's/.*://g' `
2009-07-10 15:52:43 +00:00
echo $cpp ,$lineno 1>& 2
2010-01-06 22:11:59 +00:00
if [ -e " $CPP_HTML_DIR / $cpp .html " ]
#if true
2009-07-10 15:52:43 +00:00
then
2009-10-03 23:07:44 +00:00
#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>? "
2009-07-10 15:52:43 +00:00
else
echo " $l "
fi
fi
done | sed 's/^/<br\/>/'
}
2010-01-02 21:46:11 +00:00
get_description( ) {
echo "Keycodes: "
trac_keycode
ii = 1
echo
echo To reproduce:
cat " $f_base .KEYCODEpure " " $f_base .KEYCODEpure+ " | while read -r L
do
echo " $ii ) ... ( $L ) "
ii = $(( ii+1))
done
echo
echo Arch: ` arch`
svn_revision $f_base
echo '{{{'
cat $g
echo '}}}'
echo
echo For more info see the " [[ $URL_OF_OUT / $HTML_NAME Keytest Report]] "
}
make_cpp_html( ) {
#This is ugly. At the moment all bug reports in the same set reference the same files, which could lead to confusion if they are from differnt versions of lyx. Do not mix different versions until this is fixed. However we may not want to "fix" this when it may be better to always use a new outdir for each version and just reproduce the old bugs so they don't get lost.
if ! test -e $ROOT_OUTDIR /html/cpp_html
then
( mkdir -p $ROOT_OUTDIR /html/cpp_html/ &&
cd $ROOT_OUTDIR /html/cpp_html/ &&
2010-01-06 22:11:59 +00:00
for f in ` find ../../../src/ -iname '*.cpp' ; find ../../../src/ -iname '*.h' ` ; do g = ` basename $f ` ; c2html -n < $f > $g .html ; echo $f ; done )
2010-01-02 21:46:11 +00:00
fi
}
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
echo _KEYCODE $KEYCODE ... 1>& 2
}
2009-10-03 23:07:44 +00:00
echo beginning
2010-01-02 21:46:11 +00:00
make_cpp_html
#for file in `find $LT/$OUT_NAME/ -anewer $LT/$OUT_NAME/html | grep replay/last_crash_sec`
2009-10-03 23:07:44 +00:00
#for file in `find $KEYCODE_DIR | grep save/.*KEYCODEpure`
2010-01-02 21:46:11 +00:00
#for file in `find $KEYCODE_DIR -anewer oldfile | grep save/.*KEYCODEpure$ | head -n4`
#for file in `ls $KEYCODE_DIR/*/final/*KEYCODEpure`
#for file in `ls $KEYCODE_DIR/*/final/*/*KEYCODEpure`
list_keycode_files
echo END OF KEYCODE FILES
for file in ` list_keycode_files`
2009-07-10 15:52:43 +00:00
do
2010-01-02 21:46:11 +00:00
echo FILE $file
2009-10-03 23:07:44 +00:00
lcs_file = ` echo $file | sed 's/save\/.*//g' ` last_crash_sec
echo last_crash_sec file: $lcs_file
SEC2 = ` cat $lcs_file `
SEC = ` basename $file | sed s/[ .] .*$//g`
echo SEC .$SEC . .$SEC2 .
#if [ ! $SEC -eq $SEC2 ]
#then
#break
#fi
2009-07-10 15:52:43 +00:00
echo SEC $SEC
2009-10-03 23:07:44 +00:00
#f_base=`echo $file | sed s/last_crash_sec/$SEC/g`
f_base = ` dirname $file ` '/' $SEC
echo f_base $f_base
2009-07-10 15:52:43 +00:00
NUM_KEYCODES = ` wc -l < " $f_base .KEYCODEpure " `
echo NUM_KEYCODES = $NUM_KEYCODES ...
2010-01-06 22:11:59 +00:00
if [ " $NUM_KEYCODES " -lt 20 ]
2009-07-10 15:52:43 +00:00
then
echo f_base $f_base
f = $f_base .GDB
2009-06-17 17:56:56 +00:00
echo $f
g = $f .short
2010-01-06 22:11:59 +00:00
#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 )' -A9999 <$f >$g
2009-07-10 15:52:43 +00:00
if true
2009-06-17 17:56:56 +00:00
then
2009-07-10 15:52:43 +00:00
IN_AT = ` egrep -o '([Ii][Nn]|at) ([:lower:]* )?[:_[:alnum:]]*(::[:_[:alnum:]]*|:[0-9]*)' <$f | grep -v lyx_exit | grep -v [ Aa] ssert | head -n 1 `
2009-06-17 17:56:56 +00:00
SIGNAL = ` grep -o ' signal SIG[[:alnum:]_]*[, ]' <$g | sed s/[ ^[ :upper:] ] //g | head -n 1`
TITLE = " $SIGNAL $IN_AT "
2010-01-06 22:11:59 +00:00
if grep ' ASSERTION .* VIOLATED IN ' $g
then
TITLE = ` grep -o ' ASSERTION .* VIOLATED IN .*$' $g `
fi
2009-06-17 17:56:56 +00:00
TITLE_ = ` echo $TITLE | sed s/[ ^[ :alnum:] ] /_/g`
2009-07-10 15:52:43 +00:00
INDEX = "index.html"
2010-01-02 21:46:11 +00:00
HTML_NAME = $SEC .html # name of html report for this bug
2009-06-17 17:56:56 +00:00
echo TITLE $TITLE
echo INDEX $INDEX
2009-07-10 15:52:43 +00:00
echo NEW $INDEX
2010-01-02 21:46:11 +00:00
echo '<html>' >> $LT /$OUT_NAME /$INDEX
( echo -n " <br/><a href=\" $SEC .html\"> $TITLE </a> "
html_keycode
2010-01-06 22:11:59 +00:00
#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>]"
if ls $f_base .s*.png > /dev/null
then
echo -n " <a href=\" $SEC .screenshot.html\">screenshots</a> "
fi
echo
2010-01-02 21:46:11 +00:00
#echo -n '<br/> '
echo ) >> $OUT /indexreport.html
echo -n '<br> ' >> $LT /$OUT_NAME /$INDEX
echo >> $LT /$OUT_NAME /$INDEX
2009-10-03 23:07:44 +00:00
2009-06-17 17:56:56 +00:00
( echo '<html>'
2010-01-02 21:46:11 +00:00
echo " <title> $TITLE </title> "
2009-07-10 15:52:43 +00:00
html_keycode
2010-01-02 21:46:11 +00:00
echo " <br/><a href= $SEC .KEYCODE>KEYCODES</a> "
echo " <a href= $SEC .KEYCODEpure>pure</a> "
2009-10-03 23:07:44 +00:00
echo " <a href= $SEC .GDB>GDB</a> "
2010-01-02 21:46:11 +00:00
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/> '
2009-10-03 23:07:44 +00:00
#echo "<a href=$SEC.GDB.png><img src=$SEC.small.png/></a><br/><br/>"
2010-01-02 21:46:11 +00:00
#echo "<a href=$SEC.screenshot.html><img src=$SEC.small.png/></a><br/><br/>"
2009-07-10 15:52:43 +00:00
gdb2html
2010-01-02 21:46:11 +00:00
( 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\/>/'
2009-06-17 17:56:56 +00:00
) > $OUT /$SEC .html
echo '<a href="' " $SEC .html " '">' $SEC '</a><br/>' >> $OUT /$INDEX
2009-07-10 15:52:43 +00:00
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
2009-10-03 23:07:44 +00:00
chmod a+r $f $f .png $f_base .KEYCODE* $f_base .html $OUT /indexreport.html
ln $f $f .png $f_base .KEYCODE* $f_base .html $f_base .s*.png $OUT /
if ls $f_base .s*.png
then
$LT /make_screenshot_html.py $OUT $SEC > $OUT /$SEC .screenshot.html
fi
2009-06-17 17:56:56 +00:00
fi
2009-07-10 15:52:43 +00:00
fi
2009-06-17 17:56:56 +00:00
done
2009-07-10 15:52:43 +00:00
mv $OUT /indexreport.html $OUT /indexreport.html.bak
echo "<html>" >> $OUT /indexreport.html
echo "<h1>List of bugs found</h1>" >> $OUT /indexreport.html
2010-01-02 21:46:11 +00:00
echo '<p>Please, do not "report" bugs without searching for them first. Also make sure to fill out the "To reproduce" section before pressing the "Create ticket" button</p>' >> $OUT /indexreport.html
2009-07-10 15:52:43 +00:00
sort -k 2 -t '>' < $OUT /indexreport.html.bak >> $OUT /indexreport.html
2009-10-03 23:07:44 +00:00
firefox $OUT /indexreport.html
2010-01-02 21:46:11 +00:00
#google-chrome $OUT/indexreport.html