You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/06/11 20:45:41 UTC

[arrow] branch master updated: ARROW-5407: [C++] Allow building only integration test targets

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

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


The following commit(s) were added to refs/heads/master by this push:
     new e4f10c3  ARROW-5407: [C++] Allow building only integration test targets
e4f10c3 is described below

commit e4f10c3a88576b8a23ea5228f9aab393c6b08677
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Tue Jun 11 15:45:27 2019 -0500

    ARROW-5407: [C++] Allow building only integration test targets
    
    Author: Antoine Pitrou <an...@python.org>
    
    Closes #4458 from pitrou/ARROW-5407-build-integration-cpp and squashes the following commits:
    
    a35c7345b <Antoine Pitrou> ARROW-5407:  Allow building only integration test targets
---
 .travis.yml                                 | 14 +++++++----
 ci/travis_before_script_cpp.sh              | 21 +++++++++-------
 cpp/cmake_modules/DefineOptions.cmake       |  3 +++
 cpp/cmake_modules/ThirdpartyToolchain.cmake |  8 ++++--
 cpp/src/arrow/CMakeLists.txt                | 12 +++++++--
 cpp/src/arrow/flight/CMakeLists.txt         | 19 +++++++++------
 cpp/src/arrow/ipc/CMakeLists.txt            | 38 ++++++++++++++---------------
 7 files changed, 70 insertions(+), 45 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index ab29ec8..0c0f9fc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -233,19 +233,23 @@ matrix:
     env:
     - ARROW_TRAVIS_USE_TOOLCHAIN=1
     - ARROW_TRAVIS_FLIGHT=1
-    - ARROW_TRAVIS_PLASMA=1
-    - ARROW_TRAVIS_PLASMA_JAVA_CLIENT=1
-    - ARROW_TRAVIS_USE_TOOLCHAIN=1
+    - ARROW_TRAVIS_INTEGRATION=1
+    # TODO(ARROW-4764): Using system java and plasma built with conda doesn't work
+    #- ARROW_TRAVIS_PLASMA=1
+    #- ARROW_TRAVIS_PLASMA_JAVA_CLIENT=1
     before_script:
     - if [ $ARROW_CI_INTEGRATION_AFFECTED != "1" ]; then exit; fi
     - $TRAVIS_BUILD_DIR/ci/travis_install_clang_tools.sh
     - $TRAVIS_BUILD_DIR/ci/travis_install_linux.sh
+    # C++: Only build integration targets
+    - export ARROW_CPP_BUILD_TARGETS=arrow-integration
+    - export ARROW_TRAVIS_OPTIONAL_INSTALL=1
+    - $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
+    # Javascript
     - nvm install 11.12
     - $TRAVIS_BUILD_DIR/ci/travis_before_script_js.sh
-    - $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
     script:
     - $TRAVIS_BUILD_DIR/ci/travis_script_integration.sh
-    # TODO(ARROW-4764): Using system java and plasma built with conda doesn't work
     # - $TRAVIS_BUILD_DIR/ci/travis_script_plasma_java_client.sh
   - name: "NodeJS"
     language: node_js
diff --git a/ci/travis_before_script_cpp.sh b/ci/travis_before_script_cpp.sh
index ca01b55..0dca5e1 100755
--- a/ci/travis_before_script_cpp.sh
+++ b/ci/travis_before_script_cpp.sh
@@ -51,6 +51,7 @@ pushd $ARROW_CPP_BUILD_DIR
 CMAKE_COMMON_FLAGS="\
 -DCMAKE_INSTALL_PREFIX=$ARROW_CPP_INSTALL \
 -DARROW_NO_DEPRECATED_API=ON \
+-DARROW_INSTALL_NAME_RPATH=OFF \
 -DARROW_EXTRA_ERROR_CONTEXT=ON"
 CMAKE_LINUX_FLAGS=""
 CMAKE_OSX_FLAGS="\
@@ -63,17 +64,15 @@ fi
 
 if [ $only_library_mode == "yes" ]; then
   CMAKE_COMMON_FLAGS="\
-$CMAKE_COMMON_FLAGS \
--DARROW_BUILD_UTILITIES=OFF \
--DARROW_INSTALL_NAME_RPATH=OFF"
+    $CMAKE_COMMON_FLAGS \
+    -DARROW_BUILD_UTILITIES=OFF"
 else
   CMAKE_COMMON_FLAGS="\
-$CMAKE_COMMON_FLAGS \
--DARROW_BUILD_BENCHMARKS=ON \
--DARROW_BUILD_TESTS=ON \
--DARROW_BUILD_EXAMPLES=ON \
--DARROW_BUILD_UTILITIES=ON \
--DARROW_INSTALL_NAME_RPATH=OFF"
+    $CMAKE_COMMON_FLAGS \
+    -DARROW_BUILD_BENCHMARKS=ON \
+    -DARROW_BUILD_TESTS=ON \
+    -DARROW_BUILD_EXAMPLES=ON \
+    -DARROW_BUILD_UTILITIES=ON"
 fi
 
 ARROW_CXXFLAGS=""
@@ -91,6 +90,10 @@ if [ "$ARROW_TRAVIS_FLIGHT" == "1" ]; then
   CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_FLIGHT=ON"
 fi
 
+if [ "$ARROW_TRAVIS_INTEGRATION" == "1" ]; then
+  CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_BUILD_INTEGRATION=ON"
+fi
+
 if [ "$ARROW_TRAVIS_PLASMA" == "1" ]; then
   CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_PLASMA=ON"
 fi
diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake
index d041da5..a883b87 100644
--- a/cpp/cmake_modules/DefineOptions.cmake
+++ b/cpp/cmake_modules/DefineOptions.cmake
@@ -93,6 +93,9 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
   define_option(ARROW_BUILD_TESTS "Build the Arrow googletest unit tests, default OFF"
                 OFF)
 
+  define_option(ARROW_BUILD_INTEGRATION
+                "Build the Arrow integration test executables, default OFF" OFF)
+
   define_option(ARROW_BUILD_BENCHMARKS "Build the Arrow micro benchmarks, default OFF"
                 OFF)
 
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index a936ce2..1fe04d7 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -810,7 +810,11 @@ endif()
 # ----------------------------------------------------------------------
 # gflags
 
-if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS OR ARROW_USE_GLOG OR ARROW_WITH_GRPC)
+if(ARROW_BUILD_TESTS
+   OR ARROW_BUILD_BENCHMARKS
+   OR ARROW_BUILD_INTEGRATION
+   OR ARROW_USE_GLOG
+   OR ARROW_WITH_GRPC)
   set(ARROW_NEED_GFLAGS 1)
 else()
   set(ARROW_NEED_GFLAGS 0)
@@ -1283,7 +1287,7 @@ macro(build_gtest)
   add_dependencies(GTest::GMock googletest_ep)
 endmacro()
 
-if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
+if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS OR ARROW_BUILD_INTEGRATION)
   resolve_dependency(GTest)
 
   if(NOT GTEST_VENDORED)
diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt
index bfb4245..08f676a 100644
--- a/cpp/src/arrow/CMakeLists.txt
+++ b/cpp/src/arrow/CMakeLists.txt
@@ -19,7 +19,12 @@ add_custom_target(arrow-all)
 add_custom_target(arrow)
 add_custom_target(arrow-benchmarks)
 add_custom_target(arrow-tests)
-add_dependencies(arrow-all arrow arrow-tests arrow-benchmarks)
+add_custom_target(arrow-integration)
+add_dependencies(arrow-all
+                 arrow
+                 arrow-tests
+                 arrow-benchmarks
+                 arrow-integration)
 
 # Adding unit tests part of the "arrow" portion of the test suite
 function(ADD_ARROW_TEST REL_TEST_NAME)
@@ -285,7 +290,7 @@ if(ARROW_BUILD_STATIC AND WIN32)
   target_compile_definitions(arrow_static PUBLIC ARROW_STATIC)
 endif()
 
-if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
+if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS OR ARROW_BUILD_INTEGRATION)
   # that depend on gtest
   add_arrow_lib(arrow_testing
                 SOURCES
@@ -304,6 +309,9 @@ if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
                 STATIC_LINK_LIBS
                 arrow_static)
 
+  add_custom_target(arrow_testing)
+  add_dependencies(arrow_testing ${ARROW_TESTING_LIBRARIES})
+
   if(ARROW_BUILD_STATIC AND WIN32)
     target_compile_definitions(arrow_testing_static PUBLIC ARROW_STATIC)
   endif()
diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt
index a46e776..5f193f6 100644
--- a/cpp/src/arrow/flight/CMakeLists.txt
+++ b/cpp/src/arrow/flight/CMakeLists.txt
@@ -106,7 +106,7 @@ foreach(LIB_TARGET ${ARROW_FLIGHT_LIBRARIES})
 endforeach()
 
 # Define arrow_flight_testing library
-if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
+if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS OR ARROW_BUILD_INTEGRATION)
   add_arrow_lib(arrow_flight_testing
                 OUTPUTS
                 ARROW_FLIGHT_TESTING_LIBRARIES
@@ -146,6 +146,14 @@ if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
   target_link_libraries(flight-test-server ${ARROW_FLIGHT_TEST_LINK_LIBS}
                         ${GFLAGS_LIBRARIES} GTest::GTest)
 
+  if(ARROW_BUILD_TESTS)
+    add_dependencies(arrow-flight-test flight-test-server)
+  endif()
+
+  add_dependencies(arrow_flight flight-test-server)
+endif()
+
+if(ARROW_BUILD_INTEGRATION)
   add_executable(flight-test-integration-server test-integration-server.cc)
   target_link_libraries(flight-test-integration-server ${ARROW_FLIGHT_TEST_LINK_LIBS}
                         ${GFLAGS_LIBRARIES} GTest::GTest)
@@ -154,12 +162,9 @@ if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
   target_link_libraries(flight-test-integration-client ${ARROW_FLIGHT_TEST_LINK_LIBS}
                         ${GFLAGS_LIBRARIES} GTest::GTest)
 
-  # This is needed for the unit tests
-  if(ARROW_BUILD_TESTS)
-    add_dependencies(arrow-flight-test flight-test-server)
-  endif()
-
-  add_dependencies(arrow_flight flight-test-server flight-test-integration-client
+  add_dependencies(arrow_flight flight-test-integration-client
+                   flight-test-integration-server)
+  add_dependencies(arrow-integration flight-test-integration-client
                    flight-test-integration-server)
 endif()
 
diff --git a/cpp/src/arrow/ipc/CMakeLists.txt b/cpp/src/arrow/ipc/CMakeLists.txt
index e79c1ff..3e19304 100644
--- a/cpp/src/arrow/ipc/CMakeLists.txt
+++ b/cpp/src/arrow/ipc/CMakeLists.txt
@@ -15,10 +15,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# Targets required for protocol integration testing
-add_custom_target(integration)
-add_dependencies(arrow-tests integration)
-
 #
 # Messaging and interprocess communication
 
@@ -28,19 +24,19 @@ add_arrow_test(json-simple-test PREFIX "arrow-ipc")
 add_arrow_test(json-test PREFIX "arrow-ipc")
 
 if(NOT ARROW_BOOST_HEADER_ONLY)
-  add_arrow_test(json-integration-test EXTRA_LINK_LIBS ${GFLAGS_LIBRARIES})
-
-  # Test is being built
-  if(TARGET arrow-json-integration-test)
-    add_dependencies(integration arrow-json-integration-test)
-    if(UNIX)
-      if(APPLE)
-        set_target_properties(arrow-json-integration-test
-                              PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
-      else()
-        target_link_libraries(arrow-json-integration-test PRIVATE pthread)
-      endif()
-    endif()
+  # json-integration-test is two things at the same time:
+  # - an executable that can be called to answer integration test requests
+  # - a self-(unit)test for the C++ side of integration testing
+  if(ARROW_BUILD_TESTS)
+    add_arrow_test(json-integration-test EXTRA_LINK_LIBS ${GFLAGS_LIBRARIES})
+    add_dependencies(arrow-integration arrow-json-integration-test)
+  elseif(ARROW_BUILD_INTEGRATION)
+    add_executable(arrow-json-integration-test json-integration-test.cc)
+    target_link_libraries(arrow-json-integration-test ${ARROW_TEST_LINK_LIBS}
+                          ${GFLAGS_LIBRARIES} GTest::GTest)
+
+    add_dependencies(arrow-json-integration-test arrow arrow_testing)
+    add_dependencies(arrow-integration arrow-json-integration-test)
   endif()
 endif()
 
@@ -92,14 +88,16 @@ else()
   set(ARROW_UTIL_LIB arrow_shared)
 endif()
 
-if(ARROW_BUILD_UTILITIES)
+if(ARROW_BUILD_UTILITIES OR ARROW_BUILD_INTEGRATION)
   add_executable(arrow-file-to-stream file-to-stream.cc)
   target_link_libraries(arrow-file-to-stream ${ARROW_UTIL_LIB})
   add_executable(arrow-stream-to-file stream-to-file.cc)
   target_link_libraries(arrow-stream-to-file ${ARROW_UTIL_LIB})
 
-  add_dependencies(integration arrow-file-to-stream)
-  add_dependencies(integration arrow-stream-to-file)
+  if(ARROW_BUILD_INTEGRATION)
+    add_dependencies(arrow-integration arrow-file-to-stream)
+    add_dependencies(arrow-integration arrow-stream-to-file)
+  endif()
 endif()
 
 add_arrow_benchmark(read-write-benchmark PREFIX "arrow-ipc")