tests: Limit spam from todos, skips and traces when winetest_debug==1.
Some tests loop on system resources like fonts and issue todos, skips or even traces on every iteration. Depending on the machine configuration this can result in a lot of traces and push WineTest reports above the 1.5 MB limit. So on low debugging levels automatically silence test lines that issue more than 50 such messages. A count of the silenced messages is given at the end. Signed-off-by: Francois Gouget <fgouget@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
db498b3bf2
commit
e4dbd56705
|
@ -62,6 +62,9 @@ extern int winetest_interactive;
|
||||||
/* report successful tests (BOOL) */
|
/* report successful tests (BOOL) */
|
||||||
extern int winetest_report_success;
|
extern int winetest_report_success;
|
||||||
|
|
||||||
|
/* silence todos and skips above this threshold */
|
||||||
|
extern int winetest_mute_threshold;
|
||||||
|
|
||||||
/* current platform */
|
/* current platform */
|
||||||
extern const char *winetest_platform;
|
extern const char *winetest_platform;
|
||||||
|
|
||||||
|
@ -211,6 +214,9 @@ const char *winetest_platform = "windows";
|
||||||
/* report successful tests (BOOL) */
|
/* report successful tests (BOOL) */
|
||||||
int winetest_report_success = 0;
|
int winetest_report_success = 0;
|
||||||
|
|
||||||
|
/* silence todos and skips above this threshold */
|
||||||
|
int winetest_mute_threshold = 42;
|
||||||
|
|
||||||
/* passing arguments around */
|
/* passing arguments around */
|
||||||
static int winetest_argc;
|
static int winetest_argc;
|
||||||
static char** winetest_argv;
|
static char** winetest_argv;
|
||||||
|
@ -222,6 +228,12 @@ static LONG failures; /* number of failures */
|
||||||
static LONG skipped; /* number of skipped test chunks */
|
static LONG skipped; /* number of skipped test chunks */
|
||||||
static LONG todo_successes; /* number of successful tests inside todo block */
|
static LONG todo_successes; /* number of successful tests inside todo block */
|
||||||
static LONG todo_failures; /* number of failures inside todo block */
|
static LONG todo_failures; /* number of failures inside todo block */
|
||||||
|
static LONG muted_traces; /* number of silenced traces */
|
||||||
|
static LONG muted_skipped; /* same as skipped but silent */
|
||||||
|
static LONG muted_todo_successes; /* same as todo_successes but silent */
|
||||||
|
|
||||||
|
/* counts how many times a given line printed a message */
|
||||||
|
static LONG line_counters[16384];
|
||||||
|
|
||||||
/* The following data must be kept track of on a per-thread basis */
|
/* The following data must be kept track of on a per-thread basis */
|
||||||
struct tls_data
|
struct tls_data
|
||||||
|
@ -284,6 +296,25 @@ int broken( int condition )
|
||||||
return (strcmp(winetest_platform, "windows") == 0) && condition;
|
return (strcmp(winetest_platform, "windows") == 0) && condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LONG winetest_add_line( void )
|
||||||
|
{
|
||||||
|
struct tls_data *data;
|
||||||
|
int index, count;
|
||||||
|
|
||||||
|
if (winetest_debug > 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
data = get_tls_data();
|
||||||
|
index = data->current_line % ARRAY_SIZE(line_counters);
|
||||||
|
count = InterlockedIncrement(line_counters + index) - 1;
|
||||||
|
if (count == winetest_mute_threshold)
|
||||||
|
printf( "%s:%d Line has been silenced after %d occurrences\n",
|
||||||
|
data->current_file, data->current_line,
|
||||||
|
winetest_mute_threshold);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks condition.
|
* Checks condition.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
|
@ -310,13 +341,19 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (winetest_debug > 0)
|
if (!winetest_debug ||
|
||||||
|
winetest_add_line() < winetest_mute_threshold)
|
||||||
{
|
{
|
||||||
printf( "%s:%d: Test marked todo: ",
|
if (winetest_debug > 0)
|
||||||
data->current_file, data->current_line );
|
{
|
||||||
vprintf(msg, args);
|
printf( "%s:%d Test marked todo: ",
|
||||||
|
data->current_file, data->current_line );
|
||||||
|
vprintf(msg, args);
|
||||||
|
}
|
||||||
|
InterlockedIncrement(&todo_successes);
|
||||||
}
|
}
|
||||||
InterlockedIncrement(&todo_successes);
|
else
|
||||||
|
InterlockedIncrement(&muted_todo_successes);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,24 +390,32 @@ void __winetest_cdecl winetest_ok( int condition, const char *msg, ... )
|
||||||
void __winetest_cdecl winetest_trace( const char *msg, ... )
|
void __winetest_cdecl winetest_trace( const char *msg, ... )
|
||||||
{
|
{
|
||||||
__winetest_va_list valist;
|
__winetest_va_list valist;
|
||||||
struct tls_data *data = get_tls_data();
|
|
||||||
|
|
||||||
if (winetest_debug > 0)
|
if (!winetest_debug)
|
||||||
|
return;
|
||||||
|
if (winetest_add_line() < winetest_mute_threshold)
|
||||||
{
|
{
|
||||||
printf( "%s:%d: ", data->current_file, data->current_line );
|
struct tls_data *data = get_tls_data();
|
||||||
|
printf( "%s:%d ", data->current_file, data->current_line );
|
||||||
__winetest_va_start(valist, msg);
|
__winetest_va_start(valist, msg);
|
||||||
vprintf(msg, valist);
|
vprintf(msg, valist);
|
||||||
__winetest_va_end(valist);
|
__winetest_va_end(valist);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
InterlockedIncrement(&muted_traces);
|
||||||
}
|
}
|
||||||
|
|
||||||
void winetest_vskip( const char *msg, __winetest_va_list args )
|
void winetest_vskip( const char *msg, __winetest_va_list args )
|
||||||
{
|
{
|
||||||
struct tls_data *data = get_tls_data();
|
if (winetest_add_line() < winetest_mute_threshold)
|
||||||
|
{
|
||||||
printf( "%s:%d: Tests skipped: ", data->current_file, data->current_line );
|
struct tls_data *data = get_tls_data();
|
||||||
vprintf(msg, args);
|
printf( "%s:%d Tests skipped: ", data->current_file, data->current_line );
|
||||||
skipped++;
|
vprintf(msg, args);
|
||||||
|
InterlockedIncrement(&skipped);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
InterlockedIncrement(&muted_skipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __winetest_cdecl winetest_skip( const char *msg, ... )
|
void __winetest_cdecl winetest_skip( const char *msg, ... )
|
||||||
|
@ -504,7 +549,11 @@ static int run_test( const char *name )
|
||||||
|
|
||||||
if (winetest_debug)
|
if (winetest_debug)
|
||||||
{
|
{
|
||||||
printf( "%04x:%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
|
if (muted_todo_successes || muted_skipped || muted_traces)
|
||||||
|
printf( "%04x:%s Silenced %d todos, %d skips and %d traces.\n",
|
||||||
|
GetCurrentProcessId(), test->name,
|
||||||
|
muted_todo_successes, muted_skipped, muted_traces);
|
||||||
|
printf( "%04x:%s %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
|
||||||
GetCurrentProcessId(), test->name,
|
GetCurrentProcessId(), test->name,
|
||||||
successes + failures + todo_successes + todo_failures,
|
successes + failures + todo_successes + todo_failures,
|
||||||
todo_successes, failures + todo_failures,
|
todo_successes, failures + todo_failures,
|
||||||
|
|
Loading…
Reference in New Issue