on windows test clang in release without asan

This commit is contained in:
Nikita Smith
2026-06-02 12:10:21 -07:00
committed by Ryan Fleury
parent b4cfc61408
commit 1de3be3b8b
2 changed files with 88 additions and 63 deletions
+3 -18
View File
@@ -118,30 +118,16 @@ jobs:
mode: mode:
- debug - debug
- release - release
exclude:
- { compiler: clang, mode: release } # clang runs OOM in release with ASAN
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: run-torture - name: run-torture
shell: cmd shell: cmd
run: | run: |
rem find path to clang
for /f "tokens=*" %%i in ('where clang') do set clang_path=%%~dpi
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
where clang
rem set clang path before MSVC's clang path clang --version
set PATH=%clang_path%;%PATH% call run_tests.bat ${{ matrix.compiler }} ${{ matrix.mode }} -- --gen_crash_dump || exit /b 1
rem parse out clang version number out of --version to build path to the folder with ASAN DLL
for /f "tokens=3 delims=. " %%v in ('clang -v 2^>^&1 ^| findstr version') do set clang_version=%%v
if "${{matrix.compiler}}" == "clang" set PATH=%clang_path%..\lib\clang\%clang_version%\lib\windows;%PATH%
call build meta raddbg_non_graphical || exit /b 1
call build asan meta torture radlink radbin mule_main mule_module "${{matrix.mode}}" "${{matrix.compiler}}" || exit /b 1
cd build
torture --gen_crash_dump || exit /b 1
- name: upload torture crash dumps - name: upload torture crash dumps
if: failure() if: failure()
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
@@ -153,4 +139,3 @@ jobs:
build/*.pdb build/*.pdb
build/torture_artifacts/** build/torture_artifacts/**
if-no-files-found: ignore if-no-files-found: ignore
+85 -45
View File
@@ -1,45 +1,85 @@
@echo off @echo off
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
rem Make sure that your VS install does not have LLVM included otherwise this script will use VS clang set TARGET_VALUES=radlink radbin mule_main mule_module torture
set CC_VALUES=msvc clang
set TARGET_VALUES=radlink radbin mule_main mule_module torture set MODE_VALUES=debug release
set CC_VALUES=msvc clang set RAW_ARGS=%*
set MODE_VALUES=debug release set TORTURE_ARGS=
set RUN_TORTURE=1
rem find path to clang
for /f "tokens=*" %%i in ('where clang') do set clang_path=%%~dpi :parse_args
if "%~1" == "" goto parse_done
rem parse out clang version number out of --version to build path to the folder with ASAN DLL if "%~1" == "--" goto parse_torture_args
for /f "tokens=3 delims=. " %%v in ('clang -v 2^>^&1 ^| findstr version') do set clang_version=%%v if /i "%~1" == "msvc" set CC_VALUES=msvc && shift /1 && goto parse_args
if /i "%~1" == "clang" set CC_VALUES=clang && shift /1 && goto parse_args
for %%m in (%MODE_VALUES%) do for %%c in (%CC_VALUES%) do ( if /i "%~1" == "debug" set MODE_VALUES=debug && shift /1 && goto parse_args
setlocal if /i "%~1" == "release" set MODE_VALUES=release && shift /1 && goto parse_args
if /i "%~1" == "no_torture" set RUN_TORTURE=0 && shift /1 && goto parse_args
echo -------------------------------------------------------------------------------- echo usage: run_tests.bat [msvc^|clang] [debug^|release] [no_torture] [-- <torture args>]
echo Build %%c+%%m exit /b 1
rem nuke artifacts from last run :parse_torture_args
rmdir /s /q build\torture_artifacts shift /1
if "%~1" == "" set "TORTURE_ARGS=" && goto parse_done
if "%%c" equ "clang" ( set "TORTURE_ARGS=%RAW_ARGS%"
set PATH=%clang_path%..\lib\clang\%clang_version%\lib\windows;!PATH! if "%TORTURE_ARGS:~0,3%" == "-- " set "TORTURE_ARGS=%TORTURE_ARGS:~3%" && goto parse_done
) set "TORTURE_ARGS=%TORTURE_ARGS:* -- =%"
rem TODO: unblock asan :parse_done
call build.bat meta %%c %%m raddbg raddbg_non_graphical || exit /b 1
for %%m in (%MODE_VALUES%) do for %%c in (%CC_VALUES%) do (
rem clang does not compile with asan in release mode because it runs out of memory setlocal
if "%%c" equ "clang" (
call build.bat meta %%c %%m %TARGET_VALUES% || exit /b 1 :: nuke artifacts from last run
) else ( if exist build/torture_artifacts rmdir /s /q build\torture_artifacts
call build.bat meta asan %%c %%m %TARGET_VALUES% || exit /b 1 if exist build\metagen.exe del /q build\metagen.exe
) for %%t in (%TARGET_VALUES%) do (
if exist build\%%t.exe del /q build\%%t.exe
pushd build if exist build\%%t.pdb del /q build\%%t.pdb
torture %* || exit /b 1 )
popd
if "%%c" == "clang" (
endlocal :: Prefer standalone LLVM clang over Visual Studio clang so ASAN runtime files match the compiler.
) set "clang_path="
for /f "tokens=*" %%i in ('where clang') do (
set "candidate_clang_path=%%~dpi"
if "!candidate_clang_path:Microsoft Visual Studio=!"=="!candidate_clang_path!" (
if not defined clang_path set "clang_path=!candidate_clang_path!"
)
)
if not defined clang_path (
echo ERROR: standalone LLVM clang not found in PATH
exit /b 1
)
set PATH=!clang_path!;!PATH!
for /f "tokens=3 delims=. " %%v in ('clang -v 2^>^&1 ^| findstr version') do set clang_version=%%v
if not defined clang_version (
echo ERROR: failed to detect clang version
exit /b 1
)
set PATH=!clang_path!..\lib\clang\!clang_version!\lib\windows;!PATH!
)
:: TODO: unblock asan
call build.bat meta %%c %%m raddbg raddbg_non_graphical || exit /b 1
:: clang does not compile with asan in release mode because it runs out of memory
if "%%c" equ "clang" (
if /i "%%m" equ "release" (
call build.bat meta %%c %%m !TARGET_VALUES! || exit /b 1
) else (
call build.bat meta asan %%c %%m !TARGET_VALUES! || exit /b 1
)
) else (
call build.bat meta asan %%c %%m !TARGET_VALUES! || exit /b 1
)
if "%RUN_TORTURE%" equ "1" (
pushd build
torture %TORTURE_ARGS% || exit /b 1
popd
)
endlocal
)