@@ -379,51 +379,132 @@ jobs:
379379 flags : ${{ matrix.suite }}
380380 use_oidc : true
381381
382- rust-test :
383- name : " Rust tests (sanitizer)"
384- timeout-minutes : 40
382+ rust-test-sanitizer :
383+ strategy :
384+ fail-fast : false
385+ matrix :
386+ include :
387+ - sanitizer : asan
388+ sanitizer_flags : " -Zsanitizer=address -Zsanitize=leak"
389+ - sanitizer : msan
390+ sanitizer_flags : " -Zsanitizer=memory"
391+ - sanitizer : tsan
392+ sanitizer_flags : " -Zsanitizer=thread"
393+ name : " Rust tests (${{ matrix.sanitizer }})"
385394 runs-on : >-
386395 ${{ github.repository == 'vortex-data/vortex'
387396 && format('runs-on={0}/runner=amd64-medium/image=ubuntu24-full-x64-pre-v2/tag=rust-test-sanitizer', github.run_id)
388397 || 'ubuntu-latest' }}
398+ timeout-minutes : 40
389399 env :
390- # Add debug symbols and enable ASAN/LSAN with better output
391- ASAN_OPTIONS : " symbolize=1:print_stats=1:check_initialization_order=1:detect_leaks=1:halt_on_error=0:verbosity=1:leak_check_at_exit=1"
392- LSAN_OPTIONS : " verbosity=1:report_objects=1"
400+ ASAN_OPTIONS : " symbolize=1:check_initialization_order=1:detect_leaks=1:leak_check_at_exit=1"
401+ LSAN_OPTIONS : " report_objects=1"
393402 ASAN_SYMBOLIZER_PATH : " /usr/bin/llvm-symbolizer"
394- # Link against DuckDB debug build
395- VX_DUCKDB_DEBUG : " 1"
396- # Keep frame pointers for better stack traces
397- CARGO_PROFILE_DEV_DEBUG : " true"
398- CARGO_PROFILE_TEST_DEBUG : " true"
399- # Skip slow tests that are too expensive under sanitizer
403+ MSAN_OPTIONS : " symbolize=1"
404+ MSAN_SYMBOLIZER_PATH : " /usr/bin/llvm-symbolizer"
405+ TSAN_OPTIONS : " symbolize=1"
406+ TSAN_SYMBOLIZER_PATH : " /usr/bin/llvm-symbolizer"
400407 VORTEX_SKIP_SLOW_TESTS : " 1"
408+ # -Cunsafe-allow-abi-mismatch=sanitizer: libraries like compiler_builtins
409+ # unset -Zsanitizer flag and we should allow that.
410+ RUSTFLAGS : " -A warnings -Cunsafe-allow-abi-mismatch=sanitizer --cfg disable_loom --cfg vortex_nightly -C debuginfo=2 -C opt-level=0 -C strip=none"
401411 steps :
402412 - uses : runs-on/action@v2
403413 if : github.repository == 'vortex-data/vortex'
404414 with :
405415 sccache : s3
406416 - uses : actions/checkout@v6
407417 - uses : ./.github/actions/setup-prebuild
408- - name : Install nightly for sanitizer
418+ - name : Install Rust nightly toolchain
409419 run : |
410420 rustup toolchain install $NIGHTLY_TOOLCHAIN
411421 rustup component add --toolchain $NIGHTLY_TOOLCHAIN rust-src rustfmt clippy llvm-tools-preview
412- - name : Rust Tests
413- env :
414- RUSTFLAGS : " -A warnings -Zsanitizer=address -Zsanitizer=leak --cfg disable_loom --cfg vortex_nightly -C debuginfo=2 -C opt-level=0 -C strip=none"
422+ export RUSTFLAGS="${RUSTFLAGS} ${{ matrix.sanitizer_flags }}"
423+ - name : Build tests with sanitizer
415424 run : |
416- # Build with full debug info first (helps with caching)
417- cargo +$NIGHTLY_TOOLCHAIN build --locked --all-features \
418- --target x86_64-unknown-linux-gnu \
419- -p vortex-buffer -p vortex-ffi -p vortex-fastlanes -p vortex-fsst -p vortex-alp -p vortex-array
420- # Run tests with sanitizers and debug output
421- cargo +$NIGHTLY_TOOLCHAIN nextest run \
422- --locked \
423- --all-features \
424- --no-fail-fast \
425- --target x86_64-unknown-linux-gnu \
426- -p vortex-buffer -p vortex-ffi -p vortex-fastlanes -p vortex-fsst -p vortex-alp -p vortex-array
425+ cargo +$NIGHTLY_TOOLCHAIN build --locked --all-features \
426+ --target x86_64-unknown-linux-gnu -Zbuild-std \
427+ -p vortex-buffer -p vortex-fastlanes -p vortex-fsst -p vortex-alp -p vortex-array
428+
429+ - name : Run tests with sanitizer
430+ run : |
431+ cargo +$NIGHTLY_TOOLCHAIN nextest run --locked --all-features \
432+ --target x86_64-unknown-linux-gnu --no-fail-fast -Zbuild-std \
433+ -p vortex-buffer -p vortex-fastlanes -p vortex-fsst -p vortex-alp -p vortex-array
434+
435+ # vortex-ffi requires --no-default-features as otherwise we pull in
436+ # Mimalloc which interferes with sanitizers
437+ # cargo nextest reports less sanitizer issues than cargo test
438+ # TODO(myrrc): remove --no-default-features once we make Mimalloc opt-in
439+ - name : Run vortex-ffi tests with sanitizer
440+ run : |
441+ cargo +$NIGHTLY_TOOLCHAIN test --locked --no-default-features \
442+ --target x86_64-unknown-linux-gnu --no-fail-fast -Zbuild-std \
443+ -p vortex-ffi -- --no-capture
444+
445+ rust-ffi-test-sanitizer :
446+ strategy :
447+ fail-fast : false
448+ matrix :
449+ include :
450+ # We don't run memory sanitizer as it's clang-only and provides many
451+ # false positives for Catch2
452+ - sanitizer : asan
453+ sanitizer_flags : " -Zsanitizer=address -Zsanitize=leak"
454+ - sanitizer : tsan
455+ sanitizer_flags : " -Zsanitizer=thread"
456+ name : " Rust/C++ FFI tests (${{ matrix.sanitizer }})"
457+ timeout-minutes : 40
458+ env :
459+ ASAN_OPTIONS : " symbolize=1:check_initialization_order=1:detect_leaks=1:leak_check_at_exit=1"
460+ LSAN_OPTIONS : " report_objects=1"
461+ ASAN_SYMBOLIZER_PATH : " /usr/bin/llvm-symbolizer"
462+ MSAN_OPTIONS : " symbolize=1"
463+ MSAN_SYMBOLIZER_PATH : " /usr/bin/llvm-symbolizer"
464+ TSAN_OPTIONS : " symbolize=1"
465+ TSAN_SYMBOLIZER_PATH : " /usr/bin/llvm-symbolizer"
466+ VORTEX_SKIP_SLOW_TESTS : " 1"
467+ # -Cunsafe-allow-abi-mismatch=sanitizer: libraries like compiler_builtins
468+ # unset -Zsanitizer flag and we should allow that.
469+ runs-on : >-
470+ ${{ github.repository == 'vortex-data/vortex'
471+ && format('runs-on={0}/runner=amd64-medium/image=ubuntu24-full-x64-pre-v2/tag=rust-ffi-test-sanitizer', github.run_id)
472+ || 'ubuntu-latest' }}
473+ steps :
474+ - uses : runs-on/action@v2
475+ if : github.repository == 'vortex-data/vortex'
476+ with :
477+ sccache : s3
478+ - uses : actions/checkout@v6
479+ - uses : ./.github/actions/setup-prebuild
480+ - name : Install rustfilt
481+ run : |
482+ cargo install rustfilt
483+ - name : Install Rust nightly toolchain
484+ run : |
485+ rustup toolchain install $NIGHTLY_TOOLCHAIN
486+ rustup component add --toolchain $NIGHTLY_TOOLCHAIN rust-src rustfmt clippy llvm-tools-preview
487+
488+ # Export flags here so that rustfilt won't be built with sanitizers
489+ export RUSTFLAGS="-A warnings -Cunsafe-allow-abi-mismatch=sanitizer \
490+ --cfg disable_loom --cfg vortex_nightly -C debuginfo=2 \
491+ -C opt-level=0 -C strip=none -Zexternal-clangrt \
492+ ${{ matrix.sanitizer_flags }}"
493+ - name : Build FFI library
494+ run : |
495+ # TODO(myrrc): remove --no-default-features
496+ cargo +$NIGHTLY_TOOLCHAIN build --locked --no-default-features \
497+ --target x86_64-unknown-linux-gnu -Zbuild-std \
498+ -p vortex-ffi
499+ - name : Build FFI library tests
500+ run : |
501+ cd vortex-ffi
502+ cmake -Bbuild -DBUILD_TESTS=1 -DSANITIZER=${{ matrix.sanitizer }} -DTARGET_TRIPLE="x86_64-unknown-linux-gnu"
503+ cmake --build build -j
504+ - name : Run tests
505+ run : |
506+ set -o pipefail
507+ ./vortex-ffi/build/test/vortex_ffi_test 2>&1 | rustfilt -i-
427508
428509 cuda-build-lint :
429510 if : github.repository == 'vortex-data/vortex'
0 commit comments