From 150b67b57bd25ba9c8ec9c28c7aed3cc0b557bfd Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 24 Jan 2020 19:02:23 +0100 Subject: [PATCH] UITest: Actually time-out the wait Without that, if XDesktop::terminate() fails (e.g., because an assert in a test was false while a modal dialog was open, which left the dialog open, and so TerminationVetoException was thrown in XDesktop::terminate() by a listener), the wait never ends, and the assertion message gets lost when buildbot terminates the build, as happened in https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/51496/console. The timeout only available since python 3.3. The soffice process is not terminated in this case; hopefully it will be terminated when build cleanup will occur. Change-Id: I924775d0e58619d1fbd603e80ed1f8d047c91145 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87362 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- uitest/libreoffice/connection.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/uitest/libreoffice/connection.py b/uitest/libreoffice/connection.py index cb3ae1a0128e..3dbae4cca355 100644 --- a/uitest/libreoffice/connection.py +++ b/uitest/libreoffice/connection.py @@ -9,6 +9,7 @@ import subprocess import time import uuid import os +import sys try: import pyuno @@ -130,10 +131,17 @@ class OfficeConnection: else: self.soffice.terminate() - ret = self.soffice.wait() - self.xContext = None - self.socket = None - self.soffice = None + + try: + if sys.version_info >= (3,3): + ret = self.soffice.wait(30) # will throw when timed out + else: + ret = self.soffice.wait() # no timeout in python that old + finally: + self.xContext = None + self.socket = None + self.soffice = None + if ret != 0: raise Exception("Exit status indicates failure: " + str(ret))