[PATCH 2/2] programs/cmd/tests: test paths which length exceeds MAX_PATH

Eric Pouech eric.pouech at gmail.com
Fri Jan 21 03:33:05 CST 2022


v2: fix failures on windows' VM

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 programs/cmd/tests/test_builtins.cmd     |   19 +++++++++++++++++++
 programs/cmd/tests/test_builtins.cmd.exp |    4 ++++
 2 files changed, 23 insertions(+)

diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 47b028207ac..56a682577bd 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -3333,6 +3333,25 @@ if errorlevel 1 echo Normal+tab+garbage drive change failed
 
 popd
 
+echo ------------ Testing length wrt. MAX_PATH ------------
+rem native cmd limits all path lengths to MAX_PATH=260
+pushd c:\
+set depth=25
+for /L %%d in (0,1,25) do (
+  mkdir abcdefghij > NUL 2>&1
+  if exist abcdefghij (
+     cd abcdefghij
+     set depth=%%d
+  )
+)
+echo %depth%
+rem even relative paths are transformed to absolute, and tested against MAX_PATH
+echo abc > 01234567890123
+if exist 01234567890123 (echo Success) else echo Failure
+echo abc > 012345678901234
+if exist 012345678901234 (echo Failure) else echo Success
+popd
+rmdir /s /q c:\abcdefghij
 echo ------------ Testing combined CALLs/GOTOs ------------
 echo @echo off>foo.cmd
 echo goto :eof>>foot.cmd
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index 4c7bc3e0c02..8b6e0914112 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -1687,6 +1687,10 @@ Normal+space+garbage
 Quoted should fail
 Normal+tab
 Normal+tab+garbage
+------------ Testing length wrt. MAX_PATH ------------
+ at todo_wine@21
+Success
+ at todo_wine@Success
 ------------ Testing combined CALLs/GOTOs ------------
 world
 cheball




More information about the wine-devel mailing list