The TestBot expects the failure text to directly follow the line number.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- include/wine/test.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/wine/test.h b/include/wine/test.h index f2aacaff592..67774b1746a 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -303,11 +303,8 @@ const char *winetest_elapsed(void) static void winetest_vprintf( const char *msg, __winetest_va_list args ) { struct tls_data *data = get_tls_data(); - unsigned int i;
printf( "%s:%d:%s ", data->current_file, data->current_line, winetest_elapsed() ); - for (i = 0; i < data->context_count; ++i) - printf( "%s: ", data->context[i] ); vprintf( msg, args ); }
@@ -366,12 +363,15 @@ static LONG winetest_add_line( void ) int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { struct tls_data *data = get_tls_data(); + unsigned int i;
if (data->todo_level) { if (condition) { winetest_printf( "Test succeeded inside todo block: " ); + for (i = 0; i < data->context_count; ++i) + printf( "%s: ", data->context[i] ); vprintf(msg, args); InterlockedIncrement(&todo_failures); return 0; @@ -384,6 +384,8 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) if (winetest_debug > 0) { winetest_printf( "Test marked todo: " ); + for (i = 0; i < data->context_count; ++i) + printf( "%s: ", data->context[i] ); vprintf(msg, args); } InterlockedIncrement(&todo_successes); @@ -398,6 +400,8 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) if (!condition) { winetest_printf( "Test failed: " ); + for (i = 0; i < data->context_count; ++i) + printf( "%s: ", data->context[i] ); vprintf(msg, args); InterlockedIncrement(&failures); return 0;
This makes identifying the failures and other message types easier and more reliable.
From: Zebediah Figura z.figura12@gmail.com Signed-off-by: Francois Gouget fgouget@codeweavers.com ---
I think traces should have the context information too.
Skips probably would not be used inside context blocks but if they are I think they should have the context information too.
I would consider that the "Test succeeded" messages are mostly useful to determine the location of a crash and thus don't need contect information. Maybe that's wrong in case they are used to identify the location of slowdowns (with WINETEST_TIME).
So taking all that into account I propose this patch.
It adds a winetest_print_context() function so the context printing code is in just one location. It also removes winetest_vprintf() since that's only used in one place and not exported. --- include/wine/test.h | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/include/wine/test.h b/include/wine/test.h index f2aacaff592..8073071d262 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -300,26 +300,26 @@ const char *winetest_elapsed(void) return wine_dbg_sprintf( "%.3f", (now - winetest_start_time) / 1000.0); }
-static void winetest_vprintf( const char *msg, __winetest_va_list args ) -{ - struct tls_data *data = get_tls_data(); - unsigned int i; - - printf( "%s:%d:%s ", data->current_file, data->current_line, winetest_elapsed() ); - for (i = 0; i < data->context_count; ++i) - printf( "%s: ", data->context[i] ); - vprintf( msg, args ); -} - static void __winetest_cdecl winetest_printf( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2); static void __winetest_cdecl winetest_printf( const char *msg, ... ) { + struct tls_data *data = get_tls_data(); __winetest_va_list valist;
+ printf( "%s:%d:%s ", data->current_file, data->current_line, winetest_elapsed() ); __winetest_va_start( valist, msg ); - winetest_vprintf( msg, valist ); + vprintf( msg, valist ); __winetest_va_end( valist ); } +static void __winetest_cdecl winetest_print_context( const char *msgtype ) +{ + struct tls_data *data = get_tls_data(); + unsigned int i; + + winetest_printf( "%s", msgtype ); + for (i = 0; i < data->context_count; ++i) + printf( "%s: ", data->context[i] ); +}
void winetest_subtest( const char* name ) { @@ -371,7 +371,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (condition) { - winetest_printf( "Test succeeded inside todo block: " ); + winetest_print_context( "Test succeeded inside todo block: " ); vprintf(msg, args); InterlockedIncrement(&todo_failures); return 0; @@ -383,7 +383,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (winetest_debug > 0) { - winetest_printf( "Test marked todo: " ); + winetest_print_context( "Test marked todo: " ); vprintf(msg, args); } InterlockedIncrement(&todo_successes); @@ -397,7 +397,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (!condition) { - winetest_printf( "Test failed: " ); + winetest_print_context( "Test failed: " ); vprintf(msg, args); InterlockedIncrement(&failures); return 0; @@ -407,7 +407,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) if (winetest_report_success || (winetest_time && GetTickCount() >= winetest_last_time + 1000)) { - winetest_printf( "Test succeeded\n" ); + winetest_printf("Test succeeded\n"); } InterlockedIncrement(&successes); return 1; @@ -432,8 +432,9 @@ void __winetest_cdecl winetest_trace( const char *msg, ... ) return; if (winetest_add_line() < winetest_mute_threshold) { + winetest_print_context( "" ); __winetest_va_start(valist, msg); - winetest_vprintf( msg, valist ); + vprintf( msg, valist ); __winetest_va_end(valist); } else @@ -444,7 +445,7 @@ void winetest_vskip( const char *msg, __winetest_va_list args ) { if (winetest_add_line() < winetest_mute_threshold) { - winetest_printf( "Tests skipped: " ); + winetest_print_context( "Tests skipped: " ); vprintf(msg, args); InterlockedIncrement(&skipped); }