V2: - fix broken results on Win7
note: a couple of errors reported by Marvin when running these tests are fixed by the other 2 patch-serie (and others have been present on Debian from some locale)
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/kernel32/tests/process.c | 89 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index ebadc2e8d12..446a2b25713 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -512,7 +512,22 @@ static void doChild(const char* file, const char* option) ok(WriteFile(hStdOut, buf, r, &w, NULL) && w == r, "Writing message to output pipe\n"); } } + if (option && strcmp(option, "stdinfo") == 0) + { + DWORD flin, flout, flerr;
+ BOOL bin = GetHandleInformation(GetStdHandle(STD_INPUT_HANDLE), &flin); + BOOL bout = GetHandleInformation(GetStdHandle(STD_OUTPUT_HANDLE), &flout); + BOOL berr = GetHandleInformation(GetStdHandle(STD_ERROR_HANDLE), &flerr); + if (bin || bout || berr) + { + childPrintf(hFile, "[StdHandleInfo]\n"); + if (bin ) childPrintf(hFile, "hStdInput=%lu", flin); + if (bout) childPrintf(hFile, "hStdOutput=%lu", flout); + if (berr) childPrintf(hFile, "hStdError=%lu", flerr); + childPrintf(hFile, "\n"); + } + } if (option && strcmp(option, "exit_code") == 0) { childPrintf(hFile, "[ExitCode]\nvalue=%d\n\n", 123); @@ -523,6 +538,15 @@ static void doChild(const char* file, const char* option) CloseHandle(hFile); }
+static BOOL isChildPresent( const char* sect, const char* key ) +{ + char buf[1024+4*MAX_LISTED_ENV_VAR]; + + GetPrivateProfileStringA(sect, key, "-", buf, sizeof(buf), resfile); + if (buf[0] == '\0' || (buf[0] == '-' && buf[1] == '\0')) return FALSE; + return TRUE; +} + static char* getChildString(const char* sect, const char* key) { char buf[1024+4*MAX_LISTED_ENV_VAR]; @@ -614,10 +638,17 @@ static void ok_child_int( int line, const char *sect, const char *key, UINT expe ok_(__FILE__, line)( result == expect, "%s:%s expected %u, but got %u\n", sect, key, expect, result ); }
+static void ok_child_intbrk( int line, const char *sect, const char *key, UINT expect, UINT brk ) +{ + UINT result = GetPrivateProfileIntA( sect, key, !expect, resfile ); + ok_(__FILE__, line)( result == expect || broken(result == brk), "%s:%s expected %u, but got %u\n", sect, key, expect, result ); +} + #define okChildString(sect, key, expect) ok_child_string(__LINE__, (sect), (key), (expect), 1 ) #define okChildIString(sect, key, expect) ok_child_string(__LINE__, (sect), (key), (expect), 0 ) #define okChildStringWA(sect, key, expect) ok_child_stringWA(__LINE__, (sect), (key), (expect), 1 ) #define okChildInt(sect, key, expect) ok_child_int(__LINE__, (sect), (key), (expect)) +#define okChildIntBroken(sect, key, expect, brk) ok_child_intbrk(__LINE__, (sect), (key), (expect), (brk))
static void test_Startup(void) { @@ -1691,6 +1722,64 @@ static void test_Console(void)
release_memory(); DeleteFileA(resfile); + + /* test passing in startupinfo inheritable and non inheritable handles (CreateProcess not inheriting handles) */ + memset(&startup, 0, sizeof(startup)); + startup.cb = sizeof(startup); + startup.dwFlags = STARTF_USESTDHANDLES; + startup.hStdInput = CreateFileA("NUL", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); + startup.hStdOutput = CreateFileA("NUL", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); + startup.hStdError = (HANDLE)(DWORD_PTR)0x00585840; + ok(startup.hStdInput != INVALID_HANDLE_VALUE, "failed to open NUL\n"); + ok(startup.hStdOutput != INVALID_HANDLE_VALUE, "failed to open NUL\n"); + sprintf(buffer, ""%s" process dump "%s" stdinfo", selfname, resfile); + ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess\n"); + wait_and_close_child_process(&info); + CloseHandle(startup.hStdInput); + + reload_child_info(resfile); + /* handles values have been zero:ed */ + todo_wine okChildIntBroken("StartupInfoA", "hStdInput", 0, /* Win7 */ (DWORD_PTR)startup.hStdInput); + todo_wine okChildIntBroken("StartupInfoA", "hStdOutput", 0, /* Win7 */ (DWORD_PTR)startup.hStdOutput); + todo_wine okChildIntBroken("StartupInfoA", "hStdError", 0, /* Win7 */ (DWORD_PTR)startup.hStdError); + todo_wine okChildIntBroken("StartupInfoW", "hStdInput", 0, /* Win7 */ (DWORD_PTR)startup.hStdInput); + todo_wine okChildIntBroken("StartupInfoW", "hStdOutput", 0, /* Win7 */ (DWORD_PTR)startup.hStdOutput); + todo_wine okChildIntBroken("StartupInfoW", "hStdError", 0, /* Win7 */ (DWORD_PTR)startup.hStdError); + /* even inheritable objects are not inherited */ + todo_wine ok(!isChildPresent("StdHandleInfo", "hStdInput"), "shouldn't inherit handle\n"); + ok(!isChildPresent("StdHandleInfo", "hStdOutput"), "hStdOutput shouldn't be present\n"); + ok(!isChildPresent("StdHandleInfo", "hStdError"), "hStdError shouldn't be present\n"); + release_memory(); + DeleteFileA(resfile); + + /* test passing in startupinfo inheritable and non inheritable handles (CreateProcess inhering handles)) */ + memset(&startup, 0, sizeof(startup)); + startup.cb = sizeof(startup); + startup.dwFlags = STARTF_USESTDHANDLES; + startup.hStdInput = CreateFileA("NUL", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); + startup.hStdOutput = CreateFileA("NUL", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); + startup.hStdError = (HANDLE)(DWORD_PTR)0x00585840; + ok(startup.hStdInput != INVALID_HANDLE_VALUE, "failed to open NUL\n"); + ok(startup.hStdOutput != INVALID_HANDLE_VALUE, "failed to open NUL\n"); + sprintf(buffer, ""%s" process dump "%s" stdinfo", selfname, resfile); + ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info), "CreateProcess\n"); + wait_and_close_child_process(&info); + CloseHandle(startup.hStdInput); + + reload_child_info(resfile); + /* handles values are available */ + okChildInt("StartupInfoA", "hStdInput", (DWORD_PTR)startup.hStdInput); + okChildInt("StartupInfoA", "hStdOutput", (DWORD_PTR)startup.hStdOutput); + okChildInt("StartupInfoA", "hStdError", (DWORD_PTR)startup.hStdError); + okChildInt("StartupInfoW", "hStdInput", (DWORD_PTR)startup.hStdInput); + okChildInt("StartupInfoW", "hStdOutput", (DWORD_PTR)startup.hStdOutput); + okChildInt("StartupInfoW", "hStdError", (DWORD_PTR)startup.hStdError); + /* only inheritable objects are inherited */ + okChildInt("StdHandleInfo", "hStdInput", HANDLE_FLAG_INHERIT); + ok(!isChildPresent("StdHandleInfo", "hStdOutput"), "hStdOutput shouldn't be present\n"); + ok(!isChildPresent("StdHandleInfo", "hStdError"), "hStdError shouldn't be present\n"); + release_memory(); + DeleteFileA(resfile); }
static void test_ExitCode(void)
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=112936
Your paranoid android.
=== debian11 (32 bit report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 2, but got 0 process.c:1653: Test failed: Console:SizeY expected 0, but got 1 process.c:1654: Test failed: Console:CursorX expected 3, but got 0 process.c:1655: Test failed: Console:CursorY expected 0, but got 1 process.c:1656: Test failed: Console:Attributes expected 4076, but got 0 process.c:1657: Test failed: Console:winLeft expected 19, but got 0 process.c:1658: Test failed: Console:winTop expected 4294963112, but got 0 process.c:1660: Test failed: Console:winBottom expected 11310, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 32764, but got 0 process.c:1662: Test failed: Console:maxWinHeight expected 11264, but got 0 process.c:1665: Test failed: Console:InputMode expected 6619251, but got 0 process.c:1666: Test failed: Console:OutputMode expected 7536754, but got 0
=== debian11 (32 bit Arabic:Morocco report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 2, but got 0 process.c:1653: Test failed: Console:SizeY expected 0, but got 1 process.c:1654: Test failed: Console:CursorX expected 3, but got 0 process.c:1655: Test failed: Console:CursorY expected 0, but got 1 process.c:1656: Test failed: Console:Attributes expected 4100, but got 0 process.c:1657: Test failed: Console:winLeft expected 19, but got 0 process.c:1658: Test failed: Console:winTop expected 4294963112, but got 0 process.c:1660: Test failed: Console:winBottom expected 11310, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 32764, but got 0 process.c:1662: Test failed: Console:maxWinHeight expected 11264, but got 0 process.c:1665: Test failed: Console:InputMode expected 6619251, but got 0 process.c:1666: Test failed: Console:OutputMode expected 7536754, but got 0
=== debian11 (32 bit German report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 2, but got 0 process.c:1653: Test failed: Console:SizeY expected 0, but got 1 process.c:1654: Test failed: Console:CursorX expected 3, but got 0 process.c:1655: Test failed: Console:CursorY expected 0, but got 1 process.c:1656: Test failed: Console:Attributes expected 4100, but got 0 process.c:1657: Test failed: Console:winLeft expected 19, but got 0 process.c:1658: Test failed: Console:winTop expected 4294963112, but got 0 process.c:1660: Test failed: Console:winBottom expected 11310, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 32764, but got 0 process.c:1662: Test failed: Console:maxWinHeight expected 11264, but got 0 process.c:1665: Test failed: Console:InputMode expected 6619251, but got 0 process.c:1666: Test failed: Console:OutputMode expected 7536754, but got 0
=== debian11 (32 bit French report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 2, but got 0 process.c:1653: Test failed: Console:SizeY expected 0, but got 1 process.c:1654: Test failed: Console:CursorX expected 3, but got 0 process.c:1655: Test failed: Console:CursorY expected 0, but got 1 process.c:1656: Test failed: Console:Attributes expected 4100, but got 0 process.c:1657: Test failed: Console:winLeft expected 19, but got 0 process.c:1658: Test failed: Console:winTop expected 4294963112, but got 0 process.c:1660: Test failed: Console:winBottom expected 11310, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 32764, but got 0 process.c:1662: Test failed: Console:maxWinHeight expected 11264, but got 0 process.c:1665: Test failed: Console:InputMode expected 6619251, but got 0 process.c:1666: Test failed: Console:OutputMode expected 7536754, but got 0
=== debian11 (32 bit Hebrew:Israel report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 2, but got 0 process.c:1653: Test failed: Console:SizeY expected 0, but got 1 process.c:1654: Test failed: Console:CursorX expected 3, but got 0 process.c:1655: Test failed: Console:CursorY expected 0, but got 1 process.c:1656: Test failed: Console:Attributes expected 4100, but got 0 process.c:1657: Test failed: Console:winLeft expected 19, but got 0 process.c:1658: Test failed: Console:winTop expected 4294963112, but got 0 process.c:1660: Test failed: Console:winBottom expected 11310, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 32764, but got 0 process.c:1662: Test failed: Console:maxWinHeight expected 11264, but got 0 process.c:1665: Test failed: Console:InputMode expected 6619251, but got 0 process.c:1666: Test failed: Console:OutputMode expected 7536754, but got 0
=== debian11 (32 bit Hindi:India report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 2, but got 0 process.c:1653: Test failed: Console:SizeY expected 0, but got 1 process.c:1654: Test failed: Console:CursorX expected 3, but got 0 process.c:1655: Test failed: Console:CursorY expected 0, but got 1 process.c:1656: Test failed: Console:Attributes expected 4100, but got 0 process.c:1657: Test failed: Console:winLeft expected 19, but got 0 process.c:1658: Test failed: Console:winTop expected 4294963112, but got 0 process.c:1660: Test failed: Console:winBottom expected 11310, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 32764, but got 0 process.c:1662: Test failed: Console:maxWinHeight expected 11264, but got 0 process.c:1665: Test failed: Console:InputMode expected 6619251, but got 0 process.c:1666: Test failed: Console:OutputMode expected 7536754, but got 0
=== debian11 (32 bit Japanese:Japan report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 2, but got 0 process.c:1653: Test failed: Console:SizeY expected 0, but got 1 process.c:1654: Test failed: Console:CursorX expected 3, but got 0 process.c:1655: Test failed: Console:CursorY expected 0, but got 1 process.c:1656: Test failed: Console:Attributes expected 4100, but got 0 process.c:1657: Test failed: Console:winLeft expected 19, but got 0 process.c:1658: Test failed: Console:winTop expected 4294963112, but got 0 process.c:1660: Test failed: Console:winBottom expected 11310, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 32764, but got 0 process.c:1662: Test failed: Console:maxWinHeight expected 11264, but got 0 process.c:1665: Test failed: Console:InputMode expected 6619251, but got 0 process.c:1666: Test failed: Console:OutputMode expected 7536754, but got 0
=== debian11 (32 bit Chinese:China report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 2, but got 0 process.c:1653: Test failed: Console:SizeY expected 0, but got 1 process.c:1654: Test failed: Console:CursorX expected 3, but got 0 process.c:1655: Test failed: Console:CursorY expected 0, but got 1 process.c:1656: Test failed: Console:Attributes expected 4100, but got 0 process.c:1657: Test failed: Console:winLeft expected 19, but got 0 process.c:1658: Test failed: Console:winTop expected 4294963112, but got 0 process.c:1660: Test failed: Console:winBottom expected 11310, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 32764, but got 0 process.c:1662: Test failed: Console:maxWinHeight expected 11264, but got 0 process.c:1665: Test failed: Console:InputMode expected 6619251, but got 0 process.c:1666: Test failed: Console:OutputMode expected 7536754, but got 0
=== debian11 (32 bit WoW report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 2, but got 0 process.c:1653: Test failed: Console:SizeY expected 0, but got 1 process.c:1654: Test failed: Console:CursorX expected 3, but got 0 process.c:1655: Test failed: Console:CursorY expected 0, but got 1 process.c:1656: Test failed: Console:Attributes expected 4532, but got 0 process.c:1657: Test failed: Console:winLeft expected 36, but got 0 process.c:1658: Test failed: Console:winTop expected 4294963112, but got 0 process.c:1660: Test failed: Console:winBottom expected 11310, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 32764, but got 0 process.c:1662: Test failed: Console:maxWinHeight expected 11264, but got 0 process.c:1665: Test failed: Console:InputMode expected 6619251, but got 0 process.c:1666: Test failed: Console:OutputMode expected 7536754, but got 0
=== debian11 (64 bit WoW report) ===
kernel32: process.c:1652: Test failed: Console:SizeX expected 23, but got 0 process.c:1653: Test failed: Console:SizeY expected 4294950912, but got 0 process.c:1656: Test failed: Console:Attributes expected 0, but got 1 process.c:1657: Test failed: Console:winLeft expected 64, but got 0 process.c:1660: Test failed: Console:winBottom expected 4294961424, but got 0 process.c:1661: Test failed: Console:maxWinWidth expected 140, but got 0 process.c:1665: Test failed: Console:InputMode expected 0, but got 1