Skip to content

chore: run tests with ASAN in CI - #360

Open
cartercanedy wants to merge 4 commits into
HMIProject:mainfrom
cartercanedy:cc/asan
Open

cartercanedy wants to merge 4 commits into
HMIProject:mainfrom
cartercanedy:cc/asan

Conversation

@cartercanedy

@cartercanedy cartercanedy commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #358

Summary

  • create a new justfile recipe that runs tests with ASAN enabled
  • add a concurrent CI job that runs ASAN as a required CI step
  • pins the MacOS LLVM toolchain instance to the homebrew installation
    • prevents runtime ASAN symbol version mismatches, since the symbols from apple's 1st-party llvm distribution don't match the rust-bundled version.

NOTE: stacked on top of #356, needs to be rebased before merge

@uklotzde

Copy link
Copy Markdown
Collaborator

Stacked PRs might not work (yet) with forked repositories. Marking this as Draft until #356 has been merged.

@uklotzde uklotzde added this to the v0.12.1 milestone Oct 17, 2026
@cartercanedy
cartercanedy force-pushed the cc/asan branch 2 times, most recently from a6c712d to f7095e4 Compare October 20, 2026 12:10
@cartercanedy
cartercanedy force-pushed the cc/asan branch 2 times, most recently from 390a82f to 72ddf19 Compare October 21, 2026 21:03
@uklotzde

Copy link
Copy Markdown
Collaborator

I tried to merge main. But there are still differences. Please rebase.

@uklotzde
uklotzde marked this pull request as ready for review October 22, 2026 08:02
@uklotzde
uklotzde requested a review from sgoll October 22, 2026 08:06
@uklotzde

uklotzde commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

A first local test on Linux/Fedora failed.

  CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
    The C compiler

      "/usr/lib64/ccache/cc"

    is not able to compile a simple test program.

    It fails with the following output:

      Change Dir: '/home/uk/github/rust/open62541/target/x86_64-unknown-linux-gnu/debug/build/open62541-sys/ca4d013612b2c8ad/out/build/CMakeFiles/CMakeScratch/TryCompile-t6h3Bk'
      
      Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_dbe94/fast
      /usr/bin/gmake  -f CMakeFiles/cmTC_dbe94.dir/build.make CMakeFiles/cmTC_dbe94.dir/build
      gmake[1]: Entering directory '/run/media/uk/Build/cargo/open62541/target/x86_64-unknown-linux-gnu/debug/build/open62541-sys/ca4d013612b2c8ad/out/build/CMakeFiles/CMakeScratch/TryCompile-t6h3Bk'
      Building C object CMakeFiles/cmTC_dbe94.dir/testCCompiler.c.o
      /usr/lib64/ccache/cc   -fsanitize=address -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fPIC -m64 -fsanitize=address -w  -o CMakeFiles/cmTC_dbe94.dir/testCCompiler.c.o -c /home/uk/github/rust/open62541/target/x86_64-unknown-linux-gnu/debug/build/open62541-sys/ca4d013612b2c8ad/out/build/CMakeFiles/CMakeScratch/TryCompile-t6h3Bk/testCCompiler.c
      Linking C executable cmTC_dbe94
      /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_dbe94.dir/link.txt --verbose=1
      /usr/bin/ld.bfd: cannot find /usr/lib64/libasan.so.8.0.0: No such file or directory
      collect2: error: ld returned 1 exit status
      /usr/lib64/ccache/cc  -fsanitize=address -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fPIC -m64 -fsanitize=address -w  CMakeFiles/cmTC_dbe94.dir/testCCompiler.c.o -o cmTC_dbe94
      gmake[1]: *** [CMakeFiles/cmTC_dbe94.dir/build.make:102: cmTC_dbe94] Error 1
      gmake[1]: Leaving directory '/run/media/uk/Build/cargo/open62541/target/x86_64-unknown-linux-gnu/debug/build/open62541-sys/ca4d013612b2c8ad/out/build/CMakeFiles/CMakeScratch/TryCompile-t6h3Bk'
      gmake: *** [Makefile:134: cmTC_dbe94/fast] Error 2

Update: Probably, because cc points to gcc.

@uklotzde
uklotzde marked this pull request as draft October 22, 2026 08:12
@uklotzde uklotzde modified the milestones: v0.12.1, v0.12.2 Oct 22, 2026
@uklotzde

uklotzde commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

@uklotzde
uklotzde marked this pull request as ready for review October 22, 2026 08:38
@uklotzde
uklotzde requested a lite review from Copilot October 22, 2026 08:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The ASAN CI matrix can test an unintended target, and unpinned LLVM/nightly versions can cause required-job failures.

1 open issue
What changed in this PR

Adds AddressSanitizer test coverage for Rust tests and integrates native Linux/macOS ASAN jobs into CI.

Changes:

  • Adds nightly ASAN test recipes with leak detection.
  • Adds Linux and macOS ASAN CI matrix jobs.
  • Updates the array ownership test to transfer raw allocation ownership safely.
File Description Review findings
src/​ua/​array.rs Updates the raw-array test to use move-based ownership transfer. No unresolved findings.
.justfile Defines reusable nightly ASAN test and command recipes. No unresolved findings.
.github/​workflows/​test.yaml Adds Linux/macOS ASAN jobs and macOS LLVM configuration. The matrix target is not enforced by the test recipe; the LLVM/nightly pairing is not pinned or verified; and required-check configuration may still need repository-level updates.

Review effort: Lite

steps:
- name: Install Rust toolchain
# Sanitizers are only available on nightly Rust.
uses: dtolnay/rust-toolchain@nightly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run ASAN in CI

3 participants