From 224a34b9e98ef11d8c9a7c3a980e56f69d41abd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Fri, 16 Feb 2024 12:34:42 +0100 Subject: [PATCH 1/4] gh-115556: Remove quotes from command-line arguments in test.bat and rt.bat This change essentially replaces usage of `%1` with `%~1`, which removes quotes, if any. Without this change, the if statements fail due to the quotes mangling the syntax. --- PCbuild/rt.bat | 22 +++++++++++----------- Tools/buildbot/test.bat | 18 +++++++++--------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/PCbuild/rt.bat b/PCbuild/rt.bat index 293f99ae135faa..07f6e05ca43bb5 100644 --- a/PCbuild/rt.bat +++ b/PCbuild/rt.bat @@ -38,18 +38,18 @@ set regrtestargs=--fast-ci set exe= :CheckOpts -if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts -if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts -if "%1"=="-d" (set suffix=_d) & shift & goto CheckOpts +if "%~1"=="-O" (set dashO=-O) & shift & goto CheckOpts +if "%~1"=="-q" (set qmode=yes) & shift & goto CheckOpts +if "%~1"=="-d" (set suffix=_d) & shift & goto CheckOpts rem HACK: Need some way to infer the version number in this script -if "%1"=="--disable-gil" (set pyname=python3.13t) & shift & goto CheckOpts -if "%1"=="-win32" (set prefix=%pcbuild%win32) & shift & goto CheckOpts -if "%1"=="-x64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts -if "%1"=="-amd64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts -if "%1"=="-arm64" (set prefix=%pcbuild%arm64) & shift & goto CheckOpts -if "%1"=="-arm32" (set prefix=%pcbuild%arm32) & shift & goto CheckOpts -if "%1"=="-p" (call :SetPlatform %~2) & shift & shift & goto CheckOpts -if NOT "%1"=="" (set regrtestargs=%regrtestargs% %1) & shift & goto CheckOpts +if "%~1"=="--disable-gil" (set pyname=python3.13t) & shift & goto CheckOpts +if "%~1"=="-win32" (set prefix=%pcbuild%win32) & shift & goto CheckOpts +if "%~1"=="-x64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts +if "%~1"=="-amd64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts +if "%~1"=="-arm64" (set prefix=%pcbuild%arm64) & shift & goto CheckOpts +if "%~1"=="-arm32" (set prefix=%pcbuild%arm32) & shift & goto CheckOpts +if "%~1"=="-p" (call :SetPlatform %~2) & shift & shift & goto CheckOpts +if NOT "%~1"=="" (set regrtestargs=%regrtestargs% %1) & shift & goto CheckOpts if not defined prefix set prefix=%pcbuild%amd64 set exe=%prefix%\%pyname%%suffix%.exe diff --git a/Tools/buildbot/test.bat b/Tools/buildbot/test.bat index 781f9a4c8206c8..33344955170c10 100644 --- a/Tools/buildbot/test.bat +++ b/Tools/buildbot/test.bat @@ -9,15 +9,15 @@ set regrtest_args= set arm32_ssh= :CheckOpts -if "%1"=="-x64" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%1"=="-arm64" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%1"=="-arm32" (set rt_opts=%rt_opts% %1) & (set arm32_ssh=true) & shift & goto CheckOpts -if "%1"=="-d" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%1"=="-O" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%1"=="-q" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%1"=="+d" (set rt_opts=%rt_opts:-d=%) & shift & goto CheckOpts -if "%1"=="+q" (set rt_opts=%rt_opts:-q=%) & shift & goto CheckOpts -if NOT "%1"=="" (set regrtest_args=%regrtest_args% %1) & shift & goto CheckOpts +if "%~1"=="-x64" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if "%~1"=="-arm64" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if "%~1"=="-arm32" (set rt_opts=%rt_opts% %1) & (set arm32_ssh=true) & shift & goto CheckOpts +if "%~1"=="-d" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if "%~1"=="-O" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if "%~1"=="-q" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if "%~1"=="+d" (set rt_opts=%rt_opts:-d=%) & shift & goto CheckOpts +if "%~1"=="+q" (set rt_opts=%rt_opts:-q=%) & shift & goto CheckOpts +if NOT "%~1"=="" (set regrtest_args=%regrtest_args% "%~1") & shift & goto CheckOpts if "%PROCESSOR_ARCHITECTURE%"=="ARM" if "%arm32_ssh%"=="true" goto NativeExecution if "%arm32_ssh%"=="true" goto :Arm32Ssh From 9a8429cb99e93a9509fb6f33c2098502f23f7c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Fri, 16 Feb 2024 13:04:35 +0100 Subject: [PATCH 2/4] Add Blurb --- .../next/Tests/2024-02-16-13-04-28.gh-issue-115556.rjaQ9w.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2024-02-16-13-04-28.gh-issue-115556.rjaQ9w.rst diff --git a/Misc/NEWS.d/next/Tests/2024-02-16-13-04-28.gh-issue-115556.rjaQ9w.rst b/Misc/NEWS.d/next/Tests/2024-02-16-13-04-28.gh-issue-115556.rjaQ9w.rst new file mode 100644 index 00000000000000..c2811b133d9314 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2024-02-16-13-04-28.gh-issue-115556.rjaQ9w.rst @@ -0,0 +1,2 @@ +On Windows, commas passed in arguments to ``Tools\buildbot\test.bat`` and +``PCbuild\\rt.bat`` are now properly handled. From 624b2bfdb19b9422789e41969ac0e914a0213b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Fri, 16 Feb 2024 17:22:01 +0100 Subject: [PATCH 3/4] Escape comma by hand --- PCbuild/rt.bat | 2 +- Tools/buildbot/test.bat | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/PCbuild/rt.bat b/PCbuild/rt.bat index 07f6e05ca43bb5..ac530a5206271f 100644 --- a/PCbuild/rt.bat +++ b/PCbuild/rt.bat @@ -49,7 +49,7 @@ if "%~1"=="-amd64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts if "%~1"=="-arm64" (set prefix=%pcbuild%arm64) & shift & goto CheckOpts if "%~1"=="-arm32" (set prefix=%pcbuild%arm32) & shift & goto CheckOpts if "%~1"=="-p" (call :SetPlatform %~2) & shift & shift & goto CheckOpts -if NOT "%~1"=="" (set regrtestargs=%regrtestargs% %1) & shift & goto CheckOpts +if NOT "%~1"=="" (set regrtestargs=%regrtestargs% %~1) & shift & goto CheckOpts if not defined prefix set prefix=%pcbuild%amd64 set exe=%prefix%\%pyname%%suffix%.exe diff --git a/Tools/buildbot/test.bat b/Tools/buildbot/test.bat index 33344955170c10..a3d9f5bd914c32 100644 --- a/Tools/buildbot/test.bat +++ b/Tools/buildbot/test.bat @@ -7,17 +7,10 @@ set here=%~dp0 set rt_opts=-q -d set regrtest_args= set arm32_ssh= +set cmdline_args=%* +set cmdline_args=%cmdline_args:,=#COMMA#% -:CheckOpts -if "%~1"=="-x64" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%~1"=="-arm64" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%~1"=="-arm32" (set rt_opts=%rt_opts% %1) & (set arm32_ssh=true) & shift & goto CheckOpts -if "%~1"=="-d" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%~1"=="-O" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%~1"=="-q" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts -if "%~1"=="+d" (set rt_opts=%rt_opts:-d=%) & shift & goto CheckOpts -if "%~1"=="+q" (set rt_opts=%rt_opts:-q=%) & shift & goto CheckOpts -if NOT "%~1"=="" (set regrtest_args=%regrtest_args% "%~1") & shift & goto CheckOpts +call:CheckOpts %cmdline_args% if "%PROCESSOR_ARCHITECTURE%"=="ARM" if "%arm32_ssh%"=="true" goto NativeExecution if "%arm32_ssh%"=="true" goto :Arm32Ssh @@ -49,3 +42,16 @@ echo The test worker should have the SSH agent running. echo Also a key must be created with ssh-keygen and added to both the buildbot worker machine echo and the ARM32 worker device: see https://docs.microsoft.com/en-us/windows/iot-core/connect-your-device/ssh exit /b 127 + +:CheckOpts +set arg="%~1" +if %arg%=="-x64" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if %arg%=="-arm64" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if %arg%=="-arm32" (set rt_opts=%rt_opts% %1) & (set arm32_ssh=true) & shift & goto CheckOpts +if %arg%=="-d" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if %arg%=="-O" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if %arg%=="-q" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts +if %arg%=="+d" (set rt_opts=%rt_opts:-d=%) & shift & goto CheckOpts +if %arg%=="+q" (set rt_opts=%rt_opts:-q=%) & shift & goto CheckOpts +if NOT %arg%=="" (set regrtest_args=%regrtest_args% %arg:#COMMA#=,%) & shift & goto CheckOpts +goto:eof \ No newline at end of file From 7a96ee02993cc2782f45d8ac030757c968dbe68e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Fri, 16 Feb 2024 19:23:41 +0100 Subject: [PATCH 4/4] Fix missing newline at the end of the file --- Tools/buildbot/test.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/buildbot/test.bat b/Tools/buildbot/test.bat index a3d9f5bd914c32..0c47470a0ecb7a 100644 --- a/Tools/buildbot/test.bat +++ b/Tools/buildbot/test.bat @@ -54,4 +54,4 @@ if %arg%=="-q" (set rt_opts=%rt_opts% %1) & shift & goto CheckOpts if %arg%=="+d" (set rt_opts=%rt_opts:-d=%) & shift & goto CheckOpts if %arg%=="+q" (set rt_opts=%rt_opts:-q=%) & shift & goto CheckOpts if NOT %arg%=="" (set regrtest_args=%regrtest_args% %arg:#COMMA#=,%) & shift & goto CheckOpts -goto:eof \ No newline at end of file +goto:eof