Recovered working autotests for findadv on Linux/Ubuntu (after a long no-use time).

- from specific dependency on wish8.5, to just wish
- from checking the 2nd line of /proc/*/status, to grep-ing on sleeping (old system was failing on newer kernels)
- mode debugging and python output during tests
This commit is contained in:
Tommaso Cucinotta 2017-01-25 02:08:28 +01:00
parent e07cb1da96
commit a8bb3171f1
3 changed files with 16 additions and 13 deletions

View File

@ -151,22 +151,13 @@ class CommandSourceFromFile(CommandSource):
self.i = self.i + 1
return line
def lyx_exists():
if lyx_pid is None:
return False
fname = '/proc/' + lyx_pid + '/status'
return os.path.exists(fname)
def lyx_sleeping():
fname = '/proc/' + lyx_pid + '/status'
f = open(fname, 'r')
lines = f.readlines()
sleeping = lines[1].find('(sleeping)') > 0
# print 'LYX_STATE', lines[1] , 'SLEEPING=', sleeping
return sleeping
# Interruptible os.system()
def intr_system(cmd, ignore_err = False):
@ -175,10 +166,16 @@ def intr_system(cmd, ignore_err = False):
if os.WIFSIGNALED(ret):
raise KeyboardInterrupt
if ret != 0 and not ignore_err:
raise BaseException("command failed.")
raise BaseException("command failed:" + cmd)
return ret
# Return true if LyX (identified via lyx_pid) is sleeping
def lyx_sleeping():
fname = '/proc/' + lyx_pid + '/status'
return intr_system("grep 'State.*sleeping' " + fname, True)
def sendKeystring(keystr, LYX_PID):
# print "sending keystring "+keystr+"\n"
@ -351,8 +348,10 @@ while not failed:
count = 5
while count > 0:
lyx_pid=os.popen("pidof " + lyx).read().rstrip()
print 'lyx_pid=' + lyx_pid, '\n'
if lyx_pid != "":
lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) + " ' | cut -d ' ' -f 1").read().rstrip()
print 'lyx_win=' + lyx_window_name, '\n'
if lyx_window_name != "":
break
else:

View File

@ -26,6 +26,10 @@ if [ "$(pidof lyx)" != "" ]; then
export LYX_PID=$(pidof lyx)
export LYX_WINDOW_NAME=$(wmctrl -l -p | grep " $LYX_PID " | cut -d ' ' -f 1);
fi
echo LYX_PID=$LYX_PID
echo LYX_WINDOW_NAME=$LYX_WINDOW_NAME
export MAX_LOOPS=1
export LYX_EXE=${LYX_EXE:-../../src/lyx}
@ -35,4 +39,4 @@ else
export XVKBD_EXE=${XVKBD_EXE:-xvkbd};
fi
$KEYTEST
python -m trace --trace $KEYTEST

View File

@ -1,4 +1,4 @@
#!/usr/bin/wish8.5
#!/usr/bin/wish
wm attributes . -topmost 1