AutoTest: Merge group setup with process setup

There is no need to have 2 separate handlers.

Change-Id: Ifb42d939b68abfb5a5e38c8aa6a8f9c7a262de9d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Jarek Kobus
2024-01-12 21:18:18 +01:00
parent 185454bc9b
commit b163f58305

View File

@@ -351,7 +351,7 @@ void TestRunner::runTestsHelper()
const LoopRepeat repeater(selectedTests.size()); const LoopRepeat repeater(selectedTests.size());
const Storage<TestStorage> storage; const Storage<TestStorage> storage;
const auto onSetup = [this, selectedTests, repeater] { const auto onSetup = [this, selectedTests, repeater, storage](Process &process) {
ITestConfiguration *config = selectedTests.at(repeater.iteration()); ITestConfiguration *config = selectedTests.at(repeater.iteration());
QTC_ASSERT(config, return SetupResult::StopWithError); QTC_ASSERT(config, return SetupResult::StopWithError);
if (!config->project()) if (!config->project())
@@ -361,14 +361,10 @@ void TestRunner::runTestsHelper()
Tr::tr("Executable path is empty. (%1)").arg(config->displayName())); Tr::tr("Executable path is empty. (%1)").arg(config->displayName()));
return SetupResult::StopWithSuccess; return SetupResult::StopWithSuccess;
} }
return SetupResult::Continue;
};
const auto onProcessSetup = [this, selectedTests, repeater, storage](Process &process) {
ITestConfiguration *config = selectedTests.at(repeater.iteration());
TestStorage *testStorage = storage.activeStorage(); TestStorage *testStorage = storage.activeStorage();
QTC_ASSERT(testStorage, return); QTC_ASSERT(testStorage, return SetupResult::StopWithError);
testStorage->m_outputReader.reset(config->createOutputReader(&process)); testStorage->m_outputReader.reset(config->createOutputReader(&process));
QTC_ASSERT(testStorage->m_outputReader, return); QTC_ASSERT(testStorage->m_outputReader, return SetupResult::StopWithError);
connect(testStorage->m_outputReader.get(), &TestOutputReader::newResult, connect(testStorage->m_outputReader.get(), &TestOutputReader::newResult,
this, &TestRunner::testResultReady); this, &TestRunner::testResultReady);
connect(testStorage->m_outputReader.get(), &TestOutputReader::newOutputLineAvailable, connect(testStorage->m_outputReader.get(), &TestOutputReader::newOutputLineAvailable,
@@ -410,8 +406,9 @@ void TestRunner::runTestsHelper()
qCInfo(runnerLog) << "Arguments:" << process.commandLine().arguments(); qCInfo(runnerLog) << "Arguments:" << process.commandLine().arguments();
qCInfo(runnerLog) << "Working directory:" << process.workingDirectory(); qCInfo(runnerLog) << "Working directory:" << process.workingDirectory();
qCDebug(runnerLog) << "Environment:" << process.environment().toStringList(); qCDebug(runnerLog) << "Environment:" << process.environment().toStringList();
return SetupResult::Continue;
}; };
const auto onProcessDone = [this, selectedTests, repeater, storage](const Process &process) { const auto onDone = [this, selectedTests, repeater, storage](const Process &process) {
ITestConfiguration *config = selectedTests.at(repeater.iteration()); ITestConfiguration *config = selectedTests.at(repeater.iteration());
TestStorage *testStorage = storage.activeStorage(); TestStorage *testStorage = storage.activeStorage();
QTC_ASSERT(testStorage, return); QTC_ASSERT(testStorage, return);
@@ -451,10 +448,8 @@ void TestRunner::runTestsHelper()
finishAllAndSuccess, finishAllAndSuccess,
repeater, repeater,
Group { Group {
finishAllAndSuccess,
storage, storage,
onGroupSetup(onSetup), ProcessTask(onSetup, onDone)
ProcessTask(onProcessSetup, onProcessDone)
} }
}; };