Signed-off-by: Francois Gouget fgouget@codeweavers.com --- v2: Chop off the AM/PM time /t suffix. I'll resend the rest of the series once the base tests have proven they work for a while. --- programs/cmd/tests/test_builtins.cmd | 41 +++++++++++++++++++++++- programs/cmd/tests/test_builtins.cmd.exp | 15 ++++++++- 2 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 3f410e55166..d4f4306391a 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -585,7 +585,6 @@ cd dummydir echo %~dp0 cd .. rmdir dummydir -echo CD value %CD% echo %% echo P% echo %P @@ -1789,6 +1788,46 @@ set /a WINE_foo=5 set /a WINE_bar=WINE_foo=6 call :checkenvvars WINE_foo 6 WINE_bar 6
+echo --- Magic environment variables +if defined cd (echo Has %%cd%%) else (echo Not defined) +echo CD value %CD% + +rem Some locales include the day-of-week either before or after the +rem day-month-year part. This makes it impossible to check the content of %date% +if defined date (echo Has %%date%%) else (echo Not defined) +set WINE_foo=%date:~9,1% +if defined WINE_foo (echo Good %%date%%) else (echo Too short) + +set WINE_before=%date% +for /f "usebackq tokens=*" %%i in (`date /t`) do set WINE_foo=%%i +set WINE_after=%date% +rem Use extra parentheses to work around a Wine bug +if not "%WINE_foo%"=="%WINE_before% " (if not "%WINE_foo%"=="%WINE_after% " (echo date /t != %%date%%) else (echo Match)) else (echo Match) + +if defined errorlevel (echo Has %%errorlevel%%) else (echo Not defined) + +if defined time (echo Has %%time%%) else (echo Not defined) +set WINE_foo=%time:~7,1% +if defined WINE_foo (echo %%time%% has seconds) else (echo Too short) +set WINE_foo=%time:~10,1% +if defined WINE_foo (echo %%time%% has 1/100s) else (echo Too short) +set WINE_foo=%time:~11,1% +if not defined WINE_foo (echo End of %%time%%) else (echo Too long) + +rem %time% has a leading space instead of a zero so ignore the first character. +rem It is also in 24h mode while time /t may be in am/pm mode so ignore the +rem second character too. +set WINE_before=%time:~2,3% +for /f "usebackq tokens=*" %%i in (`time /t`) do set WINE_foo=%%i +set WINE_after=%time:~2,3% +set WINE_foo=%WINE_foo:~2,3% +rem Use extra parentheses to work around a Wine bug +if not "%WINE_foo%"=="%WINE_before%" (if not "%WINE_foo%"=="%WINE_after%" (echo time /t != %%time:~2,3%%) else (echo Match)) else (echo Match) + +if defined random (echo Has %%random%%) else (echo Not defined) +set WINE_foo=%random% +if %WINE_foo% neq %random% (echo %%random%% looks random) else (echo Constant?) + echo --- for /F mkdir foobar & cd foobar echo ------ string argument diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 8b6e0914112..15fda131a5c 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -500,7 +500,6 @@ I'm here!@space@ ~dp0 should be directory containing batch file @drive@@path@ @drive@@path@ -CD value @pwd@@or_broken@CD value@space@ % P P @@ -1216,6 +1215,20 @@ WINE_foo correctly 7 WINE_foo correctly 8@or_broken@ERROR: WINE_foo incorrectly 4 [8] WINE_foo correctly 6@or_broken@ERROR: WINE_foo incorrectly 5 [6] WINE_bar correctly 6@or_broken@ERROR: WINE_bar incorrectly 5 [6] +--- Magic environment variables +@todo_wine@Has %cd% +CD value @pwd@@or_broken@CD value@space@ +@todo_wine@Has %date% +@todo_wine@Good %date% +@todo_wine@Match +@todo_wine@Has %errorlevel% +@todo_wine@Has %time% +@todo_wine@%time% has seconds +@todo_wine@%time% has 1/100s +End of %time% +@todo_wine@Match +@todo_wine@Has %random% +%random% looks random --- for /F ------ string argument a
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=112725
Your paranoid android.
=== debian11 (32 bit Arabic:Morocco report) ===
cmd.exe: batch.c:321: Test succeeded inside todo block: unexpected char 0x0 position -1 in line 1222 (got 'Good %date%', wanted 'Good %date%')