forked from qt-creator/qt-creator
ITestConfiguration: Introduce testExecutable() helper
Reuse it in TestRunner. Change-Id: I59ffd256a7e84f0d0726261496d73bc4f622d666 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -38,6 +38,7 @@ public:
|
||||
Utils::FilePath workingDirectory() const;
|
||||
bool hasExecutable() const;
|
||||
Utils::FilePath executableFilePath() const;
|
||||
virtual Utils::FilePath testExecutable() const { return executableFilePath(); };
|
||||
|
||||
virtual TestOutputReader *createOutputReader(const QFutureInterface<TestResult> &fi,
|
||||
Utils::QtcProcess *app) const = 0;
|
||||
@@ -124,6 +125,7 @@ public:
|
||||
explicit TestToolConfiguration(ITestBase *testBase) : ITestConfiguration(testBase) {}
|
||||
Utils::CommandLine commandLine() const { return m_commandLine; }
|
||||
void setCommandLine(const Utils::CommandLine &cmdline) { m_commandLine = cmdline; }
|
||||
virtual Utils::FilePath testExecutable() const override { return m_commandLine.executable(); };
|
||||
|
||||
private:
|
||||
Utils::CommandLine m_commandLine;
|
||||
|
@@ -146,15 +146,10 @@ static QString constructOmittedVariablesDetailsString(const EnvironmentItems &di
|
||||
|
||||
bool TestRunner::currentConfigValid()
|
||||
{
|
||||
FilePath commandFilePath;
|
||||
if (m_currentConfig->testBase()->type() == ITestBase::Framework) {
|
||||
TestConfiguration *current = static_cast<TestConfiguration *>(m_currentConfig);
|
||||
commandFilePath = current->executableFilePath();
|
||||
} else {
|
||||
TestToolConfiguration *current = static_cast<TestToolConfiguration *>(m_currentConfig);
|
||||
commandFilePath = current->commandLine().executable();
|
||||
}
|
||||
if (commandFilePath.isEmpty()) {
|
||||
const FilePath commandFilePath = m_currentConfig->testExecutable();
|
||||
if (!commandFilePath.isEmpty())
|
||||
return true;
|
||||
|
||||
reportResult(ResultType::MessageFatal,
|
||||
Tr::tr("Executable path is empty. (%1)").arg(m_currentConfig->displayName()));
|
||||
delete m_currentConfig;
|
||||
@@ -167,21 +162,6 @@ bool TestRunner::currentConfigValid()
|
||||
onProcessDone();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TestRunner::setUpProcess()
|
||||
{
|
||||
QTC_ASSERT(m_currentConfig, return);
|
||||
m_currentProcess = new QtcProcess;
|
||||
if (m_currentConfig->testBase()->type() == ITestBase::Framework) {
|
||||
TestConfiguration *current = static_cast<TestConfiguration *>(m_currentConfig);
|
||||
m_currentProcess->setCommand({current->executableFilePath(), {}});
|
||||
} else {
|
||||
TestToolConfiguration *current = static_cast<TestToolConfiguration *>(m_currentConfig);
|
||||
m_currentProcess->setCommand({current->commandLine().executable(), {}});
|
||||
}
|
||||
}
|
||||
|
||||
void TestRunner::setUpProcessEnv()
|
||||
@@ -232,8 +212,9 @@ void TestRunner::scheduleNext()
|
||||
if (!m_currentConfig->project())
|
||||
onProcessDone();
|
||||
|
||||
setUpProcess();
|
||||
QTC_ASSERT(m_currentProcess, onProcessDone(); return);
|
||||
m_currentProcess = new QtcProcess;
|
||||
m_currentProcess->setCommand({m_currentConfig->testExecutable(), {}});
|
||||
|
||||
QTC_ASSERT(!m_currentOutputReader, delete m_currentOutputReader);
|
||||
m_currentOutputReader = m_currentConfig->createOutputReader(*m_fakeFutureInterface, m_currentProcess);
|
||||
QTC_ASSERT(m_currentOutputReader, onProcessDone(); return);
|
||||
|
@@ -62,7 +62,6 @@ private:
|
||||
|
||||
int precheckTestConfigurations();
|
||||
bool currentConfigValid();
|
||||
void setUpProcess();
|
||||
void setUpProcessEnv();
|
||||
void scheduleNext();
|
||||
void cancelCurrent(CancelReason reason);
|
||||
|
Reference in New Issue
Block a user