diff options
author | Johan Lorensson <lateralusx.github@gmail.com> | 2018-06-22 19:23:08 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-06-22 19:23:08 +0300 |
commit | 622a1b6f55b9a9c95f02458d2a0e930a087a9891 (patch) | |
tree | b622dd832d0a55567f39279419b49063b790c80f /msvc | |
parent | a49b96d72d628d719837fc07bdf95a209333ff2b (diff) |
Helper scripts running mini regression tests in JIT/Full AOT on Windows. (#9252)
* Helper scripts running mini regression tests in JIT/Full AOT on Windows.
A set of helper scripts running all mini regression tests, supporting both
JIT and full AOT (including building full AOT assemblies) using local build
Visual Studio mono runtime (can be switched in setp.env.bat). Includes logic
to pick correct Visual Studio toolchain and support to setup command prompt
targeting x64 full AOT build and running tests. NOTE, the scripts are not limited
to the mini regression tests, only includes a set of predefined assemblies making
it easier to execute regression tests.
Full AOT scripts includes capabilities to build dynamic library, static linked objects
or assembler output, it also supports switches to use LLVM when building full AOT
assemblies if supported by local build mono runtime.
By default, scripts follow default build configurations used by mono BCL builds and
Visual Studio x64 Release build mono runtime.
Examples to run all JIT regression tests:
run-jit-regression.bat all
To run individual programs using JIT (doesn’t need to be a regression test):
run-jit.bat [full path to assembly]
NOTE, for regression tests there is a shortcut making them easier to locate,
so then just the assembly name can be used, not the full path is needed.
run-jit.bat basic.exe
Examples to build all regression tests using full AOT:
build-full-aot-regression-tests.bat all
Builds all regression tests in full AOT including all needed support and
BCL assemblies. All build assemblies will end up in msvc\build\fullaot\winaot
folder by default. It is possible to build individual assemblies as well using:
build-full-aot-regression-tests.bat [full path to assembly]
NOTE, for regression tests there is a shortcut making them easier to locate,
so then just the assembly name can be used, not the full path is needed.
build-full-aot-regression-tests.bat basic.exe
Examples to run all regression tests using full AOT:
run-full-aot-regression-tests.bat all
Runs all regression tests in full AOT. It is possible to run individual assemblies
as well using:
run-full-aot-regression-tests.bat [full path to assembly]
NOTE, for regression tests there is a shortcut making them easier to locate,
so then just the assembly name can be used, not the full path is needed.
run-full-aot-regression-tests.bat basic.exe
There are some more features included in the scripts as well, but above shows
basic usage. It could also be possible to reuse the scripts in Visual Studio
build targets going forward to at least run the JIT regression tests
as part of Visual Studio build.
* Fixed some review feedback.
* Switching to 1 instead of -1 in case of errors.
* Used case insensetiv compare for some if's.
* Dropped use of ECHO OFF/ON in nested scripts.
* Removed clear of PATH (was not intended).
Diffstat (limited to 'msvc')
-rw-r--r-- | msvc/scripts/tests/build-full-aot-regression-tests.bat | 194 | ||||
-rw-r--r-- | msvc/scripts/tests/clang-vs2015-toolchain.bat | 60 | ||||
-rw-r--r-- | msvc/scripts/tests/clang-vs2017-toolchain.bat | 69 | ||||
-rw-r--r-- | msvc/scripts/tests/run-full-aot-regression-tests.bat | 80 | ||||
-rw-r--r-- | msvc/scripts/tests/run-jit-regression.bat | 114 | ||||
-rw-r--r-- | msvc/scripts/tests/run-jit.bat | 86 | ||||
-rw-r--r-- | msvc/scripts/tests/setup-env.bat | 43 | ||||
-rw-r--r-- | msvc/scripts/tests/setup-toolchain.bat | 40 |
8 files changed, 686 insertions, 0 deletions
diff --git a/msvc/scripts/tests/build-full-aot-regression-tests.bat b/msvc/scripts/tests/build-full-aot-regression-tests.bat new file mode 100644 index 00000000000..8a254081cab --- /dev/null +++ b/msvc/scripts/tests/build-full-aot-regression-tests.bat @@ -0,0 +1,194 @@ +@ECHO OFF + +SETLOCAL ENABLEDELAYEDEXPANSION + +SET TEMP_PATH=%PATH% +SET MONO_RESULT=1 + +SET BUILD_TARGET=%1 +SET CLEAN=%2 + +IF NOT "" == "%BUILD_TARGET%" ( + SET BUILD_TARGET=%BUILD_TARGET:"=% +) + +CALL setup-env.bat +IF NOT ERRORLEVEL == 0 ( + ECHO Failed to setup mono paths. + GOTO ON_ERROR +) + +CALL setup-toolchain.bat +IF NOT ERRORLEVEL == 0 ( + ECHO Failed to setup toolchain. + GOTO ON_ERROR +) + +IF NOT EXIST "%MONO_WINAOT_BCL_PATH%" ( + ECHO Could not find "%MONO_WINAOT_BCL_PATH%". + GOTO ON_ERROR +) + +SET MONO_RUNTIME_TEST_PATH=%MONO_MINI_HOME% +SET MONO_TEST_PATH=%MONO_TEST_BUILD_DIR% + +SET FULLAOT_DIR=%MONO_WINAOT_BUILD_DIR% +SET MONO_PATH=%FULLAOT_DIR% + +REM Debug output options. + +REM SET MONO_LOG_LEVEL=debug +REM SET MONO_LOG_MASK=asm,aot + +SET MONO_LOG_LEVEL= +SET MONO_LOG_MASK= + +SET FULLAOT_BCL_LIBS=^ +mscorlib.dll ^ +System.Core.dll ^ +System.dll ^ +System.Numerics.dll ^ +System.Numerics.Vectors.dll ^ +System.Xml.dll ^ +System.Security.dll ^ +Mono.Simd.dll ^ +Mono.Security.dll ^ +I18N.dll ^ +I18N.West.dll ^ +MemoryIntrinsics.dll + +SET FULLAOT_TEST_LIBS=^ +TestDriver.dll ^ +generics-variant-types.dll + +REM basic-simd.exe not in full AOT profile on Windows. +SET FULLAOT_RUNTIME_TESTS=^ +basic.exe ^ +basic-float.exe ^ +basic-long.exe ^ +basic-calls.exe ^ +objects.exe ^ +arrays.exe ^ +basic-math.exe ^ +exceptions.exe ^ +iltests.exe ^ +devirtualization.exe ^ +generics.exe ^ +basic-vectors.exe ^ +gshared.exe ^ +aot-tests.exe ^ +ratests.exe ^ +unaligned.exe ^ +builtin-types.exe + +SET FULLAOT_LIBS= + +mkdir %FULLAOT_DIR% >nul 2>&1 + +IF /i "bcl" == "%BUILD_TARGET%" ( + + SET FULLAOT_LIBS=%FULLAOT_LIBS% %FULLAOT_BCL_LIBS% + +) + +IF /i "tests" == "%BUILD_TARGET%" ( + + SET FULLAOT_LIBS=%FULLAOT_LIBS% %FULLAOT_TEST_LIBS% %FULLAOT_RUNTIME_TESTS% + +) + +IF /i "all" == "%BUILD_TARGET%" ( + + SET FULLAOT_LIBS=%FULLAOT_LIBS% %FULLAOT_BCL_LIBS% %FULLAOT_TEST_LIBS% %FULLAOT_RUNTIME_TESTS% + +) + +IF "" == "%FULLAOT_LIBS%" ( + + IF NOT "" == "%BUILD_TARGET%" ( + + SET FULLAOT_LIBS=%BUILD_TARGET% + ) +) + +FOR %%a IN (%FULLAOT_LIBS%) DO ( + + del "%FULLAOT_DIR%\%%a.dll" >nul 2>&1 + ECHO Deleting "%FULLAOT_DIR%\%%a.dll". + del "%FULLAOT_DIR%\%%a.dll.lib" >nul 2>&1 + ECHO Deleting "%FULLAOT_DIR%\%%a.dll.lib". + del "%FULLAOT_DIR%\%%a.dll.exp" >nul 2>&1 + ECHO Deleting "%FULLAOT_DIR%\%%a.dll.exp". + del "%FULLAOT_DIR%\%%a.dll.pdb" >nul 2>&1 + ECHO Deleting "%FULLAOT_DIR%\%%a.dll.pdb". + del "%FULLAOT_DIR%\%%a.obj" >nul 2>&1 + ECHO Deleting "%FULLAOT_DIR%\%%a.obj". + + IF EXIST %MONO_WINAOT_BCL_PATH%\%%a ( + ECHO Copying %MONO_WINAOT_BCL_PATH%\%%a %FULLAOT_DIR%\%%a. + copy %MONO_WINAOT_BCL_PATH%\%%a %FULLAOT_DIR%\%%a >nul 2>&1 + ) ELSE ( + SET FOUND_TEST_TARGET_PATH= + CALL :INNER_COPY_LOOP FOUND_TEST_TARGET_PATH %%a + ECHO Copying !FOUND_TEST_TARGET_PATH! %FULLAOT_DIR%\%%a. + copy !FOUND_TEST_TARGET_PATH! %FULLAOT_DIR%\%%a >nul 2>&1 + ) +) + +GOTO BUILD + +:INNER_COPY_LOOP +FOR /d %%d IN (%MONO_TEST_PATH%\*) DO ( + IF EXIST %%d\%2 ( + SET %1=%%d\%2 + GOTO RETURN_INNER_COPY_LOOP + ) +) + +IF EXIST %MONO_RUNTIME_TEST_PATH%\%2 ( + SET %1=%MONO_RUNTIME_TEST_PATH%\%2 +) + +:RETURN_INNER_COPY_LOOP +GOTO :EOF + +:BUILD + +SET FULLAOT_TEMP_DIR=%FULLAOT_DIR%\%%a-build +REM SET USE_LLVM=llvm + +SET MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE=--aot=full,temp-path=%FULLAOT_TEMP_DIR%,print-skipped,%USE_LLVM%,outfile=%FULLAOT_DIR%\%%a.dll +REM SET MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE=--aot=full,temp-path=%FULLAOT_TEMP_DIR%,print-skipped,static,%USE_LLVM%,outfile=%FULLAOT_DIR%\%%a.obj,llvm-outfile=%FULLAOT_DIR%\%%a-llvm.obj +REM SET MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE=--aot=full,temp-path=%FULLAOT_TEMP_DIR%,print-skipped,asmonly,%USE_LLVM%,outfile=%FULLAOT_DIR%\%%a.s,llvm-outfile=%FULLAOT_DIR%\%%a-llvm.s + +IF "" == "%CLEAN%" ( + + FOR %%a IN (%FULLAOT_LIBS%) DO ( + + mkdir %FULLAOT_TEMP_DIR% >nul 2>&1 + + ECHO %MONO_AOT_COMPILER_EXECUTABLE% %MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE% %FULLAOT_DIR%\%%a. + %MONO_AOT_COMPILER_EXECUTABLE% %MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE% %FULLAOT_DIR%\%%a + + rmdir /S /Q %FULLAOT_TEMP_DIR% + + IF NOT ERRORLEVEL == 0 ( + ECHO "Failed Full AOT compile of %FULLAOT_DIR%\%%a". + GOTO ON_ERROR + ) + ) +) + +SET MONO_RESULT=0 +GOTO ON_EXIT + +:ON_ERROR + ECHO Usage: build-full-aot-regression-tests.bat [bcl|tests|all|assembly path] [clean]. + SET MONO_RESULT=ERRORLEVEL + GOTO ON_EXIT + +:ON_EXIT + SET PATH=%TEMP_PATH% + EXIT /b %MONO_RESULT% + +@ECHO ON diff --git a/msvc/scripts/tests/clang-vs2015-toolchain.bat b/msvc/scripts/tests/clang-vs2015-toolchain.bat new file mode 100644 index 00000000000..9eef6a65f5c --- /dev/null +++ b/msvc/scripts/tests/clang-vs2015-toolchain.bat @@ -0,0 +1,60 @@ +REM Look for Clang VS2015 toolchain in VS installation folders. +ECHO Searching for Clang in VS2015 toolchain... + +IF "%VCINSTALLDIR%" == "" ( + ECHO VCINSTALLDIR environment variable not set. + GOTO ON_ENV_ERROR +) + +IF /i NOT "%Platform%" == "X64" ( + ECHO Platform environment variable not set to X64. + GOTO ON_ENV_ERROR +) + +IF NOT "%VisualStudioVersion%" == "14.0" ( + ECHO VisualStudioVersion environment variable not set to 14.0. + GOTO ON_ENV_ERROR +) + +SET CLANGC2_TOOLS_BIN_PATH=%VCINSTALLDIR%\ClangC2\bin\amd64\ +SET CLANGC2_TOOLS_BIN=%CLANGC2_TOOLS_BIN_PATH%clang.exe +IF NOT EXIST "%CLANGC2_TOOLS_BIN%" ( + ECHO Could not find "%CLANGC2_TOOLS_BIN%" + GOTO ON_ERROR +) + +ECHO Found "%CLANGC2_TOOLS_BIN%" + +ECHO Searching for Linker in VS2015 toolchain... + +SET LINK_TOOLS_BIN_PATH=%VCINSTALLDIR%bin\amd64\ +SET LINK_TOOLS_BIN=%LINK_TOOLS_BIN_PATH%link.exe +IF NOT EXIST "%LINK_TOOLS_BIN%" ( + ECHO Could not find "%LINK_TOOLS_BIN%" + GOTO ON_ERROR +) + +ECHO Found "%LINK_TOOLS_BIN%" + +SET COMPILER_TOOLS_BIN="%LINK_TOOLS_BIN_PATH%";"%CLANGC2_TOOLS_BIN_PATH%" +SET PATH=%COMPILER_TOOLS_BIN%;%PATH% + +SET MONO_RESULT=0 +GOTO ON_EXIT + +:ON_ENV_ERROR + +SET VC_VARS_ALL_FILE=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat + +ECHO Make sure to run this from a "VS2015 x64 Native Tools Command Prompt" command prompt. +IF EXIST "%VC_VARS_ALL_FILE%" ( + ECHO Setup a "VS2015 x64 Native Tools Command Prompt" command prompt by using "%VC_VARS_ALL_FILE%" amd64. +) + +:ON_ERROR + +SET MONO_RESULT=1 + +:ON_EXIT + +EXIT /b %MONO_RESULT% diff --git a/msvc/scripts/tests/clang-vs2017-toolchain.bat b/msvc/scripts/tests/clang-vs2017-toolchain.bat new file mode 100644 index 00000000000..4ea30e0cd72 --- /dev/null +++ b/msvc/scripts/tests/clang-vs2017-toolchain.bat @@ -0,0 +1,69 @@ +REM Look for Clang VS2017 toolchain in VS installation folders. +ECHO Searching for Clang in VS2017 toolchain... + +IF "%VCINSTALLDIR%" == "" ( + ECHO VCINSTALLDIR environment variable not set. + GOTO ON_ENV_ERROR +) + +IF /i NOT "%VSCMD_ARG_TGT_ARCH%" == "x64" ( + ECHO VSCMD_ARG_TGT_ARCH environment variable not set to x64. + GOTO ON_ENV_ERROR +) + +IF NOT "%VisualStudioVersion%" == "15.0" ( + ECHO VisualStudioVersion environment variable not set to 15.0. + GOTO ON_ENV_ERROR +) + +SET CLANGC2_VERSION_FILE=%VCINSTALLDIR%Auxiliary/Build/Microsoft.ClangC2Version.default.txt +IF NOT EXIST "%CLANGC2_VERSION_FILE%" ( + ECHO Could not find "%CLANGC2_VERSION_FILE%". + GOTO ON_ENV_ERROR +) + +SET /p CLANGC2_VERSION=<"%CLANGC2_VERSION_FILE%" +SET CLANGC2_TOOLS_BIN_PATH=%VCINSTALLDIR%Tools\ClangC2\%CLANGC2_VERSION%\bin\HostX64\ +SET CLANGC2_TOOLS_BIN=%CLANGC2_TOOLS_BIN_PATH%clang.exe +IF NOT EXIST "%CLANGC2_TOOLS_BIN%" ( + ECHO Could not find "%CLANGC2_TOOLS_BIN%". + GOTO ON_ERROR +) + +ECHO Found "%CLANGC2_TOOLS_BIN%". + +ECHO Searching for Linker in VS2017 toolchain... + +SET LINK_TOOLS_BIN_PATH=%VCToolsInstallDir%bin\HostX64\x64\ +SET LINK_TOOLS_BIN=%LINK_TOOLS_BIN_PATH%link.exe +IF NOT EXIST "%LINK_TOOLS_BIN%" ( + ECHO Could not find "%LINK_TOOLS_BIN%". + GOTO ON_ERROR +) + +ECHO Found "%LINK_TOOLS_BIN%". + +SET COMPILER_TOOLS_BIN="%LINK_TOOLS_BIN_PATH%";"%CLANGC2_TOOLS_BIN_PATH%" +SET PATH=%COMPILER_TOOLS_BIN%;%PATH% + +SET MONO_RESULT=0 +GOTO ON_EXIT + +:ON_ENV_ERROR + +SET VSWHERE_TOOLS_BIN=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe + +ECHO Make sure to run this from a "x64 Native Tools Command Prompt for VS2017" command prompt. +IF EXIST "%VSWHERE_TOOLS_BIN%" ( + FOR /F "tokens=*" %%a IN ('"%VSWHERE_TOOLS_BIN%" -latest -property installationPath') DO ( + ECHO Setup a "x64 Native Tools Command Prompt for VS2017" command prompt by using "%%a\VC\Auxiliary\Build\vcvars64.bat". + ) +) + +:ON_ERROR + +SET MONO_RESULT=1 + +:ON_EXIT + +EXIT /b %MONO_RESULT% diff --git a/msvc/scripts/tests/run-full-aot-regression-tests.bat b/msvc/scripts/tests/run-full-aot-regression-tests.bat new file mode 100644 index 00000000000..2f85ada5b6c --- /dev/null +++ b/msvc/scripts/tests/run-full-aot-regression-tests.bat @@ -0,0 +1,80 @@ +@ECHO OFF + +SET TEMP_PATH=%PATH% +SET MONO_RESULT=1 + +CALL setup-env.bat +IF NOT ERRORLEVEL == 0 ( + ECHO Failed to setup mono paths. + GOTO ON_ERROR +) + +CALL setup-toolchain.bat +IF NOT ERRORLEVEL == 0 ( + ECHO Failed to setup toolchain. + GOTO ON_ERROR +) + +SET FULLAOT_DIR=%MONO_WINAOT_BUILD_DIR% +SET MONO_PATH=%FULLAOT_DIR% + +SET RUN_TARGET=%1 + +REM %FULLAOT_DIR%\basic-simd.exe not in full AOT profile on Windows. + +IF /i "all" == "%RUN_TARGET%" ( + SET RUN_TARGET=%FULLAOT_DIR%\basic.exe ^ + %FULLAOT_DIR%\basic-float.exe ^ + %FULLAOT_DIR%\basic-long.exe ^ + %FULLAOT_DIR%\basic-calls.exe ^ + %FULLAOT_DIR%\objects.exe ^ + %FULLAOT_DIR%\arrays.exe ^ + %FULLAOT_DIR%\basic-math.exe ^ + %FULLAOT_DIR%\exceptions.exe ^ + %FULLAOT_DIR%\iltests.exe ^ + %FULLAOT_DIR%\devirtualization.exe ^ + %FULLAOT_DIR%\generics.exe ^ + %FULLAOT_DIR%\aot-tests.exe ^ + %FULLAOT_DIR%\gshared.exe ^ + %FULLAOT_DIR%\ratests.exe ^ + %FULLAOT_DIR%\unaligned.exe ^ + %FULLAOT_DIR%\builtin-types.exe +) ELSE ( + IF NOT EXIST %RUN_TARGET% ( + SET RUN_TARGET=%FULLAOT_DIR%\%1 + ) +) + +REM Debug output options. + +REM SET MONO_LOG_LEVEL=debug +REM SET MONO_LOG_MASK=asm,aot + +SET MONO_LOG_LEVEL= +SET MONO_LOG_MASK= + +FOR %%a IN (%RUN_TARGET%) DO ( + + ECHO %MONO_AOT_RUNTIME_EXECUTABLE% --full-aot %%a --exclude "!FULLAOT" --exclude "!FULLAOT-AMD64". + %MONO_AOT_RUNTIME_EXECUTABLE% --full-aot %%a --exclude "!FULLAOT" --exclude "!FULLAOT-AMD64" + + IF NOT ERRORLEVEL == 0 ( + ECHO Failed Full AOT execute of %%a. + GOTO ON_ERROR + ) + +) + +GOTO ON_EXIT + +:ON_ERROR + ECHO Failed Full AOT execute. + SET MONO_RESULT=ERRORLEVEL + GOTO ON_EXIT + +:ON_EXIT + SET PATH=%TEMP_PATH% + EXIT /b %MONO_RESULT% + +@ECHO ON + diff --git a/msvc/scripts/tests/run-jit-regression.bat b/msvc/scripts/tests/run-jit-regression.bat new file mode 100644 index 00000000000..ae7b3012a4c --- /dev/null +++ b/msvc/scripts/tests/run-jit-regression.bat @@ -0,0 +1,114 @@ +@ECHO OFF + +SETLOCAL ENABLEDELAYEDEXPANSION + +SET TEMP_PATH=%PATH% +SET MONO_RESULT=1 + +CALL setup-env.bat +IF NOT ERRORLEVEL == 0 ( + ECHO Failed to setup mono paths. + GOTO ON_ERROR +) + +CALL setup-toolchain.bat +IF NOT ERRORLEVEL == 0 ( + ECHO Failed to setup toolchain. + GOTO ON_ERROR +) + +IF NOT EXIST "%MONO_BCL_PATH%" ( + ECHO Could not find "%MONO_BCL_PATH%". + GOTO ON_ERROR +) + +SET MONO_RUNTIME_TEST_PATH=%MONO_MINI_HOME% +SET MONO_TEST_PATH=%MONO_TEST_BUILD_DIR% + +SET MONO_PATH=%MONO_BCL_PATH%;%MONO_TEST_PATH%;%MONO_RUNTIME_TEST_PATH% + +SET MONO_RUNTIME_REGRESSION_TESTS=basic.exe ^ +basic-float.exe ^ +basic-long.exe ^ +basic-calls.exe ^ +objects.exe ^ +arrays.exe ^ +basic-math.exe ^ +exceptions.exe ^ +iltests.exe ^ +devirtualization.exe ^ +generics.exe ^ +basic-simd.exe ^ +basic-vectors.exe ^ +ratests.exe ^ +unaligned.exe ^ +builtin-types.exe + +SET RUN_TARGET=%1 + +IF /i "all" == "%RUN_TARGET%" ( + SET RUN_TARGET= + FOR %%a IN (%MONO_RUNTIME_REGRESSION_TESTS%) DO ( + SET FOUND_TEST_TARGET= + CALL :FIND_TEST FOUND_TEST_TARGET %%a + IF NOT "!RUN_TARGET!" == "" ( + SET RUN_TARGET=!RUN_TARGET! !FOUND_TEST_TARGET! + ) ELSE ( + SET RUN_TARGET=!FOUND_TEST_TARGET! + ) + ) + +) ELSE ( + SET FOUND_TEST_TARGET= + CALL :FIND_TEST FOUND_TEST_TARGET %RUN_TARGET% + SET RUN_TARGET=!FOUND_TEST_TARGET! +) + +GOTO END_FIND_TEST + +:FIND_TEST +FOR /d %%d IN (%MONO_TEST_PATH%\*) DO ( + IF EXIST %%d\%2 ( + SET %1=%%d\%2 + GOTO RETURN_FIND_TEST + ) +) + +IF EXIST %MONO_RUNTIME_TEST_PATH%\%2 ( + SET %1=%MONO_RUNTIME_TEST_PATH%\%2 +) + +:RETURN_FIND_TEST +GOTO :EOF + +:END_FIND_TEST + +REM Debug output options. + +REM SET MONO_LOG_LEVEL=debug +REM SET MONO_LOG_MASK=asm,aot + +SET MONO_LOG_LEVEL= +SET MONO_LOG_MASK= + + +ECHO %MONO_JIT_EXECUTABLE% --regression %RUN_TARGET%. +%MONO_JIT_EXECUTABLE% --regression %RUN_TARGET% + +IF NOT ERRORLEVEL == 0 ( + ECHO Failed JIT regression execute of %RUN_TARGET%. + GOTO ON_ERROR +) + +GOTO ON_EXIT + +:ON_ERROR + ECHO Failed JIT regression execute. + SET MONO_RESULT=ERRORLEVEL + GOTO ON_EXIT + +:ON_EXIT + SET PATH=%TEMP_PATH% + EXIT /b %MONO_RESULT% + +@ECHO ON diff --git a/msvc/scripts/tests/run-jit.bat b/msvc/scripts/tests/run-jit.bat new file mode 100644 index 00000000000..c558be0128a --- /dev/null +++ b/msvc/scripts/tests/run-jit.bat @@ -0,0 +1,86 @@ +@ECHO OFF + +SET TEMP_PATH=%PATH% +SET MONO_RESULT=1 + +CALL setup-env.bat +IF NOT ERRORLEVEL == 0 ( + ECHO Failed to setup mono paths. + GOTO ON_ERROR +) + +CALL setup-toolchain.bat +IF NOT ERRORLEVEL == 0 ( + ECHO Failed to setup toolchain. + GOTO ON_ERROR +) + + +IF NOT EXIST "%MONO_BCL_PATH%" ( + ECHO Could not find "%MONO_BCL_PATH%". + GOTO ON_ERROR +) + +SET MONO_RUNTIME_TEST_PATH=%MONO_MINI_HOME% +SET MONO_TEST_PATH=%MONO_TEST_BUILD_DIR% + +SET MONO_PATH=%MONO_BCL_PATH%;%MONO_TEST_PATH%;%MONO_RUNTIME_TEST_PATH% + +SET RUN_TARGET=%1 + +IF NOT EXIST %RUN_TARGET% ( + CALL :FIND_TEST RUN_TARGET %%1 +) + +IF NOT EXIST %RUN_TARGET% ( + SET RUN_TARGET=%MONO_RUNTIME_TEST_PATH%\%1 +) + +IF NOT EXIST %RUN_TARGET% ( + ECHO Couldn't locate run target, %1. + GOTO ON_ERROR +) + +GOTO END_FIND_TEST + +:FIND_TEST +FOR /d %%d IN (%MONO_TEST_PATH%\*) DO ( + IF EXIST %%d\%2 ( + SET %1=%%d\%2 + GOTO RETURN_FIND_TEST + ) +) + +:RETURN_FIND_TEST +GOTO :EOF + +:END_FIND_TEST + +REM Debug output options. + +REM SET MONO_LOG_LEVEL=debug +REM SET MONO_LOG_MASK=asm,aot + +SET MONO_LOG_LEVEL= +SET MONO_LOG_MASK= + +ECHO %MONO_JIT_EXECUTABLE% %RUN_TARGET%. +%MONO_JIT_EXECUTABLE% %RUN_TARGET% + +IF NOT ERRORLEVEL == 0 ( + ECHO Failed JIT execute of %RUN_TARGET%. + GOTO ON_ERROR +) + +GOTO ON_EXIT + +:ON_ERROR + ECHO Failed JIT execute. + SET MONO_RESULT=ERRORLEVEL + GOTO ON_EXIT + +:ON_EXIT + SET PATH=%TEMP_PATH% + EXIT /b %MONO_RESULT% + +@ECHO ON diff --git a/msvc/scripts/tests/setup-env.bat b/msvc/scripts/tests/setup-env.bat new file mode 100644 index 00000000000..e8c45909689 --- /dev/null +++ b/msvc/scripts/tests/setup-env.bat @@ -0,0 +1,43 @@ +SET CURRENT_MONO_HOME=%MONO_HOME% +IF "" == "%CURRENT_MONO_HOME%" ( + SET CURRENT_MONO_HOME=%~dp0..\..\.. +) + +REM Convert to absolute path. +pushd %CURRENT_MONO_HOME% +SET CURRENT_MONO_HOME=%CD% +popd + + +SET MONO_BUILD_CONFIG=Release +SET MONO_CFG_DIR=%CURRENT_MONO_HOME%\runtime\etc + +SET MONO_BCL_HOME=%CURRENT_MONO_HOME%\mcs\class\lib +SET MONO_MINI_HOME=%CURRENT_MONO_HOME%\mono\mini + +SET MONO_BUILD_DIR=%CURRENT_MONO_HOME%\msvc\build +SET MONO_AOT_BUILD_DIR=%MONO_BUILD_DIR%\fullaot +SET MONO_DIST_DIR=%CURRENT_MONO_HOME%\msvc\dist + +SET MONO_BCL_PATH=%MONO_BCL_HOME%\net_4_x +SET MONO_BCL_FACADE_PATH=%MONO_BCL_PATH%\Facades +SET MONO_WINAOT_BCL_PATH=%MONO_BCL_HOME%\winaot +SET MONO_WINAOT_BCL_FACADE_PATH=%MONO_WINAOT_BCL_PATH%\Facades + +SET MONO_WINAOT_BUILD_DIR=%MONO_AOT_BUILD_DIR%\winaot +SET MONO_TEST_BUILD_DIR= +SET MONO_SAMPLE_BUILD_DIR= + +SET MONO_CROSS_COMPILER_HOME=%MONO_BUILD_DIR%\sgen\x64\bin\%MONO_BUILD_CONFIG% + +REM Look for Mono repositories. +ECHO Searching for Mono repositories... +IF NOT EXIST "%CURRENT_MONO_HOME%" ( + ECHO Could not find "%CURRENT_MONO_HOME%". + EXIT /b 1 +) + + +ECHO Found "%CURRENT_MONO_HOME%". + +EXIT /b 0
\ No newline at end of file diff --git a/msvc/scripts/tests/setup-toolchain.bat b/msvc/scripts/tests/setup-toolchain.bat new file mode 100644 index 00000000000..d5dd6e61402 --- /dev/null +++ b/msvc/scripts/tests/setup-toolchain.bat @@ -0,0 +1,40 @@ +SET SCRIPT_DIR=%~dp0 + +REM Look for Mono toolchain. +ECHO Searching for Mono toolchain... +IF NOT EXIST "%MONO_CROSS_COMPILER_HOME%\mono-sgen.exe" ( + ECHO Could not find "%MONO_CROSS_COMPILER_HOME%\mono-sgen.exe". + EXIT /b 1 +) + +ECHO Found "%MONO_CROSS_COMPILER_HOME%\mono-sgen.exe". + +SET MONO_AOT_COMPILER_PATH=%MONO_CROSS_COMPILER_HOME% +SET MONO_AOT_COMPILER_EXECUTABLE=%MONO_AOT_COMPILER_PATH%\mono-sgen.exe +SET MONO_AOT_RUNTIME_PATH=%MONO_AOT_COMPILER_PATH% +SET MONO_AOT_RUNTIME_EXECUTABLE=%MONO_AOT_COMPILER_EXECUTABLE% +SET MONO_JIT_EXECUTABLE_PATH=%MONO_AOT_COMPILER_PATH% +SET MONO_JIT_EXECUTABLE=%MONO_AOT_COMPILER_EXECUTABLE% +SET MONO_LLVM_EXECUTABLES=%MONO_DIST_DIR%\llvm\bin + +REM Setup toolchain. +IF "%VisualStudioVersion%" == "14.0" ( + CALL %SCRIPT_DIR%clang-vs2015-toolchain.bat +) ELSE ( + IF "%VisualStudioVersion%" == "15.0" ( + CALL %SCRIPT_DIR%clang-vs2017-toolchain.bat + ) ELSE ( + ECHO Failed to identify supported Visual Studio toolchain. Environment variable VisualStudioVersion must be set to 14.0 for VS2015 or 15.0 for VS2017. Checking supported toolchains for more error diagnostics... + CALL %SCRIPT_DIR%clang-vs2015-toolchain.bat + CALL %SCRIPT_DIR%clang-vs2017-toolchain.bat + EXIT /b 1 + ) +) + +IF NOT ERRORLEVEL == 0 ( + EXIT /b %ERRORLEVEL% +) + +SET PATH=%MONO_JIT_EXECUTABLE_PATH%;%MONO_AOT_RUNTIME_PATH%;%MONO_AOT_COMPILER_PATH%;%MONO_LLVM_EXECUTABLES%;%PATH% + +EXIT /b 0
\ No newline at end of file |