lyx_mirror/development/keystest/report_html.sh
Pavel Sanda 3f3d37ca09 Next patch from John McCabe-Dansted.
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg152211.html

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30148 a592a061-630c-0410-9148-cb99ea01b6c8
2009-06-17 17:56:56 +00:00

79 lines
2.2 KiB
Bash

#!/bin/bash
LT=development/keystest
# echo 'grep "#1 " $LT/out/GDB | sed 's/0x[^ )]*[ )]/.*/g' | sort | uniq' >> report.sh
UNIQUE_LINE=1
SRC=
if [ -e out/log ]
then
LT=.
fi
while [ ! -e $LT/out/log ]
do
cd ..
if [ `pwd` = '/' ]
then
exit
fi
done
OUT=$LT/out
rm $OUT/index*.html
#rm $OUT/indexreport.html
ls $OUT/*.html
strings $LT/out/GDB.* > $LT/out/GDBs
grep "#$UNIQUE_LINE " $LT/out/GDBs > $LT/out/list
#cat $LT/out/list | grep -o ' in [[:alnum:]:]* ' | sort | uniq| tee $LT/out/listuniq
#cat $LT/out/list | grep -o ' in [[:alnum:]:]* ' | sort | uniq| tee $LT/out/listuniq
cat $LT/out/list | sed 's/0x[^ )]*[ )]/.*/g' | sort | uniq | tee $LT/out/listuniq
NUM_REPORTS=`wc -l < $LT/out/list`
echo NUM_REPORTS $NUM_REPORTS
echo > $LT/out/overview
echo '<html>' >> $OUT/indexreport.html
#cat $LT/out/listuniq | while read l
for f in $LT/out/*GDB
do
echo $f
g=$f.short
if egrep '([Ii][Nn] .*[:[:alnum:]][:][0-9]*[^0-9]|#0 | signal SIG)' -A9999 <$f >$g
then
#egrep '(([Ii][Nn]|at) .*[:[:alnum:]][:][0-9]*[^0-9]|#0 | signal SIG)' -A9999 <$f
SEC=`echo $f | sed s/[^[:digit:]]//g`
#IN_AT=`egrep -o '([Ii][Nn]|at) ([:lower:]* )[:_[:alnum:]]*(::[:_[:alnum:]]*|:[0-9]*)' <$f | head -n 1 `
IN_AT=`egrep -o '([Ii][Nn]|at) ([:lower:]* )?[:_[:alnum:]]*(::[:_[:alnum:]]*|:[0-9]*)' <$f | head -n 1 `
SIGNAL=`grep -o ' signal SIG[[:alnum:]_]*[, ]' <$g | sed s/[^[:upper:]]//g | head -n 1`
TITLE="$SIGNAL $IN_AT"
TITLE_=`echo $TITLE|sed s/[^[:alnum:]]/_/g`
INDEX="index_$TITLE_.html"
echo TITLE $TITLE
echo INDEX $INDEX
if [ ! -e $LT/out/$INDEX ]
then
echo NEW $INDEX
echo '<html>' >> $LT/out/$INDEX
echo -n '<a href="'"$INDEX"'">'"$TITLE</a>" >> $OUT/indexreport.html
echo '[<a href="'"$SEC.html"'">'1'</a>]<br/>' >> $OUT/indexreport.html
else
echo exists $INDEX
fi
( echo '<html>'
echo "<h1>$TITLE</h1>"
echo "<img src=$SEC.GDB.png>$TITLE</img>"
# head -n 20 $g | txt2html -pi | sed 's/^/<br\/>/' | sed 's/<br\/>$//g'
#head -n 20 $g | txt2html -pi | sed 's/^#/#<br\/>/'
# cat $g | txt2html -pi | sed 's/^#/#<br\/>/'
cat $g | sed 's/&/&amp/g' | sed 's/</&lt/g' | sed 's/^/<br\/>/'
) > $OUT/$SEC.html
echo '<a href="'"$SEC.html"'">'$SEC'</a><br/>' >> $OUT/$INDEX
echo '<a href="'"$SEC.html"'">'$SEC'</a><br/>'
fi
done
exit