-
Notifications
You must be signed in to change notification settings - Fork 40
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
test: Make Arrow C++ dependency optional #677
Changes from 7 commits
99e72e5
9198c20
fa52487
d9f7b36
ff4b4b2
d465717
7db51a6
76af997
6d349c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ option(NANOARROW_DEVICE_WITH_CUDA "Build CUDA libraries" OFF) | |
# Development options | ||
option(NANOARROW_BUILD_APPS "Build utility applications" OFF) | ||
option(NANOARROW_BUILD_TESTS "Build tests" OFF) | ||
option(NANOARROW_BUILD_TESTS_WITH_ARROW "Build tests that require Arrow" OFF) | ||
option(NANOARROW_BUILD_BENCHMARKS "Build benchmarks" OFF) | ||
option(NANOARROW_BUILD_INTEGRATION_TESTS | ||
"Build cross-implementation Arrow integration tests" OFF) | ||
|
@@ -422,26 +423,28 @@ if(NANOARROW_BUILD_TESTS) | |
) | ||
include(CTest) | ||
|
||
find_package(Arrow REQUIRED) | ||
message(STATUS "Arrow version: ${ARROW_VERSION}") | ||
message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}") | ||
find_package(Arrow) | ||
if(Arrow_FOUND) | ||
message(STATUS "Arrow version: ${ARROW_VERSION}") | ||
message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}") | ||
|
||
# Give caller the option to link a static version of Arrow C++ | ||
if(NANOARROW_ARROW_STATIC) | ||
set(NANOARROW_ARROW_TARGET arrow_static) | ||
else() | ||
set(NANOARROW_ARROW_TARGET arrow_shared) | ||
endif() | ||
# Give caller the option to link a static version of Arrow C++ | ||
if(NANOARROW_ARROW_STATIC) | ||
set(NANOARROW_ARROW_TARGET arrow_static) | ||
else() | ||
set(NANOARROW_ARROW_TARGET arrow_shared) | ||
endif() | ||
|
||
# Arrow >= 10.0.0 requires C++17; GTest requires C++11. | ||
# Leave the option open to use an older version of Arrow | ||
# to make it easier to test on old Linux (e.g., Centos7) | ||
if(${ARROW_VERSION} VERSION_GREATER_EQUAL "10.0.0") | ||
set(CMAKE_CXX_STANDARD 17) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
# Arrow >= 10.0.0 requires C++17; GTest requires C++11. | ||
# Leave the option open to use an older version of Arrow | ||
# to make it easier to test on old Linux (e.g., Centos7) | ||
if(${ARROW_VERSION} VERSION_GREATER_EQUAL "10.0.0") | ||
set(CMAKE_CXX_STANDARD 17) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
endif() | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
endif() | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
add_subdirectory("thirdparty/googletest") | ||
|
||
|
@@ -517,6 +520,27 @@ if(NANOARROW_BUILD_TESTS) | |
gmock_main | ||
nanoarrow_coverage_config) | ||
|
||
list(APPEND | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just kept the loop scoped to adding the define for now, although there is (as you've already mentioned) potential to use this for other parts of the config |
||
NanoarrowTests | ||
utils_test | ||
buffer_test | ||
array_test | ||
schema_test | ||
array_stream_test | ||
nanoarrow_testing_test | ||
c_data_integration_test | ||
hpp_array_stream | ||
hpp_buffer | ||
hpp_exception | ||
hpp_unique | ||
hpp_view) | ||
if(Arrow_FOUND) | ||
foreach(test_target ${NanoarrowTests}) | ||
target_compile_definitions(${test_target} | ||
PRIVATE -DNANOARROW_BUILD_TESTS_WITH_ARROW) | ||
endforeach() | ||
endif() | ||
|
||
include(GoogleTest) | ||
# Some users have reported a timeout with the default value of 5 | ||
# Building with -DBUILD_SHARED_LIBS=ON may also help reduce the size of test | ||
|
@@ -569,6 +593,11 @@ if(NANOARROW_BUILD_TESTS) | |
target_link_libraries(nanoarrow_ipc_${name}_test flatccrt) | ||
endif() | ||
|
||
if(Arrow_FOUND) | ||
target_compile_definitions(nanoarrow_ipc_${name}_test | ||
PRIVATE -DNANOARROW_BUILD_TESTS_WITH_ARROW) | ||
endif() | ||
|
||
gtest_discover_tests(nanoarrow_ipc_${name}_test) | ||
endforeach() | ||
|
||
|
@@ -593,6 +622,13 @@ if(NANOARROW_BUILD_TESTS) | |
gtest_main | ||
nanoarrow_coverage_config) | ||
|
||
if(Arrow_FOUND) | ||
target_compile_definitions(nanoarrow_device_test | ||
PRIVATE -DNANOARROW_BUILD_TESTS_WITH_ARROW) | ||
target_compile_definitions(nanoarrow_device_hpp_test | ||
PRIVATE -DNANOARROW_BUILD_TESTS_WITH_ARROW) | ||
endif() | ||
|
||
include(GoogleTest) | ||
gtest_discover_tests(nanoarrow_device_test) | ||
gtest_discover_tests(nanoarrow_device_hpp_test) | ||
|
@@ -604,6 +640,10 @@ if(NANOARROW_BUILD_TESTS) | |
nanoarrow | ||
gtest_main | ||
nanoarrow_coverage_config) | ||
if(Arrow_FOUND) | ||
target_compile_definitions(nanoarrow_device_metal_test | ||
PRIVATE -DNANOARROW_BUILD_TESTS_WITH_ARROW) | ||
endif() | ||
gtest_discover_tests(nanoarrow_device_metal_test) | ||
endif() | ||
|
||
|
@@ -615,6 +655,10 @@ if(NANOARROW_BUILD_TESTS) | |
CUDA::cuda_driver | ||
gtest_main | ||
nanoarrow_coverage_config) | ||
if(Arrow_FOUND) | ||
target_compile_definitions(nanoarrow_device_cuda_test | ||
PRIVATE -DNANOARROW_BUILD_TESTS_WITH_ARROW) | ||
endif() | ||
gtest_discover_tests(nanoarrow_device_cuda_test) | ||
endif() | ||
endif() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug", | ||
"NANOARROW_BUILD_TESTS": "ON" | ||
"NANOARROW_BUILD_TESTS_WITH_ARROW": "ON" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should probably leave this out of the defaults (I would keep it in my own CMakeUserPresets, but most people wouldn't need this when making their first contribution). |
||
} | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,12 +243,14 @@ test_cmake_project() { | |
|
||
test_c() { | ||
show_header "Build and test C library" | ||
test_cmake_project build . -DNANOARROW_BUILD_TESTS=ON -DNANOARROW_IPC=ON | ||
test_cmake_project build . -DNANOARROW_BUILD_TESTS=ON -DNANOARROW_IPC=ON \ | ||
-DNANOARROW_BUILD_TESTS_WITH_ARROW=ON | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For verification it would be useful to default this to OFF (because it significantly improves the instructions required for verifying). It can always be turned on (and perhaps we should turn it on in .github/workflows/verify.yaml) via the extra cmake args. |
||
} | ||
|
||
test_c_bundled() { | ||
show_header "Build test bundled C library" | ||
test_cmake_project build-bundled . -DNANOARROW_BUILD_TESTS=ON -DNANOARROW_IPC=ON -DNANOARROW_BUNDLE=ON | ||
test_cmake_project build-bundled . -DNANOARROW_BUILD_TESTS=ON -DNANOARROW_IPC=ON \ | ||
-DNANOARROW_BUILD_TESTS_WITH_ARROW=ON -DNANOARROW_BUNDLE=ON | ||
} | ||
|
||
test_r() { | ||
|
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.
...maybe?