Skip to content

Commit 9f84c85

Browse files
committed
Tweak CI settings for asan to see what sticks
1 parent 09b220c commit 9f84c85

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

.github/workflows/ports_unix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ jobs:
274274
- name: Run main test suite
275275
run: source tools/ci.sh && ci_unix_sanitize_address_run_tests
276276
- name: Test merging .mpy files
277-
run: source tools/ci.sh && ci_unix_coverage_run_mpy_merge_tests
277+
run: source tools/ci.sh && ci_unix_sanitize_address_run_mpy_merge_tests
278278
- name: Build native mpy modules
279279
run: source tools/ci.sh && ci_native_mpy_modules_build
280280
- name: Test importing .mpy generated by mpy_ld.py
281-
run: source tools/ci.sh && ci_unix_coverage_run_native_mpy_tests
281+
run: source tools/ci.sh && ci_unix_sanitize_address_run_native_mpy_tests
282282
- name: Print failures
283283
if: failure()
284284
run: tests/run-tests.py --print-failures

tools/ci.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,14 +514,16 @@ CI_UNIX_OPTS_QEMU_RISCV64=(
514514

515515
CI_UNIX_OPTS_SANITIZE_ADDRESS=(
516516
VARIANT=coverage
517-
CFLAGS_EXTRA="-fsanitize=address"
517+
CFLAGS_EXTRA="-DMICROPY_ASAN -fsanitize=address -g"
518518
LDFLAGS_EXTRA="-fsanitize=address"
519+
STRIP=:
519520
)
520521

521522
CI_UNIX_OPTS_SANITIZE_UNDEFINED=(
522523
VARIANT=coverage
523-
CFLAGS_EXTRA="-fsanitize=undefined -fno-sanitize=nonnull-attribute"
524-
LDFLAGS_EXTRA="-fsanitize=undefined -fno-sanitize=nonnull-attribute"
524+
CFLAGS_EXTRA="-fsanitize=undefined -fno-sanitize=nonnull-attribute -g"
525+
LDFLAGS_EXTRA="--fsanitize=undefined -fno-sanitize=nonnull-attribute"
526+
STRIP=:
525527
)
526528

527529
function ci_unix_build_helper {
@@ -773,12 +775,20 @@ function ci_unix_sanitize_address_build {
773775
}
774776

775777
function ci_unix_sanitize_address_run_tests {
776-
# Detect_stack_use_after_return causes failures because
777-
# micropython's assumptions about stack usage are not met.
778+
# The address sanitizer's "detect_stack_use_after_return" mode causes
779+
# failures because micropython's assumptions about stack usage are not met.
778780
# The specific reasons why are not known.
779781
ASAN_OPTIONS=detect_stack_use_after_return=0 ci_unix_run_tests_full_helper coverage "${CI_UNIX_OPTS_SANITIZE_ADDRESS[@]}"
780782
}
781783

784+
function ci_unix_sanitize_address_run_mpy_merge_tests {
785+
ASAN_OPTIONS=detect_stack_use_after_return=0 ci_unix_coverage_run_mpy_merge_tests
786+
}
787+
788+
function ci_unix_sanitize_address_run_native_mpy_tests {
789+
ASAN_OPTIONS=detect_stack_use_after_return=0 ci_unix_coverage_run_mpy_native_mpy_tests
790+
}
791+
782792
function ci_unix_macos_build {
783793
make ${MAKEOPTS} -C mpy-cross
784794
make ${MAKEOPTS} -C ports/unix submodules

0 commit comments

Comments
 (0)