Test for ARGV handling (Bug 1330)
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Mon Oct 3 10:51:46 CDT 2005
Changelog:
wine/dlls/kernel/tests/process.c: test_CommandLine()
Document handling of '/' in argv[0] by a test
At least XP doesn't change a '/' into a '\\'. Resolving bug 1330
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/kernel/tests/process.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/process.c,v
retrieving revision 1.22
diff -u -r1.22 process.c
--- wine/dlls/kernel/tests/process.c 17 Aug 2005 09:56:24 -0000 1.22
+++ wine/dlls/kernel/tests/process.c 3 Oct 2005 15:47:37 -0000
@@ -693,9 +693,10 @@
static void test_CommandLine(void)
{
- char buffer[MAX_PATH];
+ char buffer[MAX_PATH], fullpath[MAX_PATH], *lpFilePart, *p;
PROCESS_INFORMATION info;
STARTUPINFOA startup;
+ DWORD len;
memset(&startup, 0, sizeof(startup));
startup.cb = sizeof(startup);
@@ -740,6 +741,49 @@
okChildString("Arguments", "CommandLineA", buffer);
release_memory();
assert(DeleteFileA(resfile) != 0);
+
+ /* Test for Bug1330 to show that XP doesn't change '/' to '\\' in argv[0]*/
+ get_file_name(resfile);
+ sprintf(buffer, "./%s tests/process.c %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);
+ sprintf(buffer, "./%s", selfname);
+ okChildString("Arguments", "argvA0", buffer);
+ release_memory();
+ assert(DeleteFileA(resfile) != 0);
+
+ get_file_name(resfile);
+ sprintf(buffer, ".\\%s tests/process.c %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);
+ sprintf(buffer, ".\\%s", selfname);
+ okChildString("Arguments", "argvA0", buffer);
+ release_memory();
+ assert(DeleteFileA(resfile) != 0);
+
+ get_file_name(resfile);
+ len = GetFullPathNameA(selfname, MAX_PATH, fullpath, &lpFilePart);
+ assert ( lpFilePart != 0);
+ *(lpFilePart -1 ) = 0;
+ p = strrchr(fullpath, '\\');
+ assert (p);
+ sprintf(buffer, "..%s/%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", p, 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);
+ sprintf(buffer, "..%s/%s", p, selfname);
+ okChildString("Arguments", "argvA0", buffer);
+ release_memory();
+ assert(DeleteFileA(resfile) != 0);
+
}
static void test_Directory(void)
More information about the wine-patches
mailing list