From 54326a127eece7cb5c5387b0a0ac73cb734e808b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Mon, 30 Jan 2023 14:58:05 +0100 Subject: [PATCH 1/6] SquishTests: Use openDocument()'s return for verifying project tree It's used anyway, relies on the expected project tree and works around a problem on some machines. Change-Id: Ic1e3e7a3f492f37d70c4409699ca78ad548d7445 Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/suite_QMLS/tst_QMLS04/test.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py index 2c42c178cc0..f3758ca8b02 100644 --- a/tests/system/suite_QMLS/tst_QMLS04/test.py +++ b/tests/system/suite_QMLS/tst_QMLS04/test.py @@ -40,17 +40,16 @@ def main(): myCompTE = "SampleApp.SampleApp.qml\\.qrc./.MyComponent\\.qml" # there should be new QML file generated with name "MyComponent.qml" try: - waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", myCompTE, 5000) + # openDocument() doesn't wait for expected elements, so it might be faster than the updates + # to the tree. Explicitly wait here to avoid timing issues. Using wFOI() instead of + # snooze() allows to proceed earlier, just in case it can find the item. + waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", + addBranchWildcardToRoot(myCompTE), 2000) except: - try: - waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", addBranchWildcardToRoot(myCompTE), 1000) - except: - test.fail("Refactoring failed - file MyComponent.qml was not generated properly in project explorer") - saveAndExit() - return - test.passes("Refactoring - file MyComponent.qml was generated properly in project explorer") + pass # open MyComponent.qml file for verification - if not openDocument(myCompTE): + if not test.verify(openDocument(myCompTE), + "Was MyComponent.qml properly generated in project explorer?"): test.fatal("Could not open MyComponent.qml.") saveAndExit() return From d8b5f32e5aff3601492106c1515ca3987e48950d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 1 Feb 2023 13:43:40 +0100 Subject: [PATCH 2/6] QtSupport: Fix missing object name Used in squish tests. Change-Id: Ib0eadfd295a5f03449509d70d1e1dfd1601e616b Reviewed-by: hjk --- src/plugins/qtsupport/qtoptionspage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index b1f3c129712..56bd6d47224 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -253,6 +253,7 @@ QtOptionsPageWidget::QtOptionsPageWidget() m_nameEdit = new QLineEdit; m_qmakePath = new QLabel; + m_qmakePath->setObjectName("qmakePath"); // for Squish m_qmakePath->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); m_qmakePath->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse); From 476f67cce5797bd9639c3bc3e29c332af64557c0 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 1 Feb 2023 14:42:24 +0100 Subject: [PATCH 3/6] SquishTests: Fix default settings test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Depending on the presence of the llvm that had been used when building QC we need to expect its clang. Use special environment variable to be able to do this correctly. Change-Id: I2497bbd96483f37aa90842d7fffa5d0a8103ff45 Reviewed-by: Robert Löhning --- tests/system/suite_general/tst_default_settings/test.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index c8814d8eef1..ebb8ef0dd46 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -31,6 +31,13 @@ def __checkKits__(): mouseClick(waitForObjectItem(":Options_QListView", "Kits")) # check compilers expectedCompilers = __getExpectedCompilers__() + llvmForBuild = os.getenv("SYSTEST_LLVM_FROM_BUILD", None) + if llvmForBuild is not None: + internalClangExe = os.path.join(llvmForBuild, "bin", "clang") + if platform.system() in ("Microsoft", "Windows"): + internalClangExe.append(".exe") + if os.path.exists(internalClangExe): + expectedCompilers.append(internalClangExe) foundCompilers = [] foundCompilerNames = [] clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Compilers") From 1d6d01952b0d59b153f8bf82d7f6f358c52d551a Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 9 Nov 2022 10:36:19 +0100 Subject: [PATCH 4/6] SquishTests: Fix tst_cmake_speedcrunch Change-Id: I76b199a7e1f2e92b78b42ee08342a95bdf385950 Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/shared/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index bd2a80452e0..5cbb1e43f3c 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -418,7 +418,7 @@ def __chooseTargets__(targets, availableTargets=None, additionalFunc=None): "window=':Qt Creator_Core::Internal::MainWindow' " "summaryText='%s' visible='1'}" % Targets.getStringForTarget(current)) - detailsButton = getChildByClass(detailsWidget, "Utils::DetailsButton") + detailsButton = getChildByClass(detailsWidget, "QToolButton") clickButton(detailsButton) additionalFunc() clickButton(detailsButton) From 51cbfd77db86f3d35ed80d5fdb75bc8fdb11a773 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 31 Jan 2023 16:14:36 +0100 Subject: [PATCH 5/6] CMakePM: Improve CMake presets kit config hashing Amends a3153c535d7e9e64fab530d86e64ab76ef4988e0 QT_QMAKE_EXECUTABLE was not taken into consideration and this would result in not matching kits. Also Visual Studio generator will not have a CMAKE_C|XX_COMPILER values in the cache. On Windows there could be paths with "C:" vs "c:" and the hashes again wouldn't match. Change-Id: I5da5fafbd29f3d1fd8c9615c41b7659e63c30ff1 Reviewed-by: Alessandro Portale --- .../cmakekitinformation.cpp | 14 +++++-- .../cmakeprojectmanager/cmakekitinformation.h | 3 +- .../cmakeprojectimporter.cpp | 37 ++++++++++++++++++- tests/manual/cmakepresets/CMakePresets.json | 10 ++--- 4 files changed, 53 insertions(+), 11 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index 6e7638e2d03..5fbf06505d4 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -1145,7 +1145,10 @@ void CMakeConfigurationKitAspect::setKitDefaultConfigHash(ProjectExplorer::Kit * expanded.value = item.expandedValue(k).toUtf8(); return expanded; }); - const QByteArray kitHash = computeDefaultConfigHash(defaultConfigExpanded); + const CMakeTool *const tool = CMakeKitAspect::cmakeTool(k); + const QByteArray kitHash = computeDefaultConfigHash(defaultConfigExpanded, + tool ? tool->cmakeExecutable() + : FilePath()); CMakeConfig config = configuration(k); config.append(CMakeConfigItem(QTC_KIT_DEFAULT_CONFIG_HASH, CMakeConfigItem::INTERNAL, kitHash)); @@ -1161,7 +1164,8 @@ CMakeConfigItem CMakeConfigurationKitAspect::kitDefaultConfigHashItem(const Proj }); } -QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConfig &config) +QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConfig &config, + const FilePath &cmakeBinary) { const CMakeConfig defaultConfig = defaultConfiguration(nullptr); const QByteArray configValues = std::accumulate(defaultConfig.begin(), @@ -1171,7 +1175,11 @@ QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConf const CMakeConfigItem &item) { return sum += config.valueOf(item.key); }); - return QCryptographicHash::hash(configValues, QCryptographicHash::Md5).toHex(); + return QCryptographicHash::hash(cmakeBinary.caseSensitivity() == Qt::CaseInsensitive + ? configValues.toLower() + : configValues, + QCryptographicHash::Md5) + .toHex(); } QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.h b/src/plugins/cmakeprojectmanager/cmakekitinformation.h index 25b7b7f3f7d..66e54280b80 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.h +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.h @@ -93,7 +93,8 @@ public: static void setKitDefaultConfigHash(ProjectExplorer::Kit *k); static CMakeConfigItem kitDefaultConfigHashItem(const ProjectExplorer::Kit *k); - static QByteArray computeDefaultConfigHash(const CMakeConfig &config); + static QByteArray computeDefaultConfigHash(const CMakeConfig &config, + const Utils::FilePath &cmakeBinary); // KitAspect interface ProjectExplorer::Tasks validate(const ProjectExplorer::Kit *k) const final; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index b2e0e6f12df..840e0108cea 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -464,6 +464,35 @@ void updateCompilerPaths(CMakeConfig &config, const Environment &env) updateRelativePath("CMAKE_CXX_COMPILER"); } +void updateConfigWithDirectoryData(CMakeConfig &config, const std::unique_ptr &data) +{ + auto updateCompilerValue = [&config, &data](const QByteArray &key, const Utils::Id &language) { + auto it = std::find_if(config.begin(), config.end(), [&key](const CMakeConfigItem &ci) { + return ci.key == key; + }); + + auto tcd = Utils::findOrDefault(data->toolChains, + [&language](const ToolChainDescription &t) { + return t.language == language; + }); + + if (it != config.end() && it->value.isEmpty()) + it->value = tcd.compilerPath.toString().toUtf8(); + else + config << CMakeConfigItem(key, + CMakeConfigItem::FILEPATH, + tcd.compilerPath.toString().toUtf8()); + }; + + updateCompilerValue("CMAKE_C_COMPILER", ProjectExplorer::Constants::C_LANGUAGE_ID); + updateCompilerValue("CMAKE_CXX_COMPILER", ProjectExplorer::Constants::CXX_LANGUAGE_ID); + + if (data->qt.qt) + config << CMakeConfigItem("QT_QMAKE_EXECUTABLE", + CMakeConfigItem::FILEPATH, + data->qt.qt->qmakeFilePath().toString().toUtf8()); +} + QList CMakeProjectImporter::examineDirectory(const FilePath &importPath, QString *warningMessage) const { @@ -550,8 +579,6 @@ QList CMakeProjectImporter::examineDirectory(const FilePath &importPath, CMakeConfigItem::STRING, configurePreset.generator.value().toUtf8()); } - data->cmakePresetDefaultConfigHash = CMakeConfigurationKitAspect::computeDefaultConfigHash( - config); const FilePath qmake = qmakeFromCMakeCache(config); if (!qmake.isEmpty()) @@ -560,6 +587,12 @@ QList CMakeProjectImporter::examineDirectory(const FilePath &importPath, // ToolChains: data->toolChains = extractToolChainsFromCache(config); + // Update QT_QMAKE_EXECUTABLE and CMAKE_C|XX_COMPILER config values + updateConfigWithDirectoryData(config, data); + + data->cmakePresetDefaultConfigHash + = CMakeConfigurationKitAspect::computeDefaultConfigHash(config, data->cmakeBinary); + QByteArrayList buildConfigurationTypes = {cache.valueOf("CMAKE_BUILD_TYPE")}; if (buildConfigurationTypes.front().isEmpty()) { buildConfigurationTypes.clear(); diff --git a/tests/manual/cmakepresets/CMakePresets.json b/tests/manual/cmakepresets/CMakePresets.json index 90e2df58369..da98c991baa 100644 --- a/tests/manual/cmakepresets/CMakePresets.json +++ b/tests/manual/cmakepresets/CMakePresets.json @@ -12,7 +12,7 @@ "generator": "Ninja", "installDir": "../inst-${presetName}", "cacheVariables": { - "CMAKE_PREFIX_PATH": "$env{SYSTEMDRIVE}/Qt/6.3.2/mingw_64" + "CMAKE_PREFIX_PATH": "$env{SYSTEMDRIVE}/Qt/6.4.2/mingw_64" }, "condition": { "type": "equals", @@ -34,7 +34,7 @@ "inherits" : "mingw", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release", - "CMAKE_PREFIX_PATH": "$env{SystemDrive}/Qt/6.3.2/mingw_64" + "CMAKE_PREFIX_PATH": "$env{SystemDrive}/Qt/6.4.2/mingw_64" } }, { @@ -56,7 +56,7 @@ }, "environment" : { "HOST_SYSTEM_NAME": "Windows", - "QT_VERSION": "6.3.2" + "QT_VERSION": "6.4.2" } }, { @@ -64,7 +64,7 @@ "displayName": "Visual C++ 2019 x64 Ninja", "generator": "Ninja", "binaryDir": "${sourceDir}/build-${presetName}", - "toolchainFile" : "c:/Qt/6.3.2/msvc2019_64/lib/cmake/Qt6/qt.toolchain.cmake", + "toolchainFile" : "c:/Qt/6.4.2/msvc2019_64/lib/cmake/Qt6/qt.toolchain.cmake", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }, @@ -92,7 +92,7 @@ "displayName": "Linux GCC", "generator": "Ninja", "binaryDir": "${sourceDir}/build-${presetName}", - "toolchainFile" : "$env{HOME}/Qt/6.3.2/gcc_64/lib/cmake/Qt6/qt.toolchain.cmake", + "toolchainFile" : "$env{HOME}/Qt/6.4.2/gcc_64/lib/cmake/Qt6/qt.toolchain.cmake", "condition" : { "type": "equals", "lhs": "${hostSystemName}", From dd3f5d3a6a6803b0ac6ce37d861ab27e0b25eb19 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 3 Feb 2023 08:56:02 +0100 Subject: [PATCH 6/6] SquishTests: Fix designer test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Children inside the object inspector are sorted lexicographically nowadays. Change-Id: I2f704e3a3cca526246babb2b12d48fe359eb6e6b Reviewed-by: Robert Löhning --- tests/system/suite_tools/tst_designer_edit/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/suite_tools/tst_designer_edit/test.py b/tests/system/suite_tools/tst_designer_edit/test.py index 850490674d6..e0dd8685186 100644 --- a/tests/system/suite_tools/tst_designer_edit/test.py +++ b/tests/system/suite_tools/tst_designer_edit/test.py @@ -67,8 +67,8 @@ def performEditMenu(): "visible='1' window=':Qt Creator_Core::Internal::MainWindow'} " "type='QTreeView' unnamed='1' visible='1'}") tree = __iterateChildren__(objInspTV.model(), None) - expectedMenuSequence = [["menuSquishTestFile", 2], ["actionOpen", 3], ["separator", 3], - ["actionShutdown", 3]] + expectedMenuSequence = [["menuSquishTestFile", 2], ["actionOpen", 3], ["actionShutdown", 3], + ["separator", 3]] seqStart = tree.index(expectedMenuSequence[0]) test.verify(seqStart != -1 and tree[seqStart:seqStart + 4] == expectedMenuSequence, "Verify Object Inspector contains expected menu inclusive children.")