Author: akhaldi Date: Tue Oct 21 15:50:16 2014 New Revision: 64869
URL: http://svn.reactos.org/svn/reactos?rev=64869&view=rev Log: [XCOPY_WINETEST] * Import from Wine 1.7.27. CORE-8540
Added: trunk/rostests/winetests/xcopy/ (with props) trunk/rostests/winetests/xcopy/CMakeLists.txt (with props) trunk/rostests/winetests/xcopy/testlist.c (with props) trunk/rostests/winetests/xcopy/xcopy.c (with props) Modified: trunk/rostests/winetests/CMakeLists.txt
Modified: trunk/rostests/winetests/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/CMakeLists.txt?r... ============================================================================== --- trunk/rostests/winetests/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/CMakeLists.txt [iso-8859-1] Tue Oct 21 15:50:16 2014 @@ -114,5 +114,6 @@ add_subdirectory(wlanapi) add_subdirectory(wldap32) add_subdirectory(ws2_32) +add_subdirectory(xcopy) add_subdirectory(xinput1_3) add_subdirectory(xmllite)
Propchange: trunk/rostests/winetests/xcopy/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Oct 21 15:50:16 2014 @@ -0,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: trunk/rostests/winetests/xcopy/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/rostests/winetests/xcopy/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Added: trunk/rostests/winetests/xcopy/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/xcopy/CMakeLists... ============================================================================== --- trunk/rostests/winetests/xcopy/CMakeLists.txt (added) +++ trunk/rostests/winetests/xcopy/CMakeLists.txt [iso-8859-1] Tue Oct 21 15:50:16 2014 @@ -0,0 +1,5 @@ + +add_executable(xcopy_winetest xcopy.c testlist.c) +set_module_type(xcopy_winetest win32cui) +add_importlibs(xcopy_winetest msvcrt kernel32) +add_cd_file(TARGET xcopy_winetest DESTINATION reactos/bin FOR all)
Propchange: trunk/rostests/winetests/xcopy/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/winetests/xcopy/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/xcopy/testlist.c... ============================================================================== --- trunk/rostests/winetests/xcopy/testlist.c (added) +++ trunk/rostests/winetests/xcopy/testlist.c [iso-8859-1] Tue Oct 21 15:50:16 2014 @@ -0,0 +1,12 @@ +/* Automatically generated by make depend; DO NOT EDIT!! */ + +#define STANDALONE +#include <wine/test.h> + +extern void func_xcopy(void); + +const struct test winetest_testlist[] = +{ + { "xcopy", func_xcopy }, + { 0, 0 } +};
Propchange: trunk/rostests/winetests/xcopy/testlist.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/winetests/xcopy/xcopy.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/xcopy/xcopy.c?re... ============================================================================== --- trunk/rostests/winetests/xcopy/xcopy.c (added) +++ trunk/rostests/winetests/xcopy/xcopy.c [iso-8859-1] Tue Oct 21 15:50:16 2014 @@ -0,0 +1,97 @@ +/* + * Copyright 2013 Francois Gouget + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <wine/test.h> + +static DWORD runcmd(const char* cmd) +{ + STARTUPINFOA si = {sizeof(STARTUPINFOA)}; + PROCESS_INFORMATION pi; + char* wcmd; + DWORD rc; + + /* Create a writable copy for CreateProcessA() */ + wcmd = HeapAlloc(GetProcessHeap(), 0, strlen(cmd) + 1); + strcpy(wcmd, cmd); + + /* On Windows 2003 and older, xcopy.exe fails if stdin is not a console + * handle, even with '/I /Y' options. + */ + rc = CreateProcessA(NULL, wcmd, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi); + HeapFree(GetProcessHeap(), 0, wcmd); + if (!rc) + return 260; + + rc = WaitForSingleObject(pi.hProcess, 5000); + if (rc == WAIT_OBJECT_0) + GetExitCodeProcess(pi.hProcess, &rc); + else + TerminateProcess(pi.hProcess, 1); + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + + return rc; +} + +static void test_date_format(void) +{ + DWORD rc; + + rc = runcmd("xcopy /D:20-01-2000 xcopy1 xcopytest"); + ok(rc == 4, "xcopy /D:d-m-y test returned rc=%u\n", rc); + ok(GetFileAttributesA("xcopytest\xcopy1") == INVALID_FILE_ATTRIBUTES, + "xcopy should not have created xcopytest\xcopy1\n"); + + rc = runcmd("xcopy /D:01-20-2000 xcopy1 xcopytest"); + ok(rc == 0, "xcopy /D:m-d-y test failed rc=%u\n", rc); + ok(GetFileAttributesA("xcopytest\xcopy1") != INVALID_FILE_ATTRIBUTES, + "xcopy did not create xcopytest\xcopy1\n"); + DeleteFileA("xcopytest\xcopy1"); + + rc = runcmd("xcopy /D:1-20-2000 xcopy1 xcopytest"); + ok(rc == 0, "xcopy /D:m-d-y test failed rc=%u\n", rc); + ok(GetFileAttributesA("xcopytest\xcopy1") != INVALID_FILE_ATTRIBUTES, + "xcopy did not create xcopytest\xcopy1\n"); + DeleteFileA("xcopytest\xcopy1"); +} + +START_TEST(xcopy) +{ + char tmpdir[MAX_PATH]; + HANDLE hfile; + + GetTempPathA(MAX_PATH, tmpdir); + SetCurrentDirectoryA(tmpdir); + trace("%s\n", tmpdir); + + CreateDirectoryA("xcopytest", NULL); + hfile = CreateFileA("xcopy1", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + ok(hfile != INVALID_HANDLE_VALUE, "Failed to create xcopy1 file\n"); + if (hfile == INVALID_HANDLE_VALUE) + { + skip("skipping xcopy tests\n"); + return; + } + CloseHandle(hfile); + + test_date_format(); + + DeleteFileA("xcopy1"); + RemoveDirectoryA("xcopytest"); +}
Propchange: trunk/rostests/winetests/xcopy/xcopy.c ------------------------------------------------------------------------------ svn:eol-style = native