AutoTest: Support multiple test cases for Qt

Multiple testcases inside a single executable are not
supported officially, but widely used.
Detect them and handle them as appropriate as possible.
Single test functions or data tags are not selectable
as they cannot get addressed correctly and rely
strongly on the implementation of the test main.

Fixes: QTCREATORBUG-18347
Change-Id: I0f0f42579709d8896e034a6df356cb560291d2ba
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2021-04-23 13:40:46 +02:00
parent 0147fdfc8c
commit 615b37193b
8 changed files with 146 additions and 61 deletions

View File

@@ -36,11 +36,19 @@ namespace Autotest {
class ITestFramework;
namespace Internal {
struct TestCase
{
QString name;
bool multipleTestCases;
};
using TestCases = QList<TestCase>;
namespace QTestUtils {
bool isQTestMacro(const QByteArray &macro);
QHash<Utils::FilePath, QString> testCaseNamesForFiles(ITestFramework *framework,
const Utils::FilePaths &files);
QHash<Utils::FilePath, TestCases> testCaseNamesForFiles(ITestFramework *framework,
const Utils::FilePaths &files);
QMultiHash<Utils::FilePath, Utils::FilePath> alternativeFiles(ITestFramework *framework,
const Utils::FilePaths &files);
QStringList filterInterfering(const QStringList &provided, QStringList *omitted, bool isQuickTest);