mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
272 lines
14 KiB
Diff
272 lines
14 KiB
Diff
From d11a4312c95af78a10bda811e91d5175eb63aae4 Mon Sep 17 00:00:00 2001
|
|
From: Sebastian Lackner <sebastian@fds-team.de>
|
|
Date: Thu, 26 Feb 2015 05:18:09 +0100
|
|
Subject: kernel32/tests: Allow multiple subprocess commands in process tests.
|
|
|
|
---
|
|
dlls/kernel32/tests/process.c | 74 +++++++++++++++++++++++--------------------
|
|
1 file changed, 40 insertions(+), 34 deletions(-)
|
|
|
|
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
|
|
index 99185fb..32d57c2 100644
|
|
--- a/dlls/kernel32/tests/process.c
|
|
+++ b/dlls/kernel32/tests/process.c
|
|
@@ -550,7 +550,7 @@ static void test_Startup(void)
|
|
startup.wShowWindow = SW_SHOWNORMAL;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
/* wait for child to terminate */
|
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
|
@@ -588,7 +588,7 @@ static void test_Startup(void)
|
|
startup.dwFillAttribute = 0xA55A;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
/* wait for child to terminate */
|
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
|
@@ -626,7 +626,7 @@ static void test_Startup(void)
|
|
startup.dwFillAttribute = 0xA55A;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
/* wait for child to terminate */
|
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
|
@@ -664,7 +664,7 @@ static void test_Startup(void)
|
|
startup.dwFillAttribute = 0xA55A;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
/* wait for child to terminate */
|
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
|
@@ -702,7 +702,7 @@ static void test_Startup(void)
|
|
startup.dwFillAttribute = 0xA55A;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
/* wait for child to terminate */
|
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
|
@@ -742,7 +742,7 @@ static void test_Startup(void)
|
|
startup.dwFillAttribute = 0xA55A;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
/* wait for child to terminate */
|
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
|
@@ -780,7 +780,7 @@ static void test_Startup(void)
|
|
startup.dwFillAttribute = 0xA55A;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
/* wait for child to terminate */
|
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
|
@@ -820,16 +820,16 @@ static void test_CommandLine(void)
|
|
|
|
/* the basics */
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\" \"C:\\Program Files\\my nice app.exe\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c 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");
|
|
/* 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 */
|
|
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
|
|
|
|
- okChildInt("Arguments", "argcA", 4);
|
|
- okChildString("Arguments", "argvA3", "C:\\Program Files\\my nice app.exe");
|
|
- okChildString("Arguments", "argvA4", NULL);
|
|
+ okChildInt("Arguments", "argcA", 5);
|
|
+ okChildString("Arguments", "argvA4", "C:\\Program Files\\my nice app.exe");
|
|
+ okChildString("Arguments", "argvA5", NULL);
|
|
okChildString("Arguments", "CommandLineA", buffer);
|
|
release_memory();
|
|
assert(DeleteFileA(resfile) != 0);
|
|
@@ -841,18 +841,18 @@ static void test_CommandLine(void)
|
|
|
|
/* from François */
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
/* 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 */
|
|
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
|
|
|
|
- okChildInt("Arguments", "argcA", 6);
|
|
- okChildString("Arguments", "argvA3", "a\"b\\");
|
|
- okChildString("Arguments", "argvA4", "c\"");
|
|
- okChildString("Arguments", "argvA5", "d");
|
|
- okChildString("Arguments", "argvA6", NULL);
|
|
+ okChildInt("Arguments", "argcA", 7);
|
|
+ okChildString("Arguments", "argvA4", "a\"b\\");
|
|
+ okChildString("Arguments", "argvA5", "c\"");
|
|
+ okChildString("Arguments", "argvA6", "d");
|
|
+ okChildString("Arguments", "argvA7", NULL);
|
|
okChildString("Arguments", "CommandLineA", buffer);
|
|
release_memory();
|
|
assert(DeleteFileA(resfile) != 0);
|
|
@@ -860,7 +860,7 @@ static void test_CommandLine(void)
|
|
/* Test for Bug1330 to show that XP doesn't change '/' to '\\' in argv[0]*/
|
|
get_file_name(resfile);
|
|
/* Use exename to avoid buffer containing things like 'C:' */
|
|
- sprintf(buffer, "./%s tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile);
|
|
+ sprintf(buffer, "./%s tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile);
|
|
SetLastError(0xdeadbeef);
|
|
ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
|
|
ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError());
|
|
@@ -875,7 +875,7 @@ static void test_CommandLine(void)
|
|
|
|
get_file_name(resfile);
|
|
/* Use exename to avoid buffer containing things like 'C:' */
|
|
- sprintf(buffer, ".\\%s tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile);
|
|
+ sprintf(buffer, ".\\%s tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile);
|
|
SetLastError(0xdeadbeef);
|
|
ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
|
|
ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError());
|
|
@@ -894,8 +894,8 @@ static void test_CommandLine(void)
|
|
*(lpFilePart -1 ) = 0;
|
|
p = strrchr(fullpath, '\\');
|
|
/* Use exename to avoid buffer containing things like 'C:' */
|
|
- if (p) sprintf(buffer, "..%s/%s tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", p, exename, resfile);
|
|
- else sprintf(buffer, "./%s tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile);
|
|
+ if (p) sprintf(buffer, "..%s/%s tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", p, exename, resfile);
|
|
+ else sprintf(buffer, "./%s tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile);
|
|
SetLastError(0xdeadbeef);
|
|
ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
|
|
ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError());
|
|
@@ -918,7 +918,7 @@ static void test_CommandLine(void)
|
|
/* Use exename to avoid buffer containing things like 'C:' */
|
|
if (p) sprintf(buffer, "..%s/%s", p, exename);
|
|
else sprintf(buffer, "./%s", exename);
|
|
- sprintf(buffer2, "dummy tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", resfile);
|
|
+ sprintf(buffer2, "dummy tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", resfile);
|
|
SetLastError(0xdeadbeef);
|
|
ret = CreateProcessA(buffer, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
|
|
ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError());
|
|
@@ -926,7 +926,7 @@ static void test_CommandLine(void)
|
|
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 */
|
|
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
|
|
- sprintf(buffer, "tests/process.c %s", resfile);
|
|
+ sprintf(buffer, "tests/process.c dump %s", resfile);
|
|
okChildString("Arguments", "argvA0", "dummy");
|
|
okChildString("Arguments", "CommandLineA", buffer2);
|
|
okChildStringWA("Arguments", "CommandLineW", buffer2);
|
|
@@ -1016,7 +1016,7 @@ static void test_Directory(void)
|
|
|
|
/* the basics */
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
GetWindowsDirectoryA( windir, sizeof(windir) );
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, windir, &startup, &info), "CreateProcess\n");
|
|
/* wait for child to terminate */
|
|
@@ -1123,7 +1123,7 @@ static void test_Environment(void)
|
|
|
|
/* the basics */
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
/* wait for child to terminate */
|
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
|
@@ -1142,7 +1142,7 @@ static void test_Environment(void)
|
|
|
|
/* the basics */
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
|
|
child_env_len = 0;
|
|
ptr = env;
|
|
@@ -1210,7 +1210,7 @@ static void test_SuspendFlag(void)
|
|
startup.wShowWindow = SW_SHOWNORMAL;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
|
|
ok(GetExitCodeThread(info.hThread, &exit_status) && exit_status == STILL_ACTIVE, "thread still running\n");
|
|
@@ -1260,7 +1260,7 @@ static void test_DebuggingFlag(void)
|
|
startup.wShowWindow = SW_SHOWNORMAL;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
|
|
/* get all startup events up to the entry point break exception */
|
|
@@ -1358,7 +1358,7 @@ static void test_Console(void)
|
|
cpOut = GetConsoleOutputCP();
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\" console", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" console", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
|
|
/* wait for child to terminate */
|
|
@@ -1472,7 +1472,7 @@ static void test_Console(void)
|
|
startup.hStdError = hChildOutInh;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\" stdhandle", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" stdhandle", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
ok(CloseHandle(hChildInInh), "Closing handle\n");
|
|
ok(CloseHandle(hChildOutInh), "Closing handle\n");
|
|
@@ -1509,7 +1509,7 @@ static void test_ExitCode(void)
|
|
startup.wShowWindow = SW_SHOWNORMAL;
|
|
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\" exit_code", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" exit_code", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess\n");
|
|
|
|
/* wait for child to terminate */
|
|
@@ -2151,7 +2151,7 @@ void test_StartupNoConsole(void)
|
|
startup.dwFlags = STARTF_USESHOWWINDOW;
|
|
startup.wShowWindow = SW_SHOWNORMAL;
|
|
get_file_name(resfile);
|
|
- sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
|
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
|
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &startup,
|
|
&info), "CreateProcess\n");
|
|
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
|
@@ -2174,9 +2174,15 @@ START_TEST(process)
|
|
ok(b, "Basic init of CreateProcess test\n");
|
|
if (!b) return;
|
|
|
|
- if (myARGC >= 3)
|
|
+ if (myARGC >= 4)
|
|
{
|
|
- doChild(myARGV[2], (myARGC == 3) ? NULL : myARGV[3]);
|
|
+ if (!strcmp(myARGV[2], "dump"))
|
|
+ {
|
|
+ doChild(myARGV[3], (myARGC >= 5) ? myARGV[4] : NULL);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ ok(0, "Unexpected command %s\n", myARGV[2]);
|
|
return;
|
|
}
|
|
test_TerminateProcess();
|
|
--
|
|
2.3.0
|
|
|