wine/test.h: Identify test result lines printed by child processes.

Francois Gouget fgouget at codeweavers.com
Wed Feb 1 13:05:44 CST 2017


On Tue, 31 Jan 2017, Alexandre Julliard wrote:
[...]
> Couldn't you simply print the pid, have winetest print it too on the
> 'done' line, and check that they match?

That's going to be more work but it's an excellent idea.

Would something like this do?


diff --git a/include/wine/test.h b/include/wine/test.h
index f33ab9ab560..cd07772e366 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( "%s:%u %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
+                test->name, GetCurrentProcessId(),
+                successes + failures + todo_successes + todo_failures,
                 todo_successes, failures + todo_failures,
                 (failures + todo_failures != 1) ? "failures" : "failure",
                 skipped );
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index 1eb49b6a699..388e351c5b3 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -620,7 +620,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;
@@ -634,9 +634,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)
     {
@@ -720,7 +724,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 */
@@ -791,13 +795,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:%u 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);



If yes I'll also update the code parsing the test results for the 
winetest and testbot websites so they recognize both the old and new 
styles. Then this patch can be committed and I'll adapt it to 
TestLauncher which will mean committing the new binaries to Git (yuck) 
unless the TestBot is further modified, or we revive the idea of using 
WineTest for everything (but it cannot be built for just one test 
anymore).


-- 
Francois Gouget <fgouget at codeweavers.com>



More information about the wine-devel mailing list