[2/2] kernel32: Count precise amount of child process failures.

Dmitry Timoshkov dmitry at baikal.ru
Thu Apr 18 03:44:43 CDT 2013


---
 dlls/kernel32/tests/loader.c | 30 +++++++++++++++++++++++++-----
 include/wine/test.h          |  7 +++++++
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index ca33ef7..20ae3ec 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1615,7 +1615,11 @@ static void test_ExitProcess(void)
     ok(ret == WAIT_OBJECT_0, "child process failed to terminate\n");
     GetExitCodeProcess(pi.hProcess, &ret);
     ok(ret == 195, "expected exit code 195, got %u\n", ret);
-    ok(!*child_failures, "%u failures in child process\n", *child_failures);
+    if (*child_failures)
+    {
+        trace("%d failures in child process\n", *child_failures);
+        winetest_add_failures(*child_failures);
+    }
     CloseHandle(pi.hThread);
     CloseHandle(pi.hProcess);
 
@@ -1628,7 +1632,11 @@ static void test_ExitProcess(void)
     ok(ret == WAIT_OBJECT_0, "child process failed to terminate\n");
     GetExitCodeProcess(pi.hProcess, &ret);
     ok(ret == 195, "expected exit code 195, got %u\n", ret);
-    ok(!*child_failures, "%u failures in child process\n", *child_failures);
+    if (*child_failures)
+    {
+        trace("%d failures in child process\n", *child_failures);
+        winetest_add_failures(*child_failures);
+    }
     CloseHandle(pi.hThread);
     CloseHandle(pi.hProcess);
 
@@ -1641,7 +1649,11 @@ static void test_ExitProcess(void)
     ok(ret == WAIT_OBJECT_0, "child process failed to terminate\n");
     GetExitCodeProcess(pi.hProcess, &ret);
     ok(ret == 197, "expected exit code 197, got %u\n", ret);
-    ok(!*child_failures, "%u failures in child process\n", *child_failures);
+    if (*child_failures)
+    {
+        trace("%d failures in child process\n", *child_failures);
+        winetest_add_failures(*child_failures);
+    }
     CloseHandle(pi.hThread);
     CloseHandle(pi.hProcess);
 
@@ -1654,7 +1666,11 @@ static void test_ExitProcess(void)
     ok(ret == WAIT_OBJECT_0, "child process failed to terminate\n");
     GetExitCodeProcess(pi.hProcess, &ret);
     ok(ret == 195, "expected exit code 195, got %u\n", ret);
-    ok(!*child_failures, "%u failures in child process\n", *child_failures);
+    if (*child_failures)
+    {
+        trace("%d failures in child process\n", *child_failures);
+        winetest_add_failures(*child_failures);
+    }
     CloseHandle(pi.hThread);
     CloseHandle(pi.hProcess);
 
@@ -1668,7 +1684,11 @@ static void test_ExitProcess(void)
     GetExitCodeProcess(pi.hProcess, &ret);
 todo_wine
     ok(ret == 0 || broken(ret == 195) /* before win7 */, "expected exit code 0, got %u\n", ret);
-    ok(!*child_failures, "%u failures in child process\n", *child_failures);
+    if (*child_failures)
+    {
+        trace("%d failures in child process\n", *child_failures);
+        winetest_add_failures(*child_failures);
+    }
     CloseHandle(pi.hThread);
     CloseHandle(pi.hProcess);
 
diff --git a/include/wine/test.h b/include/wine/test.h
index 0bd4db5..373fe76 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -61,6 +61,7 @@ extern int winetest_loop_todo(void);
 extern void winetest_end_todo( const char* platform );
 extern int winetest_get_mainargs( char*** pargv );
 extern LONG winetest_get_failures(void);
+extern void winetest_add_failures( LONG new_failures );
 extern void winetest_wait_child_process( HANDLE process );
 
 extern const char *wine_dbgstr_wn( const WCHAR *str, int n );
@@ -434,6 +435,12 @@ LONG winetest_get_failures(void)
     return failures;
 }
 
+void winetest_add_failures( LONG new_failures )
+{
+    while (new_failures-- > 0)
+        InterlockedIncrement( &failures );
+}
+
 void winetest_wait_child_process( HANDLE process )
 {
     DWORD exit_code = 1;
-- 
1.8.2.1




More information about the wine-patches mailing list