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

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


The following commit(s) were added to refs/heads/main by this push:
     new bc9746d6d2 GH-47659: [C++] Fix Arrow Flight Testing's unresolved 
external symbol error  (#47660)
bc9746d6d2 is described below

commit bc9746d6d269db81118edbeb786bac215047b15c
Author: Alina (Xi) Li <[email protected]>
AuthorDate: Mon Oct 6 17:57:01 2025 -0700

    GH-47659: [C++] Fix Arrow Flight Testing's unresolved external symbol error 
 (#47660)
    
    ### Rationale for this change
    
    Fixes issue at https://github.com/apache/arrow/issues/47659
    
    ### What changes are included in this PR?
    
    Include add gmock as a shared private link library to `arrow_flight_testing`
    
    ### Are these changes tested?
    
    Build for `arrow_flight_testing` succeeds on my Windows environment
    
    ### Are there any user-facing changes?
    No
    * GitHub Issue: #47659
    
    Authored-by: Alina (Xi) Li <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/src/arrow/flight/CMakeLists.txt |  2 ++
 cpp/src/arrow/flight/test_util.cc   | 15 +++++++++++++++
 cpp/src/arrow/flight/test_util.h    | 17 ++---------------
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/cpp/src/arrow/flight/CMakeLists.txt 
b/cpp/src/arrow/flight/CMakeLists.txt
index d6edbcefcf..359f6d3727 100644
--- a/cpp/src/arrow/flight/CMakeLists.txt
+++ b/cpp/src/arrow/flight/CMakeLists.txt
@@ -284,7 +284,9 @@ if(ARROW_TESTING)
          ArrowTesting::arrow_testing_static)
   endif()
   list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS 
${ARROW_FLIGHT_TEST_INTERFACE_LIBS})
+  list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS ${ARROW_GTEST_GMOCK})
   list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS 
${ARROW_FLIGHT_TEST_INTERFACE_LIBS})
+  list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS ${ARROW_GTEST_GMOCK})
   add_arrow_lib(arrow_flight_testing
                 CMAKE_PACKAGE_NAME
                 ArrowFlightTesting
diff --git a/cpp/src/arrow/flight/test_util.cc 
b/cpp/src/arrow/flight/test_util.cc
index e0b73ebb6e..46c8f4c984 100644
--- a/cpp/src/arrow/flight/test_util.cc
+++ b/cpp/src/arrow/flight/test_util.cc
@@ -25,6 +25,7 @@
 // We need Windows fixes before including Boost
 #include "arrow/util/windows_compatibility.h"
 
+#include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
 #include "arrow/array.h"
@@ -105,6 +106,20 @@ arrow::Result<FlightPayload> NumberingStream::Next() {
   return payload;
 }
 
+void AssertEqual(const FlightInfo& expected, const FlightInfo& actual) {
+  ipc::DictionaryMemo expected_memo;
+  ipc::DictionaryMemo actual_memo;
+  ASSERT_OK_AND_ASSIGN(auto ex_schema, expected.GetSchema(&expected_memo));
+  ASSERT_OK_AND_ASSIGN(auto actual_schema, actual.GetSchema(&actual_memo));
+
+  AssertSchemaEqual(*ex_schema, *actual_schema);
+  ASSERT_EQ(expected.total_records(), actual.total_records());
+  ASSERT_EQ(expected.total_bytes(), actual.total_bytes());
+
+  ASSERT_EQ(expected.descriptor(), actual.descriptor());
+  ASSERT_THAT(actual.endpoints(), 
::testing::ContainerEq(expected.endpoints()));
+}
+
 std::shared_ptr<Schema> ExampleIntSchema() {
   auto f0 = field("f0", int8());
   auto f1 = field("f1", uint8());
diff --git a/cpp/src/arrow/flight/test_util.h b/cpp/src/arrow/flight/test_util.h
index fd0f3c88b6..59eb9c0c1a 100644
--- a/cpp/src/arrow/flight/test_util.h
+++ b/cpp/src/arrow/flight/test_util.h
@@ -17,7 +17,6 @@
 
 #pragma once
 
-#include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
 #include <cstdint>
@@ -42,20 +41,8 @@ namespace flight {
 
 // ----------------------------------------------------------------------
 // Helpers to compare values for equality
-
-inline void AssertEqual(const FlightInfo& expected, const FlightInfo& actual) {
-  ipc::DictionaryMemo expected_memo;
-  ipc::DictionaryMemo actual_memo;
-  ASSERT_OK_AND_ASSIGN(auto ex_schema, expected.GetSchema(&expected_memo));
-  ASSERT_OK_AND_ASSIGN(auto actual_schema, actual.GetSchema(&actual_memo));
-
-  AssertSchemaEqual(*ex_schema, *actual_schema);
-  ASSERT_EQ(expected.total_records(), actual.total_records());
-  ASSERT_EQ(expected.total_bytes(), actual.total_bytes());
-
-  ASSERT_EQ(expected.descriptor(), actual.descriptor());
-  ASSERT_THAT(actual.endpoints(), 
::testing::ContainerEq(expected.endpoints()));
-}
+ARROW_FLIGHT_EXPORT
+void AssertEqual(const FlightInfo& expected, const FlightInfo& actual);
 
 // ----------------------------------------------------------------------
 // Fixture to use for running test servers

Reply via email to