From 4a983e31187b754c29bf852dd4412be95d62d1ba Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Wed, 13 Jan 2016 12:41:42 +0100 Subject: [PATCH] tests: Use plain printf() calls instead of fprintf(stdout). The fprintf() calls are a left-over from when errors were reported to stderr. Signed-off-by: Francois Gouget Signed-off-by: Alexandre Julliard --- include/wine/test.h | 65 +++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/include/wine/test.h b/include/wine/test.h index 567229a7c67..a5b67a02282 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -310,9 +310,9 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (condition) { - fprintf( stdout, "%s:%d: Test succeeded inside todo block: ", - data->current_file, data->current_line ); - vfprintf(stdout, msg, args); + printf( "%s:%d: Test succeeded inside todo block: ", + data->current_file, data->current_line ); + vprintf(msg, args); InterlockedIncrement(&todo_failures); return 0; } @@ -320,9 +320,9 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (winetest_debug > 0) { - fprintf( stdout, "%s:%d: Test marked todo: ", - data->current_file, data->current_line ); - vfprintf(stdout, msg, args); + printf( "%s:%d: Test marked todo: ", + data->current_file, data->current_line ); + vprintf(msg, args); } InterlockedIncrement(&todo_successes); return 1; @@ -332,17 +332,17 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (!condition) { - fprintf( stdout, "%s:%d: Test failed: ", - data->current_file, data->current_line ); - vfprintf(stdout, msg, args); + printf( "%s:%d: Test failed: ", + data->current_file, data->current_line ); + vprintf(msg, args); InterlockedIncrement(&failures); return 0; } else { if (report_success) - fprintf( stdout, "%s:%d: Test succeeded\n", - data->current_file, data->current_line); + printf( "%s:%d: Test succeeded\n", + data->current_file, data->current_line); InterlockedIncrement(&successes); return 1; } @@ -365,9 +365,9 @@ void __winetest_cdecl winetest_trace( const char *msg, ... ) if (winetest_debug > 0) { - fprintf( stdout, "%s:%d: ", data->current_file, data->current_line ); + printf( "%s:%d: ", data->current_file, data->current_line ); __winetest_va_start(valist, msg); - vfprintf(stdout, msg, valist); + vprintf(msg, valist); __winetest_va_end(valist); } } @@ -376,8 +376,8 @@ void winetest_vskip( const char *msg, __winetest_va_list args ) { tls_data* data=get_tls_data(); - fprintf( stdout, "%s:%d: Tests skipped: ", data->current_file, data->current_line ); - vfprintf(stdout, msg, args); + printf( "%s:%d: Tests skipped: ", data->current_file, data->current_line ); + vprintf(msg, args); skipped++; } @@ -447,7 +447,7 @@ void winetest_wait_child_process( HANDLE process ) DWORD exit_code = 1; if (WaitForSingleObject( process, 30000 )) - fprintf( stdout, "%s: child process wait failed\n", current_test->name ); + printf( "%s: child process wait failed\n", current_test->name ); else GetExitCodeProcess( process, &exit_code ); @@ -455,13 +455,13 @@ void winetest_wait_child_process( HANDLE process ) { if (exit_code > 255) { - fprintf( stdout, "%s: exception 0x%08x in child process\n", current_test->name, exit_code ); + printf( "%s: exception 0x%08x in child process\n", current_test->name, exit_code ); InterlockedIncrement( &failures ); } else { - fprintf( stdout, "%s: %u failures in child process\n", - current_test->name, exit_code ); + printf( "%s: %u failures in child process\n", + current_test->name, exit_code ); while (exit_code-- > 0) InterlockedIncrement(&failures); } @@ -562,8 +562,9 @@ static void list_tests(void) { const struct test *test; - fprintf( stdout, "Valid test names:\n" ); - for (test = winetest_testlist; test->name; test++) fprintf( stdout, " %s\n", test->name ); + printf( "Valid test names:\n" ); + for (test = winetest_testlist; test->name; test++) + printf( " %s\n", test->name ); } @@ -575,7 +576,7 @@ static int run_test( const char *name ) if (!(test = find_test( name ))) { - fprintf( stdout, "Fatal: test '%s' does not exist.\n", name ); + printf( "Fatal: test '%s' does not exist.\n", name ); exit_process(1); } successes = failures = todo_successes = todo_failures = 0; @@ -585,11 +586,11 @@ static int run_test( const char *name ) if (winetest_debug) { - fprintf( stdout, "%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n", - test->name, successes + failures + todo_successes + todo_failures, - todo_successes, failures + todo_failures, - (failures + todo_failures != 1) ? "failures" : "failure", - skipped ); + printf( "%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n", + test->name, successes + failures + todo_successes + todo_failures, + todo_successes, failures + todo_failures, + (failures + todo_failures != 1) ? "failures" : "failure", + skipped ); } status = (failures + todo_failures < 255) ? failures + todo_failures : 255; return status; @@ -599,7 +600,7 @@ static int run_test( const char *name ) /* Display usage and exit */ static void usage( const char *argv0 ) { - fprintf( stdout, "Usage: %s test_name\n\n", argv0 ); + printf( "Usage: %s test_name\n\n", argv0 ); list_tests(); exit_process(1); } @@ -610,10 +611,10 @@ static LONG CALLBACK exc_filter( EXCEPTION_POINTERS *ptrs ) tls_data *data = get_tls_data(); if (data->current_file) - fprintf( stdout, "%s:%d: this is the last test seen before the exception\n", - data->current_file, data->current_line ); - fprintf( stdout, "%s: unhandled exception %08x at %p\n", current_test->name, - ptrs->ExceptionRecord->ExceptionCode, ptrs->ExceptionRecord->ExceptionAddress ); + printf( "%s:%d: this is the last test seen before the exception\n", + data->current_file, data->current_line ); + printf( "%s: unhandled exception %08x at %p\n", current_test->name, + ptrs->ExceptionRecord->ExceptionCode, ptrs->ExceptionRecord->ExceptionAddress ); fflush( stdout ); return EXCEPTION_EXECUTE_HANDLER; }