Skip to content

Commit f25fab4

Browse files
authored
GH-46314: [C++][Parquet] Fix valgrind error when collecting parameterized tests for MakeWKBPoint (#46320)
### Rationale for this change The nightlies for valgrind report a use of an uninitialized value around MakeWKBPointTestCase. ### What changes are included in this PR? A custom printer was added for the test case. I believe the sanitizer error was occurring because the bytes of the std::vector were being printed (and may not have been initialized yet). ### Are these changes tested? Yes ### Are there any user-facing changes? No! * GitHub Issue: #46314 Authored-by: Dewey Dunnington <dewey@wherobots.com> Signed-off-by: Dewey Dunnington <dewey@wherobots.com>
1 parent 702de09 commit f25fab4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cpp/src/parquet/geospatial/util_internal_test.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,19 @@ INSTANTIATE_TEST_SUITE_P(
507507

508508
struct MakeWKBPointTestCase {
509509
std::vector<double> xyzm;
510-
bool has_z;
511-
bool has_m;
510+
bool has_z{};
511+
bool has_m{};
512512
};
513513

514+
std::ostream& operator<<(std::ostream& os, const MakeWKBPointTestCase& obj) {
515+
os << "MakeWKBPointTestCase<has_z=" << obj.has_z << ", has_m=" << obj.has_m << ">";
516+
return os;
517+
}
518+
514519
class MakeWKBPointTestFixture : public testing::TestWithParam<MakeWKBPointTestCase> {};
515520

516521
TEST_P(MakeWKBPointTestFixture, MakeWKBPoint) {
517-
auto param = GetParam();
522+
const auto& param = GetParam();
518523
std::string wkb = test::MakeWKBPoint(param.xyzm, param.has_z, param.has_m);
519524
WKBGeometryBounder bounder;
520525
ASSERT_NO_THROW(bounder.MergeGeometry(wkb));

0 commit comments

Comments
 (0)