Our test framework depends on CreateProcess() initializing the hProcess field in case of a failure. The process tests depend on it not modifying the STARTUPINFO fields.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- dlls/kernel32/tests/process.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 08eff6fc640..0691feff544 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -895,10 +895,31 @@ static void test_CommandLine(void) startup.dwFlags = STARTF_USESHOWWINDOW; startup.wShowWindow = SW_SHOWNORMAL;
+ /* failure case */ + strcpy(buffer, ""t:\NotADir\NotAFile.exe""); + memset(&info, 0xa, sizeof(info)); + ok(!CreateProcessA(buffer, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess unexpectedly succeeded\n"); + /* Check that the effective STARTUPINFOA parameters are not modified */ + ok(startup.cb == sizeof(startup), "unexpected cb %d\n", startup.cb); + ok(startup.lpDesktop == NULL, "lpDesktop is not NULL\n"); + ok(startup.lpTitle == NULL, "lpTitle is not NULL\n"); + ok(startup.dwFlags == STARTF_USESHOWWINDOW, "unexpected dwFlags %04x\n", startup.dwFlags); + ok(startup.wShowWindow == SW_SHOWNORMAL, "unexpected wShowWindow %d\n", startup.wShowWindow); + ok(!info.hProcess, "unexpected hProcess %p\n", info.hProcess); + ok(!info.hThread, "unexpected hThread %p\n", info.hThread); + ok(!info.dwProcessId, "unexpected dwProcessId %04x\n", info.dwProcessId); + ok(!info.dwThreadId, "unexpected dwThreadId %04x\n", info.dwThreadId); + /* the basics */ get_file_name(resfile); sprintf(buffer, ""%s" process dump "%s" "C:\Program Files\my nice app.exe" """"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); + /* Check that the effective STARTUPINFOA parameters are not modified */ + ok(startup.cb == sizeof(startup), "unexpected cb %d\n", startup.cb); + ok(startup.lpDesktop == NULL, "lpDesktop is not NULL\n"); + ok(startup.lpTitle == NULL, "lpTitle is not NULL\n"); + ok(startup.dwFlags == STARTF_USESHOWWINDOW, "unexpected dwFlags %04x\n", startup.dwFlags); + ok(startup.wShowWindow == SW_SHOWNORMAL, "unexpected wShowWindow %d\n", startup.wShowWindow); /* wait for child to terminate */ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); /* child process has changed result file, so let profile functions know about it */ @@ -914,11 +935,6 @@ static void test_CommandLine(void) release_memory(); DeleteFileA(resfile);
- memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - /* test main()'s quotes handling */ get_file_name(resfile); sprintf(buffer, ""%s" process dump "%s" "a\"b\\" c\" d", selfname, resfile);
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=65680
Your paranoid android.
=== w8 (32 bit report) ===
kernel32: process.c:1242: Test failed: expected 1, got 0 process.c:1249: Test failed: Toolhelp:cntUsage expected 0, but got 1 process.c:1250: Test failed: Toolhelp:th32DefaultHeapID expected 0, but got 1 process.c:1251: Test failed: Toolhelp:th32ModuleID expected 0, but got 1 process.c:1252: Test failed: Toolhelp:th32ParentProcessID expected 2484, but got 0 process.c:1254: Test failed: Toolhelp:dwFlags expected 0, but got 1
On Sun, 23 Feb 2020, Marvin wrote: [...]
[...]
=== w8 (32 bit report) ===
kernel32: process.c:1242: Test failed: expected 1, got 0 process.c:1249: Test failed: Toolhelp:cntUsage expected 0, but got 1 process.c:1250: Test failed: Toolhelp:th32DefaultHeapID expected 0, but got 1 process.c:1251: Test failed: Toolhelp:th32ModuleID expected 0, but got 1 process.c:1252: Test failed: Toolhelp:th32ParentProcessID expected 2484, but got 0 process.c:1254: Test failed: Toolhelp:dwFlags expected 0, but got 1
This is one of those rare intermittent failures: it has happened 3 times before, once on w864-32, once on w8adm and once on cw-gtx560-64; but never on w8, hence the false positive.