Skip to content

Commit fe94dd4

Browse files
committed
test: run the full suite in the sanitizer runner
The sanitizer script only ran three files. A clean run then missed connection, query, and cancellation paths that also enter the NIF. With no arguments, the script now runs the full `test/` suite and includes `:sanitizer` and `:slow_test`. The `c-sanitizers` job calls that script with no arguments, so CI uses the same default.
1 parent 895a37b commit fe94dd4

4 files changed

Lines changed: 10 additions & 12 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,5 @@ jobs:
113113
elixir-version: "1.20"
114114
- run: sudo apt-get update && sudo apt-get install -y clang libclang-rt-dev llvm
115115
- run: mix deps.get
116+
# No arguments: the script runs the full test/ suite.
116117
- run: sh scripts/test-c-sanitizers.sh

‎AGENTS.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ test/
172172
├── pragma_test.exs # PRAGMA helper tests
173173
├── stream_test.exs # Stream protocol tests
174174
├── sanitizer_test.exs # Busy-handler tests excluded unless --include sanitizer
175-
├── sqlite3_nif_test.exs # NIF lifecycle tests (also run under ASan/UBSan)
175+
├── sqlite3_nif_test.exs # NIF lifecycle tests
176176
├── cancellation_test.exs # Query cancellation tests
177177
└── timeout_segfault_test.exs # Timeout edge cases
178178
```
@@ -189,7 +189,8 @@ EXQLITE_INTEGRATION=1 mix test
189189
# Specific test file
190190
mix test test/exqlite/connection_test.exs
191191
192-
# Linux ASan/UBSan. See C_TESTING.md.
192+
# Linux ASan/UBSan. Full test/ suite, including :sanitizer and :slow_test.
193+
# See C_TESTING.md.
193194
sh scripts/test-c-sanitizers.sh
194195
195196
# Verbose output

‎C_TESTING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ The runner:
3333
- Uses LLVM's symbolizer for source locations.
3434
- Passes `+Mea min` to BEAM so its optional pooling allocators stay off. More allocations then go through the system allocator that ASan tracks.
3535
- Disables Exqlite's SQLite Erlang allocator (`EXQLITE_DISABLE_ERLANG_ALLOCATOR=true`) for the same reason.
36-
- Runs the NIF lifecycle tests, the low-level SQLite3 tests, and the busy-handler tests tagged `:sanitizer`. Normal `mix test` skips that tag.
36+
- Runs the full `test/` suite. `test/test_helper.exs` excludes `:sanitizer` and `:slow_test`; this runner includes both. It does not run the integration suite.
3737

38-
Pass Mix test arguments to select different tests:
38+
Pass Mix test arguments to select a subset. Those arguments replace the default includes, so add `--include sanitizer` or `--include slow_test` when the subset needs that tag:
3939

4040
```sh
4141
sh scripts/test-c-sanitizers.sh test/exqlite/sqlite3_nif_test.exs --seed 0

‎scripts/test-c-sanitizers.sh‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Linux only. The build goes to _build/c-sanitizers. This script does not
77
# replace the NIF in the normal Mix tree. Do not ship the sanitizer build.
88
#
9-
# With no arguments, this runs sqlite3_nif_test.exs, sqlite3_test.exs, and
10-
# the tests tagged :sanitizer. mix test skips that tag unless you pass
11-
# --include sanitizer.
9+
# With no arguments, this runs the full test/ suite. test/test_helper.exs
10+
# excludes :sanitizer and :slow_test. This script includes both. Arguments
11+
# replace that default, so a subset that needs those tags must include them.
1212
set -eu
1313

1414
cd "$(dirname "$0")/.."
@@ -56,11 +56,7 @@ export ASAN_OPTIONS="${ASAN_OPTIONS:-detect_leaks=0}:halt_on_error=1"
5656
export UBSAN_OPTIONS="${UBSAN_OPTIONS:-}:halt_on_error=1:print_stacktrace=1"
5757

5858
if [ "$#" -eq 0 ]; then
59-
set -- \
60-
test/exqlite/sqlite3_nif_test.exs \
61-
test/exqlite/sqlite3_test.exs \
62-
test/exqlite/sanitizer_test.exs \
63-
--include sanitizer
59+
set -- --include sanitizer --include slow_test
6460
fi
6561
mix compile --warnings-as-errors
6662
# mix may be a shell shim. elixir -S mix compiles that shim and fails.

0 commit comments

Comments
 (0)