aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2017-12-14 06:46:26 +0100
committerChristian Stenger <christian.stenger@qt.io>2017-12-14 12:26:58 +0000
commitc98131d8e791f6b7cf929d5465b8e89c12db0cf0 (patch)
tree9f460ba3cad4f28ced1490bce4eb284de6d3cd39 /src
parentbd8027d2320d5205e074464436bbfd63f237ffe1 (diff)
AutoTest: Fix setting test executable for output reader
The test executable of the process must be set before creating an instance of the output reader as the process' command file path is only read on construction. This lead to wrong ordering inside the result model at least for the first test case. Change-Id: I4140ee02c8e2ea4105d276017a460676514abc91 Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/autotest/testrunner.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp
index a49831d5a4b..b1860111c76 100644
--- a/src/plugins/autotest/testrunner.cpp
+++ b/src/plugins/autotest/testrunner.cpp
@@ -195,6 +195,15 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
futureInterface.setProgressValue(0);
for (const TestConfiguration *testConfiguration : selectedTests) {
+ QString commandFilePath = testConfiguration->executableFilePath();
+ if (commandFilePath.isEmpty()) {
+ futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
+ TestRunner::tr("Executable path is empty. (%1)")
+ .arg(testConfiguration->displayName()))));
+ continue;
+ }
+ testProcess.setProgram(commandFilePath);
+
QScopedPointer<TestOutputReader> outputReader;
outputReader.reset(testConfiguration->outputReader(futureInterface, &testProcess));
QTC_ASSERT(outputReader, continue);
@@ -206,15 +215,6 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
if (!testConfiguration->project())
continue;
- QProcessEnvironment environment = testConfiguration->environment().toProcessEnvironment();
- QString commandFilePath = testConfiguration->executableFilePath();
- if (commandFilePath.isEmpty()) {
- futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
- TestRunner::tr("Executable path is empty. (%1)")
- .arg(testConfiguration->displayName()))));
- continue;
- }
-
QStringList omitted;
testProcess.setArguments(testConfiguration->argumentsForTestRunner(&omitted));
if (!omitted.isEmpty()) {
@@ -223,10 +223,10 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
details.arg(testConfiguration->displayName()))));
}
testProcess.setWorkingDirectory(testConfiguration->workingDirectory());
+ QProcessEnvironment environment = testConfiguration->environment().toProcessEnvironment();
if (Utils::HostOsInfo::isWindowsHost())
environment.insert("QT_LOGGING_TO_CONSOLE", "1");
testProcess.setProcessEnvironment(environment);
- testProcess.setProgram(commandFilePath);
testProcess.start();
bool ok = testProcess.waitForStarted();