]> git.lyx.org Git - features.git/commitdiff
keytests: add a timeout for LyX process to start
authorKornel Benko <kornel@lyx.org>
Mon, 25 Aug 2014 11:49:12 +0000 (13:49 +0200)
committerKornel Benko <kornel@lyx.org>
Mon, 25 Aug 2014 11:49:12 +0000 (13:49 +0200)
If the LyX window does not appear after a certain (conservative)
time, the keytest now fails. One reason that caused the LyX window
to never show up was when DISPLAY was not set. This particular case
has been fixed in <commit1hash>. This commit is meant for the more general
scenario.
(Collaboration with Scott Kostyshak)

development/autotests/keytest.py

index b2a89c2d0d63944c101146419e0997950b9b1e58..cbfe2ff3fa10bf9094584e35426f27b02b98aabc 100755 (executable)
@@ -342,7 +342,8 @@ while not failed:
             intr_system(lyx_exe + c[9:] + "&")
         else:
             intr_system(lyx_exe + " -userdir " + lyx_userdir + " " + c[9:] + "&")
-        while True:
+        count = 100
+        while count > 0:
             lyx_pid=os.popen("pidof " + lyx).read().rstrip()
             if lyx_pid != "":
                 lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) +  " ' | cut -d ' ' -f 1").read().rstrip()
@@ -351,6 +352,11 @@ while not failed:
             print 'lyx_win: ' + lyx_window_name + '\n'
             print "Waiting for LyX to show up . . ."
             time.sleep(1)
+            count = count - 1
+        if count <= 0:
+            print 'Timeout: could not start ' + lyx_exe, '\n'
+            sys.stdout.flush()
+            failed = True
         print 'lyx_pid: ' + lyx_pid + '\n'
         print 'lyx_win: ' + lyx_window_name + '\n'
     elif c[0:5] == 'Sleep':