From 4faa15af12040c723f40fd7dce956a0131f9e2a8 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Fri, 1 Nov 2024 16:27:16 -0400 Subject: [PATCH] clean: Assorted Meson and clang-tidy fixes --- .github/workflows/build-and-test.yaml | 1 + meson.build | 14 +++++++++++++- src/nanoarrow/ipc/decoder_test.cc | 23 ++++++++++++----------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index db2f6abca..127917edd 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -28,6 +28,7 @@ on: - 'CMakeLists.txt' - '.github/workflows/build-and-test.yaml' - 'src/nanoarrow/**' + - 'meson.build' permissions: contents: read diff --git a/meson.build b/meson.build index 144319c77..4c33170fc 100644 --- a/meson.build +++ b/meson.build @@ -46,6 +46,11 @@ add_project_arguments( language : 'cpp' ) +if get_option('buildtype') in ['debug', 'debugoptimized'] + add_project_arguments('-DNANOARROW_DEBUG', language: 'c') + add_project_arguments('-DNANOARROW_DEBUG', language: 'cpp') +endif + nanoarrow_dep_args = [] if host_machine.system() == 'windows' and get_option('default_library') == 'shared' add_project_arguments(['-DNANOARROW_BUILD_DLL', '-DNANOARROW_EXPORT_DLL'], language: 'c') @@ -210,7 +215,13 @@ if get_option('tests') ipc_test_files = { 'ipc-decoder': { 'src': 'decoder', - 'deps': [nanoarrow_ipc_dep, arrow_dep, gtest_dep, gmock_dep], + 'deps': [ + nanoarrow_ipc_dep, + flatcc_dep, + arrow_dep, + gtest_dep, + gmock_dep, + ], 'timeout': 30, }, 'ipc-reader': { @@ -226,6 +237,7 @@ if get_option('tests') 'deps': [ nanoarrow_testing_dep, nanoarrow_ipc_dep, + flatcc_dep, zlib_dep, arrow_dep, gtest_dep, diff --git a/src/nanoarrow/ipc/decoder_test.cc b/src/nanoarrow/ipc/decoder_test.cc index 078fcf70e..29209ec73 100644 --- a/src/nanoarrow/ipc/decoder_test.cc +++ b/src/nanoarrow/ipc/decoder_test.cc @@ -856,14 +856,14 @@ TEST_P(ArrowTypeParameterizedTestFixture, NanoarrowIpcNanoarrowArrayRoundtrip) { EXPECT_EQ(ArrowIpcDecoderSetSchema(decoder.get(), schema.get(), &error), NANOARROW_OK) << error.message; EXPECT_EQ(ArrowIpcDecoderDecodeHeader(decoder.get(), - {buffer->data, buffer->size_bytes}, &error), + {{buffer->data}, buffer->size_bytes}, &error), NANOARROW_OK) << error.message; struct ArrowArrayView* roundtripped; - ASSERT_EQ(ArrowIpcDecoderDecodeArrayView(decoder.get(), - {body_buffer->data, body_buffer->size_bytes}, - -1, &roundtripped, nullptr), + ASSERT_EQ(ArrowIpcDecoderDecodeArrayView( + decoder.get(), {{body_buffer->data}, body_buffer->size_bytes}, -1, + &roundtripped, nullptr), NANOARROW_OK); AssertArrayViewIdentical(roundtripped, array_view.get()); @@ -1232,26 +1232,27 @@ TEST(NanoarrowIpcTest, NanoarrowIpcFooterDecodingErrors) { ArrowIpcDecoderInit(decoder.get()); // not enough data to get the size+magic - EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {nullptr, 3}, &error), ESPIPE) + EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {{nullptr}, 3}, &error), ESPIPE) << error.message; // doesn't end with magic - EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {"\0\0\0\0blargh", 10}, &error), + EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {{"\0\0\0\0blargh"}, 10}, &error), EINVAL) << error.message; // negative size EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), - {"\xFF\xFF\xFF\xFF" - "ARROW1", + {{"\xFF\xFF\xFF\xFF" + "ARROW1"}, 10}, &error), EINVAL) << error.message; // PeekFooter doesn't check for available data - EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {"\xFF\xFF\0\0ARROW1", 10}, &error), - NANOARROW_OK) + EXPECT_EQ( + ArrowIpcDecoderPeekFooter(decoder.get(), {{"\xFF\xFF\0\0ARROW1"}, 10}, &error), + NANOARROW_OK) << error.message; EXPECT_EQ(decoder->header_size_bytes, 0xFFFF); @@ -1259,7 +1260,7 @@ TEST(NanoarrowIpcTest, NanoarrowIpcFooterDecodingErrors) { // VerifyFooter *does* check for enough available data EXPECT_EQ( - ArrowIpcDecoderVerifyFooter(decoder.get(), {"\xFF\xFF\0\0ARROW1", 10}, &error), + ArrowIpcDecoderVerifyFooter(decoder.get(), {{"\xFF\xFF\0\0ARROW1"}, 10}, &error), ESPIPE) << error.message; EXPECT_EQ(decoder->header_size_bytes, 0xFFFF);