Add option to enable sanitization in python module

this is off by default, since it requires juggling some platform-specific environment variables
This commit is contained in:
2022-07-01 19:30:21 -07:00
parent 0bd0c6846f
commit 768248c20d
2 changed files with 12 additions and 1 deletions

View File

@ -64,7 +64,7 @@ package-dir = { '' = '.' } # without this line, C++ source files get included in
[tool.cibuildwheel]
build = "cp*" # only build wheels for cpython.
build-frontend = "build"
test-command = "pytest {project}/tests --verbose"
test-command = "pytest --verbose"
test-extras = ["tests"]
test-skip = "*-macosx_arm64 *-macosx_universal2:arm64" # skip testing on arm macOS because CIBW doesnt support it
environment = { QUICKTEX_SIMD_MODE = "SSE4" } # SSE4 has a 99% market share and was released under the Bush administration
@ -85,3 +85,8 @@ manylinux-aarch64-image = "manylinux2014"
line-length = 120 # 80-column is stupid
target-version = ['py37', 'py38', 'py39', 'py310']
skip-string-normalization = true
[tool.pytest.ini_options]
minversion = "7.0"
addopts = ["--full-trace", "--capture=tee-sys"]
testpaths = ["tests"]

View File

@ -62,4 +62,10 @@ if (NOT QUICKTEX_NOPYTHON)
# Link python module with implementation
target_link_libraries(_quicktex PUBLIC quicktex)
if ((NOT MSVC) AND (CMAKE_BUILD_TYPE MATCHES Debug) AND ($ENV{QUICKTEX_SANITIZE}))
target_compile_options(_quicktex PUBLIC -fsanitize=address,undefined -fno-sanitize-recover=address,undefined -fno-omit-frame-pointer)
target_link_options(_quicktex PUBLIC -fsanitize=address,undefined -fno-sanitize-recover=address,undefined -fno-omit-frame-pointer)
endif ()
endif ()