Scenario: Running GTest unit tests within Qt Creator, from the Tests pane.
Issue: If the environment variable GTEST_COLOR is set to 1, Qt Creator cannot parse the output, and fails with the following error:
Steps to reproduce:
- Create an Autotest project, selecting Googletest as the test framework.
- In Projects -> Build Environment, add a variable named GTEST_COLOR with a value of 1.
- Run the single default test from the Tests pane.
GTEST_COLOR is an environment variable you can set so that test output in a shell is coloured according to the test result.
When GTEST_COLOR is not set, Qt Creator sees and processes test output like this (in this case, in GTestOutputReader::processOutput():
outputLine = "[==========] Running 1 test from 1 test case."
If, however, GTEST_COLOR=1 is set, Qt Creator sees the colour formatting, which it can't parse:
outputLine = "\x1B[m\x1B[0;32m[==========] \x1B[mRunning 1 test from 1 test case."
The attached screenshots show the working and non-working case for the default test created when using the Autotest project creation wizard with Googletest.
It'd be nice if Qt Creator could parse this, as there are cases where Qt Creator needs to be run from a shell where it's handy to also be able to run the unit tests standalone (for example, a cross-compilation environment with Yocto, where the compiler is detected according to the environment variables).