diff options
author | Christian Stenger <[email protected]> | 2017-09-13 11:03:29 +0200 |
---|---|---|
committer | Christian Stenger <[email protected]> | 2017-09-26 07:00:57 +0000 |
commit | 090dea66eea8a29dd3c7a798927dc7610c2d11ce (patch) | |
tree | 77067bda146193a12f6a3dcf6d1c6cf5304a53fa /src/plugins/autotest/testconfiguration.cpp | |
parent | 3c602b32d4914768465e0b226b2f996081333e08 (diff) |
AutoTest: Use single build target as fallback
If we cannot find the respective build target to execute
tests, but we only have a single build target then
we now assume that this will be the right one.
Change-Id: I0f7c3c4f371bce3a7f328e7c28dc61cadf7f6e9e
Reviewed-by: Oliver Wolff <[email protected]>
Diffstat (limited to 'src/plugins/autotest/testconfiguration.cpp')
-rw-r--r-- | src/plugins/autotest/testconfiguration.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index 396fbb4f1c8..1bdb794abdf 100644 --- a/src/plugins/autotest/testconfiguration.cpp +++ b/src/plugins/autotest/testconfiguration.cpp @@ -90,7 +90,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) const QSet<QString> buildSystemTargets = m_buildTargets; qCDebug(LOG) << "BuildSystemTargets\n " << buildSystemTargets; - const BuildTargetInfo targetInfo + BuildTargetInfo targetInfo = Utils::findOrDefault(target->applicationTargets().list, [&buildSystemTargets] (const BuildTargetInfo &bti) { return Utils::anyOf(buildSystemTargets, [&bti](const QString &b) { @@ -101,11 +101,19 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) && targWithProjectFile.at(1).startsWith(bti.projectFilePath.toString()); }); }); - if (!QTC_GUARD(!targetInfo.targetFilePath.isEmpty())) { // empty if BTI default created + // 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()) { qCDebug(LOG) << "BuildTargetInfos"; - for (const BuildTargetInfo &bti : target->applicationTargets().list) - qCDebug(LOG) << " " << bti.targetName << bti.projectFilePath << bti.targetFilePath; + const QList<BuildTargetInfo> buildTargets = target->applicationTargets().list; + // if there is only one build target just use it (but be honest that we're guessing) + if (buildTargets.size() == 1) { + targetInfo = buildTargets.first(); + m_guessedConfiguration = true; + m_guessedFrom = targetInfo.targetName; + } } + const QString localExecutable = ensureExeEnding(targetInfo.targetFilePath.toString()); QString buildBase; |