AutoTest: Allow colored commandline output

Some test frameworks allow to print their output colorful
to further indicate meanings of messages or test results.
Provide a highlighter for the textual output of the results
and enable this functionality for GTest and Boost UTF.
Keep at least a small backdoor for overwriting this by
the user.

Fixes: QTCREATORBUG-22297
Change-Id: Iddd2b734416de807635d90c6519553081f7372f2
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2019-11-06 14:26:40 +01:00
parent e58f376068
commit 333b8f9812
15 changed files with 269 additions and 8 deletions

View File

@@ -54,7 +54,6 @@ QStringList filterInterfering(const QStringList &provided, QStringList *omitted)
"--gtest_stream_result_to=",
"--gtest_break_on_failure",
"--gtest_throw_on_failure",
"--gtest_color=",
"--gtest_print_time="
};
@@ -110,11 +109,13 @@ QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) con
Utils::Environment GTestConfiguration::filteredEnvironment(const Utils::Environment &original) const
{
const QStringList interfering{"GTEST_FILTER", "GTEST_COLOR", "GTEST_ALSO_RUN_DISABLED_TESTS",
const QStringList interfering{"GTEST_FILTER", "GTEST_ALSO_RUN_DISABLED_TESTS",
"GTEST_REPEAT", "GTEST_SHUFFLE", "GTEST_RANDOM_SEED",
"GTEST_OUTPUT", "GTEST_BREAK_ON_FAILURE", "GTEST_PRINT_TIME",
"GTEST_CATCH_EXCEPTIONS"};
Utils::Environment result = original;
if (!result.hasKey("GTEST_COLOR"))
result.set("GTEST_COLOR", "1"); // use colored output by default
for (const QString &key : interfering)
result.unset(key);
return result;