From 97648298f31e9e5cf6c5045dc6a7b8126b46a6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Mon, 19 Aug 2024 22:03:31 +0200 Subject: [PATCH] SquishTests: Handle autodetected kits when no qmake was found Small code cleanups along the way. Change-Id: If2f3a5ad7f8f7fe7fc550f044929bfe8768175ab Reviewed-by: Christian Stenger --- .../tst_default_settings/test.py | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index ffdb10710d6..a50f69682c0 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -29,8 +29,11 @@ def __createMinimumIni__(emptyParent): iniFile.write("OverrideLanguage=C\n") iniFile.close() + +glblDefaultKits = 0 + + def __checkKits__(): - global genericDebuggers mouseClick(waitForObjectItem(":Options_QListView", "Kits")) # check compilers expectedCompilers = __getExpectedCompilers__() @@ -75,6 +78,7 @@ def __checkKits__(): # check kits clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Kits") __iterateTree__(":BuildAndRun_QTreeView", __kitFunc__, foundQt, foundCompilerNames) + test.compare(glblDefaultKits, 1, "Was exactly one default kit found?") return qmakePath != None def __processSubItems__(treeObjStr, section, parModelIndexStr, doneItems, @@ -161,19 +165,31 @@ def __qtFunc__(it, foundQt, qmakePath): except: pass + +glblUsedKitNames = set() + + def __kitFunc__(it, foundQt, foundCompNames): global currentSelectedTreeItem, warningOrError if 'Python' in it: # skip Python kits return - qtVersionStr = str(waitForObjectExists(":Kits_QtVersion_QComboBox").currentText) - # The following may fail if Creator doesn't find a Qt version in PATH. It will then create one - # Qt-less kit for each available toolchain instead of just one default Desktop kit. - # Since Qt usually is in PATH on the test machines anyway, we consider this too much of a - # corner case to add error handling code or make Qt in PATH a hard requirement for the tests. - test.compare(it, "Desktop (default)", "Verifying whether default Desktop kit has been created.") + defaultKitSuffix = " (default)" + if it.endswith(defaultKitSuffix): + global glblDefaultKits + glblDefaultKits += 1 if foundQt: + test.compare(it, "Desktop" + defaultKitSuffix, + "Verifying whether default Desktop kit has been created.") + qtVersionStr = str(waitForObjectExists(":Kits_QtVersion_QComboBox").currentText) test.compare(qtVersionStr, foundQt, "Verifying if Qt versions match.") + else: + # Creator creates one kit for each compiler's ABI + global glblUsedKitNames + kitName = it.removesuffix(defaultKitSuffix) + test.verify(kitName not in glblUsedKitNames, + "The kit name '%s' was not used before?" % kitName) + glblUsedKitNames.add(kitName) compilerCombo = findObject(":Compiler:_QComboBox") test.compare(compilerCombo.enabled, compilerCombo.count > 1, "Verifying whether compiler combo is enabled/disabled correctly.")