From ac7572f366f3e2b6c969fbd04ea539903b120d02 Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Tue, 1 Feb 2011 22:57:10 +0000 Subject: [PATCH] More precise identification of the lyx window (by id, instead of the buggy by title). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37410 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/autotests/keytest.py | 16 ++++++++-------- development/autotests/single-test.sh | 5 ++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/development/autotests/keytest.py b/development/autotests/keytest.py index bb715ff0a7..1f6710eba7 100755 --- a/development/autotests/keytest.py +++ b/development/autotests/keytest.py @@ -224,7 +224,7 @@ def RaiseWindow(): #os.system("echo x-session-manager open files: `lsof -p $X_PID | grep ICE-unix | wc -l`") ####os.system("wmctrl -l | ( grep '"+lyx_window_name+"' || ( killall lyx ; sleep 1 ; killall -9 lyx ))") #os.system("wmctrl -R '"+lyx_window_name+"' ;sleep 0.1") - system_retry(30, "wmctrl -R '"+lyx_window_name+"'") + system_retry(30, "wmctrl -a '"+lyx_window_name+"'") lyx_pid = os.environ.get('LYX_PID') @@ -274,7 +274,7 @@ else: outfile = open(outfilename, 'w') -if lyx_pid != "": +if not lyx_pid is None: RaiseWindow() sendKeystring("\Afn", lyx_pid) @@ -298,6 +298,8 @@ while not failed: if lyx_pid != "": print "Found running instance(s) of LyX: " + lyx_pid + ": killing them all\n" os.system("killall lyx") + time.sleep(0.5) + os.system("killall -KILL lyx") time.sleep(0.2) print "Starting LyX . . ." if lyx_userdir is None: @@ -306,17 +308,15 @@ while not failed: os.system(lyx_exe + " -userdir " + lyx_userdir + " " + c[9:] + "&") while True: lyx_pid=os.popen("pidof lyx").read().rstrip() - lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) + " ' | cut -d ' ' -f 1").read().rstrip() - if lyx_window_name != "": - break + if lyx_pid != "": + lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) + " ' | cut -d ' ' -f 1").read().rstrip() + if lyx_window_name != "": + break print 'lyx_win: ' + lyx_window_name + '\n' print "Waiting for LyX to show up . . ." time.sleep(1) print 'lyx_pid: ' + lyx_pid + '\n' print 'lyx_win: ' + lyx_window_name + '\n' - time.sleep(1) - #RaiseWindow() - #sendKeystring("\Afn", lyx_pid) elif c[0:5] == 'Sleep': print "\nSleeping for " + c[6:] + "\n" time.sleep(float(c[6:])) diff --git a/development/autotests/single-test.sh b/development/autotests/single-test.sh index dd2dec67f6..e83d834df4 100755 --- a/development/autotests/single-test.sh +++ b/development/autotests/single-test.sh @@ -16,7 +16,10 @@ if [ "$1" != "" ]; then fi export MAX_DROP=0 -export LYX_WINDOW_NAME=$(wmctrl -l | grep -v Mozilla | grep -v Firefox | grep LyX | sed -e 's/.*\(LyX: .*\)$/\1/') +if [ "$(pidof lyx)" != "" ]; then + export LYX_PID=$(pidof lyx) + export LYX_WINDOW_NAME=$(wmctrl -l | grep " $LYX_PID " | cut -d ' ' -f 1); +fi export MAX_LOOPS=1 export LYX_EXE=${LYX_EXE:-../../src/lyx} -- 2.39.2