Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
KEP-527 Add code coverage to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ebruck committed Aug 16, 2018
1 parent 6d2cfae commit 572b5fa
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ matrix:
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- CMAKE_URL="http://cmake.org/files/v3.11/cmake-3.11.0-Linux-x86_64.tar.gz"
- CMAKE_COMMAND="$HOME/.local/bin/cmake -DPMD_EXE=$HOME/pmd-bin-6.6.0/bin/run.sh "
- CMAKE_COMMAND="$HOME/.local/bin/cmake -DPMD_EXE=$HOME/pmd-bin-6.6.0/bin/run.sh -DENABLE_GCOV=ON "

- os: osx
osx_image: xcode9.4
Expand All @@ -47,6 +47,7 @@ cache:
- $HOME/.local

before_install:
- pip install --user cpp-coveralls
- eval "${MATRIX_EVAL}"
- mkdir -p $HOME/.local
- |
Expand Down Expand Up @@ -95,6 +96,10 @@ script:
- make package

after_success:
- |
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
coveralls -r ${TRAVIS_BUILD_DIR} -E '\*/test/\*' -E '\*proto/\*' -E '\*swarm/\*' -E '\*mocks/\*' --gcov-options '\-lp'
fi
- echo ${TRAVIS_BRANCH}
- if [ "$TRAVIS_BRANCH" = "master" ] ; then PACKAGE_COMPONENT="stable" ; else PACKAGE_COMPONENT="unstable" ; fi
- |
Expand All @@ -111,4 +116,3 @@ after_success:
git remote add origin-swarm https://${GITHUB_TOKEN}@github.com/bluzelle/swarmdb.git > /dev/null 2>&1
git push --quiet --set-upstream origin-swarm ${TRAVIS_BRANCH} --tags
fi
31 changes: 31 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,21 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})

include(cmake/jsoncpp.cmake)
include(cmake/googletest.cmake)

enable_testing()

# coverage?
if (ENABLE_GCOV)
set(COVERAGE_COMPILER_FLAGS "-g -O0 --coverage -fprofile-arcs -ftest-coverage"
CACHE INTERNAL "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" )
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
endif()

#include(cmake/CodeCoverage.cmake)
#APPEND_COVERAGE_COMPILER_FLAGS()

add_subdirectory(bootstrap)
add_subdirectory(crud)
add_subdirectory(ethereum)
Expand All @@ -78,3 +91,21 @@ add_subdirectory(audit)
add_subdirectory(pbft)

include(cmake/static_analysis.cmake)

#list(APPEND COVERAGE_GCOVR_EXCLUDES
# ${CMAKE_SOURCE_DIR}/audit/test
# ${CMAKE_SOURCE_DIR}/bootstrap/test
# ${CMAKE_SOURCE_DIR}/curd/test
# ${CMAKE_SOURCE_DIR}/ethereum/test
# ${CMAKE_SOURCE_DIR}/http/test
# ${CMAKE_SOURCE_DIR}/mocks
# ${CMAKE_SOURCE_DIR}/node/test
# ${CMAKE_SOURCE_DIR}/options/test
# ${CMAKE_SOURCE_DIR}/pbft/test
# ${CMAKE_SOURCE_DIR}/raft/test
# ${CMAKE_SOURCE_DIR}/status/test
# ${CMAKE_SOURCE_DIR}/swarm
# ${CMAKE_SOURCE_DIR}/include
# )

#SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML(NAME ctest_coverage EXECUTABLE ctest OUTPUT ${CMAKE_BINARY_DIR} )
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SwarmDB

[![Build Status](https://travis-ci.org/bluzelle/swarmDB.svg?branch=devel)](https://travis-ci.org/bluzelle/swarmDB) [![License](https://img.shields.io/:license-AGPLv3-blue.svg?style=flat-square)](https://github.com/bluzelle/swarmDB/blob/devel/LICENSE) [![Twitter](https://img.shields.io/badge/twitter-@bluzelle-blue.svg?style=flat-square)](https://twitter.com/BluzelleHQ) [![Gitter chat](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=flat-square)](https://gitter.im/bluzelle)
[![Build Status](https://travis-ci.org/bluzelle/swarmDB.svg?branch=devel)](https://travis-ci.org/bluzelle/swarmDB) [![Coverage Status](https://coveralls.io/repos/github/bluzelle/swarmDB/badge.svg?branch=master)](https://coveralls.io/github/bluzelle/swarmDB?branch=devel) [![License](https://img.shields.io/:license-AGPLv3-blue.svg?style=flat-square)](https://github.com/bluzelle/swarmDB/blob/devel/LICENSE) [![Twitter](https://img.shields.io/badge/twitter-@bluzelle-blue.svg?style=flat-square)](https://twitter.com/BluzelleHQ) [![Gitter chat](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=flat-square)](https://gitter.im/bluzelle)

## ABOUT SWARMDB

Expand Down
10 changes: 3 additions & 7 deletions include/boost_asio_beast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ namespace bzn::asio
public:
virtual ~udp_socket_base() = default;

virtual void async_send_to(const boost::asio::const_buffer& msg,
boost::asio::ip::udp::endpoint ep,
std::function<void(const boost::system::error_code&, size_t)> handler)
= 0;
virtual void async_send_to(const boost::asio::const_buffer& msg, boost::asio::ip::udp::endpoint ep, bzn::asio::write_handler handler) = 0;
};

///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -135,12 +132,11 @@ namespace bzn::asio
this->socket.open(boost::asio::ip::udp::v4());
}

void async_send_to(const boost::asio::const_buffer& msg,
boost::asio::ip::udp::endpoint ep,
std::function<void(const boost::system::error_code&, size_t)> handler)
void async_send_to(const boost::asio::const_buffer& msg, boost::asio::ip::udp::endpoint ep, bzn::asio::write_handler handler)
{
this->socket.async_send_to(msg, ep, handler);
}

private:
boost::asio::ip::udp::socket socket;
};
Expand Down

0 comments on commit 572b5fa

Please sign in to comment.