Skip to content

Commit

Permalink
clean: Assorted Meson and clang-tidy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Nov 1, 2024
1 parent d9cc164 commit 4faa15a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:
- 'CMakeLists.txt'
- '.github/workflows/build-and-test.yaml'
- 'src/nanoarrow/**'
- 'meson.build'

permissions:
contents: read
Expand Down
14 changes: 13 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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': {
Expand All @@ -226,6 +237,7 @@ if get_option('tests')
'deps': [
nanoarrow_testing_dep,
nanoarrow_ipc_dep,
flatcc_dep,
zlib_dep,
arrow_dep,
gtest_dep,
Expand Down
23 changes: 12 additions & 11 deletions src/nanoarrow/ipc/decoder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -1232,34 +1232,35 @@ 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);

decoder->header_size_bytes = -1;

// 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);
Expand Down

0 comments on commit 4faa15a

Please sign in to comment.