Skip to content

Commit

Permalink
chore(c): Add UBSAN / ASAN to Meson CI job (#523)
Browse files Browse the repository at this point in the history
Figured this is a pretty easy addition, and might help catch more
mistakes up front if this becomes a standard CI job
  • Loading branch information
WillAyd authored Jun 13, 2024
1 parent 9c4aba3 commit 4ed0631
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
44 changes: 40 additions & 4 deletions ci/scripts/build-with-meson.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,52 @@ function main() {

pushd "${SANDBOX_DIR}"

show_header "Run test suite"
meson configure -Dtests=true -Db_coverage=true -Dipc=true
show_header "Run ASAN/UBSAN test suite"
meson configure \
-Dbuildtype=debugoptimized \
-Db_sanitize="address,undefined" \
-Dtests=true \
-Dipc=true \
-Dbenchmarks=false \
-Db_coverage=false
meson compile
meson test --wrap='valgrind --track-origins=yes --leak-check=full' --print-errorlogs
export ASAN_OPTIONS=allocator_may_return_null=1 # allow ENOMEM tests
meson test --print-errorlogs

show_header "Run valgrind test suite"
meson configure \
-Dbuildtype=debugoptimized \
-Db_sanitize=none \
-Dtests=true \
-Dipc=true \
-Dbenchmarks=false \
-Db_coverage=false
meson compile
meson test --wrap='valgrind --track-origins=yes --leak-check=full' --print-errorlog

show_header "Run benchmarks"
meson configure -Dbenchmarks=true
meson configure \
-Dbuildtype=release \
-Db_sanitize=none \
-Dtests=false \
-Dipc=true \
-Dbenchmarks=true \
-Db_coverage=false
meson compile
meson test --benchmark --print-errorlogs

show_header "Run coverage test suite"
meson configure \
-Dbuildtype=release \
-Db_sanitize=none \
-Dtests=true \
-Dipc=true \
-Dbenchmarks=false \
-Db_coverage=true

meson compile
meson test --print-errorlogs

show_header "Generate coverage reports"
ninja coverage
lcov --list meson-logs/coverage.info
Expand Down
2 changes: 1 addition & 1 deletion src/nanoarrow/nanoarrow_ipc_decoder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ TEST(NanoarrowIpcTest, NanoarrowIpcVerifyInvalid) {

memcpy(simple_schema_invalid, kSimpleSchema, i);
memcpy(simple_schema_invalid + i, kSimpleSchema + (i + 1),
(sizeof(simple_schema_invalid) - i));
(sizeof(simple_schema_invalid) - i - 1));

ArrowErrorInit(&error);
ASSERT_NE(ArrowIpcDecoderVerifyHeader(&decoder, data, &error), NANOARROW_OK);
Expand Down
4 changes: 2 additions & 2 deletions src/nanoarrow/nanoarrow_ipc_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ TEST(NanoarrowIpcTest, StreamReaderInvalidBuffer) {

memcpy(simple_stream_invalid, kSimpleSchema, i);
memcpy(simple_stream_invalid + i, kSimpleSchema + (i + 1),
(sizeof(kSimpleSchema) - i));
(sizeof(kSimpleSchema) - i - 1));

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

memcpy(simple_stream_invalid + sizeof(kSimpleSchema), kSimpleRecordBatch, i);
memcpy(simple_stream_invalid + sizeof(kSimpleSchema) + i,
kSimpleRecordBatch + (i + 1), (sizeof(kSimpleRecordBatch) - i));
kSimpleRecordBatch + (i + 1), (sizeof(kSimpleRecordBatch) - i - 1));

ArrowBufferInit(&input_buffer);
ASSERT_EQ(ArrowBufferAppendBufferView(&input_buffer, data), NANOARROW_OK);
Expand Down

0 comments on commit 4ed0631

Please sign in to comment.