mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 14:24:45 +00:00
include: Allow printing test failure messages in bright red.
Colours are disabled by default, and can be enabled using WINETEST_COLOR=1.
This commit is contained in:
parent
9d9b564e4b
commit
549969a6fb
1 changed files with 9 additions and 0 deletions
|
@ -199,6 +199,9 @@ int winetest_report_success = 0;
|
||||||
/* silence todos and skips above this threshold */
|
/* silence todos and skips above this threshold */
|
||||||
int winetest_mute_threshold = 42;
|
int winetest_mute_threshold = 42;
|
||||||
|
|
||||||
|
/* use ANSI escape codes for output coloring */
|
||||||
|
static int winetest_color;
|
||||||
|
|
||||||
/* passing arguments around */
|
/* passing arguments around */
|
||||||
static int winetest_argc;
|
static int winetest_argc;
|
||||||
static char** winetest_argv;
|
static char** winetest_argv;
|
||||||
|
@ -277,6 +280,9 @@ const char *winetest_elapsed(void)
|
||||||
return wine_dbg_sprintf( "%.3f", (now - winetest_start_time) / 1000.0);
|
return wine_dbg_sprintf( "%.3f", (now - winetest_start_time) / 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char color_reset[] = "\e[0m";
|
||||||
|
static const char color_bright_red[] = "\e[1;91m";
|
||||||
|
|
||||||
static void winetest_printf( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2);
|
static void winetest_printf( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2);
|
||||||
static void winetest_printf( const char *msg, ... )
|
static void winetest_printf( const char *msg, ... )
|
||||||
{
|
{
|
||||||
|
@ -374,8 +380,10 @@ int winetest_vok( int condition, const char *msg, va_list args )
|
||||||
{
|
{
|
||||||
if (!condition)
|
if (!condition)
|
||||||
{
|
{
|
||||||
|
if (winetest_color) printf( color_bright_red );
|
||||||
winetest_print_context( "Test failed: " );
|
winetest_print_context( "Test failed: " );
|
||||||
vprintf(msg, args);
|
vprintf(msg, args);
|
||||||
|
if (winetest_color) printf( color_reset );
|
||||||
InterlockedIncrement(&failures);
|
InterlockedIncrement(&failures);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -656,6 +664,7 @@ int main( int argc, char **argv )
|
||||||
else if (running_under_wine())
|
else if (running_under_wine())
|
||||||
winetest_platform = "wine";
|
winetest_platform = "wine";
|
||||||
|
|
||||||
|
if (GetEnvironmentVariableA( "WINETEST_COLOR", p, sizeof(p) )) winetest_color = atoi(p);
|
||||||
if (GetEnvironmentVariableA( "WINETEST_DEBUG", p, sizeof(p) )) winetest_debug = atoi(p);
|
if (GetEnvironmentVariableA( "WINETEST_DEBUG", p, sizeof(p) )) winetest_debug = atoi(p);
|
||||||
if (GetEnvironmentVariableA( "WINETEST_INTERACTIVE", p, sizeof(p) )) winetest_interactive = atoi(p);
|
if (GetEnvironmentVariableA( "WINETEST_INTERACTIVE", p, sizeof(p) )) winetest_interactive = atoi(p);
|
||||||
if (GetEnvironmentVariableA( "WINETEST_REPORT_SUCCESS", p, sizeof(p) )) winetest_report_success = atoi(p);
|
if (GetEnvironmentVariableA( "WINETEST_REPORT_SUCCESS", p, sizeof(p) )) winetest_report_success = atoi(p);
|
||||||
|
|
Loading…
Reference in a new issue