forked from qt-creator/qt-creator
AutoTest: Fix source file construction on Windows
Task-number: QTCREATORBUG-15667 Change-Id: I4d0e81a39a5031403d77fb3e2179ed17451346b4 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cpptools/projectinfo.h>
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildtargetinfo.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
@@ -115,6 +116,7 @@ void TestConfiguration::completeTestInformation()
|
||||
QString workDir;
|
||||
QString proFile = m_proFile;
|
||||
QString displayName;
|
||||
QString buildDir;
|
||||
Project *targetProject = 0;
|
||||
Utils::Environment env;
|
||||
bool hasDesktopTarget = false;
|
||||
@@ -140,6 +142,15 @@ void TestConfiguration::completeTestInformation()
|
||||
}
|
||||
}
|
||||
|
||||
if (targetProject) {
|
||||
if (auto buildConfig = target->activeBuildConfiguration()) {
|
||||
const QString buildBase = buildConfig->buildDirectory().toString();
|
||||
const QString projBase = targetProject->projectDirectory().toString();
|
||||
if (proFile.startsWith(projBase))
|
||||
buildDir = QFileInfo(buildBase + proFile.mid(projBase.length())).absolutePath();
|
||||
}
|
||||
}
|
||||
|
||||
QList<RunConfiguration *> rcs = target->runConfigurations();
|
||||
foreach (RunConfiguration *rc, rcs) {
|
||||
Runnable runnable = rc->runnable();
|
||||
@@ -176,6 +187,7 @@ void TestConfiguration::completeTestInformation()
|
||||
setTargetFile(targetFile);
|
||||
setTargetName(targetName);
|
||||
setWorkingDirectory(workDir);
|
||||
setBuildDirectory(buildDir);
|
||||
setEnvironment(env);
|
||||
setProject(project);
|
||||
setGuessedConfiguration(guessedRunConfiguration);
|
||||
@@ -228,6 +240,11 @@ void TestConfiguration::setWorkingDirectory(const QString &workingDirectory)
|
||||
m_workingDir = workingDirectory;
|
||||
}
|
||||
|
||||
void TestConfiguration::setBuildDirectory(const QString &buildDirectory)
|
||||
{
|
||||
m_buildDir = buildDirectory;
|
||||
}
|
||||
|
||||
void TestConfiguration::setDisplayName(const QString &displayName)
|
||||
{
|
||||
m_displayName = displayName;
|
||||
|
||||
Reference in New Issue
Block a user