Skip to content

Commit

Permalink
Add code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean-Der committed Nov 27, 2019
1 parent 939224c commit 5627e31
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
15 changes: 14 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,18 @@ cache:

script:
- mkdir build && cd build
- cmake ..
- |
if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_COMPILER}" = "gcc" ]]; then
cmake .. -DCODE_COVERAGE=TRUE -DBUILD_TEST=TRUE
else
cmake .. -DBUILD_TEST=TRUE
fi
- make
- ./tst/webrtc_client_test

after_success:
- |
if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_COMPILER}" = "gcc" ]]; then
for test_file in $(find CMakeFiles/kvsWebrtcClient.dir CMakeFiles/kvsWebrtcSignalingClient.dir -name '*.gcno'); do gcov $test_file; done
bash <(curl -s https://codecov.io/bash)
fi
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
cmake_minimum_required(VERSION 2.8)

set(CMAKE_MACOSX_RPATH TRUE)

project(KinesisVideoWebRTCClient LANGUAGES C)
get_filename_component(ROOT "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)

# User Flags
option(ADD_MUCLIBC "Add -muclibc c flag" OFF)
option(BUILD_DEPENDENCIES "Whether or not to build depending libraries from source" ON)
option(BUILD_OPENSSL "If building dependencies, whether or not building openssl from source" OFF)

# Developer Flags
option(CODE_COVERAGE "Enable coverage reporting" OFF)
option(BUILD_TEST "Build the testing tree." OFF)

set(CMAKE_MACOSX_RPATH TRUE)
get_filename_component(ROOT "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)

if(NOT KINESIS_VIDEO_PIC_SRC)
if(DEFINED ENV{KINESIS_VIDEO_PIC_SRC})
set(KINESIS_VIDEO_PIC_SRC $ENV{KINESIS_VIDEO_PIC_SRC})
Expand Down Expand Up @@ -263,10 +267,16 @@ endif()

if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU|Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

if(ADD_MUCLIBC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -muclibc")
endif()

if(CODE_COVERAGE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()

find_package(PkgConfig REQUIRED)
set(ENV{PKG_CONFIG_PATH}
"$ENV{PKG_CONFIG_PATH}:${KINESIS_VIDEO_OPEN_SOURCE_SRC}/lib/pkgconfig")
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Amazon Kinesis Video Streams C WebRTC SDK
[![Build Status](https://travis-ci.org/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c.svg?branch=master)](https://travis-ci.org/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c)
[![Coverage Status](https://codecov.io/gh/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/branch/master/graph/badge.svg)](https://codecov.io/gh/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c)

## Running
### 1. Download
Expand All @@ -19,8 +21,6 @@ To build the library and the provided samples run make in the build directory yo

`make`



## License

This library is licensed under the Apache 2.0 License.

0 comments on commit 5627e31

Please sign in to comment.