mirror of
https://github.com/QuasarApp/pe-parse.git
synced 2025-04-26 12:24:32 +00:00
Catch2 ASAN support with Windows MSVC
ASAN on Windows messes with exception handlers, and Catch2 doesn't account for this. A workaround is to disable SEH on Windows with ASAN as suggested in this reply to an existing issue https://github.com/catchorg/Catch2/issues/898#issuecomment-841733322 CI requires some sourcing of the development tools for required paths
This commit is contained in:
parent
7d285ea7b9
commit
41a08eb3ee
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -110,6 +110,13 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
|
- name: Enable ASan Sanitizers
|
||||||
|
if: matrix.build-type == 'Debug' && matrix.build-arch == 'x64'
|
||||||
|
run: |
|
||||||
|
echo "SANITIZER_FLAG=-DPEPARSE_USE_SANITIZER=Address" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
|
||||||
|
- uses: ilammy/msvc-dev-cmd@v1.8.0
|
||||||
|
with:
|
||||||
|
arch: ${{ matrix.build-arch }}
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
@ -119,6 +126,7 @@ jobs:
|
|||||||
-A ${{ matrix.build-arch }} `
|
-A ${{ matrix.build-arch }} `
|
||||||
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} `
|
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} `
|
||||||
-DPEPARSE_ENABLE_TESTING=ON `
|
-DPEPARSE_ENABLE_TESTING=ON `
|
||||||
|
$Env:SANITIZER_FLAG `
|
||||||
..
|
..
|
||||||
cmake --build . --config ${{ matrix.build-type }}
|
cmake --build . --config ${{ matrix.build-type }}
|
||||||
- name: install
|
- name: install
|
||||||
|
@ -28,8 +28,14 @@ add_executable(tests
|
|||||||
filesystem_compat.h
|
filesystem_compat.h
|
||||||
)
|
)
|
||||||
target_compile_definitions(tests PRIVATE ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
target_compile_definitions(tests PRIVATE ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
||||||
target_link_libraries(tests PRIVATE std::filesystem ${PROJECT_NAME} Catch2::Catch2)
|
|
||||||
target_include_directories(tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
target_link_libraries(tests PRIVATE std::filesystem ${PROJECT_NAME} Catch2::Catch2)
|
||||||
|
# ASAN on Windows messes with exception handlers, and Catch2 doesn't account
|
||||||
|
# for this. A workaround is to disable SEH on Windows with ASAN
|
||||||
|
# https://github.com/catchorg/Catch2/issues/898#issuecomment-841733322
|
||||||
|
if (WIN32 AND PEPARSE_USE_SANITIZER STREQUAL "Address")
|
||||||
|
target_compile_definitions(tests PUBLIC CATCH_CONFIG_NO_WINDOWS_SEH)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (EXISTS "${CORKAMI_PE_PATH}")
|
if (EXISTS "${CORKAMI_PE_PATH}")
|
||||||
target_compile_definitions(tests PRIVATE CORKAMI_PE_PATH="${CORKAMI_PE_PATH}")
|
target_compile_definitions(tests PRIVATE CORKAMI_PE_PATH="${CORKAMI_PE_PATH}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user