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

Francois Gouget fgouget at codeweavers.com
Tue Jan 17 10:28:07 CST 2017


Currently the child process result 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 result line,
if it has run a subprocess. By making the subprocess result lines
different analysis tools will detect that the main result line is
missing and automatically consider that the main process crashed,
thus marking the test as failed.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---

This fixes bug 32354:
https://bugs.winehq.org/show_bug.cgi?id=32354

 include/wine/test.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/wine/test.h b/include/wine/test.h
index f33ab9ab560..aa89c55ca07 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -205,6 +205,9 @@ const char *winetest_platform = "windows";
 /* report successful tests (BOOL) */
 static int report_success = 0;
 
+/* non-zero if this is a test subprocess */
+static int winetest_is_child = 0;
+
 /* passing arguments around */
 static int winetest_argc;
 static char** winetest_argv;
@@ -590,8 +593,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",
+        printf( "%s: %d tests executed%s (%d marked as todo, %d %s), %d skipped.\n",
                 test->name, successes + failures + todo_successes + todo_failures,
+                winetest_is_child ? " in child" : "",
                 todo_successes, failures + todo_failures,
                 (failures + todo_failures != 1) ? "failures" : "failure",
                 skipped );
@@ -653,6 +657,9 @@ int main( int argc, char **argv )
     if (GetEnvironmentVariableA( "WINETEST_DEBUG", p, sizeof(p) )) winetest_debug = 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_IS_CHILD", p, sizeof(p) )) winetest_is_child = atoi(p);
+    /* Identify any future process as a child of this one */
+    SetEnvironmentVariableA( "WINETEST_IS_CHILD", "1" );
 
     if (!strcmp( winetest_platform, "windows" )) SetUnhandledExceptionFilter( exc_filter );
     if (!winetest_interactive) SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX );
-- 
2.11.0



More information about the wine-patches mailing list