Skip to content

Commit

Permalink
fixed ASAN reports: stack objects were destroyed before being accesse…
Browse files Browse the repository at this point in the history
…d (from tests)
  • Loading branch information
Klaim committed Sep 24, 2024
1 parent 9e0b82f commit 392aa48
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/test_arrow_array_schema_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,13 @@ TEST_SUITE("ArrowArrowSchemaProxy")
{
SUBCASE("on sparrow c structure")
{
auto [schema, array] = make_sparrow_arrow_schema_and_array();
sparrow::arrow_proxy proxy(std::move(array), std::move(schema));
auto array_schema_pair = make_sparrow_arrow_schema_and_array();
std::array<sparrow::arrow_array_and_schema_pointers,1> array_child_ptr{{{&array_schema_pair.second ,&array_schema_pair.first}}};

auto [schema, array] = make_sparrow_arrow_schema_and_array();
sparrow::arrow_proxy proxy(std::move(array), std::move(schema));
proxy.add_children(array_child_ptr);

const auto children = proxy.children();
CHECK_EQ(children.size(), 1);
CHECK_EQ(children[0].format(), "C");
Expand Down Expand Up @@ -455,20 +457,22 @@ TEST_SUITE("ArrowArrowSchemaProxy")
{
SUBCASE("on sparrow c structure")
{
auto array_schema_pair = make_sparrow_arrow_schema_and_array();

auto [schema, array] = make_sparrow_arrow_schema_and_array();
sparrow::arrow_proxy proxy(std::move(array), std::move(schema));
auto array_schema_pair = make_sparrow_arrow_schema_and_array();
proxy.set_dictionary(&array_schema_pair.second, &array_schema_pair.first);

const auto& dictionary = proxy.dictionary();
REQUIRE(dictionary);
CHECK_EQ(dictionary->format(), "C");
}

SUBCASE("on external c structure")
{
auto [schema_dict, array_dict] = make_external_arrow_schema_and_array();
auto [schema, array] = make_external_arrow_schema_and_array();
sparrow::arrow_proxy proxy(std::move(array), std::move(schema));
auto [schema_dict, array_dict] = make_external_arrow_schema_and_array();
CHECK_THROWS_AS(proxy.set_dictionary(&array_dict, &schema_dict), std::runtime_error);
}
}
Expand Down

0 comments on commit 392aa48

Please sign in to comment.