Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
61358d04
Commit
61358d04
authored
Nov 29, 2013
by
Francois Gouget
Committed by
Alexandre Julliard
Nov 29, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xcopy: Add tests to show that the /D option only accepts dates in the m-d-y format.
parent
e4856dbb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
3 deletions
+108
-3
configure
configure
+1
-0
configure.ac
configure.ac
+1
-0
Makefile.in
programs/xcopy/tests/Makefile.in
+6
-0
xcopy.c
programs/xcopy/tests/xcopy.c
+96
-0
xcopy.c
programs/xcopy/xcopy.c
+4
-3
No files found.
configure
View file @
61358d04
...
...
@@ -17459,6 +17459,7 @@ wine_fn_config_program wscript enable_wscript clean,install
wine_fn_config_test programs/wscript/tests wscript.exe_test
wine_fn_config_program wusa enable_wusa
install
wine_fn_config_program xcopy enable_xcopy
install
,po
wine_fn_config_test programs/xcopy/tests xcopy.exe_test
wine_fn_config_makefile server enable_server clean,install-lib,manpage
wine_fn_config_tool tools clean,install-dev,install-lib,manpage
wine_fn_config_tool tools/widl clean,install-dev,manpage
...
...
configure.ac
View file @
61358d04
...
...
@@ -3414,6 +3414,7 @@ WINE_CONFIG_PROGRAM(wscript,,[clean,install])
WINE_CONFIG_TEST(programs/wscript/tests)
WINE_CONFIG_PROGRAM(wusa,,[install])
WINE_CONFIG_PROGRAM(xcopy,,[install,po])
WINE_CONFIG_TEST(programs/xcopy/tests)
WINE_CONFIG_MAKEFILE([server],,[clean,install-lib,manpage])
WINE_CONFIG_TOOL(tools,[clean,install-dev,install-lib,manpage])
WINE_CONFIG_TOOL(tools/widl,[clean,install-dev,manpage])
...
...
programs/xcopy/tests/Makefile.in
0 → 100644
View file @
61358d04
TESTDLL
=
xcopy.exe
C_SRCS
=
\
xcopy.c
@MAKE_TEST_RULES@
programs/xcopy/tests/xcopy.c
0 → 100644
View file @
61358d04
/*
* 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 <windows.h>
#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
);
rc
=
CreateProcessA
(
NULL
,
wcmd
,
NULL
,
NULL
,
FALSE
,
0
,
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"
);
}
programs/xcopy/xcopy.c
View file @
61358d04
...
...
@@ -778,19 +778,20 @@ static int XCOPY_ParseCommandLine(WCHAR *suppliedsource,
BOOL
isError
=
FALSE
;
memset
(
&
st
,
0x00
,
sizeof
(
st
));
/* Parse the arg : Month */
/* Microsoft's xcopy's usage implies that the date
* format depends on the locale but that false.
* It is hardcoded to month-day-year
*/
st
.
wMonth
=
_wtol
(
pos
);
while
(
*
pos
&&
isdigit
(
*
pos
))
pos
++
;
if
(
*
pos
++
!=
'-'
)
isError
=
TRUE
;
/* Parse the arg : Day */
if
(
!
isError
)
{
st
.
wDay
=
_wtol
(
pos
);
while
(
*
pos
&&
isdigit
(
*
pos
))
pos
++
;
if
(
*
pos
++
!=
'-'
)
isError
=
TRUE
;
}
/* Parse the arg : Year */
if
(
!
isError
)
{
st
.
wYear
=
_wtol
(
pos
);
while
(
*
pos
&&
isdigit
(
*
pos
))
pos
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment