Skip to content

Commit 4ed0631

Browse files
authored
chore(c): Add UBSAN / ASAN to Meson CI job (#523)
Figured this is a pretty easy addition, and might help catch more mistakes up front if this becomes a standard CI job
1 parent 9c4aba3 commit 4ed0631

File tree

3 files changed

+43
-7
lines changed

3 files changed

+43
-7
lines changed

ci/scripts/build-with-meson.sh

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,52 @@ function main() {
6565

6666
pushd "${SANDBOX_DIR}"
6767

68-
show_header "Run test suite"
69-
meson configure -Dtests=true -Db_coverage=true -Dipc=true
68+
show_header "Run ASAN/UBSAN test suite"
69+
meson configure \
70+
-Dbuildtype=debugoptimized \
71+
-Db_sanitize="address,undefined" \
72+
-Dtests=true \
73+
-Dipc=true \
74+
-Dbenchmarks=false \
75+
-Db_coverage=false
7076
meson compile
71-
meson test --wrap='valgrind --track-origins=yes --leak-check=full' --print-errorlogs
77+
export ASAN_OPTIONS=allocator_may_return_null=1 # allow ENOMEM tests
78+
meson test --print-errorlogs
79+
80+
show_header "Run valgrind test suite"
81+
meson configure \
82+
-Dbuildtype=debugoptimized \
83+
-Db_sanitize=none \
84+
-Dtests=true \
85+
-Dipc=true \
86+
-Dbenchmarks=false \
87+
-Db_coverage=false
88+
meson compile
89+
meson test --wrap='valgrind --track-origins=yes --leak-check=full' --print-errorlog
7290

7391
show_header "Run benchmarks"
74-
meson configure -Dbenchmarks=true
92+
meson configure \
93+
-Dbuildtype=release \
94+
-Db_sanitize=none \
95+
-Dtests=false \
96+
-Dipc=true \
97+
-Dbenchmarks=true \
98+
-Db_coverage=false
7599
meson compile
76100
meson test --benchmark --print-errorlogs
77101

102+
show_header "Run coverage test suite"
103+
meson configure \
104+
-Dbuildtype=release \
105+
-Db_sanitize=none \
106+
-Dtests=true \
107+
-Dipc=true \
108+
-Dbenchmarks=false \
109+
-Db_coverage=true
110+
111+
meson compile
112+
meson test --print-errorlogs
113+
78114
show_header "Generate coverage reports"
79115
ninja coverage
80116
lcov --list meson-logs/coverage.info

src/nanoarrow/nanoarrow_ipc_decoder_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ TEST(NanoarrowIpcTest, NanoarrowIpcVerifyInvalid) {
252252

253253
memcpy(simple_schema_invalid, kSimpleSchema, i);
254254
memcpy(simple_schema_invalid + i, kSimpleSchema + (i + 1),
255-
(sizeof(simple_schema_invalid) - i));
255+
(sizeof(simple_schema_invalid) - i - 1));
256256

257257
ArrowErrorInit(&error);
258258
ASSERT_NE(ArrowIpcDecoderVerifyHeader(&decoder, data, &error), NANOARROW_OK);

src/nanoarrow/nanoarrow_ipc_reader_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ TEST(NanoarrowIpcTest, StreamReaderInvalidBuffer) {
360360

361361
memcpy(simple_stream_invalid, kSimpleSchema, i);
362362
memcpy(simple_stream_invalid + i, kSimpleSchema + (i + 1),
363-
(sizeof(kSimpleSchema) - i));
363+
(sizeof(kSimpleSchema) - i - 1));
364364

365365
ArrowBufferInit(&input_buffer);
366366
ASSERT_EQ(ArrowBufferAppendBufferView(&input_buffer, data), NANOARROW_OK);
@@ -382,7 +382,7 @@ TEST(NanoarrowIpcTest, StreamReaderInvalidBuffer) {
382382

383383
memcpy(simple_stream_invalid + sizeof(kSimpleSchema), kSimpleRecordBatch, i);
384384
memcpy(simple_stream_invalid + sizeof(kSimpleSchema) + i,
385-
kSimpleRecordBatch + (i + 1), (sizeof(kSimpleRecordBatch) - i));
385+
kSimpleRecordBatch + (i + 1), (sizeof(kSimpleRecordBatch) - i - 1));
386386

387387
ArrowBufferInit(&input_buffer);
388388
ASSERT_EQ(ArrowBufferAppendBufferView(&input_buffer, data), NANOARROW_OK);

0 commit comments

Comments
 (0)