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
This commit is contained in:
Pavel Sanda 2009-06-17 17:56:56 +00:00
parent 4559c29eeb
commit 3f3d37ca09
9 changed files with 216 additions and 18 deletions

View File

@ -2,15 +2,59 @@
# This script starts LyX, and restarts LyX if it is closed
# it logs all output, including backtraces to development/keystest/out/GDB
#Setting the following may give better screen shots
#gconftool-2 /apps/metacity/general/compositing_manager -s -t bool true
DIRNAME0=`dirname "$0"`
OUTDIR="$DIRNAME0/out"
#rename other windows to avoid confusion.
wmctrl -N __renamed__ -r lyx
wmctrl -N __renamed__ -r lyx
wmctrl -N __renamed__ -r lyx
wmctrl -N __renamed__ -r lyx
(
while true
do
( (echo SECONDS: `date +%s`
(echo "run
bt" ; yes q) | gdb src/lyx 2>&1) | strings| tee -a development/keystest/out/GDB)
SEC=`date +%s`
GDB=$OUTDIR/$SEC.GDB
KEYCODE=$OUTDIR/$SEC.KEYCODE
( sleep 20 && python $DIRNAME0/test.py | tee $KEYCODE) &
CHILD_PID="$!"
ls src/lyx ; sleep 1
pwd
#sleep 10
#You may want to use the following to simulate SIGFPE
#(sleep 90 && killall -8 lyx) &
(echo "
shell svn info src/
run
bt
shell kill $CHILD_PID
shell import -window root '$GDB.png'
shell wmctrl -l
shell sleep 1
shell kill -9 $CHILD_PID
shell wmctrl -r __renamed__ -b add,shaded
shell wmctrl -r term -b add,shaded
shell wmctrl -r term -b add,shaded
shell wmctrl -R lyx
shell import -window root '$GDB..png'
" ; yes q) | gdb src/lyx 2>&1 | strings| tee $GDB
kill $CHILD_PID
#sleep 2 kill -9 $CHILD_PID
grep " signal " $GDB || (
rm $OUTDIR/*GDB*.bak
rm $OUTDIR/*KEYCODE*.bak
mv $KEYCODE $KEYCODE.bak
mv $GDB $GDB.bak
mv $GDB.png $GDB.png.bak
mv $GDB..png $GDB..png.bak
#rm $OUTDIR/KEYCODE.$SEC
#rm $OUTDIR/GDB.$SEC
)
done
) 2>&1 |tee $OUTDIR/log

View File

@ -1,14 +1,17 @@
AUTOLYX=`ps gaux | grep autolyx | grep -v grep | sed 's/[^ ]* //' | sed s/0.0.*//g`
TESTPY=`ps gaux | grep test.py | grep -v grep | sed 's/[^ ]* //' | sed s/0.0.*//g`
killall autolyx
killall test.py
killall lyx
killall gdb
killall xterm
kill $AUTOLYX
killall replay.sh
kill $AUTOLYX $TESTPY
sleep 0.3
killall autolyx -9
killall test.py -9
killall lyx -9
killall gdb -9
killall xterm -9
kill $AUTOLYX -9
killall replay.sh -9
kill $AUTOLYX $TESTPY -9

View File

@ -0,0 +1,4 @@
TESTPY=`ps gaux | grep test.py | grep -v grep | sed 's/[^ ]* //' | sed s/0.0.*//g`
kill $TESTPY
sleep 0.1
kill $TESTPY -9

View File

@ -16,12 +16,16 @@ then
if [ a"$1" == a--update ]; then
svn up
./autogen.sh && ./configure --enable-debug -- && nice -18 make && (bash $LT/autolyx & sleep 9 ; xterm -e python $LT/test.py)
./autogen.sh && ./configure --enable-debug -- && nice -18 make &&
if [ ! a"$2" == a"0" ]
then
bash $LT/autolyx
fi
else
DBG=`src/lyx --version 2>&1 | grep C++.Compiler.flags|grep -- -g`;
if [ -z "$DBG" ]; then echo Wrong build of LyX binary. ; exit; fi
bash $LT/autolyx & sleep 9 ; xterm -e python $LT/test.py
bash $LT/autolyx
fi
else

View File

@ -0,0 +1,65 @@
#!/bin/bash
# This script starts LyX, and restarts LyX if it is closed
# it logs all output, including backtraces to development/keystest/out/GDB
#rename other windows to avoid confusion.
DIRNAME0=`dirname "$0"`
OUTDIR="$DIRNAME0/out"
WAITSECS=20
INFILE="$1"
LINES_TO_INCLUDE=8
if [ ! -e "$INFILE" ]
then
echo cannot find "$INFILE"
exit
fi
killall lyx
wmctrl -N __renamed__ -r lyx
wmctrl -N __renamed__ -r lyx
wmctrl -N __renamed__ -r lyx
wmctrl -N __renamed__ -r lyx
while ! grep " signal SIG[^T]" "$INFILE.new_gdb"
do
SEC=`date +%s`
echo GDB---------------- >> "$INFILE.new_gdb.bak"
cat "$INFILE.new_gdb" >> "$INFILE.new_gdb.bak"
echo LINES_TO_INCLUDE $LINES_TO_INCLUDE
#cat $NUMLINES
tail -n $LINES_TO_INCLUDE < $INFILE > $INFILE.new_key
NUMLINES=`wc -l "$INFILE.new_key"`
echo NUMLINES $NUMLINES
( i=0
echo Waiting $WAITSECS before starting replay
sleep $WAITSECS
echo Starting replay
wmctrl -R LyX && xvkbd -xsendevent -text '\Afn'
cat "$INFILE.new_key" |
while read -r l
do
wmctrl -R LyX && xvkbd -xsendevent -text "$l"
#echo -- "$l"
i=$(($i+1))
echo $i/$NUMLINES
sleep 0.1
done
echo FINISHED REPLAY
sleep 4
killall lyx
sleep 2
killall lyx -9
echo FINISHED REPLAY and killed lyx
) &
CHILD_PID="$!"
echo "Starting Lyx"
(echo "run
bt" ; yes q) | gdb src/lyx 2>&1 | strings| tee "$INFILE.new_gdb"
kill $CHILD_PID
sleep 2 kill -9 $CHILD_PID
LINES_TO_INCLUDE=$(($LINES_TO_INCLUDE*2))
done
echo END

View File

@ -14,7 +14,7 @@ do
fi
done
strings $LT/out/GDB > $LT/out/GDBs
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

View File

@ -0,0 +1,78 @@
#!/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

View File

@ -5,4 +5,4 @@
LT=development/keystest
(bash $LT/autolyx & sleep 9 ; xterm -e python $LT/test.py)
bash $LT/autolyx

View File

@ -7,13 +7,7 @@
import random
import os
#os.system("mv LT/*lyx*_*
#os.system("lyx &")
#os.system("sleep 20")
keycode=["\[Left]",'\[Right]','\[Down]','\[Up]','\[BackSpace]','\[Delete]']
keycode=["\[Left]",'\[Right]','\[Down]','\[Up]','\[BackSpace]','\[Delete]','\[Escape]']
keycode[:0]=keycode
keycode[:0]=keycode
@ -38,10 +32,16 @@ print (random.randint(1,len(keycode)))
for k in range(97, 123):
print (keycode[random.randint(1,len(keycode))-1])
#Start a new file. We could also open a random Help file.
#os.system("wmctrl -R LyX && xvkbd -xsendevent -text '\Afn';sleep 1")
keystr="'\Afn'"
os.system("wmctrl -R LyX && xvkbd -xsendevent -text '"+keystr+"';sleep 1")
os.system("echo '"+keystr+"'")
while True:
keystr=""
for k in range(1,80):
keystr=keystr+keycode[random.randint(1,len(keycode))-1]
#output keystr before using, to make sure it is output before we are killed
os.system("echo '"+keystr+"'")
os.system("wmctrl -R LyX && xvkbd -xsendevent -text '"+keystr+"';sleep 1")
#os.system("echo KEYCODES: '"+keystr+"' >> development/keystest/out/GDB")
os.system("echo `date +%s`: '"+keystr+"' >> development/keystest/out/KEYCODES")