mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-04 08:04:04 +00:00
testutils: Add coloring to verbose PASS/FAILED output
Helps to visually track down test failures if debugging the test suite. The colors match what 'make check' does for pass/fail/skip
This commit is contained in:
parent
1895b42114
commit
3de074efa5
@ -91,6 +91,11 @@ bool virtTestOOMActive(void)
|
|||||||
return testOOMActive;
|
return testOOMActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int virtTestUseTerminalColors(void)
|
||||||
|
{
|
||||||
|
return isatty(STDIN_FILENO);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
virTestGetFlag(const char *name)
|
virTestGetFlag(const char *name)
|
||||||
{
|
{
|
||||||
@ -217,11 +222,20 @@ virtTestRun(const char *title,
|
|||||||
|
|
||||||
if (virTestGetVerbose()) {
|
if (virTestGetVerbose()) {
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
fprintf(stderr, "OK\n");
|
if (virtTestUseTerminalColors())
|
||||||
|
fprintf(stderr, "\e[32mOK\e[0m\n"); /* green */
|
||||||
|
else
|
||||||
|
fprintf(stderr, "OK\n");
|
||||||
else if (ret == EXIT_AM_SKIP)
|
else if (ret == EXIT_AM_SKIP)
|
||||||
fprintf(stderr, "SKIP\n");
|
if (virtTestUseTerminalColors())
|
||||||
|
fprintf(stderr, "\e[34m\e[1mSKIP\e[0m\n"); /* bold blue */
|
||||||
|
else
|
||||||
|
fprintf(stderr, "SKIP\n");
|
||||||
else
|
else
|
||||||
fprintf(stderr, "FAILED\n");
|
if (virtTestUseTerminalColors())
|
||||||
|
fprintf(stderr, "\e[31m\e[1mFAILED\e[0m\n"); /* bold red */
|
||||||
|
else
|
||||||
|
fprintf(stderr, "FAILED\n");
|
||||||
} else {
|
} else {
|
||||||
if (testCounter != 1 &&
|
if (testCounter != 1 &&
|
||||||
!((testCounter-1) % 40)) {
|
!((testCounter-1) % 40)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user