You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/06/27 19:12:03 UTC

[arrow] branch master updated: ARROW-16877: [C++] Define custom printer for Registry tests to fix valgrind (#13438)

This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 8e9cc05fe0 ARROW-16877: [C++] Define custom printer for Registry tests to fix valgrind (#13438)
8e9cc05fe0 is described below

commit 8e9cc05fe0aca94b8b7dc9e59ced0682381b4c1c
Author: Raúl Cumplido <ra...@gmail.com>
AuthorDate: Mon Jun 27 21:11:52 2022 +0200

    ARROW-16877: [C++] Define custom printer for Registry tests to fix valgrind (#13438)
    
    Authored-by: Raúl Cumplido <ra...@gmail.com>
    Signed-off-by: David Li <li...@gmail.com>
---
 cpp/src/arrow/compute/registry_test.cc | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/cpp/src/arrow/compute/registry_test.cc b/cpp/src/arrow/compute/registry_test.cc
index 937515af4a..5517f3090d 100644
--- a/cpp/src/arrow/compute/registry_test.cc
+++ b/cpp/src/arrow/compute/registry_test.cc
@@ -96,18 +96,28 @@ TEST_P(TestRegistry, Basics) {
   ASSERT_EQ(func, f2);
 }
 
+// Define a custom print since the default Googletest print trips Valgrind
+void PrintTo(const TestRegistryParams& param, std::ostream* os) {
+  (*os) << "TestRegistryParams{"
+        << "get_num_funcs()=" << std::get<1>(param)() << ", get_func_names()=";
+  for (std::string func_name : std::get<2>(param)()) {
+    (*os) << func_name;
+  }
+  (*os) << ", name=" << std::get<3>(param) << "}";
+}
+
 INSTANTIATE_TEST_SUITE_P(
     TestRegistry, TestRegistry,
     testing::Values(
-        std::make_tuple(
+        TestRegistryParams{std::make_tuple(
             static_cast<MakeFunctionRegistry>([]() { return FunctionRegistry::Make(); }),
-            []() { return 0; }, []() { return std::vector<std::string>{}; }, "default"),
-        std::make_tuple(
+            []() { return 0; }, []() { return std::vector<std::string>{}; }, "default")},
+        TestRegistryParams{std::make_tuple(
             static_cast<MakeFunctionRegistry>([]() {
               return FunctionRegistry::Make(GetFunctionRegistry());
             }),
             []() { return GetFunctionRegistry()->num_functions(); },
-            []() { return GetFunctionRegistry()->GetFunctionNames(); }, "nested")));
+            []() { return GetFunctionRegistry()->GetFunctionNames(); }, "nested")}));
 
 TEST(TestRegistry, RegisterTempFunctions) {
   auto default_registry = GetFunctionRegistry();