Commit 89ad1f26 authored by Alexandre Julliard's avatar Alexandre Julliard

tests: Print information about the last executed test before crashing.

parent e2c48c59
...@@ -237,8 +237,7 @@ static tls_data* get_tls_data(void) ...@@ -237,8 +237,7 @@ static tls_data* get_tls_data(void)
data=TlsGetValue(tls_index); data=TlsGetValue(tls_index);
if (!data) if (!data)
{ {
data=HeapAlloc(GetProcessHeap(), 0, sizeof(tls_data)); data=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(tls_data));
data->todo_level = 0;
data->str_pos = data->strings; data->str_pos = data->strings;
TlsSetValue(tls_index,data); TlsSetValue(tls_index,data);
} }
...@@ -577,6 +576,19 @@ static void usage( const char *argv0 ) ...@@ -577,6 +576,19 @@ static void usage( const char *argv0 )
exit_process(1); 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 */ /* main function */
int main( int argc, char **argv ) int main( int argc, char **argv )
...@@ -593,6 +605,7 @@ 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_INTERACTIVE", p, sizeof(p) )) winetest_interactive = atoi(p);
if (GetEnvironmentVariableA( "WINETEST_REPORT_SUCCESS", p, sizeof(p) )) report_success = 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 (!winetest_interactive) SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX );
if (!argv[1]) if (!argv[1])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment