From 596b4c4ae90b757b069a97ef40de67a7d1f9ab73 Mon Sep 17 00:00:00 2001 From: Bevan Weiss Date: Thu, 27 Jun 2024 18:34:50 +1000 Subject: No longer support downloading within the Sandbox. Just error instead. Install both the x64 AND the x86 versions of Windows Desktop Runtime. Needed for the Burn Integration tests. And having dotnet files in the sandbox directory was annoying, so put them all into an assets directory Signed-off-by: Bevan Weiss --- src/test/sandbox/runtest_menu.bat | 8 +++--- src/test/sandbox/setup_sandbox.bat | 27 ++++++++++++------ src/test/sandbox/startup.bat | 57 +++++++++++++++++++------------------- 3 files changed, 51 insertions(+), 41 deletions(-) (limited to 'src/test') diff --git a/src/test/sandbox/runtest_menu.bat b/src/test/sandbox/runtest_menu.bat index fc6ad93e..cc7bd4cf 100644 --- a/src/test/sandbox/runtest_menu.bat +++ b/src/test/sandbox/runtest_menu.bat @@ -8,12 +8,12 @@ REM If we do offer the debugger, we better show the IP address too, since it see REM to change for each invocation of the Sandbox environment for /f "tokens=2 delims=[]" %%a in ('ping -n 1 -4 ""') do set IPAddr=%%a @if %PROCESSOR_ARCHITECTURE%=="ARM64" ( - @if exist C:\sandbox\Debugger\ARM64\msvsmon.exe ( - set "MsVsMonPath=C:\sandbox\Debugger\ARM64\msvsmon.exe /noauth /anyuser /nosecuritywarn" + @if exist C:\sandbox\assets\Debugger\ARM64\msvsmon.exe ( + set "MsVsMonPath=C:\sandbox\assets\Debugger\ARM64\msvsmon.exe /noauth /anyuser /nosecuritywarn" ) ) else ( - @if exist C:\sandbox\Debugger\x64\msvsmon.exe ( - set "MsVsMonPath=C:\sandbox\Debugger\x64\msvsmon.exe /noauth /anyuser /nosecuritywarn" + @if exist C:\sandbox\assets\Debugger\x64\msvsmon.exe ( + set "MsVsMonPath=C:\sandbox\assets\Debugger\x64\msvsmon.exe /noauth /anyuser /nosecuritywarn" ) ) FOR /F "tokens=* USEBACKQ" %%F IN (`powershell -Command "[System.Net.Dns]::GetHostEntry('localhost').HostName"`) DO ( diff --git a/src/test/sandbox/setup_sandbox.bat b/src/test/sandbox/setup_sandbox.bat index dc462324..fac7ec4c 100644 --- a/src/test/sandbox/setup_sandbox.bat +++ b/src/test/sandbox/setup_sandbox.bat @@ -1,4 +1,4 @@ -@setlocal +@setlocal enabledelayedexpansion @echo off SET DOTNET_VERSION=8.0 @@ -20,19 +20,28 @@ goto MENU :EXE echo EXE> dotnet.cfg +if not exist .\assets mkdir .\assets if %PROCESSOR_ARCHITECTURE%=="ARM64" ( - curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.exe --output ".\dotnet-sdk.exe" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.exe --output ".\assets\dotnet-sdk-64.exe" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-arm64.exe --output ".\assets\windowsdesktop-runtime-64.exe" ) else ( - curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.exe --output ".\dotnet-sdk.exe" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.exe --output ".\assets\dotnet-sdk-64.exe" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-x86.exe --output ".\assets\windowsdesktop-runtime-x86.exe" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-x64.exe --output ".\assets\windowsdesktop-runtime-64.exe" ) goto VSDEBUG :ZIP echo ZIP> dotnet.cfg +if not exist .\assets mkdir .\assets if %PROCESSOR_ARCHITECTURE%=="ARM64" ( - curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.zip --output ".\dotnet-sdk.zip" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.zip --output ".\assets\dotnet-sdk-64.zip" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-arm64.zip --output ".\assets\windowsdesktop-runtime-64.zip" ) else ( - curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.zip --output ".\dotnet-sdk.zip" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.zip --output ".\assets\dotnet-sdk-64.zip" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-x64.zip --output ".\assets\windowsdesktop-runtime-64.zip" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-x86.zip --output ".\assets\dotnet-runtime-x86.zip" + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-x86.zip --output ".\assets\windowsdesktop-runtime-x86.zip" ) goto VSDEBUG @@ -49,15 +58,15 @@ if not "!VsInstallDir!"=="" ( echo. echo Have found VisualStudio Debugger at '%VsInstallDir%' set /P "Confirm=Do you wish to copy it for use by the Sandbox? (Y / N):" - if "%Confirm%"=="Y" goto VSDEBUG_COPY - if "%Confirm%"=="y" goto VSDEBUG_COPY + if "!Confirm!"=="Y" goto VSDEBUG_COPY + if "!Confirm!"=="y" goto VSDEBUG_COPY goto END ) goto END :VSDEBUG_COPY -if not exist Debugger (mkdir Debugger) -XCOPY "%VsInstallDir%\Common7\IDE\Remote Debugger\*" ".\Debugger\" /E /Y > nul +if not exist ".\assets\Debugger" (mkdir ".\assets\Debugger") +XCOPY "%VsInstallDir%\Common7\IDE\Remote Debugger\*" ".\assets\Debugger\" /E /Y > nul echo Debugger files copied diff --git a/src/test/sandbox/startup.bat b/src/test/sandbox/startup.bat index 7b9b603f..8feaddd1 100644 --- a/src/test/sandbox/startup.bat +++ b/src/test/sandbox/startup.bat @@ -12,44 +12,45 @@ goto ERROR_NO_CONFIG :ZIP mkdir "%ProgramFiles%\dotnet" -if exist %SANDBOX_FILES%\dotnet-sdk.zip ( - tar -oxzf "%SANDBOX_FILES%\dotnet-sdk.zip" -C "%ProgramFiles%\dotnet" +if exist %SANDBOX_FILES%\assets\dotnet-sdk-64.zip ( + tar -oxzf "%SANDBOX_FILES%\assets\dotnet-sdk-64.zip" -C "%ProgramFiles%\dotnet" ) else ( - if %PROCESSOR_ARCHITECTURE%=="ARM64" ( - curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.zip --output dotnet-sdk.zip - ) else ( - curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.zip --output dotnet-sdk.zip - ) - if %errorlevel% NEQ 0 ( - echo "No pre-provided dotnet sdk, and failed to download. Confirm networking is available." - goto ERROR_NO_DOTNET - ) - tar -oxzf dotnet-sdk.zip -C "%ProgramFiles%\dotnet" - del dotnet-sdk.zip + goto ERROR_NO_DOTNET +) +if exist %SANDBOX_FILES%\assets\windowsdesktop-runtime-64.zip ( + tar -oxzf "%SANDBOX_FILES%\assets\windowsdesktop-runtime-64.zip" -C "%ProgramFiles%\dotnet" +) else ( + goto ERROR_NO_DOTNET +) +if exist %SANDBOX_FILES%\assets\dotnet-runtime-x86.zip ( + mkdir "%ProgramFiles(x86)%\dotnet" + tar -oxzf "%SANDBOX_FILES%\assets\dotnet-runtime-x86.zip" -C "%ProgramFiles(x86)%\dotnet" +) +if exist %SANDBOX_FILES%\assets\windowsdesktop-runtime-x86.zip ( + tar -oxzf "%SANDBOX_FILES%\assets\windowsdesktop-runtime-x86.zip" -C "%ProgramFiles(x86)%\dotnet" ) goto PROCEED :EXE -if exist %SANDBOX_FILES%\dotnet-sdk.exe ( - "%SANDBOX_FILES%\dotnet-sdk.exe" /install /quiet /norestart +if exist %SANDBOX_FILES%\assets\dotnet-sdk-64.exe ( + "%SANDBOX_FILES%\assets\dotnet-sdk-64.exe" /install /quiet /norestart ) else ( - if %PROCESSOR_ARCHITECTURE%=="ARM64" ( - curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.exe --output dotnet-sdk.exe - ) else ( - curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.exe --output dotnet-sdk.exe - ) - if %errorlevel% NEQ 0 ( - echo "No pre-provided dotnet sdk, and failed to download. Confirm networking is available." - goto ERROR_NO_DOTNET - ) - dotnet-sdk.exe /install /quiet /norestart + goto ERROR_NO_DOTNET +) +if exist %SANDBOX_FILES%\assets\windowsdesktop-runtime-64.exe ( + "%SANDBOX_FILES%\assets\windowsdesktop-runtime-64.exe" /install /quiet /norestart +) else ( + goto ERROR_NO_DOTNET +) +if exist %SANDBOX_FILES%\assets\windowsdesktop-runtime-x86.exe ( + "%SANDBOX_FILES%\assets\windowsdesktop-runtime-x86.exe" /install /quiet /norestart ) goto PROCEED :PROCEED endlocal -SETX PATH "%PATH%;%ProgramFiles%\dotnet" /M -SET PATH=%PATH%;%ProgramFiles%\dotnet +SETX PATH "%PATH%;%ProgramFiles%\dotnet;%ProgramFiles(x86)%\dotnet" /M +SET PATH=%PATH%;%ProgramFiles%\dotnet;%ProgramFiles(x86)%\dotnet dotnet nuget locals all --clear dotnet help @@ -65,6 +66,6 @@ goto END :ERROR_NO_DOTNET -start "ERROR" CMD /c echo ERROR: Failed to find dotnet install, and download failed. Run setup_sandbox.bat again ^& pause +start "ERROR" CMD /c echo ERROR: Failed to find dotnet install files. Run setup_sandbox.bat again ^& pause :END -- cgit v1.2.3-55-g6feb