From 0a7e6ef44ff44a5ad3e67fb35b9460e1c6e58aab Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 29 Sep 2022 12:34:24 +0200 Subject: [PATCH] Squish: Fix handling of test cases Squish uses the test case entries inside the suite.conf only for sorting and determining the run order. In fact all folders inside a suite that match the common pattern will be used. Adapt our handling accordingly. Change-Id: I57121bb7715c648b6f0416012c71227261e140b9 Reviewed-by: David Schulz --- src/plugins/squish/squishnavigationwidget.cpp | 5 +++-- src/plugins/squish/suiteconf.cpp | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/plugins/squish/squishnavigationwidget.cpp b/src/plugins/squish/squishnavigationwidget.cpp index f83ea82ca10..b7390fdb574 100644 --- a/src/plugins/squish/squishnavigationwidget.cpp +++ b/src/plugins/squish/squishnavigationwidget.cpp @@ -251,8 +251,9 @@ void SquishNavigationWidget::onItemActivated(const QModelIndex &idx) break; } - if (!item->filePath().isEmpty()) - Core::EditorManager::openEditor(Utils::FilePath::fromString(item->filePath())); + auto filePath = Utils::FilePath::fromString(item->filePath()); + if (filePath.exists()) + Core::EditorManager::openEditor(filePath); } void SquishNavigationWidget::onExpanded(const QModelIndex &idx) diff --git a/src/plugins/squish/suiteconf.cpp b/src/plugins/squish/suiteconf.cpp index dddb28b1769..94b78900ec1 100644 --- a/src/plugins/squish/suiteconf.cpp +++ b/src/plugins/squish/suiteconf.cpp @@ -260,10 +260,19 @@ QStringList SuiteConf::validTestCases(const QString &baseDirectory) const Utils::FilePath testCaseDir = subDir / testCase; if (testCaseDir.isDir()) { Utils::FilePath testCaseTest = testCaseDir.pathAppended("test" + extension); - if (testCaseTest.isFile()) - validCases.append(testCaseTest.toString()); + validCases.append(testCaseTest.toString()); } } + + // now unlisted matching tests (suite.conf's TEST_CASES is used for some ordering) + const Utils::FilePaths entries = subDir.dirEntries(QDir::Dirs | QDir::NoDotAndDotDot); + for (const Utils::FilePath &entry : entries) { + if (!entry.fileName().startsWith("tst_")) + continue; + const QString testFileStr = entry.pathAppended("test" + extension).toString(); + if (!validCases.contains(testFileStr)) + validCases.append(testFileStr); + } } return validCases; }