This series fixes a couple of failures when running kernel32:debugger tests on various platforms.
From: Eric Pouech eric.pouech@gmail.com
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/kernel32/tests/debugger.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c index 513db658222..baf8d2749c7 100644 --- a/dlls/kernel32/tests/debugger.c +++ b/dlls/kernel32/tests/debugger.c @@ -1001,6 +1001,17 @@ static void test_debug_loop(int argc, char **argv) win_skip("CheckRemoteDebuggerPresent not available, skipping test.\n"); return; } + if (sizeof(void *) > sizeof(int)) + { + WCHAR buffer[MAX_PATH]; + GetSystemWow64DirectoryW( buffer, MAX_PATH ); + wcscat( buffer, L"\oleacc.dll" ); + if (GetFileAttributesW( buffer ) == INVALID_FILE_ATTRIBUTES) + { + skip("Skipping test on 64bit only configuration\n"); + return; + } + }
pid = GetCurrentProcessId(); ret = DebugActiveProcess(pid);
From: Eric Pouech eric.pouech@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54534
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/dbghelp/tests/dbghelp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/dbghelp/tests/dbghelp.c b/dlls/dbghelp/tests/dbghelp.c index 83805f3ed10..89c6ab37118 100644 --- a/dlls/dbghelp/tests/dbghelp.c +++ b/dlls/dbghelp/tests/dbghelp.c @@ -514,7 +514,8 @@ static BOOL CALLBACK aggregate_cb(PCWSTR imagename, DWORD64 base, ULONG sz, PVOI { ok(!ret, "Module %ls shouldn't be loaded\n", imagename); ret = SymLoadModuleExW(aggregation->proc, NULL, imagename, NULL, base, sz, NULL, 0); - ok(ret, "SymLoadModuleExW failed on %ls: %lu\n", imagename, GetLastError()); + ok(ret || broken(GetLastError() == ERROR_SUCCESS) /* Win10/64 v1607 return this on bcryptPrimitives.DLL */, + "SymLoadModuleExW failed on %ls: %lu\n", imagename, GetLastError()); ret = SymGetModuleInfoW64(aggregation->proc, base, &im); ok(ret, "SymGetModuleInfoW64 failed: %lu\n", GetLastError()); }
From: Eric Pouech eric.pouech@gmail.com
As background information from Windows testings: - the debug port event is closed upon thread regular exit. - results are however inconsistent across Windows versions for forced termination (through TerminateThread and equiv). - this is moreover crippled by most of the 32bit implementation on Windows (except Win8) which don't enforce the close on exit flag for wow64 debuggee:s (they enforce it for 64bit though) - but, in the cases where the debuggee terminates, the debug port is always closed *after* the debuggee process termination.
So I adapted the tests to conform to "debug port is closed" when handling the thread termination. Some tests had to be moved *after* debuggee termination to ensure success.
Net result: - tests pass on Windows - Wine implementation still to be improved
https://bugs.winehq.org/show_bug.cgi?id=53144
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/kernel32/tests/debugger.c | 46 ++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 13 deletions(-)
diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c index baf8d2749c7..b63e2acf934 100644 --- a/dlls/kernel32/tests/debugger.c +++ b/dlls/kernel32/tests/debugger.c @@ -2098,6 +2098,7 @@ static void test_kill_on_exit(const char *argv0) HANDLE event, debug, thread; DWORD exit_code, tid; ULONG val; + BOOL ret;
event = CreateEventW(&sa, FALSE, FALSE, NULL); ok(event != NULL, "CreateEvent failed: %lu\n", GetLastError()); @@ -2169,29 +2170,46 @@ static void test_kill_on_exit(const char *argv0) CloseHandle( pi.hThread ); CloseHandle( thread );
- /* but not on forced exit */ + /* checking on forced exit */ status = pNtCreateDebugObject( &debug, DEBUG_ALL_ACCESS, &attr, DEBUG_KILL_ON_CLOSE ); ok( !status, "NtCreateDebugObject failed %lx\n", status ); thread = CreateThread(NULL, 0, debug_and_wait, &debug, 0, &tid); Sleep( 100 ); ok( debug != 0, "no debug port\n" ); - val = 1; + val = DEBUG_KILL_ON_CLOSE; status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation, &val, sizeof(val), NULL ); ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %lx\n", status ); TerminateThread( thread, 0 ); - status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation, - &val, sizeof(val), NULL ); - ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %lx\n", status ); - WaitForSingleObject( pi.hProcess, 300 ); - GetExitCodeProcess( pi.hProcess, &exit_code ); - todo_wine - ok( exit_code == STATUS_DEBUGGER_INACTIVE || broken(exit_code == STILL_ACTIVE), /* wow64 */ - "exit code = %08lx\n", exit_code); + + status = WaitForSingleObject( pi.hProcess, 1500 ); + if (status != WAIT_OBJECT_0) + { + todo_wine /* Wine doesn't handle debug port of TerminateThread */ + ok(broken(sizeof(void*) == sizeof(int)), /* happens consistently on 32bit on Win7, 10 & 11 */ + "Terminating thread should terminate debuggee\n"); + + ret = TerminateProcess( pi.hProcess, 0 ); + ok(ret, "TerminateProcess failed: %lu\n", GetLastError()); + CloseHandle( debug ); + } + else + { + ok(status == WAIT_OBJECT_0, "debuggee didn't terminate %lx\n", status); + ret = GetExitCodeProcess( pi.hProcess, &exit_code ); + ok(ret, "No exit code: %lu\n", GetLastError()); + todo_wine + ok( exit_code == STATUS_DEBUGGER_INACTIVE || broken(exit_code == STILL_ACTIVE), /* wow64 */ + "exit code = %08lx\n", exit_code); + status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation, + &val, sizeof(val), NULL ); + todo_wine + ok( status == STATUS_INVALID_HANDLE, "NtSetInformationDebugObject failed %lx\n", status ); + } + CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); CloseHandle( thread ); - CloseHandle( debug );
debug = 0; thread = CreateThread(NULL, 0, create_debug_port, &debug, 0, &tid); @@ -2202,10 +2220,12 @@ static void test_kill_on_exit(const char *argv0) &val, sizeof(val), NULL ); ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %lx\n", status ); TerminateThread( thread, 0 ); + Sleep( 200 ); status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation, &val, sizeof(val), NULL ); - ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %lx\n", status ); - CloseHandle( debug ); + ok( status == STATUS_INVALID_HANDLE || broken( status == STATUS_SUCCESS ), + "NtSetInformationDebugObject failed %lx\n", status ); + if (status != STATUS_INVALID_HANDLE) CloseHandle( debug ); CloseHandle( thread );
CloseHandle( event );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=129730
Your paranoid android.
=== debian11 (32 bit report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0
=== debian11 (32 bit ar:MA report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0
=== debian11 (32 bit de report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0
=== debian11 (32 bit fr report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0
=== debian11 (32 bit he:IL report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0
=== debian11 (32 bit hi:IN report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0
=== debian11 (32 bit ja:JP report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0
=== debian11 (32 bit zh:CN report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0
=== debian11b (32 bit WoW report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0
=== debian11b (64 bit WoW report) ===
kernel32: debugger.c:2226: Test failed: NtSetInformationDebugObject failed 0