# Ignore status == "dead" if this is set. Used at the last commands after "\Cq"
dead_expected = False
+def die(excode, text):
+ if text != "":
+ print(text)
+ sys.stdout.flush()
+ os._exit(excode)
+
class CommandSource:
def __init__(self):
if self.count % 200 == 0:
return 'RaiseLyx'
elif self.count > self.count_max:
- os._exit(0)
+ die(0, "")
else:
keystr = ''
for k in range(1, 2):
def getCommand(self):
if self.count >= self.max_count:
- os._exit(0)
+ die(0, "")
if self.i >= len(self.lines):
self.loops = self.loops + 1
if self.loops >= int(max_loops):
class ControlFile:
def __init__(self):
- self.control = re.compile(r'^(C[ONPRC]):\s+(.*)$')
+ self.control = re.compile(r'^(C[ONPRC]):\s*(.*)$')
self.cntrname = None
self.cntrfile = None
self.addline("Regex: " + text)
else:
print("Error")
- _exit(1)
+ die(1,"208")
return True
return True
if (status == "dead") or (status == "zombie"):
printresstatus()
- sys.stdout.flush()
if dead_expected:
print('Lyx died while waiting for status == sleeping')
return False
else:
- print('Lyx is dead, exiting')
- os._exit(1)
+ die(1,"Lyx is dead, exiting")
if time.time() - before_secs > 180:
- print('Killing due to freeze (KILL_FREEZE)')
-
# Do profiling, but sysprof has no command line interface?
# intr_system("killall -KILL lyx")
printresstatus()
- sys.stdout.flush()
- os._exit(1)
+ die(1,"Killing due to freeze (KILL_FREEZE)")
time.sleep(0.02)
# Should be never reached
print('Wait for sleeping ends unexpectedly')
time.sleep(1)
if ( rtn != 0 ):
print("Command Failed: "+cmd)
- print(" EXITING!\n")
- os._exit(1)
+ die(1," EXITING!")
def RaiseWindow():
#intr_system("echo x-session-manager PID: $X_PID.")
else:
##intr_system('killall lyx; sleep 2 ; killall -9 lyx')
if lyx_pid is None:
- print('No path /proc/xxxx/status, exiting')
+ die(1, 'No path /proc/xxxx/status, exiting')
else:
- print('No path /proc/' + lyx_pid + '/status, exiting')
- os._exit(1)
+ die(1, 'No path /proc/' + lyx_pid + '/status, exiting')
elif c[0:4] == 'KD: ':
key_delay = c[4:].rstrip('\n')
print('Setting DELAY to ' + key_delay)
time.sleep(0.5)
dead_expected = True
is_sleeping = wait_until_lyx_sleeping(lyx_pid)
+ print("Leaved wait TestEnd")
if is_sleeping:
print('wait_until_lyx_sleeping() indicated "sleeping"')
# For a short time lyx-status is 'sleeping', even if it is nearly dead.
print("Test case terminated: ")
if failed:
- print("FAIL\n")
- os._exit(1)
+ die(1,"FAIL")
else:
- print("Ok\n")
- os._exit(0)
+ die(0, "Ok")