From 4c5163f6750b91e1d945a02daec0e1bc25f12721 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 4 Apr 2016 07:46:31 +0200 Subject: [PATCH] Squish: Ensure clean state after test run... ...depending on the environment and the present terminal variations it might be possible that QC leaves terminals with still running qtcreator_process_stubs open. Ensure to kill these (and automatically close their terminals). Task-number: QTCREATORBUG-15749 Change-Id: I0cdbaf000c355443289bf827034ad9884efc2ce7 Reviewed-by: Robert Loehning --- tests/system/shared/qtcreator.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index 116826df391..c9d2ee27826 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -33,6 +33,7 @@ import subprocess; import sys import errno; from datetime import datetime,timedelta; +import __builtin__ srcPath = '' SettingsPath = '' @@ -116,6 +117,16 @@ def waitForCleanShutdown(timeOut=10): shutdownDone=True if not shutdownDone and datetime.utcnow() > endtime: break + if platform.system() == 'Linux' and JIRA.isBugStillOpen(15749): + pgrepOutput = getOutputFromCmdline('pgrep -f qtcreator_process_stub') + pids = pgrepOutput.splitlines() + if len(pids): + print("Killing %d qtcreator_process_stub instances" % len(pids)) + for pid in pids: + try: + os.kill(__builtin__.int(pid), 9) + except OSError: # we might kill the parent before the current pid + pass def checkForStillRunningQmlExecutable(possibleNames): for qmlHelper in possibleNames: