@@ -379,51 +379,138 @@ 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+ - sanitizer : asan
451+ sanitizer_flags : " -Zsanitizer=address -Zsanitize=leak"
452+ - sanitizer : msan
453+ sanitizer_flags : " -Zsanitizer=memory"
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 clang
481+ if : matrix.sanitizer == 'msan'
482+ run : |
483+ sudo apt-get update && sudo apt-get install -y clang
484+ sudo update-alternatives --set c++ /usr/bin/clang++
485+ sudo update-alternatives --set cc /usr/bin/clang
486+ - name : Install rustfilt
487+ run : |
488+ cargo install rustfilt
489+ - name : Install Rust nightly toolchain
490+ run : |
491+ rustup toolchain install $NIGHTLY_TOOLCHAIN
492+ rustup component add --toolchain $NIGHTLY_TOOLCHAIN rust-src rustfmt clippy llvm-tools-preview
493+
494+ # Export flags here so that rustfilt won't be built with sanitizers
495+ export RUSTFLAGS="-A warnings -Cunsafe-allow-abi-mismatch=sanitizer \
496+ --cfg disable_loom --cfg vortex_nightly -C debuginfo=2 \
497+ -C opt-level=0 -C strip=none -Zexternal-clangrt \
498+ ${{ matrix.sanitizer_flags }}"
499+ - name : Build FFI library
500+ run : |
501+ # TODO(myrrc): remove --no-default-features
502+ cargo +$NIGHTLY_TOOLCHAIN build --locked --no-default-features \
503+ --target x86_64-unknown-linux-gnu -Zbuild-std \
504+ -p vortex-ffi
505+ - name : Build FFI library tests
506+ run : |
507+ cd vortex-ffi
508+ cmake -Bbuild -DBUILD_TESTS=1 -DSANITIZER=${{ matrix.sanitizer }} -DTARGET_TRIPLE="x86_64-unknown-linux-gnu"
509+ cmake --build build -j
510+ - name : Run tests
511+ run : |
512+ set -o pipefail
513+ ./vortex-ffi/build/test/vortex_ffi_test 2>&1 | rustfilt -i-
427514
428515 cuda-build-lint :
429516 if : github.repository == 'vortex-data/vortex'
0 commit comments