AutoTest: Fix getting more output from ctest on Windows

When running ctest with Qt based tests we missed output coming
from qtestlib.
Due to running a separate QProcess we need to force the output
on stderr to be printed not via the Windows debug console.

Change-Id: Ie3b957230836efd59f11b6a1e7ac310fa44fa073
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2021-09-02 14:26:48 +02:00
parent 17c6fb866c
commit 368a6614f3

View File

@@ -117,12 +117,14 @@ QList<ITestConfiguration *> CTestTreeItem::testConfigurationsFor(const QStringLi
config->setProject(project); config->setProject(project);
config->setCommandLine(command); config->setCommandLine(command);
const ProjectExplorer::RunConfiguration *runConfig = target->activeRunConfiguration(); const ProjectExplorer::RunConfiguration *runConfig = target->activeRunConfiguration();
Utils::Environment env = Utils::Environment::systemEnvironment();
if (QTC_GUARD(runConfig)) { if (QTC_GUARD(runConfig)) {
if (auto envAspect = runConfig->aspect<ProjectExplorer::EnvironmentAspect>()) if (auto envAspect = runConfig->aspect<ProjectExplorer::EnvironmentAspect>())
config->setEnvironment(envAspect->environment()); env = envAspect->environment();
else
config->setEnvironment(Utils::Environment::systemEnvironment());
} }
if (Utils::HostOsInfo::isWindowsHost())
env.set("QT_LOGGING_TO_CONSOLE", "1");
config->setEnvironment(env);
const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration(); const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration();
if (QTC_GUARD(buildConfig)) if (QTC_GUARD(buildConfig))
config->setWorkingDirectory(buildConfig->buildDirectory().toString()); config->setWorkingDirectory(buildConfig->buildDirectory().toString());