From a4f09c89c7c044f606ddf6bcff587ccb693560bf Mon Sep 17 00:00:00 2001 From: Bevan Weiss Date: Thu, 20 Jun 2024 23:40:03 +1000 Subject: Add Sandbox configuration to more easily perform Integration tests. Will automatically 'install' dotnet/dotnet sdk into sandbox at startup based on versions in 'src/test/sandbox/{AMD64,ARM64}' (dotnet-runtime.zip & dotnet-sdk.zip). Running ./src/test/sandbox/setup_sandbox.bat will download the required files (when run on the host). If the files aren't available, and the guest has network, it will attempt to download the files itself at startup. Still to be done: * menu at startup to allow easy one button selection of which particular test set to run * investigation into whether vstest.console.exe can be used to capture test execution, and possibly have the sandbox available as a test runner, so MSI tests could be run in the sandbox directly from the dev environment. Signed-off-by: Bevan Weiss --- src/test/sandbox/TestSandbox.wsb | 17 ++++++++++++++ src/test/sandbox/setup_sandbox.bat | 16 +++++++++++++ src/test/sandbox/startup.bat | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 src/test/sandbox/TestSandbox.wsb create mode 100644 src/test/sandbox/setup_sandbox.bat create mode 100644 src/test/sandbox/startup.bat (limited to 'src/test') diff --git a/src/test/sandbox/TestSandbox.wsb b/src/test/sandbox/TestSandbox.wsb new file mode 100644 index 00000000..01e11e6b --- /dev/null +++ b/src/test/sandbox/TestSandbox.wsb @@ -0,0 +1,17 @@ + + + + ..\..\..\build + C:\build + true + + + .\ + C:\sandbox + true + + + + C:\sandbox\startup.bat + + diff --git a/src/test/sandbox/setup_sandbox.bat b/src/test/sandbox/setup_sandbox.bat new file mode 100644 index 00000000..f74e7535 --- /dev/null +++ b/src/test/sandbox/setup_sandbox.bat @@ -0,0 +1,16 @@ +@setlocal +@SET DOTNET_VERSION=8.0 + +@if not exist AMD64 (mkdir AMD64) +@if not exist ARM64 (mkdir ARM64) +@REM if not exist VSTest (mkdir VSTest) + +curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-x64.zip --output ".\AMD64\dotnet-runtime.zip" +curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.zip --output ".\AMD64\dotnet-sdk.zip" +curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-arm64.zip --output ".\ARM64\dotnet-runtime.zip" +curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.zip --output ".\ARM64\dotnet-sdk.zip" + +REM "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -prerelease + + +@endlocal diff --git a/src/test/sandbox/startup.bat b/src/test/sandbox/startup.bat new file mode 100644 index 00000000..0f1b33d8 --- /dev/null +++ b/src/test/sandbox/startup.bat @@ -0,0 +1,48 @@ +@setlocal +SET DOTNET_VERSION=8.0 +SET SANDBOX_FILES=C:\sandbox + +pushd "%TEMP%" + +mkdir "%ProgramFiles%\dotnet" +@if exist %SANDBOX_FILES%\%PROCESSOR_ARCHITECTURE%\dotnet-runtime.zip ( + tar -oxzf "%SANDBOX_FILES%\%PROCESSOR_ARCHITECTURE%\dotnet-runtime.zip" -C "%ProgramFiles%\dotnet" +) else ( + if %PROCESSOR_ARCHITECTURE%=="ARM64" ( + curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-arm64.zip --output dotnet-runtime.zip + ) else ( + curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-x64.zip --output dotnet-runtime.zip + ) + if %errorlevel$ NEQ 0 ( + echo No pre-provided dotnet runtime, and failed to download. Confirm networking is available. + goto :ERROR + ) + tar -oxzf dotnet-runtime.zip -C "%ProgramFiles%\dotnet" + del dotnet-runtime.zip +) + +@if exist %SANDBOX_FILES%\%PROCESSOR_ARCHITECTURE%\dotnet-sdk.zip ( + tar -oxzf "%SANDBOX_FILES%\%PROCESSOR_ARCHITECTURE%\dotnet-sdk.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-runtime.zip + ) + if %errorlevel$ NEQ 0 echo "No pre-provided dotnet sdk, and failed to download. Confirm networking is available." goto exit + tar -oxzf dotnet-sdk.zip -C "%ProgramFiles%\dotnet" + del dotnet-sdk.zip +) + +@endlocal +SETX PATH "%PATH%;%ProgramFiles%\dotnet" /M +SET PATH=%PATH%;%ProgramFiles%\dotnet +dotnet nuget locals all --clear +dotnet help + + +:ERROR + +@popd +cd c:\build +start cmd -- cgit v1.2.3-55-g6feb