Skip to content

Commit 24212bf

Browse files
Merge pull request #4448 from yumibagge/yb/codecov
Add codecov
2 parents ae2264d + a780511 commit 24212bf

5 files changed

+94
-1
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
8888
COMMAND ${CODE_COVERAGE_LCOV} ${LCOV_FLAGS} --remove ${CODE_COVERAGE_INFO_FILE} '/usr/*' --output-file ${CODE_COVERAGE_INFO_FILE}
8989
COMMAND ${CODE_COVERAGE_GENHTML} ${CODE_COVERAGE_INFO_FILE} --output-directory ${CODE_COVERAGE_OUTPUT_DIR}
9090
DEPENDS
91-
java-models-library java-unit unit
91+
java-models-library
92+
"$<TARGET_FILE:java-unit>"
93+
"$<TARGET_FILE:unit>"
94+
"$<TARGET_FILE:goto-harness>"
9295
"$<TARGET_FILE:cbmc>"
9396
"$<TARGET_FILE:driver>"
9497
"$<TARGET_FILE:goto-analyzer>"

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
![Build Status][codebuild_img]
33
![Build Status][codebuild_windows_img]
44
[![Build Status][coverity_img]][coverity]
5+
[![Build Status][codecov_img]][codecov]
56

67
[CProver Wiki](http://www.cprover.org/wiki)
78

@@ -59,3 +60,5 @@ License
5960
[codebuild_windows_img]: https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiTFQ4Q0lCSEc1Rk5NcmlzaFZDdU44Vk8zY0c1VCtIVWMwWnJMRitmVFI5bE94Q3dhekVPMWRobFU2Q0xTTlpDSWZUQ3J1eksrWW1rSll1OExXdll2bExZPSIsIml2UGFyYW1ldGVyU3BlYyI6InpqcloyaEdxbjBiQUtvNysiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=develop
6061
[coverity]: https://scan.coverity.com/projects/diffblue-cbmc
6162
[coverity_img]: https://scan.coverity.com/projects/13552/badge.svg
63+
[codecov]: https://codecov.io/gh/diffblue/cbmc
64+
[codecov_img]: https://codecov.io/gh/diffblue/cbmc/branch/develop/graphs/badge.svg

buildspec-linux-cmake-gcc-cov.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
# CodeBuild console doesn't display color codes correctly
6+
TESTPL_COLOR_OUTPUT: 0
7+
8+
phases:
9+
install:
10+
runtime-versions:
11+
java: openjdk8
12+
commands:
13+
- sed -i 's#/archive.ubuntu.com#/us-east-1.ec2.archive.ubuntu.com#g' /etc/apt/sources.list
14+
- add-apt-repository ppa:ubuntu-toolchain-r/test
15+
- apt-get update -y
16+
- apt-get install -y flex bison make git libwww-perl patch ccache libc6-dev-i386 jq lcov cmake curl gdb python-pip
17+
- pip install codecov
18+
build:
19+
commands:
20+
- echo Build started on `date`
21+
- git submodule update --init --recursive
22+
- cmake -H. -Bbuild '-Denable_coverage=1' '-Dparallel_tests=2' '-DCMAKE_CXX_COMPILER=/usr/bin/g++'
23+
- cmake --build build --target coverage -- -j2
24+
post_build:
25+
commands:
26+
- lcov --capture --directory build --output-file ./lcov.info
27+
- VCS_PULL_REQUEST=$(echo $CODEBUILD_SOURCE_VERSION | sed 's/pr\///g')
28+
- COV_SCRIPT=/root/.cache/codecov.sh
29+
- if [ ! -f "$COV_SCRIPT" ]; then curl -s https://codecov.io/bash > "$COV_SCRIPT"; fi
30+
- echo "$CODEBUILD_INITIATOR" | grep GitHub && bash "$COV_SCRIPT" -t "$CODECOV_TOKEN" || true
31+
- echo Build completed on `date`
32+
cache:
33+
paths:
34+
- '/var/cache/apt/**/*'
35+
- '/var/lib/apt/lists/**/*'
36+
- '/root/.ccache/**/*'
37+
- '/root/.cache/codecov.sh'

buildspec-linux-make-gcc-cov.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
# CodeBuild console doesn't display color codes correctly
6+
TESTPL_COLOR_OUTPUT: 0
7+
8+
phases:
9+
install:
10+
runtime-versions:
11+
java: openjdk8
12+
commands:
13+
- sed -i 's#/archive.ubuntu.com#/us-east-1.ec2.archive.ubuntu.com#g' /etc/apt/sources.list
14+
- apt-get update -y
15+
- apt-get install -y flex bison make git libwww-perl patch ccache libc6-dev-i386 jq gdb lcov curl python-pip
16+
- pip install codecov
17+
build:
18+
commands:
19+
- echo Build started on `date`
20+
- make -C src minisat2-download
21+
- make -C jbmc/src setup-submodules
22+
- make -C src CXX="ccache g++" -j2 CPROVER_WITH_PROFILING=1
23+
- make -C unit CXX="ccache g++" -j2 CPROVER_WITH_PROFILING=1
24+
- make -C jbmc/src CXX="ccache g++" -j2 CPROVER_WITH_PROFILING=1
25+
- make -C jbmc/unit CXX="ccache g++" -j2 CPROVER_WITH_PROFILING=1
26+
post_build:
27+
commands:
28+
- make -C unit test
29+
- make -C regression test CPROVER_WITH_PROFILING=1
30+
- make -C regression/cbmc test-paths-lifo
31+
- env PATH=$PATH:`pwd`/src/solvers make -C regression/cbmc test-cprover-smt2
32+
- make -C jbmc/unit test
33+
- make -C jbmc/regression test
34+
- lcov --capture --directory . --output-file ./lcov.info
35+
- VCS_PULL_REQUEST=$(echo $CODEBUILD_SOURCE_VERSION | sed 's/pr\///g')
36+
- COV_SCRIPT=/root/.cache/codecov.sh
37+
- if [ ! -f "$COV_SCRIPT" ]; then curl -s https://codecov.io/bash > "$COV_SCRIPT"; fi
38+
- echo "$CODEBUILD_INITIATOR" | grep GitHub && bash "$COV_SCRIPT" -t "$CODECOV_TOKEN" || true
39+
- echo Build completed on `date`
40+
cache:
41+
paths:
42+
- '/var/cache/apt/**/*'
43+
- '/var/lib/apt/lists/**/*'
44+
- '/root/.ccache/**/*'
45+
- '/root/.cache/codecov.sh'

src/config.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ else
88
CXXFLAGS += -Wall -pedantic -Werror -Wno-deprecated-declarations -Wswitch-enum
99
endif
1010

11+
ifeq ($(CPROVER_WITH_PROFILING),1)
12+
CXXFLAGS += -fprofile-arcs -ftest-coverage
13+
LINKFLAGS += -lgcov -fprofile-arcs
14+
endif
15+
1116
# Select optimisation or debug info
1217
#CXXFLAGS += -O2 -DNDEBUG
1318
#CXXFLAGS += -O0 -g

0 commit comments

Comments
 (0)