Francois Gouget : wine/test.h: Identify the process responsible for test summary lines.
Alexandre Julliard
julliard at winehq.org
Wed Feb 22 15:42:03 CST 2017
Module: wine
Branch: master
Commit: 873eace6e496a154f333426aeb2b3e0ad79ba44d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=873eace6e496a154f333426aeb2b3e0ad79ba44d
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Wed Feb 22 15:33:21 2017 +0100
wine/test.h: Identify the process responsible for test summary lines.
Currently the child process summary lines are indistinguishable from the
main process one. This makes it impossible to automatically detect
when a process exits abruptly, i.e. without printing a summary line,
if it has run a subprocess.
This will let analysis tools identify which summary lines correspond to
processes they started and thus when some are missing. Note also that
in case of a crash the 'unhandled exception' play the same role as the
test summary lines. Thus it is important to also tag them with the pid
of the source process.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
include/wine/test.h | 8 +++++---
programs/winetest/main.c | 14 +++++++++-----
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/include/wine/test.h b/include/wine/test.h
index f33ab9a..bf353a5 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -590,8 +590,9 @@ static int run_test( const char *name )
if (winetest_debug)
{
- printf( "%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
- test->name, successes + failures + todo_successes + todo_failures,
+ printf( "%04x:%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
+ GetCurrentProcessId(), test->name,
+ successes + failures + todo_successes + todo_failures,
todo_successes, failures + todo_failures,
(failures + todo_failures != 1) ? "failures" : "failure",
skipped );
@@ -617,7 +618,8 @@ static LONG CALLBACK exc_filter( EXCEPTION_POINTERS *ptrs )
if (data->current_file)
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,
+ printf( "%04x:%s: unhandled exception %08x at %p\n",
+ GetCurrentProcessId(), current_test->name,
ptrs->ExceptionRecord->ExceptionCode, ptrs->ExceptionRecord->ExceptionAddress );
fflush( stdout );
return EXCEPTION_EXECUTE_HANDLER;
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index 9c32573..c8ff102 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -609,7 +609,7 @@ static void append_path( const char *path)
value of WaitForSingleObject.
*/
static int
-run_ex (char *cmd, HANDLE out_file, const char *tempdir, DWORD ms)
+run_ex (char *cmd, HANDLE out_file, const char *tempdir, DWORD ms, DWORD* pid)
{
STARTUPINFOA si;
PROCESS_INFORMATION pi;
@@ -627,9 +627,13 @@ run_ex (char *cmd, HANDLE out_file, const char *tempdir, DWORD ms)
if (!CreateProcessA (NULL, cmd, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE,
NULL, tempdir, &si, &pi))
+ {
+ if (pid) *pid = 0;
return -2;
+ }
CloseHandle (pi.hThread);
+ if (pid) *pid = pi.dwProcessId;
status = wait_process( pi.hProcess, ms );
switch (status)
{
@@ -713,7 +717,7 @@ get_subtests (const char *tempdir, struct wine_test *test, LPSTR res_name)
/* We need to add the path (to the main dll) to PATH */
append_path(test->maindllpath);
}
- status = run_ex (cmd, subfile, tempdir, 5000);
+ status = run_ex (cmd, subfile, tempdir, 5000, NULL);
err = GetLastError();
if (test->maindllpath) {
/* Restore PATH again */
@@ -785,13 +789,13 @@ run_test (struct wine_test* test, const char* subtest, HANDLE out_file, const ch
else
{
int status;
- DWORD start = GetTickCount();
+ DWORD pid, start = GetTickCount();
char *cmd = strmake (NULL, "%s %s", test->exename, subtest);
report (R_STEP, "Running: %s:%s", test->name, subtest);
xprintf ("%s:%s start %s -\n", test->name, subtest, file);
- status = run_ex (cmd, out_file, tempdir, 120000);
+ status = run_ex (cmd, out_file, tempdir, 120000, &pid);
heap_free (cmd);
- xprintf ("%s:%s done (%d) in %ds\n", test->name, subtest, status, (GetTickCount()-start)/1000);
+ xprintf ("%s:%s:%04x done (%d) in %ds\n", test->name, subtest, pid, status, (GetTickCount()-start)/1000);
if (status) failures++;
}
if (failures) report (R_STATUS, "Running tests - %u failures", failures);
More information about the wine-cvs
mailing list