From c6e08d6940e35970d62f51a7e7792bd18d72600e Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 17 Oct 2022 13:40:21 +0200 Subject: [PATCH] SquishTests: Enable clangd also on machines with low memory Change-Id: I92caa0da779aacf731a0aa23a86f55e659c51d2b Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/shared/qtcreator.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index c4a6218b6af..9f26634ef01 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -36,6 +36,7 @@ source("../../shared/clang.py") source("../../shared/welcome.py") source("../../shared/workarounds.py") # include this at last +settingsPathsWithExplicitlyEnabledClangd = set() def __closeInfoBarEntry__(leftButtonText): toolButton = ("text='%s' type='QToolButton' unnamed='1' visible='1' " @@ -47,6 +48,7 @@ def __closeInfoBarEntry__(leftButtonText): # additionalParameters must be a list or tuple of strings or None def startQC(additionalParameters=None, withPreparedSettingsPath=True, closeLinkToQt=True, cancelTour=True): global SettingsPath + global settingsPathsWithExplicitlyEnabledClangd appWithOptions = ['"Qt Creator"' if platform.system() == 'Darwin' else "qtcreator"] if withPreparedSettingsPath: appWithOptions.extend(SettingsPath) @@ -56,8 +58,22 @@ def startQC(additionalParameters=None, withPreparedSettingsPath=True, closeLinkT appWithOptions.extend(('-platform', 'windows:dialogs=none')) test.log("Starting now: %s" % ' '.join(appWithOptions)) appContext = startApplication(' '.join(appWithOptions)) - if closeLinkToQt or cancelTour: + if (closeLinkToQt or cancelTour or + str(SettingsPath) not in settingsPathsWithExplicitlyEnabledClangd): progressBarWait(3000) # wait for the "Updating documentation" progress bar + if str(SettingsPath) not in settingsPathsWithExplicitlyEnabledClangd: + # This block will incorrectly be skipped when a test calls startQC multiple times in a row + # passing different settings paths in "additionalParameters". Currently we don't have such + # a test. Even if we did, it would only make a difference if the test relied on clangd + # being active and ran on a machine with insufficient memory. + try: + mouseClick(waitForObject("{text='Enable Anyway' type='QToolButton' " + "unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}", 500)) + settingsPathsWithExplicitlyEnabledClangd.add(str(SettingsPath)) + except: + pass + if closeLinkToQt or cancelTour: if closeLinkToQt: __closeInfoBarEntry__("Link with Qt") if cancelTour: