Author: akhaldi
Date: Sat Sep 27 19:31:30 2014
New Revision: 64351
URL:
http://svn.reactos.org/svn/reactos?rev=64351&view=rev
Log:
[CMD_WINETEST]
* Sync with Wine 1.7.27.
CORE-8540
Modified:
trunk/rostests/winetests/cmd/batch.c
trunk/rostests/winetests/cmd/test_builtins.cmd
trunk/rostests/winetests/cmd/test_builtins.cmd.exp
trunk/rostests/winetests/cmd/test_cmdline.cmd
trunk/rostests/winetests/cmd/test_cmdline.cmd.exp
Modified: trunk/rostests/winetests/cmd/batch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/cmd/batch.c?rev…
==============================================================================
--- trunk/rostests/winetests/cmd/batch.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/cmd/batch.c [iso-8859-1] Sat Sep 27 19:31:30 2014
@@ -140,9 +140,9 @@
size = GetFileSize(file, NULL);
- map = CreateFileMapping(file, NULL, PAGE_READONLY, 0, 0, NULL);
+ map = CreateFileMappingA(file, NULL, PAGE_READONLY, 0, 0, NULL);
CloseHandle(file);
- ok(map != NULL, "CreateFileMapping(%s) failed: %u\n", file_name,
GetLastError());
+ ok(map != NULL, "CreateFileMappingA(%s) failed: %u\n", file_name,
GetLastError());
if(!map)
return 0;
@@ -409,7 +409,7 @@
return size;
}
-static BOOL WINAPI test_enum_proc(HMODULE module, LPCTSTR type, LPSTR name, LONG_PTR
param)
+static BOOL WINAPI test_enum_proc(HMODULE module, LPCSTR type, LPSTR name, LONG_PTR
param)
{
const char *cmd_data, *out_data;
DWORD cmd_size, out_size;
@@ -466,8 +466,14 @@
drive[0] = workdir[0];
drive[1] = workdir[1]; /* Should be ':' */
memcpy(path, workdir + drive_len, (workdir_len - drive_len) * sizeof(drive[0]));
- path[workdir_len - drive_len] = '\\';
- path_len = workdir_len - drive_len + 1;
+
+ /* Only add trailing backslash to 'path' for non-root directory */
+ if (workdir_len - drive_len > 1) {
+ path[workdir_len - drive_len] = '\\';
+ path_len = workdir_len - drive_len + 1;
+ } else {
+ path_len = 1; /* \ */
+ }
shortpath_len = GetShortPathNameA(path, shortpath,
sizeof(shortpath)/sizeof(shortpath[0]));
Modified: trunk/rostests/winetests/cmd/test_builtins.cmd
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/cmd/test_builti…
==============================================================================
--- trunk/rostests/winetests/cmd/test_builtins.cmd [iso-8859-1] (original)
+++ trunk/rostests/winetests/cmd/test_builtins.cmd [iso-8859-1] Sat Sep 27 19:31:30 2014
@@ -286,10 +286,35 @@
echo '%WINE_FOO%'
set WINE_FOO=foo@tab@
echo '%WINE_FOO%'
+rem Space symbol must appear in `var`
+set WINE_FOO=value@space@
+echo '%WINE_FOO%'
+rem Space symbol must NOT appear in `var`
+set "WINE_FOO=value"@space@
+echo '%WINE_FOO%'
+rem Mixed examples:
+set WINE_FOO=jim fred
+echo '%WINE_FOO%'
+set WINE_FOO="jim" fred
+echo '%WINE_FOO%'
+set "WINE_FOO=jim fred"
+echo '%WINE_FOO%'
+set "WINE_FOO=jim" fred
+echo '%WINE_FOO%'
+rem Only the final quote ends the string
+set "WINE_FOO=apple"banana"grape"orange
+echo '%WINE_FOO%'
set WINE_FOO=
echo ------------ Testing variable expansion ------------
call :setError 0
+echo ~p0 should be path containing batch file
+echo %~p0
+mkdir dummydir
+cd dummydir
+echo %~p0
+cd ..
+rmdir dummydir
echo ~dp0 should be directory containing batch file
echo %~dp0
mkdir dummydir
@@ -363,6 +388,7 @@
for %%i in ("g h" i) do echo %%~sdi
for %%i in ("g h" i) do echo %%~dsi
for %%i in ("j k" l.eh) do echo '%%~xsi'
+for %%i in ("") do echo
'%%~i,%%~fi,%%~di,%%~pi,%%~ni,%%~xi,%%~si,%%~ai,%%~ti,%%~zi'
echo --- in parameters
for %%i in ("A B" C) do call :echoFun %%i
@@ -998,7 +1024,22 @@
call :ValidateExpected
echo for /R passed
-cd .. & rd /s/Q foobar
+echo --- Complex wildcards unix and windows slash
+cd ..
+echo Windows slashs, valid path
+for %%f in (foobar\baz\bazbaz) do echo ASIS: %%f
+for %%f in (foobar\baz\*) do echo WC : %%f
+echo Windows slashs, invalid path
+for %%f in (foobar\jim\bazbaz) do echo ASIS: %%f
+for %%f in (foobar\jim\*) do echo WC : %%f
+echo Unix slashs, valid path
+for %%f in (foobar/baz/bazbaz) do echo ASIS: %%f
+for %%f in (foobar/baz/*) do echo WC : %%f
+echo Unix slashs, invalid path
+for %%f in (foobar/jim/bazbaz) do echo ASIS: %%f
+for %%f in (foobar/jim/*) do echo WC : %%f
+echo Done
+rd /s/Q foobar
echo --- for /L
rem Some cases loop forever writing 0s, like e.g. (1,0,1), (1,a,3) or (a,b,c); those
can't be tested here
for /L %%i in (1,2,0) do echo %%i
@@ -2199,7 +2240,7 @@
rem ASCII and BINARY tests
rem Note: hard coded numbers deliberate because need to ensure whether
rem an additional EOF has been added or not. There is no way to handle
-rem EOFs in batch, so assume if a single byte appears, its an EOF!
+rem EOFs in batch, so assume if a single byte appears, it's an EOF!
rem ******************************************************************
rem Confirm original sizes of file1,2,3
@@ -2283,7 +2324,7 @@
rem
-------------------------------------------------------------------------------------------
rem This shows when concatenating, an ascii destination always adds on an EOF but when
we
-rem are not concatenating, its a direct copy regardless of destination if being read as
binary
+rem are not concatenating, it's a direct copy regardless of destination if being read
as binary
rem
-------------------------------------------------------------------------------------------
rem All 3 have eof's, plus an extra = 6 + 9 + 12 + eof
@@ -2538,17 +2579,72 @@
echo ------------ Testing GOTO ------------
if a==a goto dest1
+echo FAILURE at dest 1
:dest1
echo goto with no leading space worked
+if a==a goto :dest1b
+echo FAILURE at dest 1b
+:dest1b
+echo goto with colon and no leading space worked
if b==b goto dest2
+echo FAILURE at dest 2
:dest2
echo goto with a leading space worked
if c==c goto dest3
+echo FAILURE at dest 3
:dest3
echo goto with a leading tab worked
if d==d goto dest4
+echo FAILURE at dest 4
:dest4@space@
echo goto with a following space worked
+if e==e goto dest5
+echo FAILURE at dest 5
+:dest5&& echo FAILURE
+echo goto with following amphersands worked
+
+del failure.txt >nul 2>&1
+if f==f goto dest6
+echo FAILURE at dest 6
+:dest6>FAILURE.TXT
+if exist FAILURE.TXT echo FAILURE at dest 6 as file exists
+echo goto with redirections worked
+del FAILURE.TXT >nul 2>&1
+
+:: some text that is ignored | dir >cmd_output | another test
+if exist cmd_output echo FAILURE at dest 6 as file exists
+echo Ignoring double colons worked
+del cmd_output >nul 2>&1
+
+rem goto a label which does not exist issues an error message and
+rem acts the same as goto :EOF, and ensure ::label is never matched
+del testgoto.bat >nul 2>&1
+echo goto :dest7 ^>nul 2^>^&1 >> testgoto.bat
+echo echo FAILURE at dest 7 - Should have not found label and issued an error plus ended
the batch>> testgoto.bat
+echo ::dest7>> testgoto.bat
+echo echo FAILURE at dest 7 - Incorrectly went to label >> testgoto.bat
+call testgoto.bat
+del testgoto.bat >nul 2>&1
+
+del testgoto.bat >nul 2>&1
+echo goto ::dest8 ^>nul 2^>^&1 >> testgoto.bat
+echo echo FAILURE at dest 8 - Should have not found label and issued an error plus ended
the batch>> testgoto.bat
+echo ::dest8>> testgoto.bat
+echo echo FAILURE at dest 8 - Incorrectly went to label >> testgoto.bat
+call testgoto.bat
+del testgoto.bat >nul 2>&1
+
+if g==g goto dest9
+echo FAILURE at dest 9
+:dest91
+echo FAILURE at dest 91
+@ : dest9>rubbish
+echo label with mixed whitespace and no echo worked
+
+if h==h goto :dest10:this is ignored
+echo FAILURE at dest 10
+:dest10:this is also ignored
+echo Correctly ignored trailing information
echo ------------ Testing PATH ------------
set WINE_backup_path=%path%
Modified: trunk/rostests/winetests/cmd/test_builtins.cmd.exp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/cmd/test_builti…
==============================================================================
--- trunk/rostests/winetests/cmd/test_builtins.cmd.exp [iso-8859-1] (original)
+++ trunk/rostests/winetests/cmd/test_builtins.cmd.exp [iso-8859-1] Sat Sep 27 19:31:30
2014
@@ -251,10 +251,20 @@
''
'foo@space@'
'foo@tab@'
+'value@space@'
+'value'
+'jim fred'
+'"jim" fred'
+'jim fred'
+'jim'
+'apple"banana"grape'
------------ Testing variable expansion ------------
+~p0 should be path containing batch file
+@path@
+@path@
~dp0 should be directory containing batch file
-@pwd@\
-@pwd@\
+@drive@@path@
+@drive@@path@
CD value @pwd@@or_broken@CD value@space@
%
P
@@ -289,8 +299,8 @@
C
'A B'@or_broken@''
'C'@or_broken@''
-@pwd@\C D@or_broken@%~ff
-@pwd@\E@or_broken@%~ff
+@drive@@path@C D@or_broken@%~ff
+@drive@@path@E@or_broken@%~ff
@drive@
@drive@
@path@@or_broken@%~pd
@@ -319,13 +329,14 @@
@drive@
''
'.eh'
+',,,,,,,,,'
--- in parameters
"A B"
C
'A B'@or_broken@''
'C'@or_broken@''
-@pwd@\C D
-@pwd@\E
+@drive@@path@C D
+@drive@@path@E
@drive@
@drive@
@path@
@@ -381,22 +392,22 @@
foo6@space@
@todo_wine@------------ Testing cd ------------
singleFile
-Current dir: @pwd@\foobar@or_broken@Current dir:@space@
-@pwd@\foobar
+Current dir: @drive@@path@foobar@or_broken@Current dir:@space@
+@drive@@path@foobar
@pwd@
-@pwd@\foobar
+@drive@@path@foobar
@pwd@
-@pwd@\foobar
+@drive@@path@foobar
@pwd@
@pwd@
@pwd@
-@pwd@\foobar\bar bak
-@pwd@\foobar\bar bak
-@pwd@\foobar\bar bak
-@pwd@\foobar\bar bak
-@pwd@\foobar\bar bak
+@drive@@path@foobar\bar bak
+@drive@@path@foobar\bar bak
+@drive@@path@foobar\bar bak
+@drive@@path@foobar\bar bak
+@drive@@path@foobar\bar bak
@pwd@
-@pwd@\foobar
+@drive@@path@foobar
------------ Testing type ------------
@pwd@>type foobaz@space@
@@ -683,6 +694,18 @@
With duplicates enumeration
Strip missing wildcards, keep unwildcarded names
for /R passed
+--- Complex wildcards unix and windows slash
+Windows slashs, valid path
+ASIS: foobar\baz\bazbaz
+WC : foobar\baz\bazbaz
+Windows slashs, invalid path
+ASIS: foobar\jim\bazbaz
+Unix slashs, valid path
+ASIS: foobar/baz/bazbaz
+WC : bazbaz
+Unix slashs, invalid path
+ASIS: foobar/jim/bazbaz
+Done
--- for /L
1
3
@@ -1067,31 +1090,31 @@
--- pushing non-existing dir
@pwd@
--- basic behaviour
-@pwd@\foobar
+@drive@@path@foobar
@pwd@
-@pwd@\foobar\baz
-@pwd@\foobar
-@pwd@\foobar
+@drive@@path@foobar\baz
+@drive@@path@foobar
+@drive@@path@foobar
@pwd@
-@pwd@\foobar
+@drive@@path@foobar
@pwd@
------------ Testing attrib ------------
-A @pwd@\foobar\foo@or_broken@A @pwd@\foobar\foo@or_broken@A I
@pwd@\foobar\foo
+A @drive@@path@foobar\foo@or_broken@A
@drive@@path@foobar\foo@or_broken@A I @drive@@path@foobar\foo
--- read-only attribute
-A R @pwd@\foobar\foo@or_broken@A R @pwd@\foobar\foo@or_broken@A R I
@pwd@\foobar\foo
+A R @drive@@path@foobar\foo@or_broken@A R
@drive@@path@foobar\foo@or_broken@A R I @drive@@path@foobar\foo
foo
foo original contents
Read-only file not deleted
Read-only file forcibly deleted
--- recursive behaviour
-A @pwd@\foobar\baz\level2@or_broken@A
@pwd@\foobar\baz\level2@or_broken@A I @pwd@\foobar\baz\level2
-A R @pwd@\foobar\level1@or_broken@A R @pwd@\foobar\level1@or_broken@A
R I @pwd@\foobar\level1
-A R @pwd@\foobar\baz\level2@or_broken@A R
@pwd@\foobar\baz\level2@or_broken@A R I @pwd@\foobar\baz\level2
-A @pwd@\foobar\bar@or_broken@A @pwd@\foobar\bar@or_broken@A I
@pwd@\foobar\bar
+A @drive@@path@foobar\baz\level2@or_broken@A
@drive@@path@foobar\baz\level2@or_broken@A I @drive@@path@foobar\baz\level2
+A R @drive@@path@foobar\level1@or_broken@A R
@drive@@path@foobar\level1@or_broken@A R I @drive@@path@foobar\level1
+A R @drive@@path@foobar\baz\level2@or_broken@A R
@drive@@path@foobar\baz\level2@or_broken@A R I @drive@@path@foobar\baz\level2
+A @drive@@path@foobar\bar@or_broken@A
@drive@@path@foobar\bar@or_broken@A I @drive@@path@foobar\bar
--- folders processing
- @pwd@\foobar@or_broken@ @pwd@\foobar@or_broken@ I
@pwd@\foobar
-@todo_wine@ R @pwd@\foobar\baz@or_broken@ R @pwd@\foobar\baz@or_broken@
@pwd@\foobar\baz@or_broken@ R I @pwd@\foobar\baz
-A @pwd@\foobar\baz\toto@or_broken@A @pwd@\foobar\baz\toto@or_broken@A
I @pwd@\foobar\baz\toto
+ @drive@@path@foobar@or_broken@ @drive@@path@foobar@or_broken@
I @drive@@path@foobar
+@todo_wine@ R @drive@@path@foobar\baz@or_broken@ R
@drive@@path@foobar\baz@or_broken@ @drive@@path@foobar\baz@or_broken@ R I
@drive@@path@foobar\baz
+A @drive@@path@foobar\baz\toto@or_broken@A
@drive@@path@foobar\baz\toto@or_broken@A I @drive@@path@foobar\baz\toto
toto
lulu
file created in read-only dir
@@ -1228,17 +1251,17 @@
--- setlocal with corresponding endlocal
globalval
localval
-@pwd@\foobar\foobar2
+@drive@@path@foobar\foobar2
globalval
-@pwd@\foobar
+@drive@@path@foobar
globalval
-@pwd@\foobar
+@drive@@path@foobar
--- setlocal with no corresponding endlocal
globalval
localval
-@pwd@\foobar\foobar2
+@drive@@path@foobar\foobar2
globalval
-@pwd@\foobar
+@drive@@path@foobar
--- setlocal within same batch program
Var1 ok 1
Var2 ok 2
@@ -1256,23 +1279,23 @@
--- Extra setlocal in called batch
value2
2set1endvalue1
-@pwd@\foobar\foodir3
+@drive@@path@foobar\foodir3
Finished:
value2
-@pwd@\foobar\foodir2
+@drive@@path@foobar\foodir2
value1
-@pwd@\foobar
+@drive@@path@foobar
--- Extra endlocal in called batch
value2
value2
-@pwd@\foobar\foodir2
+@drive@@path@foobar\foodir2
value2
-@pwd@\foobar\foodir2
+@drive@@path@foobar\foodir2
Finished:
value2
-@pwd@\foobar\foodir2
+@drive@@path@foobar\foodir2
value1
-@pwd@\foobar
+@drive@@path@foobar
--- endlocal in called function rather than batch pgm is ineffective
2
2
@@ -1294,9 +1317,15 @@
7 should still be 7
------------ Testing GOTO ------------
goto with no leading space worked
+goto with colon and no leading space worked
goto with a leading space worked
goto with a leading tab worked
goto with a following space worked
+goto with following amphersands worked
+goto with redirections worked
+Ignoring double colons worked
+label with mixed whitespace and no echo worked
+Correctly ignored trailing information
------------ Testing PATH ------------
PATH=original
PATH=try2
Modified: trunk/rostests/winetests/cmd/test_cmdline.cmd
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/cmd/test_cmdlin…
==============================================================================
--- trunk/rostests/winetests/cmd/test_cmdline.cmd [iso-8859-1] (original)
+++ trunk/rostests/winetests/cmd/test_cmdline.cmd [iso-8859-1] Sat Sep 27 19:31:30 2014
@@ -95,6 +95,7 @@
echo @echo 2 > "saytwo.bat"
echo @echo 3 > "say (3).bat"
echo @echo 4 > "say .bat"
+echo @echo 5 > "bazbaz(5).bat"
echo ------ Testing invocation of batch files ----------
call say one
@@ -144,6 +145,11 @@
call :setError 0
cmd /c say" "(3) prints 4?!
if errorlevel 2 echo error %ErrorLevel%
+call :setError 0
+rem Deliberately invoking a fully qualified batch name containing a bracket
+rem should fail, as a bracket is a command delimiter.
+cmd /c "bazbaz(5).bat"
+if errorlevel 1 echo Passed
echo ---------- Testing CMD /C quoting -----------------
cmd /c @echo "hi"
@@ -261,7 +267,7 @@
call tell(12(34)
call tell(12;34)
echo --------- Finished --------------
-del tell.bat say*.*
+del tell.bat say*.* bazbaz*.bat
exit
:setError
exit /B %1
Modified: trunk/rostests/winetests/cmd/test_cmdline.cmd.exp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/cmd/test_cmdlin…
==============================================================================
--- trunk/rostests/winetests/cmd/test_cmdline.cmd.exp [iso-8859-1] (original)
+++ trunk/rostests/winetests/cmd/test_cmdline.cmd.exp [iso-8859-1] Sat Sep 27 19:31:30
2014
@@ -70,6 +70,7 @@
0@space@
3@space@
4@space@
+Passed
---------- Testing CMD /C quoting -----------------
"hi"
1@space@