-
Notifications
You must be signed in to change notification settings - Fork 38
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
base: main
Are you sure you want to change the base?
Conversation
ad45d3e
to
bc80f47
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #677 +/- ##
==========================================
+ Coverage 86.29% 87.63% +1.34%
==========================================
Files 94 101 +7
Lines 13604 14537 +933
==========================================
+ Hits 11739 12739 +1000
+ Misses 1865 1798 -67
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
I know you're still working on this, but just two high level comments to think about:
- We probably want a CMake option of
-DNANOARROW_TESTS_WITH_ARROW
(where if it's ON, configuration will fail if Arrow is not found, and if it's OFF, tests are never built with arrow). Having it be automatic makes it relatively easy to accidentally think you are testing with Arrow C++ when CMake actually failed to locate it. - There are a few tests where the entire test is useless, but many of them only have Arrow C++ as a small component (notably: the schema init ones). It doesn't have to be perfect at the end of this PR, but before the next release we will ideally have full (or at least not reduced) test coverage without any of the Arrow C++ integration tests running.
- An alternative to compiling tests with a define is to move the (portions of) tests that need Arrow C++ to separate files (Arrow C++-specific integration tests, perhaps under integration/).
CMakeLists.txt
Outdated
# TODO: does this propoagate to projects using as a subproject? | ||
add_compile_definitions("-DNANOARROW_ARROW_FOUND") |
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.
I think it does. You probably want target_compile_definitions(xxxx_test PRIVATE -DNANOARROW_ARROW_FOUND)
for every test because the tests are what actually need this define set. You could do something fancy like we do with the nanoarrow_coverage_config
(define an interface target that the tests "link to"), or bite the bullet and use a foreach()
loop to link tests (sort of like you do in the meson config), which we probably should have done a while ago anyway.
bc80f47
to
3ffc2f7
Compare
@@ -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 comment
The 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
@@ -1719,7 +1812,8 @@ TEST(ArrayTest, ArrayTestAppendToRunEndEncodedArray) { | |||
EXPECT_EQ(ArrowArrayFinishBuilding(&array, NANOARROW_VALIDATION_LEVEL_FULL, &error), | |||
NANOARROW_OK); | |||
|
|||
#if !defined(ARROW_VERSION_MAJOR) || ARROW_VERSION_MAJOR < 12 | |||
#if !defined(NANOARROW_BUILD_TESTS_WITH_ARROW) || !defined(ARROW_VERSION_MAJOR) || \ |
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.
Do we want to add this here or leave as is?
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.
Either is OK by me! I think it makes sense that if the version isn't defined that we didn't build with arrow C++ (but also it might make searching for all the Arrow C++ conditional test blocks easier to include the extra check).
e7959e0
to
7db51a6
Compare
CMakeLists.txt
Outdated
find_package(Arrow REQUIRED) | ||
message(STATUS "Arrow version: ${ARROW_VERSION}") | ||
message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}") | ||
find_package(Arrow) |
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.
find_package(Arrow) | |
if(NANOARROW_BUILD_TESTS_WITH_ARROW) | |
find_package(Arrow REQUIRED) | |
endif() | |
...maybe?
CMakePresets.json
Outdated
@@ -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 comment
The 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).
@@ -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 comment
The 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.
@@ -1719,7 +1812,8 @@ TEST(ArrayTest, ArrayTestAppendToRunEndEncodedArray) { | |||
EXPECT_EQ(ArrowArrayFinishBuilding(&array, NANOARROW_VALIDATION_LEVEL_FULL, &error), | |||
NANOARROW_OK); | |||
|
|||
#if !defined(ARROW_VERSION_MAJOR) || ARROW_VERSION_MAJOR < 12 | |||
#if !defined(NANOARROW_BUILD_TESTS_WITH_ARROW) || !defined(ARROW_VERSION_MAJOR) || \ |
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.
Either is OK by me! I think it makes sense that if the version isn't defined that we didn't build with arrow C++ (but also it might make searching for all the Arrow C++ conditional test blocks easier to include the extra check).
f0b8ca9
to
01ce608
Compare
01ce608
to
76af997
Compare
No description provided.