[1/2] codecov: add code coverage intergated to github

Message ID 20170202144130.24097-2-maxim.uvarov@linaro.org
State New
Headers show
Series
  • travis/codecov add code coverage
Related show

Commit Message

Maxim Uvarov Feb. 2, 2017, 2:41 p.m.
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
 .travis.yml | 51 +++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 43 insertions(+), 8 deletions(-)

-- 
2.11.0.295.gd7dffce

Comments

Mike Holmes Feb. 2, 2017, 3:40 p.m. | #1
On 2 February 2017 at 09:41, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>

> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

> ---

>  .travis.yml | 51 +++++++++++++++++++++++++++++++++++++++++++--------

>  1 file changed, 43 insertions(+), 8 deletions(-)

>

> diff --git a/.travis.yml b/.travis.yml

> index 03e61b18..9e474da2 100644

> --- a/.travis.yml

> +++ b/.travis.yml

> @@ -7,21 +7,53 @@

>  # pushing to github/coverity_scan will also launch a static analysis

>  # See https://scan.coverity.com/travis_ci

>

> +language: c

> +sudo: required

> +addons:

> +  apt:

> +    sources:

> +    # add PPAs with more up-to-date toolchains

> +    - ubuntu-toolchain-r-test

> +    - llvm-toolchain-precise-3.6

> +    packages:

> +    # install toolchains

> +    - gcc

> +

>  env:

>    global:

>      # COVERITY_SCAN_TOKEN

>      # ** specific to your project **

>      - secure: "xxxx"

> +    - 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

> +            - llvm-toolchain-precise-3.8

> +          packages:

> +            - gcc-4.8

> +      env: MY_CF="-O0 -coverage" MY_LDF="--coverage" DOCOV=1

> +    - compiler: clang

> +      addons:

> +        apt:

> +          sources:

> +            - ubuntu-toolchain-r-test

> +            - llvm-toolchain-precise-3.8

> +          packages:

> +            - clang



I am running this now, but you don't mention that you also add a
matrix to test with gcc and clang as part of this, if that is not
central to the coverage should it be its own patch ?
I think you should at least mention the change in the commit

>

>

>  before_install:

> +        - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y

>          - 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

> @@ -47,15 +79,18 @@ 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}

> -        - make check

> -        - git clean -f -d -x && rm -rf dpdk

>          - ./bootstrap

>          - ./configure

>          - make doxygen-doc

>          - make distcheck

> +        - git clean -f -d -x

> +        - ./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} CFLAGS="$MY_CF" CXXFLAGS="$MY_CF" LDFLAGS="$MY_LDF"

> +        - make check

> +        - rm -rf dpdk

> +

> +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:

> --

> 2.11.0.295.gd7dffce

>




-- 
Mike Holmes
Program Manager - Linaro Networking Group
Linaro.org │ Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Mike Holmes Feb. 2, 2017, 3:48 p.m. | #2
On 2 February 2017 at 09:41, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>


Adding a note in the read me on how to find your code coverage results
might help

> ---

>  .travis.yml | 51 +++++++++++++++++++++++++++++++++++++++++++--------

>  1 file changed, 43 insertions(+), 8 deletions(-)

>

> diff --git a/.travis.yml b/.travis.yml

> index 03e61b18..9e474da2 100644

> --- a/.travis.yml

> +++ b/.travis.yml

> @@ -7,21 +7,53 @@

>  # pushing to github/coverity_scan will also launch a static analysis

>  # See https://scan.coverity.com/travis_ci

>

> +language: c

> +sudo: required

> +addons:

> +  apt:

> +    sources:

> +    # add PPAs with more up-to-date toolchains

> +    - ubuntu-toolchain-r-test

> +    - llvm-toolchain-precise-3.6

> +    packages:

> +    # install toolchains

> +    - gcc

> +

>  env:

>    global:

>      # COVERITY_SCAN_TOKEN

>      # ** specific to your project **

>      - secure: "xxxx"

> +    - CODECOV_TOKEN=8e1c0fd8-62ff-411e-a79f-5839f6662c11


Is this your token, can we all use it ?

>

> -language: c

> -compiler: clang

> -sudo: required

> +matrix:

> +  include:

> +    - compiler: gcc-4.8

> +      addons:

> +        apt:

> +          sources:

> +            - ubuntu-toolchain-r-test

> +            - llvm-toolchain-precise-3.8

> +          packages:

> +            - gcc-4.8

> +      env: MY_CF="-O0 -coverage" MY_LDF="--coverage" DOCOV=1

> +    - compiler: clang

> +      addons:

> +        apt:

> +          sources:

> +            - ubuntu-toolchain-r-test

> +            - llvm-toolchain-precise-3.8

> +          packages:

> +            - clang

>

>  before_install:

> +        - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y

>          - 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

> @@ -47,15 +79,18 @@ 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}

> -        - make check

> -        - git clean -f -d -x && rm -rf dpdk

>          - ./bootstrap

>          - ./configure

>          - make doxygen-doc

>          - make distcheck

> +        - git clean -f -d -x

> +        - ./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} CFLAGS="$MY_CF" CXXFLAGS="$MY_CF" LDFLAGS="$MY_LDF"

> +        - make check

> +        - rm -rf dpdk

> +

> +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:

> --

> 2.11.0.295.gd7dffce

>


I think this will show coverage for all executables run, is that as
valuable as showing the coverage that only comes from the execution of
the validation tests whos purpose is to cover all the implimentation ?


-- 
Mike Holmes
Program Manager - Linaro Networking Group
Linaro.org │ Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Maxim Uvarov Feb. 2, 2017, 9:08 p.m. | #3
On 02/02/17 18:48, Mike Holmes wrote:
> On 2 February 2017 at 09:41, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

> 

> Adding a note in the read me on how to find your code coverage results

> might help

> 


ok, in general there will be:
1. link printed in travis job.
2. banner link which we will place to wiki page.
3. it will automatically create a comment in merge request.



>> ---

>>  .travis.yml | 51 +++++++++++++++++++++++++++++++++++++++++++--------

>>  1 file changed, 43 insertions(+), 8 deletions(-)

>>

>> diff --git a/.travis.yml b/.travis.yml

>> index 03e61b18..9e474da2 100644

>> --- a/.travis.yml

>> +++ b/.travis.yml

>> @@ -7,21 +7,53 @@

>>  # pushing to github/coverity_scan will also launch a static analysis

>>  # See https://scan.coverity.com/travis_ci

>>

>> +language: c

>> +sudo: required

>> +addons:

>> +  apt:

>> +    sources:

>> +    # add PPAs with more up-to-date toolchains

>> +    - ubuntu-toolchain-r-test

>> +    - llvm-toolchain-precise-3.6

>> +    packages:

>> +    # install toolchains

>> +    - gcc

>> +

>>  env:

>>    global:

>>      # COVERITY_SCAN_TOKEN

>>      # ** specific to your project **

>>      - secure: "xxxx"

>> +    - CODECOV_TOKEN=8e1c0fd8-62ff-411e-a79f-5839f6662c11

> 

> Is this your token, can we all use it ?

> 


it's Linaro/odp group token. I think you can see it in settings. And yes
everybody can use it.


will send v2 rebased on current.

Maxim.

>>

>> -language: c

>> -compiler: clang

>> -sudo: required

>> +matrix:

>> +  include:

>> +    - compiler: gcc-4.8

>> +      addons:

>> +        apt:

>> +          sources:

>> +            - ubuntu-toolchain-r-test

>> +            - llvm-toolchain-precise-3.8

>> +          packages:

>> +            - gcc-4.8

>> +      env: MY_CF="-O0 -coverage" MY_LDF="--coverage" DOCOV=1

>> +    - compiler: clang

>> +      addons:

>> +        apt:

>> +          sources:

>> +            - ubuntu-toolchain-r-test

>> +            - llvm-toolchain-precise-3.8

>> +          packages:

>> +            - clang

>>

>>  before_install:

>> +        - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y

>>          - 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

>> @@ -47,15 +79,18 @@ 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}

>> -        - make check

>> -        - git clean -f -d -x && rm -rf dpdk

>>          - ./bootstrap

>>          - ./configure

>>          - make doxygen-doc

>>          - make distcheck

>> +        - git clean -f -d -x

>> +        - ./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} CFLAGS="$MY_CF" CXXFLAGS="$MY_CF" LDFLAGS="$MY_LDF"

>> +        - make check

>> +        - rm -rf dpdk

>> +

>> +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:

>> --

>> 2.11.0.295.gd7dffce

>>

> 

> I think this will show coverage for all executables run, is that as

> valuable as showing the coverage that only comes from the execution of

> the validation tests whos purpose is to cover all the implimentation ?

> 

>
Maxim Uvarov Feb. 2, 2017, 9:11 p.m. | #4
On 02/02/17 18:40, Mike Holmes wrote:
> On 2 February 2017 at 09:41, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

>>

>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

>> ---

>>  .travis.yml | 51 +++++++++++++++++++++++++++++++++++++++++++--------

>>  1 file changed, 43 insertions(+), 8 deletions(-)

>>

>> diff --git a/.travis.yml b/.travis.yml

>> index 03e61b18..9e474da2 100644

>> --- a/.travis.yml

>> +++ b/.travis.yml

>> @@ -7,21 +7,53 @@

>>  # pushing to github/coverity_scan will also launch a static analysis

>>  # See https://scan.coverity.com/travis_ci

>>

>> +language: c

>> +sudo: required

>> +addons:

>> +  apt:

>> +    sources:

>> +    # add PPAs with more up-to-date toolchains

>> +    - ubuntu-toolchain-r-test

>> +    - llvm-toolchain-precise-3.6

>> +    packages:

>> +    # install toolchains

>> +    - gcc

>> +

>>  env:

>>    global:

>>      # COVERITY_SCAN_TOKEN

>>      # ** specific to your project **

>>      - secure: "xxxx"

>> +    - 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

>> +            - llvm-toolchain-precise-3.8

>> +          packages:

>> +            - gcc-4.8

>> +      env: MY_CF="-O0 -coverage" MY_LDF="--coverage" DOCOV=1

>> +    - compiler: clang

>> +      addons:

>> +        apt:

>> +          sources:

>> +            - ubuntu-toolchain-r-test

>> +            - llvm-toolchain-precise-3.8

>> +          packages:

>> +            - clang

> 

> 

> I am running this now, but you don't mention that you also add a

> matrix to test with gcc and clang as part of this, if that is not

> central to the coverage should it be its own patch ?

> I think you should at least mention the change in the commit

> 


it's like a beta status now. I had to add matrix or switch from clang to
gcc. And also some specific gcov version is needed. I will add message
about matrix in v2.

>>

>>

>>  before_install:

>> +        - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y

>>          - 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

>> @@ -47,15 +79,18 @@ 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}

>> -        - make check

>> -        - git clean -f -d -x && rm -rf dpdk

>>          - ./bootstrap

>>          - ./configure

>>          - make doxygen-doc

>>          - make distcheck

>> +        - git clean -f -d -x

>> +        - ./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} CFLAGS="$MY_CF" CXXFLAGS="$MY_CF" LDFLAGS="$MY_LDF"

>> +        - make check

>> +        - rm -rf dpdk

>> +

>> +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:

>> --

>> 2.11.0.295.gd7dffce

>>

> 

> 

>

Patch

diff --git a/.travis.yml b/.travis.yml
index 03e61b18..9e474da2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,21 +7,53 @@ 
 # pushing to github/coverity_scan will also launch a static analysis
 # See https://scan.coverity.com/travis_ci
 
+language: c
+sudo: required
+addons:
+  apt:
+    sources:
+    # add PPAs with more up-to-date toolchains
+    - ubuntu-toolchain-r-test
+    - llvm-toolchain-precise-3.6
+    packages:
+    # install toolchains
+    - gcc
+
 env:
   global:
     # COVERITY_SCAN_TOKEN
     # ** specific to your project **
     - secure: "xxxx"
+    - 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
+            - llvm-toolchain-precise-3.8
+          packages:
+            - gcc-4.8
+      env: MY_CF="-O0 -coverage" MY_LDF="--coverage" DOCOV=1
+    - compiler: clang
+      addons:
+        apt:
+          sources:
+            - ubuntu-toolchain-r-test
+            - llvm-toolchain-precise-3.8
+          packages:
+            - clang
 
 before_install:
+        - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
         - 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
@@ -47,15 +79,18 @@  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}
-        - make check
-        - git clean -f -d -x && rm -rf dpdk
         - ./bootstrap
         - ./configure
         - make doxygen-doc
         - make distcheck
+        - git clean -f -d -x
+        - ./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} CFLAGS="$MY_CF" CXXFLAGS="$MY_CF" LDFLAGS="$MY_LDF"
+        - make check
+        - rm -rf dpdk
+
+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: