From cb905f9d6daa64bca7d893b987610d2eecd35b8a Mon Sep 17 00:00:00 2001 From: Michael Fero Date: Tue, 16 Sep 2014 05:38:34 -0700 Subject: [PATCH 1/4] - Initial Travis-CI integration + Adding build configuration with dependencies against Ubuntu 12.04 + Updated README to contain build status image + Updated ignore to support dependencies --- .gitignore | 7 +++++++ .travis.yml | 11 +++++++++++ README.md | 2 ++ 3 files changed, 20 insertions(+) create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index 4ac23038a..5b329a245 100644 --- a/.gitignore +++ b/.gitignore @@ -67,5 +67,12 @@ Doxyfile *.suo *.opensdf +# Travis Build Dependencies +libuv-v* +lib/libuv/include/** +!lib/libuv/include/README +lib/libuv/lib/** +!lib/libuv/lib/README + config*.txt diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..15d9c2db8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: c++ +compiler: gcc +before_install: + - sudo apt-get update -qq + - sudo apt-get install libssl-dev -qq + - wget http://libuv.org/dist/v0.10.28/libuv-v0.10.28.tar.gz +install: + - tar xzf libuv-v0.10.28.tar.gz + - cd libuv-v0.10.28 && make && cd - && cp -r libuv-v0.10.28/libuv.a libuv-v0.10.28/libuv.so lib/libuv/lib && cp -r libuv-v0.10.28/include/* lib/libuv/include +before_script: cmake -DLIBUV_ROOT_DIR=lib/libuv/ . +script: make diff --git a/README.md b/README.md index afd3598ed..28191f575 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ DataStax C/C++ Driver for Apache Cassandra (Beta) =============================================== +[![Build Status](https://travis-ci.org/datastax/cpp-driver.svg?branch=travis-ci)](https://travis-ci.org/datastax/cpp-driver) + A C/C++ client driver for Apache Cassandra. This driver works exclusively with the Cassandra Query Language version 3 (CQL3) and Cassandra's Binary Protocol (version 1 and 2). From d0272276e700eef24e54b4dddfce47138064f920 Mon Sep 17 00:00:00 2001 From: Michael Fero Date: Thu, 18 Sep 2014 07:01:33 -0700 Subject: [PATCH 2/4] - Updated CMake configuration + Add preprocessor definition to ensure Boost does not use rvalue references (this allows the integration tests to build without c++11). + Added a check to validate CMAKE_CXX_COMPILER_VERSION variable existence and added a workaround to get the compiler version from gcc (CMAKE_CXX_COMPILER variables were not added until 2.8.x) + Ensured the LIBUV_INCLUDE_DIR discovered by the parent was used for the unit tests (fixes unit test build) - Changed INT64_MAX/MIN to use c++ numeric limits - Updating TavisCI configuration + Install libssh2 and build Boost v1.55 from source + Build tests and run unit tests (increases build status information) NOTE: CMake configuration needs some more TLC to work properly on CentOS5. The LIBSSH2 package available by the default yum repositories is v1.0.0 and method calls used by the integration tests were not available until v1.2.5. CMake configuration should check for LIBSSH2_ROOT_DIR similar to LIBUV_ROOT_DIR. --- .gitignore | 1 + .travis.yml | 13 +++++++++---- CMakeLists.txt | 8 +++++++- test/integration_tests/src/prepared.cpp | 4 ++-- test/unit_tests/CMakeLists.txt | 1 + 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 5b329a245..c54ad97ce 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,7 @@ lib/libuv/include/** !lib/libuv/include/README lib/libuv/lib/** !lib/libuv/lib/README +boost_1_* config*.txt diff --git a/.travis.yml b/.travis.yml index 15d9c2db8..bcc72af1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,15 @@ language: c++ compiler: gcc before_install: - sudo apt-get update -qq - - sudo apt-get install libssl-dev -qq - - wget http://libuv.org/dist/v0.10.28/libuv-v0.10.28.tar.gz + - sudo apt-get install libssl-dev libssh2-1-dev -qq + - wget -q http://libuv.org/dist/v0.10.28/libuv-v0.10.28.tar.gz + - wget -q http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download -O boost_1_55_0.tar.gz install: - tar xzf libuv-v0.10.28.tar.gz - - cd libuv-v0.10.28 && make && cd - && cp -r libuv-v0.10.28/libuv.a libuv-v0.10.28/libuv.so lib/libuv/lib && cp -r libuv-v0.10.28/include/* lib/libuv/include + - cd libuv-v0.10.28 && make && cd - && cp -r libuv-v0.10.28/libuv.a libuv-v0.10.28/libuv.so lib/libuv/lib && ln -s lib/libuv/lib/libuv.so lib/libuv/lib/libuv.so.0.10 && cp -r libuv-v0.10.28/include/* lib/libuv/include + - tar xzf boost_1_55_0.tar.gz + - cd boost_1_55_0 && ./bootstrap.sh --with-libraries=chrono,date_time,log,program_options,system,thread,test && sudo ./b2 install --prefix=/usr && cd - before_script: cmake -DLIBUV_ROOT_DIR=lib/libuv/ . -script: make +script: + - make + - test/unit_tests/cassandra_unit_tests diff --git a/CMakeLists.txt b/CMakeLists.txt index a803c2cc7..f4cbad228 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,7 +93,7 @@ endif() set(MULTICORE_CORES_NUMBER "3" CACHE STRING "Number of cores (for multicore compilation)") option(MULTICORE_COMPILATION "Enable multicore compilation" OFF) -set(TEST_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_THREAD_USES_MOVE") +set(TEST_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_THREAD_USES_MOVE -DBOOST_NO_CXX11_RVALUE_REFERENCES") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if(MULTICORE_COMPILATION) @@ -125,6 +125,12 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_definitions(-DBOOST_ALL_NO_LIB) add_definitions(-DNOMINMAX) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # CMAKE_CXX_COMPILER variables do not exist in 2.6.4 (min version) + # Parse the -dumpversion argument into the variable not already set + if ("${CMAKE_CXX_COMPILER_VERSION}" STREQUAL "") + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION) + endif() + # GCC specific compiler options # I disabled long-long warning because boost generates about 50 such warnings set(WARNING_COMPILER_FLAGS "-Wall -pedantic -Wextra -Werror -Wno-long-long -Wno-deprecated-declarations -Wno-unused-parameter") diff --git a/test/integration_tests/src/prepared.cpp b/test/integration_tests/src/prepared.cpp index 668c5328d..015e996a9 100644 --- a/test/integration_tests/src/prepared.cpp +++ b/test/integration_tests/src/prepared.cpp @@ -180,7 +180,7 @@ BOOST_AUTO_TEST_CASE(test_bound_all_types_different_values) all_types[0].id = test_utils::generate_time_uuid(); all_types[0].text_sample = cass_string_init("first"); all_types[0].int_sample = 10; - all_types[0].bigint_sample = INT64_MAX - 1L; + all_types[0].bigint_sample = std::numeric_limits::max() - 1L; all_types[0].float_sample = 1.999f; all_types[0].double_sample = 32.002; all_types[0].decimal_sample = cass_decimal_init(1, cass_bytes_init(varint1, sizeof(varint1))); @@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE(test_bound_all_types_different_values) all_types[2].id = test_utils::generate_time_uuid(); all_types[2].text_sample = cass_string_init("third"); all_types[2].int_sample = -100; - all_types[2].bigint_sample = INT64_MIN + 1; + all_types[2].bigint_sample = std::numeric_limits::min() + 1; all_types[2].float_sample = -150.111f; all_types[2].double_sample = -5.12342; all_types[2].decimal_sample = cass_decimal_init(3, cass_bytes_init(varint3, sizeof(varint3))); diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt index 69bc62838..65b5b0789 100644 --- a/test/unit_tests/CMakeLists.txt +++ b/test/unit_tests/CMakeLists.txt @@ -30,6 +30,7 @@ file(GLOB UNIT_TESTS_SRC_FILES ${PROJECT_SOURCE_DIR}/test/unit_tests/src/*.cpp) set(INCLUDES ${PROJECT_INCLUDE_DIR}) set(INCLUDES ${INCLUDES} "${PROJECT_SOURCE_DIR}/src") set(INCLUDES ${INCLUDES} ${Boost_INCLUDE_DIRS}) +set(INCLUDES ${INCLUDES} ${LIBUV_INCLUDE_DIR}) # Create source groups - this is only needed to create # neat folder structure in Visual Studio... From 0d4a2fc4fec2bfd9d926211909275770ed10708f Mon Sep 17 00:00:00 2001 From: Michael Fero Date: Thu, 18 Sep 2014 08:19:07 -0700 Subject: [PATCH 3/4] - Correcting the creation of the softlink for libuv - Silencing some of the output for Boost b2 install --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bcc72af1d..92cac34f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,9 @@ before_install: - wget -q http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download -O boost_1_55_0.tar.gz install: - tar xzf libuv-v0.10.28.tar.gz - - cd libuv-v0.10.28 && make && cd - && cp -r libuv-v0.10.28/libuv.a libuv-v0.10.28/libuv.so lib/libuv/lib && ln -s lib/libuv/lib/libuv.so lib/libuv/lib/libuv.so.0.10 && cp -r libuv-v0.10.28/include/* lib/libuv/include + - cd libuv-v0.10.28 && make -s && cd - 2&> /dev/null && cp -r libuv-v0.10.28/libuv.a libuv-v0.10.28/libuv.so lib/libuv/lib && cd lib/libuv/lib && ln -sf libuv.so libuv.so.0.10 && cd - 2&> /dev/null && cp -r libuv-v0.10.28/include/* lib/libuv/include - tar xzf boost_1_55_0.tar.gz - - cd boost_1_55_0 && ./bootstrap.sh --with-libraries=chrono,date_time,log,program_options,system,thread,test && sudo ./b2 install --prefix=/usr && cd - + - cd boost_1_55_0 && ./bootstrap.sh --with-libraries=chrono,date_time,log,program_options,system,thread,test && sudo ./b2 install --prefix=/usr -d0 && cd - before_script: cmake -DLIBUV_ROOT_DIR=lib/libuv/ . script: - make From 48d70b296c92c7636c5449b5172fbae72e2893de Mon Sep 17 00:00:00 2001 From: Michael Fero Date: Thu, 18 Sep 2014 08:31:50 -0700 Subject: [PATCH 4/4] Silencing another directory change to help with navigating through Travis-CI output log --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 92cac34f0..9e287236c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: - tar xzf libuv-v0.10.28.tar.gz - cd libuv-v0.10.28 && make -s && cd - 2&> /dev/null && cp -r libuv-v0.10.28/libuv.a libuv-v0.10.28/libuv.so lib/libuv/lib && cd lib/libuv/lib && ln -sf libuv.so libuv.so.0.10 && cd - 2&> /dev/null && cp -r libuv-v0.10.28/include/* lib/libuv/include - tar xzf boost_1_55_0.tar.gz - - cd boost_1_55_0 && ./bootstrap.sh --with-libraries=chrono,date_time,log,program_options,system,thread,test && sudo ./b2 install --prefix=/usr -d0 && cd - + - cd boost_1_55_0 && ./bootstrap.sh --with-libraries=chrono,date_time,log,program_options,system,thread,test && sudo ./b2 install --prefix=/usr -d0 && cd - 2&> /dev/null before_script: cmake -DLIBUV_ROOT_DIR=lib/libuv/ . script: - make