Skip to content

Commit

Permalink
Sanitizer: add address check by disabling memory limit (RagnarGrootKo…
Browse files Browse the repository at this point in the history
…erkamp#365)

* add sanitizer flag

* add sanitizer flag

* --sanitizer disables memory limit
  • Loading branch information
mzuenni committed Mar 27, 2024
1 parent 0d32eb9 commit 9e2a377
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

SANITIZER_FLAGS = '''
cpp:
compile: -fsanitize=undefined
compile: -fsanitize=undefined,address
'''

# The cached languages.yaml for the current contest.
Expand Down
2 changes: 1 addition & 1 deletion bin/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ def build_parser():
runparser.add_argument(
'--sanitizer',
action='store_true',
help='Run submissions with additional sanitizer flags (currently only C++).',
help='Run submissions with additional sanitizer flags (currently only c++). Note that this sets --memory unlimited.',
)

# Test
Expand Down
4 changes: 3 additions & 1 deletion bin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,9 @@ def tail(string, limit):
# Return memory limit in MB.
def get_memory_limit(kwargs=None):
memory_limit = 2048 # 2GB
if config.args.memory:
if config.args.sanitizer:
memory_limit = None # disabled
elif config.args.memory:
if config.args.memory != 'unlimited':
memory_limit = int(config.args.memory)
else:
Expand Down
2 changes: 1 addition & 1 deletion doc/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Use `bt run -v` to show results for all testcases.
- `--table`: Print a table of which testcases were solved by which submissions. May be used to deduplicate testcases that fail the same solutions.
- `--overview`/`-o`: Print a live overview of the received verdicts for all submissions and testcases. If combined with `--no-bar` only the final table is printed.
- `--no-testcase-sanity-checks`: when passed, all sanity checks on the testcases are skipped. You might want to set this in `.bapctools.yaml`.
- `--sanitizer`: when passed, run submissions with additional sanitizer flags (currently only C++).
- `--sanitizer`: when passed, run submissions with additional sanitizer flags (currently only c++). Note that this sets --memory unlimited.

## `test`

Expand Down

0 comments on commit 9e2a377

Please sign in to comment.