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 <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2016-01-13 12:41:42 +01:00 committed by Alexandre Julliard
parent 4e7a7d01ff
commit 4a983e3118
1 changed files with 33 additions and 32 deletions

View File

@ -310,9 +310,9 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args )
{ {
if (condition) if (condition)
{ {
fprintf( stdout, "%s:%d: Test succeeded inside todo block: ", printf( "%s:%d: Test succeeded inside todo block: ",
data->current_file, data->current_line ); data->current_file, data->current_line );
vfprintf(stdout, msg, args); vprintf(msg, args);
InterlockedIncrement(&todo_failures); InterlockedIncrement(&todo_failures);
return 0; return 0;
} }
@ -320,9 +320,9 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args )
{ {
if (winetest_debug > 0) if (winetest_debug > 0)
{ {
fprintf( stdout, "%s:%d: Test marked todo: ", printf( "%s:%d: Test marked todo: ",
data->current_file, data->current_line ); data->current_file, data->current_line );
vfprintf(stdout, msg, args); vprintf(msg, args);
} }
InterlockedIncrement(&todo_successes); InterlockedIncrement(&todo_successes);
return 1; return 1;
@ -332,17 +332,17 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args )
{ {
if (!condition) if (!condition)
{ {
fprintf( stdout, "%s:%d: Test failed: ", printf( "%s:%d: Test failed: ",
data->current_file, data->current_line ); data->current_file, data->current_line );
vfprintf(stdout, msg, args); vprintf(msg, args);
InterlockedIncrement(&failures); InterlockedIncrement(&failures);
return 0; return 0;
} }
else else
{ {
if (report_success) if (report_success)
fprintf( stdout, "%s:%d: Test succeeded\n", printf( "%s:%d: Test succeeded\n",
data->current_file, data->current_line); data->current_file, data->current_line);
InterlockedIncrement(&successes); InterlockedIncrement(&successes);
return 1; return 1;
} }
@ -365,9 +365,9 @@ void __winetest_cdecl winetest_trace( const char *msg, ... )
if (winetest_debug > 0) 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); __winetest_va_start(valist, msg);
vfprintf(stdout, msg, valist); vprintf(msg, valist);
__winetest_va_end(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(); tls_data* data=get_tls_data();
fprintf( stdout, "%s:%d: Tests skipped: ", data->current_file, data->current_line ); printf( "%s:%d: Tests skipped: ", data->current_file, data->current_line );
vfprintf(stdout, msg, args); vprintf(msg, args);
skipped++; skipped++;
} }
@ -447,7 +447,7 @@ void winetest_wait_child_process( HANDLE process )
DWORD exit_code = 1; DWORD exit_code = 1;
if (WaitForSingleObject( process, 30000 )) 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 else
GetExitCodeProcess( process, &exit_code ); GetExitCodeProcess( process, &exit_code );
@ -455,13 +455,13 @@ void winetest_wait_child_process( HANDLE process )
{ {
if (exit_code > 255) 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 ); InterlockedIncrement( &failures );
} }
else else
{ {
fprintf( stdout, "%s: %u failures in child process\n", printf( "%s: %u failures in child process\n",
current_test->name, exit_code ); current_test->name, exit_code );
while (exit_code-- > 0) while (exit_code-- > 0)
InterlockedIncrement(&failures); InterlockedIncrement(&failures);
} }
@ -562,8 +562,9 @@ static void list_tests(void)
{ {
const struct test *test; const struct test *test;
fprintf( stdout, "Valid test names:\n" ); printf( "Valid test names:\n" );
for (test = winetest_testlist; test->name; test++) fprintf( stdout, " %s\n", test->name ); 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 ))) 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); exit_process(1);
} }
successes = failures = todo_successes = todo_failures = 0; successes = failures = todo_successes = todo_failures = 0;
@ -585,11 +586,11 @@ static int run_test( const char *name )
if (winetest_debug) if (winetest_debug)
{ {
fprintf( stdout, "%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n", printf( "%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
test->name, successes + failures + todo_successes + todo_failures, test->name, successes + failures + todo_successes + todo_failures,
todo_successes, failures + todo_failures, todo_successes, failures + todo_failures,
(failures + todo_failures != 1) ? "failures" : "failure", (failures + todo_failures != 1) ? "failures" : "failure",
skipped ); skipped );
} }
status = (failures + todo_failures < 255) ? failures + todo_failures : 255; status = (failures + todo_failures < 255) ? failures + todo_failures : 255;
return status; return status;
@ -599,7 +600,7 @@ static int run_test( const char *name )
/* Display usage and exit */ /* Display usage and exit */
static void usage( const char *argv0 ) 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(); list_tests();
exit_process(1); exit_process(1);
} }
@ -610,10 +611,10 @@ static LONG CALLBACK exc_filter( EXCEPTION_POINTERS *ptrs )
tls_data *data = get_tls_data(); tls_data *data = get_tls_data();
if (data->current_file) if (data->current_file)
fprintf( stdout, "%s:%d: this is the last test seen before the exception\n", printf( "%s:%d: this is the last test seen before the exception\n",
data->current_file, data->current_line ); data->current_file, data->current_line );
fprintf( stdout, "%s: unhandled exception %08x at %p\n", current_test->name, printf( "%s: unhandled exception %08x at %p\n", current_test->name,
ptrs->ExceptionRecord->ExceptionCode, ptrs->ExceptionRecord->ExceptionAddress ); ptrs->ExceptionRecord->ExceptionCode, ptrs->ExceptionRecord->ExceptionAddress );
fflush( stdout ); fflush( stdout );
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
} }