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

Disable leak sanitizer #132

Merged
merged 3 commits into from
Nov 19, 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
12 changes: 9 additions & 3 deletions diopter/sanitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class Sanitizer:
optimization level used when checking for warnings
sanitizer_opt_level (OptLevel):
optimization level used when running sanitizers
sanitizer_env_variables (dict[str, str]):
environment variables for sanitizers
use_gnu2x (bool):
if True then gnu2x will be used when checking for compiler warnings
compilation_timeout (int):
Expand Down Expand Up @@ -164,6 +166,9 @@ def __init__(
ccomp: CComp | None = None,
check_warnings_opt_level: OptLevel = OptLevel.O3,
sanitizer_opt_level: OptLevel = OptLevel.O0,
sanitizer_env_variables: dict[str, str] = {
"ASAN_OPTIONS": "detect_stack_use_after_return=1"
},
checked_warnings: tuple[str, ...] | None = None,
use_gnu2x_if_available: bool = True,
compilation_timeout: int = 8,
Expand Down Expand Up @@ -197,6 +202,8 @@ def __init__(
sanitizer_opt_level (OptLevel):
which optimization level to use when checking
for ub/address sanitizer issues
sanitizer_env_variables (dict[str,str]):
environment variables to use when running sanitizers
checked_warnings (tuple[str,...] | None):
if not None implies check_warnings = True and will
be used instead of Sanitizer.default_warnings
Expand Down Expand Up @@ -226,6 +233,7 @@ def __init__(
self.use_memory_sanitizer = use_memory_sanitizer
self.check_warnings_opt_level = check_warnings_opt_level
self.sanitizer_opt_level = sanitizer_opt_level
self.sanitizer_env_variables = sanitizer_env_variables
self.compilation_timeout = compilation_timeout
self.execution_timeout = execution_timeout
self.ccomp_timeout = ccomp_timeout
Expand Down Expand Up @@ -363,9 +371,7 @@ def check_for_sanitizer_errors(
run_cmd(
str(result.output.filename),
timeout=self.execution_timeout,
additional_env={
"ASAN_OPTIONS": "detect_stack_use_after_return=1",
},
additional_env=self.sanitizer_env_variables,
)
except subprocess.TimeoutExpired:
if self.debug:
Expand Down
Loading