From c684b1d40bb22cf214e03d83e63e149a2499653f Mon Sep 17 00:00:00 2001 From: dota17 Date: Mon, 17 Feb 2020 18:15:15 +0800 Subject: [PATCH 1/2] add coveralls auto tool to json-c --- .travis.yml | 17 +++++++++++++++++ CMakeLists.txt | 1 + 2 files changed, 18 insertions(+) diff --git a/.travis.yml b/.travis.yml index 222aa7f..f07c342 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,6 +78,23 @@ matrix: osx_image: xcode10.1 env: XCODE="true" CHECK="true" +# run coveralls + - os: linux + dist: xenial + compiler: gcc + env: CHECK="true" + before_install: + - sudo pip install cpp-coveralls + script: + - mkdir build + - cd build + - cmake .. + - make + - make test + - cd - + after_success: + - coveralls --include arraylist.c --include arraylist.h --include json_object.c --include json_object.h --include json_object_iterator.c --include json_object_iterator.h --include json_object_private.h --include json_pointer.c --include json_pointer.h --include json_tokener.c --include json_tokener.h --include json_util.c --include json_util.h --include json_visit.c --include json_visit.h --include linkhash.c --include linkhash.h --include printbuf.c --include printbuf.h --include random_seed.c --include strerror_override.c + # allow_failures: # - os: osx diff --git a/CMakeLists.txt b/CMakeLists.txt index 0008cbb..296ac13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,6 +197,7 @@ message(STATUS "Written ${PROJECT_BINARY_DIR}/json_config.h") if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") if ("${DISABLE_WERROR}" STREQUAL "OFF") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") endif() From 541a0b609ac054649de64daced7593d97f278efd Mon Sep 17 00:00:00 2001 From: dota17 Date: Wed, 19 Feb 2020 18:13:28 +0800 Subject: [PATCH 2/2] modify the coveralls configuration file --- .travis.yml | 25 ++++++++++++++++++------- CMakeLists.txt | 1 - 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index f07c342..2278b1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,22 +78,33 @@ matrix: osx_image: xcode10.1 env: XCODE="true" CHECK="true" -# run coveralls +# run coveralls - os: linux dist: xenial compiler: gcc env: CHECK="true" + install: + - sh autogen.sh before_install: - sudo pip install cpp-coveralls + - echo $CC + - echo $LANG + - echo $LC_ALL + - set -e + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then + eval "${MATRIX_EVAL}"; + if [ -n "$MATRIX_EVAL" ] && [ "$TRAVIS_COMPILER" != "clang" ]; then + sudo apt-get install -y $CC; + fi; + fi + before_script: + - export CFLAGS="-fprofile-arcs -ftest-coverage" + - ./configure script: - - mkdir build - - cd build - - cmake .. - make - - make test - - cd - + - make check after_success: - - coveralls --include arraylist.c --include arraylist.h --include json_object.c --include json_object.h --include json_object_iterator.c --include json_object_iterator.h --include json_object_private.h --include json_pointer.c --include json_pointer.h --include json_tokener.c --include json_tokener.h --include json_util.c --include json_util.h --include json_visit.c --include json_visit.h --include linkhash.c --include linkhash.h --include printbuf.c --include printbuf.h --include random_seed.c --include strerror_override.c + - coveralls --exclude tests --exclude fuzz # allow_failures: # - os: osx diff --git a/CMakeLists.txt b/CMakeLists.txt index 296ac13..0008cbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,7 +197,6 @@ message(STATUS "Written ${PROJECT_BINARY_DIR}/json_config.h") if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") if ("${DISABLE_WERROR}" STREQUAL "OFF") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") endif()