From 89ad1f2615918067bb6198bcdae74304f2c40dbb Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 19 Jul 2010 23:46:18 +0200 Subject: [PATCH] tests: Print information about the last executed test before crashing. --- include/wine/test.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/wine/test.h b/include/wine/test.h index 27c49388189..6ff4372a583 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -237,8 +237,7 @@ static tls_data* get_tls_data(void) data=TlsGetValue(tls_index); if (!data) { - data=HeapAlloc(GetProcessHeap(), 0, sizeof(tls_data)); - data->todo_level = 0; + data=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(tls_data)); data->str_pos = data->strings; TlsSetValue(tls_index,data); } @@ -577,6 +576,19 @@ static void usage( const char *argv0 ) exit_process(1); } +/* trap unhandled exceptions */ +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 ); + fflush( stdout ); + return EXCEPTION_EXECUTE_HANDLER; +} /* main function */ int main( int argc, char **argv ) @@ -593,6 +605,7 @@ int main( int argc, char **argv ) if (GetEnvironmentVariableA( "WINETEST_INTERACTIVE", p, sizeof(p) )) winetest_interactive = atoi(p); if (GetEnvironmentVariableA( "WINETEST_REPORT_SUCCESS", p, sizeof(p) )) report_success = atoi(p); + if (!strcmp( winetest_platform, "windows" )) SetUnhandledExceptionFilter( exc_filter ); if (!winetest_interactive) SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX ); if (!argv[1]) -- 2.11.4.GIT