-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-10746: [C++] Bump gtest version + use GTEST_SKIP in tests #8782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ecfef76 to
19c70e4
Compare
0591595 to
2e846d3
Compare
|
I think the code changes here are ok. However, at least some of the build errors look related (and persisted across two CI runs) so that's left to figure out |
1ebe491 to
f073eab
Compare
|
It seems that the latest GoogleTest doesn't use the default Could you try this? diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index df03c3129..e36571808 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -1603,21 +1603,16 @@ macro(build_gtest)
set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/googletest_ep-prefix")
set(GTEST_INCLUDE_DIR "${GTEST_PREFIX}/include")
- set(_GTEST_RUNTIME_DIR ${BUILD_OUTPUT_ROOT_DIRECTORY})
+ set(_GTEST_LIBRARY_DIR "${GTEST_PREFIX}/lib")
if(MSVC)
set(_GTEST_IMPORTED_TYPE IMPORTED_IMPLIB)
set(_GTEST_LIBRARY_SUFFIX
"${CMAKE_GTEST_DEBUG_EXTENSION}${CMAKE_IMPORT_LIBRARY_SUFFIX}")
- # Use the import libraries from the EP
- set(_GTEST_LIBRARY_DIR "${GTEST_PREFIX}/lib")
else()
set(_GTEST_IMPORTED_TYPE IMPORTED_LOCATION)
set(_GTEST_LIBRARY_SUFFIX
"${CMAKE_GTEST_DEBUG_EXTENSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
-
- # Library and runtime same on non-Windows
- set(_GTEST_LIBRARY_DIR "${_GTEST_RUNTIME_DIR}")
endif()
set(GTEST_SHARED_LIB
@@ -1632,6 +1627,7 @@ macro(build_gtest)
${EP_COMMON_TOOLCHAIN}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
"-DCMAKE_INSTALL_PREFIX=${GTEST_PREFIX}"
+ -DCMAKE_INSTALL_LIBDIR=lib
-DBUILD_SHARED_LIBS=ON
-DCMAKE_CXX_FLAGS=${GTEST_CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${GTEST_CMAKE_CXX_FLAGS})
@@ -1641,27 +1637,6 @@ macro(build_gtest)
set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} "-DCMAKE_MACOSX_RPATH:BOOL=ON")
endif()
- if(CMAKE_GENERATOR STREQUAL "Xcode")
- # Xcode projects support multi-configuration builds. This forces the gtest build
- # to use the same output directory as a single-configuration Makefile driven build.
- list(
- APPEND GTEST_CMAKE_ARGS "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${_GTEST_LIBRARY_DIR}"
- "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}=${_GTEST_RUNTIME_DIR}")
- endif()
-
- if(MSVC)
- if(NOT ("${CMAKE_GENERATOR}" STREQUAL "Ninja"))
- set(_GTEST_RUNTIME_DIR ${_GTEST_RUNTIME_DIR}/${CMAKE_BUILD_TYPE})
- endif()
- set(GTEST_CMAKE_ARGS
- ${GTEST_CMAKE_ARGS} "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${_GTEST_RUNTIME_DIR}"
- "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}=${_GTEST_RUNTIME_DIR}")
- else()
- list(
- APPEND GTEST_CMAKE_ARGS "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${_GTEST_RUNTIME_DIR}"
- "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}=${_GTEST_RUNTIME_DIR}")
- endif()
-
add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
if(MSVC AND NOT ARROW_USE_STATIC_CRT) |
e91795e to
0bef0c9
Compare
|
It seems that the template type name diff --git a/cpp/src/parquet/statistics_test.cc b/cpp/src/parquet/statistics_test.cc
index 0828f36b3..77e77e0eb 100644
--- a/cpp/src/parquet/statistics_test.cc
+++ b/cpp/src/parquet/statistics_test.cc
@@ -609,7 +609,7 @@ static const int NUM_VALUES = 10;
template <typename TestType>
class TestStatisticsSortOrder : public ::testing::Test {
public:
- typedef typename TestType::c_type T;
+ using c_type = typename TestType::c_type;
void AddNodes(std::string name) {
fields_.push_back(schema::PrimitiveNode::Make(
@@ -670,7 +670,7 @@ class TestStatisticsSortOrder : public ::testing::Test {
}
protected:
- std::vector<T> values_;
+ std::vector<c_type> values_;
std::vector<uint8_t> values_buf_;
std::vector<schema::NodePtr> fields_;
std::shared_ptr<schema::GroupNode> schema_;
@@ -700,13 +700,13 @@ void TestStatisticsSortOrder<Int32Type>::SetValues() {
// Write UINT32 min/max values
stats_[0]
- .set_min(std::string(reinterpret_cast<const char*>(&values_[5]), sizeof(T)))
- .set_max(std::string(reinterpret_cast<const char*>(&values_[4]), sizeof(T)));
+ .set_min(std::string(reinterpret_cast<const char*>(&values_[5]), sizeof(c_type)))
+ .set_max(std::string(reinterpret_cast<const char*>(&values_[4]), sizeof(c_type)));
// Write INT32 min/max values
stats_[1]
- .set_min(std::string(reinterpret_cast<const char*>(&values_[0]), sizeof(T)))
- .set_max(std::string(reinterpret_cast<const char*>(&values_[9]), sizeof(T)));
+ .set_min(std::string(reinterpret_cast<const char*>(&values_[0]), sizeof(c_type)))
+ .set_max(std::string(reinterpret_cast<const char*>(&values_[9]), sizeof(c_type)));
}
// TYPE::INT64
@@ -728,13 +728,13 @@ void TestStatisticsSortOrder<Int64Type>::SetValues() {
// Write UINT64 min/max values
stats_[0]
- .set_min(std::string(reinterpret_cast<const char*>(&values_[5]), sizeof(T)))
- .set_max(std::string(reinterpret_cast<const char*>(&values_[4]), sizeof(T)));
+ .set_min(std::string(reinterpret_cast<const char*>(&values_[5]), sizeof(c_type)))
+ .set_max(std::string(reinterpret_cast<const char*>(&values_[4]), sizeof(c_type)));
// Write INT64 min/max values
stats_[1]
- .set_min(std::string(reinterpret_cast<const char*>(&values_[0]), sizeof(T)))
- .set_max(std::string(reinterpret_cast<const char*>(&values_[9]), sizeof(T)));
+ .set_min(std::string(reinterpret_cast<const char*>(&values_[0]), sizeof(c_type)))
+ .set_max(std::string(reinterpret_cast<const char*>(&values_[9]), sizeof(c_type)));
}
// TYPE::FLOAT
@@ -747,8 +747,8 @@ void TestStatisticsSortOrder<FloatType>::SetValues() {
// Write Float min/max values
stats_[0]
- .set_min(std::string(reinterpret_cast<const char*>(&values_[0]), sizeof(T)))
- .set_max(std::string(reinterpret_cast<const char*>(&values_[9]), sizeof(T)));
+ .set_min(std::string(reinterpret_cast<const char*>(&values_[0]), sizeof(c_type)))
+ .set_max(std::string(reinterpret_cast<const char*>(&values_[9]), sizeof(c_type)));
}
// TYPE::DOUBLE
@@ -761,8 +761,8 @@ void TestStatisticsSortOrder<DoubleType>::SetValues() {
// Write Double min/max values
stats_[0]
- .set_min(std::string(reinterpret_cast<const char*>(&values_[0]), sizeof(T)))
- .set_max(std::string(reinterpret_cast<const char*>(&values_[9]), sizeof(T)));
+ .set_min(std::string(reinterpret_cast<const char*>(&values_[0]), sizeof(c_type)))
+ .set_max(std::string(reinterpret_cast<const char*>(&values_[9]), sizeof(c_type)));
}
// TYPE::ByteArrayHere is a patch to fix CMake lint failure: diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index bdf15e4bc..46872fba3 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -1603,7 +1603,7 @@ macro(build_gtest)
set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/googletest_ep-prefix")
set(GTEST_INCLUDE_DIR "${GTEST_PREFIX}/include")
-set(_GTEST_LIBRARY_DIR "${GTEST_PREFIX}/lib")
+ set(_GTEST_LIBRARY_DIR "${GTEST_PREFIX}/lib")
if(MSVC)
set(_GTEST_IMPORTED_TYPE IMPORTED_IMPLIB) |
|
Could you add required GoogleTest version check? diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index bdf15e4bc..60bdf13ad 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -1682,7 +1682,7 @@ set(_GTEST_LIBRARY_DIR "${GTEST_PREFIX}/lib")
endmacro()
if(ARROW_TESTING)
- resolve_dependency(GTest)
+ resolve_dependency(GTest REQUIRED_VERSION 1.10.0)
if(NOT GTEST_VENDORED)
# TODO(wesm): This logic does not work correctly with the MSVC static libraries |
|
Thanks @kou!!! Pushed your suggestions |
cffbea4 to
cd8f7e8
Compare
|
Is this related in C++ / AMD64 Windows 2019? |
|
I think so. |
cfaa72b to
6a32ee4
Compare
pitrou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two small comments.
cpp/src/parquet/encoding_test.cc
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be continue instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, done
cpp/src/parquet/encoding_test.cc
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
09ae96f to
c4d813b
Compare
|
It's down to three failing checks:
I'll keep looking. |
|
Both the Appveyor case and the macOS case are caused by same reason. They can't find GoogleTest's library.
|
|
@github-actions crossbow submit -g nightly |
|
Revision: f3f04e8 Submitted crossbow builds: ursa-labs/crossbow @ actions-743 |
kou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
All green. I'll merge this.
As per a TODO left in ARROW-3769 / #3721 we can now use the
GTEST_SKIPmacro inparquet/encoding-test.cpp.GTEST_SKIPwas added in gtest 1.10.0 so this involves bumping our minimal gtest version from 1.8.1