This shall let testbot succeed on kernel32:process tests (fixing evolution generated by the shell-no-window type of consoles)
Note: the tests had been written at a time where the console in Windows wasn't a kernel object like the others... (the two lower bits of the handle where set). And hadn't been updated ever since, so some test was only run on Win7... This serie also updates those test to focus mainly on Win{>= 8}
Supersede: 232632
Signed-off-by: Eric Pouech eric.pouech@gmail.com ---
Eric Pouech (2): dlls/kernel32/tests: let the console tests pass if current console is shell-no-window dlls/kernel32/tests: adapt dup console handle test to non Win7 handles
dlls/kernel32/tests/process.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
This patch shall let this kernel32:process test pass when run from TestBot.
Note: adapted the tests to non Win7 type of handles (the ones with 2 lower bits set...). Windows 8 and above use real handles for console. Wine has been doing so since since 2 years.
The is_console() helper is then not testing what its name pretends. It actually tests whether we're running the test on W7 :-( So let's get reed of it.
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/kernel32/tests/process.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 8f18a0d37a7..9629b50a744 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -1541,8 +1541,13 @@ static void test_Console(void) startup.hStdOutput = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0);
/* first, we need to be sure we're attached to a console */ - if (!is_console(startup.hStdInput) || !is_console(startup.hStdOutput)) + if (startup.hStdInput == INVALID_HANDLE_VALUE || startup.hStdOutput == INVALID_HANDLE_VALUE) { + /* this fails either when this test process is run detached from console + * (unlikely, as this very process must be explicitely created with detached flag), + * or is attached to a Wine's shell-no-window kind of console (if the later, detach from it) + */ + FreeConsole(); /* we're not attached to a console, let's do it */ AllocConsole(); startup.hStdInput = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=112924
Your paranoid android.
=== w10pro64_ar (64 bit report) ===
kernel32: process.c:4980: Test failed: got 0xc0000004 process.c:4998: Test failed: got services.exe SessionId 1
=== debian11 (32 bit Hindi:India report) ===
kernel32: process.c:1587: Test failed: GetLastError: expecting 87 got 6 process.c:1597: Test failed: GetLastError: expecting 87 got 6
This test hadn't been changed with console rewrite. The status before this patch: - it's not run on Windows except Win7 - it's not run on Wine
Rewrote it so that it run on all cases and inverse the test logic (it was only testing Win7 behavior, which is no longer what we want).
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/kernel32/tests/process.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 9629b50a744..ebadc2e8d12 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -1507,11 +1507,6 @@ static void test_DebuggingFlag(void) DeleteFileA(resfile); }
-static BOOL is_console(HANDLE h) -{ - return h != INVALID_HANDLE_VALUE && ((ULONG_PTR)h & 3) == 3; -} - static void test_Console(void) { char buffer[2 * MAX_PATH + 35]; @@ -2500,17 +2495,11 @@ static void test_DuplicateHandle(void) DeleteFileA(file_name);
f = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - if (!is_console(f)) - { - skip("DuplicateHandle on console handle\n"); - CloseHandle(f); - return; - } - + ok(f != INVALID_HANDLE_VALUE, "Failed to open CONIN$ %lu\n", GetLastError()); r = DuplicateHandle(GetCurrentProcess(), f, GetCurrentProcess(), &out, 0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); ok(r, "DuplicateHandle error %lu\n", GetLastError()); - todo_wine ok(f != out, "f == out\n"); + ok(f == out || broken(/* Win7 */ (((ULONG_PTR)f & 3) == 3) && (f != out)), "f != out\n"); CloseHandle(out); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=112925
Your paranoid android.
=== debian11 (32 bit Hindi:India report) ===
kernel32: process.c:1582: Test failed: GetLastError: expecting 87 got 6 process.c:1592: Test failed: GetLastError: expecting 87 got 6 process.c:1623: Test failed: Console:CursorX expected 4294955996, but got 0