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 <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2020-01-24 19:02:23 +01:00
parent 37b2008966
commit 150b67b57b

View file

@ -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))