kernel32: Count precise amount of child process failures.

This commit is contained in:
Dmitry Timoshkov 2013-04-18 17:44:43 +09:00 committed by Alexandre Julliard
parent 3de89e8500
commit b632f0966d
2 changed files with 32 additions and 5 deletions

View file

@ -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);

View file

@ -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;