From 2404098a2d7f52839e2a29f720b1bc2b71c6ac12 Mon Sep 17 00:00:00 2001 From: Tushar Maheshwari Date: Mon, 12 Sep 2016 15:29:42 +0530 Subject: [PATCH 1/7] Adding travis integration Starting with a linux container with an apt add-on for new g++ compiler. --- .travis.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..1e184437 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +sudo: false +language: generic + +cache: + apt: true + +matrix: + include: + - os: linux + compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - cmake + - g++-5 + env: COMPILER=g++-5 + +before_script: +- cmake --version +- ./deps.sh + +script: +- mkdir build +- cd build +- cmake -DCMAKE_CXX_COMPILER=$COMPILER .. && make && make test From 20d5f40c546274280fd2dae62f029cf597f65470 Mon Sep 17 00:00:00 2001 From: Tushar Maheshwari Date: Mon, 12 Sep 2016 18:35:10 +0530 Subject: [PATCH 2/7] Travis (#1) * Modify travis config Get the required version of cmake binaries from their website. * Travis config modification Add librt linking because of old glibc in precise. * Travis modify config Changing LibRt binding for cmake. * [trial] Travis config simplify Remove unused variables --- .travis.yml | 8 +++++--- CMakeLists.txt | 1 + cmake/modules/FindLibRt.cmake | 38 +++++++++++++++++++++++++++++++++++ test/CMakeLists.txt | 1 + 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 cmake/modules/FindLibRt.cmake diff --git a/.travis.yml b/.travis.yml index 1e184437..5bb1a4b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -sudo: false language: generic cache: @@ -13,15 +12,18 @@ matrix: sources: - ubuntu-toolchain-r-test packages: - - cmake - g++-5 env: COMPILER=g++-5 +before_install: +- mkdir -p ~/.cmake +- export PATH=$HOME/.cmake/cmake-3.6.2-Linux-x86_64/bin:$PATH +- travis_retry curl -s https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz | tar -xz -C ~/.cmake + before_script: - cmake --version - ./deps.sh script: -- mkdir build - cd build - cmake -DCMAKE_CXX_COMPILER=$COMPILER .. && make && make test diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c4d7190..fa902b31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,7 @@ find_package(UV REQUIRED) find_package(Threads REQUIRED) find_package(GoogleTest) find_package(Doxygen 1.8) +find_package(LibRt) # # Referenced directories and targets diff --git a/cmake/modules/FindLibRt.cmake b/cmake/modules/FindLibRt.cmake new file mode 100644 index 00000000..7fd2c9db --- /dev/null +++ b/cmake/modules/FindLibRt.cmake @@ -0,0 +1,38 @@ +#.rst: +# FindLibRt +# -------- +# +# Find the native realtime includes and library. +# +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``LIBRT::LIBRT``, if +# LIBRT has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: +# +# :: +# +# LIBRT_INCLUDE_DIRS - where to find time.h, etc. +# LIBRT_LIBRARIES - List of libraries when using librt. +# LIBRT_FOUND - True if realtime library found. +# +# Hints +# ^^^^^ +# +# A user may set ``LIBRT_ROOT`` to a realtime installation root to tell this +# module where to look. + +find_path(LIBRT_INCLUDE_DIRS + NAMES time.h + PATHS ${LIBRT_ROOT}/include/ +) +find_library(LIBRT_LIBRARIES rt) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LibRt DEFAULT_MSG LIBRT_LIBRARIES LIBRT_INCLUDE_DIRS) +mark_as_advanced(LIBRT_INCLUDE_DIRS LIBRT_LIBRARIES) + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6a185f4c..c4ff6128 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,6 +16,7 @@ set( ${CMAKE_THREAD_LIBS_INIT} ${GOOGLETEST_LIBRARIES} ${UV_LIBRARIES} + ${LIBRT_LIBRARIES} ) # List of available targets From da69e968b7399d9827f7faeeedcaa0427da700fb Mon Sep 17 00:00:00 2001 From: Tushar Maheshwari Date: Mon, 12 Sep 2016 19:21:11 +0530 Subject: [PATCH 3/7] [minor] delete irrelevant comments --- cmake/modules/FindLibRt.cmake | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cmake/modules/FindLibRt.cmake b/cmake/modules/FindLibRt.cmake index 7fd2c9db..caf7ac2b 100644 --- a/cmake/modules/FindLibRt.cmake +++ b/cmake/modules/FindLibRt.cmake @@ -1,15 +1,8 @@ -#.rst: # FindLibRt # -------- # # Find the native realtime includes and library. # -# IMPORTED Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines :prop_tgt:`IMPORTED` target ``LIBRT::LIBRT``, if -# LIBRT has been found. -# # Result Variables # ^^^^^^^^^^^^^^^^ # From 11b2b5cde726d3ef1a17b14d59e28c9659d75b6a Mon Sep 17 00:00:00 2001 From: Tushar Maheshwari Date: Mon, 12 Sep 2016 20:22:58 +0530 Subject: [PATCH 4/7] [trial] reduction of test compile time (#2) --- test/CMakeLists.txt | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c4ff6128..2a34c6c0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -19,6 +19,9 @@ set( ${LIBRT_LIBRARIES} ) +add_library(odr OBJECT odr.cpp) +target_include_directories(odr PRIVATE ${COMMON_INCLUDE_DIRS}) + # List of available targets set(TARGET_MAIN main) @@ -34,7 +37,7 @@ set(TARGET_WORK work) # Test TARGET_MAIN -set(TARGET_MAIN_SOURCES odr.cpp main.cpp) +set(TARGET_MAIN_SOURCES $ main.cpp) add_executable(${TARGET_MAIN} ${TARGET_MAIN_SOURCES}) target_include_directories(${TARGET_MAIN} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_MAIN} PRIVATE ${COMMON_LINK_LIBS}) @@ -42,7 +45,7 @@ add_test(NAME ${TARGET_MAIN} COMMAND ${TARGET_MAIN}) # Test TARGET_ASYNC -set(TARGET_ASYNC_SOURCES odr.cpp uvw/async.cpp) +set(TARGET_ASYNC_SOURCES $ uvw/async.cpp) add_executable(${TARGET_ASYNC} ${TARGET_ASYNC_SOURCES}) target_include_directories(${TARGET_ASYNC} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_ASYNC} PRIVATE ${COMMON_LINK_LIBS}) @@ -50,7 +53,7 @@ add_test(NAME ${TARGET_ASYNC} COMMAND ${TARGET_ASYNC}) # Test TARGET_CHECK -set(TARGET_CHECK_SOURCES odr.cpp uvw/check.cpp) +set(TARGET_CHECK_SOURCES $ uvw/check.cpp) add_executable(${TARGET_CHECK} ${TARGET_CHECK_SOURCES}) target_include_directories(${TARGET_CHECK} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_CHECK} PRIVATE ${COMMON_LINK_LIBS}) @@ -58,7 +61,7 @@ add_test(NAME ${TARGET_CHECK} COMMAND ${TARGET_CHECK}) # Test TARGET_EMITTER -set(TARGET_EMITTER_SOURCES odr.cpp uvw/emitter.cpp) +set(TARGET_EMITTER_SOURCES $ uvw/emitter.cpp) add_executable(${TARGET_EMITTER} ${TARGET_EMITTER_SOURCES}) target_include_directories(${TARGET_EMITTER} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_EMITTER} PRIVATE ${COMMON_LINK_LIBS}) @@ -66,7 +69,7 @@ add_test(NAME ${TARGET_EMITTER} COMMAND ${TARGET_EMITTER}) # Test TARGET_IDLE -set(TARGET_IDLE_SOURCES odr.cpp uvw/idle.cpp) +set(TARGET_IDLE_SOURCES $ uvw/idle.cpp) add_executable(${TARGET_IDLE} ${TARGET_IDLE_SOURCES}) target_include_directories(${TARGET_IDLE} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_IDLE} PRIVATE ${COMMON_LINK_LIBS}) @@ -74,7 +77,7 @@ add_test(NAME ${TARGET_IDLE} COMMAND ${TARGET_IDLE}) # Test TARGET_LOOP -set(TARGET_LOOP_SOURCES odr.cpp uvw/loop.cpp) +set(TARGET_LOOP_SOURCES $ uvw/loop.cpp) add_executable(${TARGET_LOOP} ${TARGET_LOOP_SOURCES}) target_include_directories(${TARGET_LOOP} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_LOOP} PRIVATE ${COMMON_LINK_LIBS}) @@ -82,7 +85,7 @@ add_test(NAME ${TARGET_LOOP} COMMAND ${TARGET_LOOP}) # Test TARGET_PREPARE -set(TARGET_PREPARE_SOURCES odr.cpp uvw/prepare.cpp) +set(TARGET_PREPARE_SOURCES $ uvw/prepare.cpp) add_executable(${TARGET_PREPARE} ${TARGET_PREPARE_SOURCES}) target_include_directories(${TARGET_PREPARE} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_PREPARE} PRIVATE ${COMMON_LINK_LIBS}) @@ -90,7 +93,7 @@ add_test(NAME ${TARGET_PREPARE} COMMAND ${TARGET_PREPARE}) # Test TARGET_SIGNAL -set(TARGET_SIGNAL_SOURCES odr.cpp uvw/signal.cpp) +set(TARGET_SIGNAL_SOURCES $ uvw/signal.cpp) add_executable(${TARGET_SIGNAL} ${TARGET_SIGNAL_SOURCES}) target_include_directories(${TARGET_SIGNAL} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_SIGNAL} PRIVATE ${COMMON_LINK_LIBS}) @@ -98,7 +101,7 @@ add_test(NAME ${TARGET_SIGNAL} COMMAND ${TARGET_SIGNAL}) # Test TARGET_TIMER -set(TARGET_TIMER_SOURCES odr.cpp uvw/timer.cpp) +set(TARGET_TIMER_SOURCES $ uvw/timer.cpp) add_executable(${TARGET_TIMER} ${TARGET_TIMER_SOURCES}) target_include_directories(${TARGET_TIMER} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_TIMER} PRIVATE ${COMMON_LINK_LIBS}) @@ -106,7 +109,7 @@ add_test(NAME ${TARGET_TIMER} COMMAND ${TARGET_TIMER}) # Test TARGET_WORK -set(TARGET_WORK_SOURCES odr.cpp uvw/work.cpp) +set(TARGET_WORK_SOURCES $ uvw/work.cpp) add_executable(${TARGET_WORK} ${TARGET_WORK_SOURCES}) target_include_directories(${TARGET_WORK} PRIVATE ${COMMON_INCLUDE_DIRS}) target_link_libraries(${TARGET_WORK} PRIVATE ${COMMON_LINK_LIBS}) From dd1a8741396c27f0710dc4bc76cce223678434ae Mon Sep 17 00:00:00 2001 From: Tushar Maheshwari Date: Mon, 12 Sep 2016 20:24:47 +0530 Subject: [PATCH 5/7] Update README.md Add travis badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 450eaf6c..f9e5fc5a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ # uvw +[![Build Status](https://travis-ci.org/tusharpm/uvw.svg?branch=master)](https://travis-ci.org/tusharpm/uvw) + # Introduction `uvw` is a header-only, event based, tiny and easy to use *libuv* wrapper in modern C++.
From b2e17090c304efef4845574b5ec5626db2689cba Mon Sep 17 00:00:00 2001 From: Tushar Maheshwari Date: Tue, 13 Sep 2016 18:01:02 +0530 Subject: [PATCH 6/7] Travis fixes (#3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add more rows to travis matrix Add OS X new image * Travis build fixes Use the filesystem and the user’s directory which is already included in PATH * travis get tests running on new OS X image The rpath configuration for uv needs libuv.dylib in /usr/local/lib. It’s easier to static link for tests instead. * OS X cannot set sigaction on 42 Use 2 (SIGINT) for the test. --- .travis.yml | 51 ++++++++++++++++++++++++++------------------- test/CMakeLists.txt | 7 +++++-- test/uvw/signal.cpp | 4 ++-- travis.sh | 16 ++++++++++++++ 4 files changed, 53 insertions(+), 25 deletions(-) create mode 100755 travis.sh diff --git a/.travis.yml b/.travis.yml index 5bb1a4b9..faae31b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,38 @@ -language: generic -cache: - apt: true +os: +- linux matrix: include: - - os: linux - compiler: gcc - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-5 - env: COMPILER=g++-5 + - os: osx + osx_image: xcode7.3 -before_install: -- mkdir -p ~/.cmake -- export PATH=$HOME/.cmake/cmake-3.6.2-Linux-x86_64/bin:$PATH -- travis_retry curl -s https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz | tar -xz -C ~/.cmake +addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.8 + packages: + - gcc-5 + - g++-5 + - clang-3.8 -before_script: +language: cpp +compiler: +- gcc +- clang + +before_install: ./travis.sh + +install: +- if [ "$CXX" = "g++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="g++-5" CC="gcc-5"; fi +- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.8" CC="clang-3.8"; fi +- echo ${PATH} +- echo ${CXX} +- ${CXX} --version +- ${CXX} -v - cmake --version -- ./deps.sh -script: -- cd build -- cmake -DCMAKE_CXX_COMPILER=$COMPILER .. && make && make test +before_script: ./deps.sh + +script: mkdir -p build && cd build && cmake .. && make && make test diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2a34c6c0..00699f69 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,10 +15,13 @@ set( COMMON_LINK_LIBS ${CMAKE_THREAD_LIBS_INIT} ${GOOGLETEST_LIBRARIES} - ${UV_LIBRARIES} - ${LIBRT_LIBRARIES} + ${UV_STATIC_LIBRARY} ) +if(${LIBRT_FOUND}) + list(APPEND COMMON_LINK_LIBS ${LIBRT_LIBRARIES}) +endif(${LIBRT_FOUND}) + add_library(odr OBJECT odr.cpp) target_include_directories(odr PRIVATE ${COMMON_INCLUDE_DIRS}) diff --git a/test/uvw/signal.cpp b/test/uvw/signal.cpp index c57a7e99..4bbbb143 100644 --- a/test/uvw/signal.cpp +++ b/test/uvw/signal.cpp @@ -10,9 +10,9 @@ TEST(Signal, Fake) { handle->on(l); handle->on(l); - handle->start(42); + handle->start(2); - ASSERT_EQ(42, handle->signal()); + ASSERT_EQ(2, handle->signal()); handle->stop(); handle->close(); diff --git a/travis.sh b/travis.sh new file mode 100755 index 00000000..b05ec793 --- /dev/null +++ b/travis.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +USER_PATH_DIR=~/bin +TEMP_DIR=~/.cmake +mkdir -p ${USER_PATH_DIR} +mkdir -p ${TEMP_DIR} + +if [ "$TRAVIS_OS_NAME" == "linux" ]; then + curl -s https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz | tar -xz -C ${TEMP_DIR} + ln -s ${TEMP_DIR}/cmake-3.6.2-Linux-x86_64/bin/cmake ${USER_PATH_DIR} +fi + +if [ "$TRAVIS_OS_NAME" == "osx" ]; then + curl -s https://cmake.org/files/v3.6/cmake-3.6.2-Darwin-x86_64.tar.gz | tar -xz -C ${TEMP_DIR} + "${TEMP_DIR}/cmake-3.6.2-Darwin-x86_64/CMake.app/Contents/bin/cmake-gui" --install=${USER_PATH_DIR} +fi From e44ae4bcbf09eeba1a86fe16622a1bcd7661f89b Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sat, 17 Sep 2016 19:54:14 +0200 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f9e5fc5a..0e3f2e2f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # uvw -[![Build Status](https://travis-ci.org/tusharpm/uvw.svg?branch=master)](https://travis-ci.org/tusharpm/uvw) +[![Build Status](https://travis-ci.org/skypjack/uvw.svg?branch=master)](https://travis-ci.org/skypjack/uvw) # Introduction