Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ASan in Windows CI #1835

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions .github/workflows/range-v3-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,13 @@ jobs:

# MSVC 2022
- {
name: "Windows MSVC 2022 Debug (C++17)", artifact: "Windows-MSVC.tar.xz",
name: "Windows MSVC 2022 Debug (C++17) / ASAN", artifact: "Windows-MSVC.tar.xz",
os: windows-latest,
build_type: Debug,
cc: "cl", cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
cxx_standard: 17,
cxx_asan: true,
}
- {
name: "Windows MSVC 2022 Release (C++17)", artifact: "Windows-MSVC.tar.xz",
Expand All @@ -366,12 +367,13 @@ jobs:
cxx_standard: 17,
}
- {
name: "Windows MSVC 2022 Debug (C++20)", artifact: "Windows-MSVC.tar.xz",
name: "Windows MSVC 2022 Debug (C++20) / ASAN", artifact: "Windows-MSVC.tar.xz",
os: windows-latest,
build_type: Debug,
cc: "cl", cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
cxx_standard: 20,
cxx_asan: true,
}
- {
name: "Windows MSVC 2022 Release (C++20)", artifact: "Windows-MSVC.tar.xz",
Expand Down Expand Up @@ -469,7 +471,7 @@ jobs:
COMMAND "${{ matrix.config.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
)
set(cxx_flags "/permissive- /EHsc")
set(cxx_flags "/nologo /permissive- /EHsc")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
Expand All @@ -495,14 +497,23 @@ jobs:
endif()

if ("x${{ matrix.config.cxx_asan }}" STREQUAL "xtrue")
set(cxx_flags "${cxx_flags} -fsanitize=address -fno-omit-frame-pointer")
set(cxx_flags "${cxx_flags} -fsanitize=address")
if ("${{ runner.os }}" STREQUAL "Windows")
set(link_flags "${link_flags} /INFERASANLIBS /INCREMENTAL:NO")
else()
set(cxx_flags "${cxx_flags} -fno-omit-frame-pointer")
endif()
endif()

set(cxx_concepts ON)
if ("x${{ matrix.config.cxx_concepts }}" STREQUAL "xfalse")
set(cxx_concepts OFF)
endif()

if ("${{ runner.os }}" STREQUAL "Windows")
set(link_flags "${link_flags} /NOLOGO")
endif()

execute_process(
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake
-S .
Expand Down Expand Up @@ -562,6 +573,15 @@ jobs:

set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")

if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()

execute_process(
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/ctest --verbose -j ${N}
WORKING_DIRECTORY build
Expand Down
Loading