Skip to content

Commit

Permalink
Problem: Dependency on googletest framework
Browse files Browse the repository at this point in the history
Currently cppzmq as relatively simple and header only library depends on rather
complex unit test framework googletest.
Current issues:
- Googletest requires downloading and building it every time on travis
as cache support is limited there
- Googletest build is signifficant with comparison to cppzmq unittests
total runtime

Solution: Port existing tests to Catch - header only C++ framework and
gain ~20% build speed up on travis.

Why Catch?
It is well know C++ header only testing framework. It works well, it is
being kept up to date and maintainers seem to pay attention to
community's comments and issues.
We can not use Catch2 currently as we still support pre-C++11 compilers.
  • Loading branch information
kurdybacha committed Oct 17, 2018
1 parent 5af2431 commit ae15964
Show file tree
Hide file tree
Showing 18 changed files with 332 additions and 389 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ There are other C++ bindings for ZeroMQ with different design goals. In particul
Supported platforms
===================

- Only a subset of the platforms that are supported by libzmq itself are supported. Some features already require a compiler supporting C++11. In the future, probably all features will require C++11. To build and run the tests, cmake and googletest are required.
- Only a subset of the platforms that are supported by libzmq itself are supported. Some features already require a compiler supporting C++11. In the future, probably all features will require C++11. To build and run the tests, CMake and Catch are required.
- Tested libzmq versions are
- 4.2.0 (without DRAFT API)
- 4.2.5 (with and without DRAFT API)
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ environment:

cache:
- libzmq -> appveyor.yml
- Build/tests/googletest -> tests/cmake/googletest-download.cmake
- Build/catch -> tests/cmake/catch.cmake

before_build:
- if not exist libzmq (
Expand Down
1 change: 0 additions & 1 deletion external/gtest-demo/INFO.md

This file was deleted.

27 changes: 0 additions & 27 deletions external/gtest-demo/LICENSE

This file was deleted.

17 changes: 7 additions & 10 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})

include(cmake/googletest.cmake)
fetch_googletest(
${PROJECT_SOURCE_DIR}/cmake
${PROJECT_BINARY_DIR}/googletest
)
include(cmake/catch.cmake)

add_executable(
unit_tests
Expand All @@ -24,14 +20,15 @@ add_executable(
active_poller.cpp
multipart.cpp
monitor.cpp
)
)

add_dependencies(unit_tests catch)

target_include_directories(unit_tests PUBLIC ${CATCH_INCLUDE_DIR})
target_link_libraries(
unit_tests
PRIVATE gtest
PRIVATE gmock_main
PRIVATE cppzmq
)
)

OPTION (COVERAGE "Enable gcda file generation needed by lcov" OFF)

Expand All @@ -45,4 +42,4 @@ add_test(
unit
COMMAND
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/unit_tests
)
)
Loading

0 comments on commit ae15964

Please sign in to comment.