2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
#include "testconfiguration.h"
|
2020-10-09 13:07:55 +02:00
|
|
|
|
2020-10-13 11:37:37 +02:00
|
|
|
#include "itestframework.h"
|
2016-06-15 12:29:24 +02:00
|
|
|
#include "testrunconfiguration.h"
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-01-26 17:24:11 +01:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2020-03-23 14:14:03 +01:00
|
|
|
#include <projectexplorer/buildsystem.h>
|
2015-04-27 16:11:28 +02:00
|
|
|
#include <projectexplorer/buildtargetinfo.h>
|
2017-07-12 15:53:31 +02:00
|
|
|
#include <projectexplorer/deploymentdata.h>
|
2016-01-25 15:00:20 +01:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
2015-04-27 16:11:28 +02:00
|
|
|
#include <projectexplorer/runconfiguration.h>
|
2023-02-14 15:47:22 +01:00
|
|
|
#include <projectexplorer/projectmanager.h>
|
2015-04-27 16:11:28 +02:00
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
|
TestRunner: Reuse TaskTree
Get rid of QFutureInterface argument from
ITestConfiguration::createOutputReader() and from
TestOutputReader c'tor.
The fine-grained progress reporting was broken anyway:
1. The assumption was that testCaseCount was meant to be
the total number of test functions executed. It didn't
include the initTestCase() and cleanupTestCase(),
while those were reported on runtime apparently
(and exceeding the max progress by 2).
2. In case of tst_qtcprocess, when the whole test was run,
the testCaseCount reported 41, while the real
number of functions was 26 (+2 = 28 for init/cleanup).
3. While the max progress was set to testCaseCount initially,
the corresponding FutureProgress rendered the progress
always in 0-100 range, what didn't match the reality.
Instead, rely on TaskTree progress, which resolution
is per test as a whole. So, when executing a series
of tests this should scale fine. In addition, the
progress advances fluently according to the expected
run time - with 10 seconds hardcoded.
The original code locations, where progress was bumped,
are left with a TODO comment for any possible future tweaks.
Like in case of result reporting, fine-grained progress
reporting may be implemented by providing additional signal,
so there is no need for QFutureInterface inside
TestOutputReader.
Change-Id: Idc11d55e3a49dac8d1788948b9a82f68199203c6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-17 00:45:50 +01:00
|
|
|
#include <utils/algorithm.h>
|
|
|
|
|
|
2017-07-31 14:59:35 +02:00
|
|
|
#include <QLoggingCategory>
|
|
|
|
|
|
2018-10-12 09:33:30 +03:00
|
|
|
static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.testconfiguration", QtWarningMsg)
|
2017-07-31 14:59:35 +02:00
|
|
|
|
2015-04-27 16:11:28 +02:00
|
|
|
using namespace ProjectExplorer;
|
2019-06-20 17:19:12 +02:00
|
|
|
using namespace Utils;
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
|
2021-08-11 06:49:25 +02:00
|
|
|
ITestConfiguration::ITestConfiguration(ITestBase *testBase)
|
2020-10-13 11:37:37 +02:00
|
|
|
: m_testBase(testBase)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-02 18:02:10 +02:00
|
|
|
void ITestConfiguration::setWorkingDirectory(const FilePath &workingDirectory)
|
2020-10-13 11:37:37 +02:00
|
|
|
{
|
|
|
|
|
m_runnable.workingDirectory = workingDirectory;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-11 06:49:25 +02:00
|
|
|
FilePath ITestConfiguration::workingDirectory() const
|
2020-10-13 11:37:37 +02:00
|
|
|
{
|
|
|
|
|
if (!m_runnable.workingDirectory.isEmpty()) {
|
2021-08-02 18:02:10 +02:00
|
|
|
if (m_runnable.workingDirectory.isDir()) // ensure wanted working dir does exist
|
|
|
|
|
return m_runnable.workingDirectory.absoluteFilePath();
|
2020-10-13 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
2021-08-11 06:49:25 +02:00
|
|
|
const FilePath executable = executableFilePath();
|
2021-05-26 15:50:03 +02:00
|
|
|
return executable.isEmpty() ? executable : executable.absolutePath();
|
2020-10-13 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ITestConfiguration::hasExecutable() const
|
|
|
|
|
{
|
2021-08-10 09:19:30 +02:00
|
|
|
return !m_runnable.command.isEmpty();
|
2020-10-13 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
2021-08-11 06:49:25 +02:00
|
|
|
FilePath ITestConfiguration::executableFilePath() const
|
2020-10-13 11:37:37 +02:00
|
|
|
{
|
|
|
|
|
if (!hasExecutable())
|
2021-05-26 15:50:03 +02:00
|
|
|
return {};
|
2020-10-13 11:37:37 +02:00
|
|
|
|
2023-01-27 12:30:03 +01:00
|
|
|
const Environment env = m_runnable.environment.hasChanges()
|
2022-06-01 15:19:31 +02:00
|
|
|
? m_runnable.environment : Environment::systemEnvironment();
|
2021-11-09 12:33:00 +01:00
|
|
|
return env.searchInPath(m_runnable.command.executable().path());
|
2020-10-13 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
2020-10-19 14:42:25 +02:00
|
|
|
Environment ITestConfiguration::filteredEnvironment(const Environment &original) const
|
|
|
|
|
{
|
|
|
|
|
return original;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-26 10:11:39 +01:00
|
|
|
TestConfiguration::TestConfiguration(ITestFramework *framework)
|
2020-10-13 11:37:37 +02:00
|
|
|
: ITestConfiguration(framework)
|
2020-03-26 10:11:39 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
TestConfiguration::~TestConfiguration()
|
|
|
|
|
{
|
|
|
|
|
m_testCases.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 09:02:23 +01:00
|
|
|
static bool isLocal(Target *target)
|
2015-04-27 16:11:28 +02:00
|
|
|
{
|
2018-05-31 07:38:04 +02:00
|
|
|
Kit *kit = target ? target->kit() : nullptr;
|
2019-02-06 12:50:51 +01:00
|
|
|
return DeviceTypeKitAspect::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
2015-04-27 16:11:28 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-20 17:19:12 +02:00
|
|
|
static FilePath ensureExeEnding(const FilePath &file)
|
2017-07-12 15:53:31 +02:00
|
|
|
{
|
2019-06-20 17:19:12 +02:00
|
|
|
if (!HostOsInfo::isWindowsHost() || file.isEmpty() || file.toString().toLower().endsWith(".exe"))
|
2017-07-12 15:53:31 +02:00
|
|
|
return file;
|
2021-08-11 08:28:29 +02:00
|
|
|
return file.withExecutableSuffix();
|
2017-07-12 15:53:31 +02:00
|
|
|
}
|
|
|
|
|
|
TestRunner: Reuse TaskTree
Get rid of QFutureInterface argument from
ITestConfiguration::createOutputReader() and from
TestOutputReader c'tor.
The fine-grained progress reporting was broken anyway:
1. The assumption was that testCaseCount was meant to be
the total number of test functions executed. It didn't
include the initTestCase() and cleanupTestCase(),
while those were reported on runtime apparently
(and exceeding the max progress by 2).
2. In case of tst_qtcprocess, when the whole test was run,
the testCaseCount reported 41, while the real
number of functions was 26 (+2 = 28 for init/cleanup).
3. While the max progress was set to testCaseCount initially,
the corresponding FutureProgress rendered the progress
always in 0-100 range, what didn't match the reality.
Instead, rely on TaskTree progress, which resolution
is per test as a whole. So, when executing a series
of tests this should scale fine. In addition, the
progress advances fluently according to the expected
run time - with 10 seconds hardcoded.
The original code locations, where progress was bumped,
are left with a TODO comment for any possible future tweaks.
Like in case of result reporting, fine-grained progress
reporting may be implemented by providing additional signal,
so there is no need for QFutureInterface inside
TestOutputReader.
Change-Id: Idc11d55e3a49dac8d1788948b9a82f68199203c6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-17 00:45:50 +01:00
|
|
|
void TestConfiguration::completeTestInformation(RunConfiguration *rc,
|
2017-09-13 14:27:20 +02:00
|
|
|
TestRunMode runMode)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(rc, return);
|
2020-10-13 11:37:37 +02:00
|
|
|
QTC_ASSERT(project(), return);
|
2018-06-21 10:36:50 +02:00
|
|
|
|
2017-09-28 13:51:31 +02:00
|
|
|
if (hasExecutable()) {
|
|
|
|
|
qCDebug(LOG) << "Executable has been set already - not completing configuration again.";
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-02-14 15:47:22 +01:00
|
|
|
Project *startupProject = ProjectManager::startupProject();
|
2020-10-13 11:37:37 +02:00
|
|
|
if (!startupProject || startupProject != project())
|
2017-09-13 14:27:20 +02:00
|
|
|
return;
|
|
|
|
|
|
2020-10-13 11:37:37 +02:00
|
|
|
Target *target = startupProject->activeTarget();
|
2017-09-13 14:27:20 +02:00
|
|
|
if (!target)
|
|
|
|
|
return;
|
|
|
|
|
|
2019-08-13 15:12:54 +02:00
|
|
|
if (!target->runConfigurations().contains(rc))
|
2017-09-13 14:27:20 +02:00
|
|
|
return;
|
|
|
|
|
|
2018-05-16 15:42:03 +02:00
|
|
|
m_runnable = rc->runnable();
|
2020-10-13 11:37:37 +02:00
|
|
|
setDisplayName(rc->displayName());
|
2017-09-13 14:27:20 +02:00
|
|
|
|
2019-02-18 18:24:10 +01:00
|
|
|
BuildTargetInfo targetInfo = rc->buildTargetInfo();
|
2017-09-13 14:27:20 +02:00
|
|
|
if (!targetInfo.targetFilePath.isEmpty())
|
2021-08-10 09:19:30 +02:00
|
|
|
m_runnable.command.setExecutable(ensureExeEnding(targetInfo.targetFilePath));
|
2017-09-13 14:27:20 +02:00
|
|
|
|
2021-08-11 06:49:25 +02:00
|
|
|
FilePath buildBase;
|
2017-09-13 14:27:20 +02:00
|
|
|
if (auto buildConfig = target->activeBuildConfiguration()) {
|
2021-05-26 15:50:03 +02:00
|
|
|
buildBase = buildConfig->buildDirectory();
|
2020-10-13 11:37:37 +02:00
|
|
|
const QString projBase = startupProject->projectDirectory().toString();
|
2017-09-13 14:27:20 +02:00
|
|
|
if (m_projectFile.startsWith(projBase))
|
2021-05-26 15:50:03 +02:00
|
|
|
m_buildDir = (buildBase / m_projectFile.toString().mid(projBase.length())).absolutePath();
|
2017-09-13 14:27:20 +02:00
|
|
|
}
|
|
|
|
|
if (runMode == TestRunMode::Debug || runMode == TestRunMode::DebugWithoutDeploy)
|
2019-08-19 10:55:32 +02:00
|
|
|
m_runConfig = new Internal::TestRunConfiguration(rc->target(), this);
|
2017-09-13 14:27:20 +02:00
|
|
|
}
|
|
|
|
|
|
2017-09-05 13:57:22 +02:00
|
|
|
void TestConfiguration::completeTestInformation(TestRunMode runMode)
|
2015-04-27 16:11:28 +02:00
|
|
|
{
|
2017-02-21 14:53:58 +01:00
|
|
|
QTC_ASSERT(!m_projectFile.isEmpty(), return);
|
2017-06-09 09:30:21 +02:00
|
|
|
QTC_ASSERT(!m_buildTargets.isEmpty(), return);
|
2020-10-13 11:37:37 +02:00
|
|
|
QTC_ASSERT(project(), return);
|
2015-04-27 16:11:28 +02:00
|
|
|
|
2017-09-13 14:27:20 +02:00
|
|
|
if (m_origRunConfig) {
|
|
|
|
|
qCDebug(LOG) << "Using run configuration specified by user or found by first call";
|
|
|
|
|
completeTestInformation(m_origRunConfig, runMode);
|
|
|
|
|
if (hasExecutable()) {
|
2021-08-10 09:19:30 +02:00
|
|
|
qCDebug(LOG) << "Completed.\nCommand:" << m_runnable.command.toUserOutput()
|
2017-09-13 14:27:20 +02:00
|
|
|
<< "\nWorking directory:" << m_runnable.workingDirectory;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
qCDebug(LOG) << "Failed to complete - using 'normal' way.";
|
|
|
|
|
}
|
2023-02-14 15:47:22 +01:00
|
|
|
Project *startupProject = ProjectManager::startupProject();
|
2020-10-13 11:37:37 +02:00
|
|
|
if (!startupProject || startupProject != project()) {
|
|
|
|
|
setProject(nullptr);
|
2015-04-27 16:11:28 +02:00
|
|
|
return;
|
2018-06-21 10:36:50 +02:00
|
|
|
}
|
2015-04-27 16:11:28 +02:00
|
|
|
|
2020-10-13 11:37:37 +02:00
|
|
|
Target *target = startupProject->activeTarget();
|
2015-04-27 16:11:28 +02:00
|
|
|
if (!target)
|
|
|
|
|
return;
|
2017-07-31 14:59:35 +02:00
|
|
|
qCDebug(LOG) << "ActiveTargetName\n " << target->displayName();
|
|
|
|
|
if (const auto kit = target->kit())
|
|
|
|
|
qCDebug(LOG) << "SupportedPlatforms\n " << kit->supportedPlatforms();
|
2015-04-27 16:11:28 +02:00
|
|
|
|
2017-06-09 09:30:21 +02:00
|
|
|
const QSet<QString> buildSystemTargets = m_buildTargets;
|
2017-07-31 14:59:35 +02:00
|
|
|
qCDebug(LOG) << "BuildSystemTargets\n " << buildSystemTargets;
|
2020-07-01 17:01:10 +02:00
|
|
|
const QList<BuildTargetInfo> buildTargets
|
|
|
|
|
= Utils::filtered(target->buildSystem()->applicationTargets(),
|
|
|
|
|
[&buildSystemTargets](const BuildTargetInfo &bti) {
|
2018-04-13 09:22:26 +02:00
|
|
|
return buildSystemTargets.contains(bti.buildKey);
|
2017-02-01 15:42:55 +01:00
|
|
|
});
|
2020-07-01 17:01:10 +02:00
|
|
|
if (buildTargets.size() > 1 ) // there are multiple executables with the same build target
|
|
|
|
|
return; // let the user decide which one to run
|
|
|
|
|
|
2020-08-04 08:21:26 +02:00
|
|
|
const BuildTargetInfo targetInfo = buildTargets.size() ? buildTargets.first()
|
|
|
|
|
: BuildTargetInfo();
|
2020-07-01 17:01:10 +02:00
|
|
|
|
2017-09-13 11:03:29 +02:00
|
|
|
// we might end up with an empty targetFilePath - e.g. when having a library we just link to
|
|
|
|
|
// there would be no BuildTargetInfo that could match
|
|
|
|
|
if (targetInfo.targetFilePath.isEmpty()) {
|
2017-07-31 14:59:35 +02:00
|
|
|
qCDebug(LOG) << "BuildTargetInfos";
|
2018-09-21 09:10:54 +02:00
|
|
|
// if there is only one build target just use it (but be honest that we're deducing)
|
2020-07-01 17:01:10 +02:00
|
|
|
m_deducedConfiguration = true;
|
|
|
|
|
m_deducedFrom = targetInfo.buildKey;
|
2017-07-31 14:59:35 +02:00
|
|
|
}
|
2017-09-13 11:03:29 +02:00
|
|
|
|
2019-06-20 17:19:12 +02:00
|
|
|
const FilePath localExecutable = ensureExeEnding(targetInfo.targetFilePath);
|
2017-09-22 12:19:13 +02:00
|
|
|
if (localExecutable.isEmpty())
|
|
|
|
|
return;
|
2017-07-12 15:53:31 +02:00
|
|
|
|
2021-08-11 06:49:25 +02:00
|
|
|
FilePath buildBase;
|
2017-07-12 15:53:31 +02:00
|
|
|
if (auto buildConfig = target->activeBuildConfiguration()) {
|
2021-05-26 15:50:03 +02:00
|
|
|
buildBase = buildConfig->buildDirectory();
|
2020-10-13 11:37:37 +02:00
|
|
|
const QString projBase = startupProject->projectDirectory().toString();
|
2017-07-12 15:53:31 +02:00
|
|
|
if (m_projectFile.startsWith(projBase))
|
2021-05-26 15:50:03 +02:00
|
|
|
m_buildDir = (buildBase / m_projectFile.toString().mid(projBase.length())).absolutePath();
|
2017-06-26 10:25:46 +02:00
|
|
|
}
|
|
|
|
|
|
2017-07-12 15:53:31 +02:00
|
|
|
// deployment information should get taken into account, but it pretty much seems as if
|
|
|
|
|
// each build system uses it differently
|
|
|
|
|
const DeploymentData &deployData = target->deploymentData();
|
2019-08-27 13:47:24 +02:00
|
|
|
const DeployableFile deploy = deployData.deployableForLocalFile(localExecutable);
|
2017-07-12 15:53:31 +02:00
|
|
|
// we might have a deployable executable
|
2019-06-20 17:19:12 +02:00
|
|
|
const FilePath deployedExecutable = ensureExeEnding((deploy.isValid() && deploy.isExecutable())
|
|
|
|
|
? FilePath::fromString(QDir::cleanPath(deploy.remoteFilePath())) : localExecutable);
|
2017-07-12 15:53:31 +02:00
|
|
|
|
2017-07-31 14:59:35 +02:00
|
|
|
qCDebug(LOG) << " LocalExecutable" << localExecutable;
|
|
|
|
|
qCDebug(LOG) << " DeployedExecutable" << deployedExecutable;
|
2020-10-15 13:30:11 +02:00
|
|
|
qCDebug(LOG) << "Iterating run configurations - prefer active over others";
|
|
|
|
|
QList<RunConfiguration *> runConfigurations = target->runConfigurations();
|
|
|
|
|
runConfigurations.removeOne(target->activeRunConfiguration());
|
|
|
|
|
runConfigurations.prepend(target->activeRunConfiguration());
|
2022-10-07 14:46:06 +02:00
|
|
|
for (RunConfiguration *runConfig : std::as_const(runConfigurations)) {
|
2017-07-31 14:59:35 +02:00
|
|
|
qCDebug(LOG) << "RunConfiguration" << runConfig->id();
|
2019-03-13 09:02:23 +01:00
|
|
|
if (!isLocal(target)) { // TODO add device support
|
2017-07-31 14:59:35 +02:00
|
|
|
qCDebug(LOG) << " Skipped as not being local";
|
2017-02-01 15:42:55 +01:00
|
|
|
continue;
|
2017-07-31 14:59:35 +02:00
|
|
|
}
|
2017-02-01 15:42:55 +01:00
|
|
|
|
2018-05-16 15:42:03 +02:00
|
|
|
const Runnable runnable = runConfig->runnable();
|
2017-07-12 15:53:31 +02:00
|
|
|
// not the best approach - but depending on the build system and whether the executables
|
|
|
|
|
// are going to get installed or not we have to soften the condition...
|
2021-08-10 09:19:30 +02:00
|
|
|
const FilePath currentExecutable = ensureExeEnding(runnable.command.executable());
|
2018-05-30 12:41:05 +02:00
|
|
|
const QString currentBST = runConfig->buildKey();
|
2017-07-31 14:59:35 +02:00
|
|
|
qCDebug(LOG) << " CurrentExecutable" << currentExecutable;
|
|
|
|
|
qCDebug(LOG) << " BST of RunConfig" << currentBST;
|
2017-07-12 15:53:31 +02:00
|
|
|
if ((localExecutable == currentExecutable)
|
|
|
|
|
|| (deployedExecutable == currentExecutable)
|
2018-05-30 12:41:05 +02:00
|
|
|
|| (buildSystemTargets.contains(currentBST))) {
|
2017-07-31 14:59:35 +02:00
|
|
|
qCDebug(LOG) << " Using this RunConfig.";
|
2017-09-13 14:27:20 +02:00
|
|
|
m_origRunConfig = runConfig;
|
2018-05-16 15:42:03 +02:00
|
|
|
m_runnable = runnable;
|
2021-08-10 09:19:30 +02:00
|
|
|
m_runnable.command.setExecutable(currentExecutable);
|
2020-10-13 11:37:37 +02:00
|
|
|
setDisplayName(runConfig->displayName());
|
2017-09-05 13:57:22 +02:00
|
|
|
if (runMode == TestRunMode::Debug || runMode == TestRunMode::DebugWithoutDeploy)
|
2019-08-19 10:55:32 +02:00
|
|
|
m_runConfig = new Internal::TestRunConfiguration(target, this);
|
2017-07-12 15:53:31 +02:00
|
|
|
break;
|
2015-04-27 16:11:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
2017-07-12 15:53:31 +02:00
|
|
|
|
2017-02-01 15:42:55 +01:00
|
|
|
// RunConfiguration for this target could be explicitly removed or not created at all
|
2017-07-12 15:53:31 +02:00
|
|
|
// or we might have end up using the (wrong) path of a locally installed executable
|
|
|
|
|
// for this case try the original executable path of the BuildTargetInfo (the executable
|
|
|
|
|
// before installation) to have at least something to execute
|
2017-09-13 14:27:20 +02:00
|
|
|
if (!hasExecutable() && !localExecutable.isEmpty())
|
2021-08-10 09:19:30 +02:00
|
|
|
m_runnable.command.setExecutable(localExecutable);
|
2020-10-13 11:37:37 +02:00
|
|
|
if (displayName().isEmpty() && hasExecutable()) {
|
2017-07-31 14:59:35 +02:00
|
|
|
qCDebug(LOG) << " Fallback";
|
2017-02-01 15:42:55 +01:00
|
|
|
// we failed to find a valid runconfiguration - but we've got the executable already
|
2016-01-25 15:00:20 +01:00
|
|
|
if (auto rc = target->activeRunConfiguration()) {
|
2019-03-13 09:02:23 +01:00
|
|
|
if (isLocal(target)) { // FIXME for now only Desktop support
|
2018-05-16 15:42:03 +02:00
|
|
|
const Runnable runnable = rc->runnable();
|
|
|
|
|
m_runnable.environment = runnable.environment;
|
2018-09-21 09:10:54 +02:00
|
|
|
m_deducedConfiguration = true;
|
|
|
|
|
m_deducedFrom = rc->displayName();
|
2018-05-16 15:42:03 +02:00
|
|
|
if (runMode == TestRunMode::Debug)
|
2019-08-19 10:55:32 +02:00
|
|
|
m_runConfig = new Internal::TestRunConfiguration(rc->target(), this);
|
2017-07-31 14:59:35 +02:00
|
|
|
} else {
|
|
|
|
|
qCDebug(LOG) << "not using the fallback as the current active run configuration "
|
|
|
|
|
"appears to be non-Desktop";
|
2016-01-25 15:00:20 +01:00
|
|
|
}
|
2015-04-27 16:11:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-13 11:37:37 +02:00
|
|
|
if (displayName().isEmpty()) // happens e.g. when deducing the TestConfiguration or error
|
|
|
|
|
setDisplayName(*buildSystemTargets.begin());
|
2017-02-01 15:42:55 +01:00
|
|
|
}
|
2015-04-27 16:11:28 +02:00
|
|
|
|
2014-11-06 16:01:06 +01:00
|
|
|
/**
|
|
|
|
|
* @brief sets the test cases for this test configuration.
|
|
|
|
|
*
|
|
|
|
|
* Watch out for special handling of test configurations, because this method also
|
|
|
|
|
* updates the test case count to the current size of \a testCases.
|
|
|
|
|
*
|
|
|
|
|
* @param testCases list of names of the test functions / test cases
|
|
|
|
|
*/
|
|
|
|
|
void TestConfiguration::setTestCases(const QStringList &testCases)
|
|
|
|
|
{
|
|
|
|
|
m_testCases.clear();
|
|
|
|
|
m_testCases << testCases;
|
2020-10-13 11:37:37 +02:00
|
|
|
setTestCaseCount(m_testCases.size());
|
2014-11-06 16:01:06 +01:00
|
|
|
}
|
|
|
|
|
|
2021-08-11 06:49:25 +02:00
|
|
|
void TestConfiguration::setProjectFile(const FilePath &projectFile)
|
2014-10-07 15:51:02 +02:00
|
|
|
{
|
2017-02-21 14:53:58 +01:00
|
|
|
m_projectFile = projectFile;
|
2014-10-07 15:51:02 +02:00
|
|
|
}
|
|
|
|
|
|
2021-05-26 15:50:03 +02:00
|
|
|
void TestConfiguration::setBuildDirectory(const FilePath &buildDirectory)
|
2016-01-26 17:24:11 +01:00
|
|
|
{
|
|
|
|
|
m_buildDir = buildDirectory;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-12 08:08:27 +02:00
|
|
|
void TestConfiguration::setInternalTarget(const QString &target)
|
|
|
|
|
{
|
|
|
|
|
m_buildTargets.clear();
|
|
|
|
|
m_buildTargets.insert(target);
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-09 09:30:21 +02:00
|
|
|
void TestConfiguration::setInternalTargets(const QSet<QString> &targets)
|
|
|
|
|
{
|
|
|
|
|
m_buildTargets = targets;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-13 14:27:20 +02:00
|
|
|
void TestConfiguration::setOriginalRunConfiguration(RunConfiguration *runConfig)
|
|
|
|
|
{
|
|
|
|
|
m_origRunConfig = runConfig;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-05 13:57:22 +02:00
|
|
|
bool DebuggableTestConfiguration::isDebugRunMode() const
|
|
|
|
|
{
|
|
|
|
|
return m_runMode == TestRunMode::Debug || m_runMode == TestRunMode::DebugWithoutDeploy;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-26 10:11:39 +01:00
|
|
|
ITestFramework *TestConfiguration::framework() const
|
|
|
|
|
{
|
2020-10-13 11:37:37 +02:00
|
|
|
return static_cast<ITestFramework *>(testBase());
|
2020-03-26 10:11:39 +01:00
|
|
|
}
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
} // namespace Autotest
|