diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 18841ac874b..03aacf4e9ba 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -679,7 +679,7 @@ endif() # the first link library. It's for prioritizing bundled FlatBuffers # than system FlatBuffers. list(PREPEND ARROW_TEST_LINK_LIBS arrow::flatbuffers) -list(APPEND ARROW_TEST_LINK_LIBS ${ARROW_GTEST_GMOCK} ${ARROW_GTEST_GTEST_MAIN}) +list(APPEND ARROW_TEST_LINK_LIBS ${ARROW_GTEST_GMOCK_MAIN}) if(ARROW_BUILD_BENCHMARKS) set(ARROW_BENCHMARK_LINK_LIBS benchmark::benchmark_main ${ARROW_TEST_LINK_LIBS}) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 6e7544a707d..b815d9da56e 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -2428,6 +2428,7 @@ if(ARROW_TESTING) set(ARROW_GTEST_GMOCK GTest::gmock) set(ARROW_GTEST_GTEST GTest::gtest) set(ARROW_GTEST_GTEST_MAIN GTest::gtest_main) + set(ARROW_GTEST_GMOCK_MAIN GTest::gmock_main) else() string(APPEND ARROW_TESTING_PC_CFLAGS " -I\${includedir}/arrow-gtest") string(APPEND ARROW_TESTING_PC_LIBS " -larrow_gtest") @@ -2435,6 +2436,7 @@ if(ARROW_TESTING) set(ARROW_GTEST_GMOCK arrow::GTest::gmock) set(ARROW_GTEST_GTEST arrow::GTest::gtest) set(ARROW_GTEST_GTEST_MAIN arrow::GTest::gtest_main) + set(ARROW_GTEST_GMOCK_MAIN arrow::GTest::gmock_main) endif() endif() diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index 0cc4765a79c..9acd7083437 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -137,7 +137,7 @@ if(ARROW_ENABLE_THREADING) list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS Threads::Threads) endif() -set(ARROW_TEST_LINK_TOOLCHAIN ${ARROW_GTEST_GMOCK} ${ARROW_GTEST_GTEST_MAIN}) +set(ARROW_TEST_LINK_TOOLCHAIN ${ARROW_GTEST_GMOCK_MAIN}) set(ARROW_TEST_STATIC_LINK_LIBS arrow::flatbuffers arrow_testing_static arrow_static ${ARROW_TEST_LINK_TOOLCHAIN}) set(ARROW_TEST_SHARED_LINK_LIBS arrow::flatbuffers arrow_testing_shared arrow_shared diff --git a/cpp/src/arrow/adapters/orc/adapter_test.cc b/cpp/src/arrow/adapters/orc/adapter_test.cc index b3c314fccc0..714e61b22b1 100644 --- a/cpp/src/arrow/adapters/orc/adapter_test.cc +++ b/cpp/src/arrow/adapters/orc/adapter_test.cc @@ -642,6 +642,9 @@ TEST(TestAdapterReadWrite, ThrowWhenTZDBUnavaiable) { if (adapters::orc::GetOrcMajorVersion() >= 2) { GTEST_SKIP() << "Only ORC pre-2.0.0 versions have the time zone database check"; } +#ifdef _WIN32 + GTEST_SKIP() << "GH-47489: Expected error is not thrown on Windows"; +#endif EnvVarGuard tzdir_guard("TZDIR", "/wrong/path"); const char* expect_str = "IANA time zone database is unavailable but required by ORC"; diff --git a/cpp/src/arrow/compute/CMakeLists.txt b/cpp/src/arrow/compute/CMakeLists.txt index 28e30a564b7..6c530a76e18 100644 --- a/cpp/src/arrow/compute/CMakeLists.txt +++ b/cpp/src/arrow/compute/CMakeLists.txt @@ -43,15 +43,9 @@ if(ARROW_TESTING AND ARROW_COMPUTE) add_library(arrow_compute_testing OBJECT ${ARROW_COMPUTE_TESTING_SRCS}) # Even though this is still just an object library we still need to "link" # arrow_compute_core_testing so that is also included correctly - if(MSVC) - target_link_libraries(arrow_compute_testing - PUBLIC $ - PUBLIC ${ARROW_GTEST_GTEST_MAIN}) - else() - target_link_libraries(arrow_compute_testing - PUBLIC $ - PUBLIC ${ARROW_GTEST_GTEST}) - endif() + target_link_libraries(arrow_compute_testing + PUBLIC $ + PUBLIC ${ARROW_GTEST_GTEST}) endif() set(ARROW_COMPUTE_TEST_PREFIX "arrow-compute") diff --git a/cpp/src/arrow/compute/test_env.cc b/cpp/src/arrow/compute/test_env.cc index b035b8ca035..57e92763c6d 100644 --- a/cpp/src/arrow/compute/test_env.cc +++ b/cpp/src/arrow/compute/test_env.cc @@ -34,19 +34,10 @@ class ComputeKernelEnvironment : public ::testing::Environment { }; } // namespace - -#ifdef _MSC_VER -// Initialize the compute module -::testing::Environment* compute_kernels_env = - ::testing::AddGlobalTestEnvironment(new ComputeKernelEnvironment); -#endif - } // namespace arrow::compute -#ifndef _MSC_VER int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ::testing::AddGlobalTestEnvironment(new arrow::compute::ComputeKernelEnvironment); return RUN_ALL_TESTS(); } -#endif diff --git a/cpp/src/arrow/engine/substrait/serde_test.cc b/cpp/src/arrow/engine/substrait/serde_test.cc index 6762d1e0454..f92aee8eaad 100644 --- a/cpp/src/arrow/engine/substrait/serde_test.cc +++ b/cpp/src/arrow/engine/substrait/serde_test.cc @@ -1065,6 +1065,10 @@ NamedTableProvider AlwaysProvideSameTable(std::shared_ptr table) { } TEST(Substrait, ExecReadRelWithLocalFiles) { +#ifdef _WIN32 + GTEST_SKIP() + << "GH-47490: Substrait does not properly parse PARQUET_TEST_DATA path on Windows"; +#endif ASSERT_OK_AND_ASSIGN(std::string dir_string, arrow::internal::GetEnvVar("PARQUET_TEST_DATA")); diff --git a/cpp/src/arrow/testing/gtest_util_test.cc b/cpp/src/arrow/testing/gtest_util_test.cc index 4ad5159a6b1..663d1549be1 100644 --- a/cpp/src/arrow/testing/gtest_util_test.cc +++ b/cpp/src/arrow/testing/gtest_util_test.cc @@ -287,9 +287,12 @@ TEST(TestWithinUlp, Float) { TEST(AssertTestWithinUlp, Basics) { AssertWithinUlp(123.4567, 123.45670000000015, 11); AssertWithinUlp(123.456f, 123.456085f, 11); +#ifndef _WIN32 + // GH-47442 EXPECT_FATAL_FAILURE(AssertWithinUlp(123.4567, 123.45670000000015, 10), "not within 10 ulps"); EXPECT_FATAL_FAILURE(AssertWithinUlp(123.456f, 123.456085f, 10), "not within 10 ulps"); +#endif } } // namespace arrow diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt index 687e75f4b73..e5760243b39 100644 --- a/cpp/src/gandiva/CMakeLists.txt +++ b/cpp/src/gandiva/CMakeLists.txt @@ -195,8 +195,8 @@ if(WIN32) list(APPEND GANDIVA_STATIC_TEST_LINK_LIBS ${GANDIVA_OPENSSL_LIBS}) list(APPEND GANDIVA_SHARED_TEST_LINK_LIBS ${GANDIVA_OPENSSL_LIBS}) endif() -list(APPEND GANDIVA_STATIC_TEST_LINK_LIBS ${ARROW_GTEST_GMOCK} ${ARROW_GTEST_GTEST_MAIN}) -list(APPEND GANDIVA_SHARED_TEST_LINK_LIBS ${ARROW_GTEST_GMOCK} ${ARROW_GTEST_GTEST_MAIN}) +list(APPEND GANDIVA_STATIC_TEST_LINK_LIBS ${ARROW_GTEST_GMOCK_MAIN}) +list(APPEND GANDIVA_SHARED_TEST_LINK_LIBS ${ARROW_GTEST_GMOCK_MAIN}) function(ADD_GANDIVA_TEST REL_TEST_NAME) set(options USE_STATIC_LINKING)