From f43348c4f28b43ec38de1606675a1a3551640370 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 15 Mar 2022 15:34:22 +0100 Subject: [PATCH] Squish: More corrections due to change of default build system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia221e1e84784f5218d14258fcc24dcac900d60ad Reviewed-by: Robert Löhning --- tests/system/objects.map | 4 --- tests/system/shared/build_utils.py | 28 +++++++++++++------ tests/system/shared/debugger.py | 20 +++++++++++-- tests/system/suite_APTW/tst_APTW03/test.py | 4 +-- .../tst_debug_empty_main/test.py | 2 +- .../suite_debugger/tst_simple_debug/test.py | 4 +-- 6 files changed, 42 insertions(+), 20 deletions(-) diff --git a/tests/system/objects.map b/tests/system/objects.map index a222860aadc..074fc19ae7e 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -22,7 +22,6 @@ :Add Bookmark_BookmarkDialog {name='BookmarkDialog' type='BookmarkDialog' visible='1' windowTitle='Add Bookmark'} :Add to Version Control.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':Add to Version Control_QMessageBox'} :Add to Version Control_QMessageBox {text~='Add the file.*to version control (.*)?' type='QMessageBox' unnamed='1' visible='1'} -:Additional arguments:_QWidget {buddy=':Qt Creator.Additional arguments:_QLabel' type='QWidget' unnamed='1' visible='1'} :Analyzer Toolbar.AnalyzerManagerToolBox_QComboBox {container=':DebugModeWidget.Toolbar_QDockWidget' name='PerspectiveChooser' type='QComboBox' visible='1'} :Analyzer Toolbar.Clear_QToolButton {container=':DebugModeWidget.Toolbar_QDockWidget' toolTip='Discard data' type='QToolButton' unnamed='1' visible='1'} :Analyzer Toolbar.Elapsed:_QLabel {container=':DebugModeWidget.Toolbar_QDockWidget' text~='Elapsed: \\\\d+.\\\\d s' type='QLabel' unnamed='1' visible='1'} @@ -118,15 +117,12 @@ :QML Debugging.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':QML Debugging_QMessageBox'} :QML Debugging_QMessageBox {text='The option will only take effect if the project is recompiled. Do you want to recompile now?' type='QMessageBox' unnamed='1' visible='1'} :Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Additional arguments:_QLabel {text='Additional arguments:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.CloseDoc_QToolButton {toolTip?='Close Document *' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.CloseFind_QToolButton {name='close' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Compile Output_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Compile Output'} :Qt Creator.Configure Project_QPushButton {text='Configure Project' type='QPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.DebugModeWidget_QSplitter {name='DebugModeWidget' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.DragDoc_QToolButton {toolTip='Drag to drag documents between splits' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Effective qmake call:_QLabel {text='Effective qmake call:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Effective qmake call:_QTextEdit {aboveWidget=':Additional arguments:_QWidget' leftWidget=':Qt Creator.Effective qmake call:_QLabel' type='QTextEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Events_QDockWidget {name='QmlProfiler.Statistics.DockDockWidget' type='QDockWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Events_QTabBar {aboveWidget=':Qt Creator.Events_QDockWidget' type='QTabBar' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'} diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index f74bea0df10..a58a1fa93d7 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -163,13 +163,17 @@ def selectBuildConfig(wantedKit, configName, afterSwitchTo=ViewConstants.EDIT): test.warning("Don't know where you trying to switch to (%s)" % afterSwitchTo) # This will not trigger a rebuild. If needed, caller has to do this. -def verifyBuildConfig(currentTarget, configName, shouldBeDebug=False, enableShadowBuild=False, enableQmlDebug=False): +def verifyBuildConfig(currentTarget, configName, shouldBeDebug=False, enableShadowBuild=False, + enableQmlDebug=False, buildSystem=None): selectBuildConfig(currentTarget, configName, None) ensureChecked(waitForObject(":scrollArea.Details_Utils::DetailsButton")) - ensureChecked("{leftWidget={text='Shadow build:' type='QLabel' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'} " - "type='QCheckBox' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}", enableShadowBuild) + + if buildSystem == "qmake": + ensureChecked("{leftWidget={text='Shadow build:' type='QLabel' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'} " + "type='QCheckBox' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}", enableShadowBuild) + buildCfCombo = waitForObject("{leftWidget=':scrollArea.Edit build configuration:_QLabel' " "type='QComboBox' unnamed='1' visible='1'}") if shouldBeDebug: @@ -184,11 +188,15 @@ def verifyBuildConfig(currentTarget, configName, shouldBeDebug=False, enableShad pass # Since waitForObject waits for the object to be enabled, # it will wait here until compilation of the debug libraries has finished. + runCMakeButton = ("{type='QPushButton' text='Run CMake' unnamed='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}") if currentTarget not in (Targets.DESKTOP_4_8_7_DEFAULT, Targets.EMBEDDED_LINUX): qmlDebuggingCombo = findObject(':Qt Creator.QML debugging and profiling:_QComboBox') if selectFromCombo(qmlDebuggingCombo, 'Enable'): - # Don't rebuild now - clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000)) + if buildSystem is None or buildSystem == "CMake": # re-run cmake to apply + clickButton(waitForObject(runCMakeButton)) + elif buildSystem == "qmake": # Don't rebuild now + clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000)) try: problemFound = waitForObject("{window=':Qt Creator_Core::Internal::MainWindow' " "type='QLabel' name='problemLabel' visible='1'}", 1000) @@ -201,8 +209,10 @@ def verifyBuildConfig(currentTarget, configName, shouldBeDebug=False, enableShad qmlDebuggingCombo = findObject(':Qt Creator.QML debugging and profiling:_QComboBox') if selectFromCombo(qmlDebuggingCombo, "Disable"): test.log("Qml debugging libraries are available - unchecked qml debugging.") - # Don't rebuild now - clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000)) + if buildSystem is None or buildSystem == "CMake": # re-run cmake to apply + clickButton(waitForObject(runCMakeButton)) + elif buildSystem == "qmake": # Don't rebuild now + clickButton(waitForObject(":QML Debugging.No_QPushButton", 5000)) clickButton(waitForObject(":scrollArea.Details_Utils::DetailsButton")) switchViewTo(ViewConstants.EDIT) diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py index 39ef5832eec..39b184146e4 100644 --- a/tests/system/shared/debugger.py +++ b/tests/system/shared/debugger.py @@ -175,8 +175,24 @@ def doSimpleDebugging(currentKit, currentConfigName, expectedBPOrder=[], enableQ def isMsvcConfig(currentKit): switchViewTo(ViewConstants.PROJECTS) switchToBuildOrRunSettingsFor(currentKit, ProjectSettings.BUILD) - clickButton(waitForObject(":scrollArea.Details_Utils::DetailsButton")) - isMsvc = " -spec win32-msvc" in str(waitForObject(":Qt Creator.Effective qmake call:_QTextEdit").plainText) + + waitForObject(":Projects.ProjectNavigationTreeView") + bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView") + wantedKitName = Targets.getStringForTarget(currentKit) + wantedKitIndexString = getQModelIndexStr("text='%s'" % wantedKitName, bAndRIndex) + if not test.verify(__kitIsActivated__(findObject(wantedKitIndexString)), + "Verifying target '%s' is enabled." % wantedKitName): + raise Exception("Kit '%s' is not activated in the project." % wantedKitName) + index = waitForObject(wantedKitIndexString) + toolTip = str(index.data(Qt.ToolTipRole).toString()) + compilerPattern = re.compile("Compiler:(?P.+)") + match = compilerPattern.search(toolTip) + if match is None: + test.warning("UI seems to have changed - failed to check for compiler.") + return False + + compiler = str(match.group("compiler")) + isMsvc = compiler.startswith("MSVC") or compiler.startswith("Microsoft Visual C") switchViewTo(ViewConstants.EDIT) return isMsvc diff --git a/tests/system/suite_APTW/tst_APTW03/test.py b/tests/system/suite_APTW/tst_APTW03/test.py index 735073f2152..e18b67ea978 100644 --- a/tests/system/suite_APTW/tst_APTW03/test.py +++ b/tests/system/suite_APTW/tst_APTW03/test.py @@ -67,7 +67,7 @@ def checkSimpleCppLib(projectName, static): Targets.desktopTargetClasses(), static, buildSystem="qmake") for kit, config in iterateBuildConfigs("Release"): - verifyBuildConfig(kit, config, False, True) + verifyBuildConfig(kit, config, False, True, buildSystem="qmake") invokeMenuItem('Build', 'Build Project "%s"' % projectName) waitForCompile(10000) checkCompile() @@ -91,7 +91,7 @@ def main(): buildSystem="qmake") virtualFunctionsAdded = False for kit, config in iterateBuildConfigs("Debug"): - verifyBuildConfig(kit, config, True, True) + verifyBuildConfig(kit, config, True, True, buildSystem="qmake") invokeMenuItem('Build', 'Build Project "%s"' % projectName) waitForCompile(10000) if not virtualFunctionsAdded: diff --git a/tests/system/suite_debugger/tst_debug_empty_main/test.py b/tests/system/suite_debugger/tst_debug_empty_main/test.py index 974c91f8c66..4a2bd938288 100644 --- a/tests/system/suite_debugger/tst_debug_empty_main/test.py +++ b/tests/system/suite_debugger/tst_debug_empty_main/test.py @@ -98,7 +98,7 @@ def __handleAppOutputWaitForDebuggerFinish__(): def performDebugging(projectName): for kit, config in iterateBuildConfigs("Debug"): test.log("Selecting '%s' as build config" % config) - verifyBuildConfig(kit, config, True, True) + verifyBuildConfig(kit, config, True, True, buildSystem="qmake") waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton") selectFromLocator("t rebuild", "Rebuild (Rebuild All Projects)") waitForCompile() diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index 7237e00aae0..8c9c71a8fc2 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -44,8 +44,8 @@ def main(): 'onTriggered: console.log("Break here")']) invokeMenuItem("File", "Save All") filesAndLines = [ - { "%s.Sources.main\\.cpp" % projectName : "QQmlApplicationEngine engine;" }, - { "%s.Resources.qml\.qrc./.main\\.qml" % projectName : 'onTriggered.*' } + { "%s.%s.Source Files.main\\.cpp" % (projectName, projectName) : "QQmlApplicationEngine engine;" }, + { "%s.%s.qml\.qrc./.main\\.qml" % (projectName, projectName) : 'onTriggered.*' } ] test.log("Setting breakpoints") expectedBreakpointsOrder = setBreakpointsForCurrentProject(filesAndLines)