On 7 February 2017 at 08:48, Maxim Uvarov <[email protected]> wrote:

> Results for code coverage will be available in https://codecov.io.
> On each successful run in github automatic code coverage will
> be run under travis ci. And at the end of travis log there will
> be link to code coverage for specific commit which you push. Also
> github merge requests will post automatically status of code coverage
> and update it if you changed merge request to new version.
>
> This patch also adds matrix to test both gcc and clang due to gcov
> is broken Travis CI shipment. Coverage done only for gcc tests.
>
> Signed-off-by: Maxim Uvarov <[email protected]>
>

Reviewed-by: Mike Holmes <[email protected]>


> ---
>  .codecov.yml | 25 +++++++++++++++++++++++++
>  .travis.yml  | 45 +++++++++++++++++++++++++++++++++++----------
>  2 files changed, 60 insertions(+), 10 deletions(-)
>  create mode 100644 .codecov.yml
>
> diff --git a/.codecov.yml b/.codecov.yml
> new file mode 100644
> index 00000000..86bcd1dc
> --- /dev/null
> +++ b/.codecov.yml
> @@ -0,0 +1,25 @@
> +codecov:
> +  notify:
> +    require_ci_to_pass: yes
> +
> +coverage:
> +  precision: 3
> +  round: down
> +  range: "50...75"
> +  status:
> +    project: yes
> +    patch: yes
> +    changes: yes
> +
> +parsers:
> +  gcov:
> +    branch_detection:
> +      conditional: yes
> +      loop: yes
> +      method: no
> +      macro: no
> +
> +comment:
> +  layout: "header, diff, files"
> +  behavior: default
> +  require_changes: no
> diff --git a/.travis.yml b/.travis.yml
> index f12242ce..5b9a29a6 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -7,6 +7,8 @@
>  # pushing to github/coverity_scan will also launch a static analysis
>  # See https://scan.coverity.com/travis_ci
>
> +language: c
> +sudo: required
>  env:
>    global:
>      # COVERITY_SCAN_TOKEN
> @@ -24,10 +26,27 @@ env:
>      # copy the secure:<key> below
>      #
>      - secure: "xxxx"
> +    #
> +    # By default Linaro CODECOV_TOKEN token is used. It's ok to use it to
> see
> +    # for individual commit validation. But you you want to track tests
> history
> +    # you need generated new one at https://codecov.io specific for your
> repo.
> +    - CODECOV_TOKEN=8e1c0fd8-62ff-411e-a79f-5839f6662c11
>
> -language: c
> -compiler: clang
> -sudo: required
> +matrix:
> +  include:
> +    - compiler: gcc-4.8
> +      addons:
> +        apt:
> +          sources:
> +            - ubuntu-toolchain-r-test
> +          packages:
> +            - gcc-4.8
> +      env: MY_CF="-O0 -coverage" MY_LDF="--coverage" DOCOV=1
> +    - compiler: clang
> +      addons:
> +        apt:
> +          packages:
> +            - clang
>
>  before_install:
>          - echo 1000 | sudo tee /proc/sys/vm/nr_hugepages
> @@ -37,7 +56,9 @@ before_install:
>          - sudo apt-get -qq update
>          - sudo apt-get install automake autoconf libtool libssl-dev
> graphviz mscgen doxygen
>          - sudo apt-get install libpcap-dev linux-headers-`uname -r`
> +        - sudo pip install coverage
>          - gem install asciidoctor
> +        - PATH=${PATH//:\.\/node_modules\/\.bin/}
>
>  #       Install cunit for the validation tests because distro version is
> too old and fails C99 compile
>          - export CUNIT_VERSION=2.1-3
> @@ -74,18 +95,22 @@ before_install:
>          - popd
>
>  script:
> -
> -        - ./bootstrap
> -        - ./configure --enable-test-cpp --enable-test-vald
> --enable-test-helper --enable-test-perf --enable-user-guides
> --enable-test-perf-proc --enable-test-example 
> --with-dpdk-path=`pwd`/dpdk/${TARGET}
> --with-netmap-path=`pwd`/netmap
> -        - make -j 4
> -        - sudo LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" make
> check
> -        - sudo git clean -f -d -x && rm -rf dpdk && rm -rf netmap && rm
> -rf $KSRC
> -
>          - ./bootstrap
>          - ./configure
>          - make doxygen-doc
>          - make distcheck
>
> +        - ./bootstrap
> +        - ./configure --enable-test-cpp --enable-test-vald
> --enable-test-helper --enable-test-perf --enable-user-guides
> --enable-test-perf-proc --enable-test-example 
> --with-dpdk-path=`pwd`/dpdk/${TARGET}
> --with-netmap-path=`pwd`/netmap CFLAGS="$MY_CF" CXXFLAGS="$MY_CF"
> LDFLAGS="$MY_LDF"
> +        - make -j 4
> +        - sudo LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" make
> check
> +        - sudo rm -rf dpdk
> +        - sudo rm -rf netmap
> +        - sudo rm -rf $KSRC
> +
> +after_success:
> +  - if [ -n "$DOCOV" ]; then find . -type f -iname '*.[ch]' -not -path
> ".git/*" -execdir gcov-4.8 {} \; ; bash <(curl -s https://codecov.io/bash)
> -X coveragepy; fi
> +
>  addons:
>      coverity_scan:
>          project:
> --
> 2.11.0.295.gd7dffce
>
>


-- 
Mike Holmes
Program Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"

Reply via email to