Some tests on http://test.winehq.org/data/ seem to crash silently.
This patch might be useful for debugging such crashes.
It prints out the last ok/trace that was executed before the crash,
the exception address and the type of the crash.
It also print out the summary that is normally printed at the end of the test
instead of exiting silently[1].
On wine it still executes winedbg for better debugging after dumping out the
info.
My concern now is that it requires a change to the parser which accepts the
test reports,
so those crashes are not lost.
And don't know much about this parser.
Suggestions, ideas anyone?
Greetings Peter
[1] example output:
file.c:1228:FileSize: 0
file.c:1229:Unknown2[0]: 0
Test crashed at B7D0DF47 with error c0000005
Last test before crash: file.c:1239
file: 19 tests executed (0 marked as todo, 3 failures), 0 skipped.
wine: Unhandled page fault on write access to 0x00001234 at address 0xb7d0df47
(thread 0009), starting debugger...
Register dump:
CS:0073 SS:007b DS:007b ES:007b FS:0033 GS:003b
...
diff --git a/include/wine/test.h b/include/wine/test.h
index ea79475..4d0b26c 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -369,6 +369,29 @@ static void list_tests(void)
for (test = winetest_testlist; test->name; test++) fprintf( stdout, " %s\n", test->name );
}
+/* display summary and last executed test in case of a crash */
+static LONG CALLBACK unhandled_exception_filter(struct _EXCEPTION_POINTERS *except)
+{
+ if (winetest_debug)
+ {
+ tls_data* data=get_tls_data();
+
+ if(except != NULL)
+ fprintf( stdout, "Test crashed at %p with error %x\n", except->ExceptionRecord->ExceptionAddress,
+ except->ExceptionRecord->ExceptionCode );
+ else
+ fprintf( stdout, "Test crashed at unknown address\n");
+
+ fprintf( stdout, "Last test before crash: %s:%d\n", data->current_file, data->current_line );
+
+ fprintf( stdout, "%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
+ current_test->name, successes + failures + todo_successes + todo_failures,
+ todo_successes, failures + todo_failures,
+ (failures + todo_failures != 1) ? "failures" : "failure",
+ skipped );
+ }
+ return EXCEPTION_CONTINUE_SEARCH;
+}
/* Run a named test, and return exit status */
static int run_test( const char *name )
@@ -384,6 +407,9 @@ static int run_test( const char *name )
successes = failures = todo_successes = todo_failures = 0;
tls_index=TlsAlloc();
current_test = test;
+
+ SetUnhandledExceptionFilter(unhandled_exception_filter);
+
test->func();
if (winetest_debug)