about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorAndrea Mattavelli <andreamattavelli@gmail.com>2017-10-06 08:52:46 +0100
committerMartinNowack <martin.nowack@gmail.com>2018-01-16 16:18:39 +0100
commit3916f00c68611a8c85b856bc4af7f43bb5f0e628 (patch)
tree03afb6a9951ccfe3713637aa72c33741e225e551
parent37f554d5cf587ec9f6befa359a0e3aa60e9ce73f (diff)
downloadklee-3916f00c68611a8c85b856bc4af7f43bb5f0e628.tar.gz
[Travis-CI] Added codecov.io support
-rw-r--r--.travis.yml7
-rwxr-xr-x.travis/klee.sh52
-rw-r--r--README.md1
-rw-r--r--codecov.yml16
4 files changed, 45 insertions, 31 deletions
diff --git a/.travis.yml b/.travis.yml
index 7aa521aa..01bac7a1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,11 +32,10 @@ env:
     #   COVERAGE: {0, 1}
     #   USE_TCMALLOC: {0, 1}
 
-    # COVERAGE set indicated that coverage data should be uploaded to the server, only ONE job should have COVERAGE set
+    # COVERAGE when set indicates that coverage data should be uploaded to the service, only ONE job should have COVERAGE set
 
     matrix:
 
-    # TODO: Add coverage build
     # TODO: Add Doxygen build
 
     # Check newer LLVMs
@@ -69,6 +68,9 @@ env:
 
     # Check with TCMALLOC
     - LLVM_VERSION=3.4 SOLVERS=STP STP_VERSION=2.1.2 KLEE_UCLIBC=klee_uclibc_v1.0.0 DISABLE_ASSERTIONS=0 ENABLE_OPTIMIZED=1 COVERAGE=0 USE_TCMALLOC=1
+
+    # Coverage build
+    - LLVM_VERSION=3.4 SOLVERS=STP:Z3 STP_VERSION=2.1.2 KLEE_UCLIBC=klee_uclibc_v1.0.0 DISABLE_ASSERTIONS=0 ENABLE_OPTIMIZED=0 COVERAGE=1 USE_TCMALLOC=0
     global:
     - secure: EF/WAc4BdIRUchF3mjATN3/UwtGWtGaRgb5oIIJHjKhgZFdPsgWsXFgaOB0jaK2hfO/svj/LvlasuRIGxeePVjeaiX8ZlVpuHiX67vdYLY+0kCDRwkusRjm60/GbPU9O/Xjgb/d4aWAEkoq5OnsprVTEvU8iY2JHtAqgwR+wW9I=
     - secure: Hrp1MRSxDUH2GTQg3QR/yUttY/3KmgbFb5e+zyy551dKpHjxJdsNe8bquY9oFoT7KmPQYl0HNNjEv4qWW8RK+HWHOCB55nL1KlGpOG7vAJcUEZg7ScbliGgiovMB6jIQVfeP9FhYngfc13vNZQ5PGlqzfSsHSAbvkwEogBToHVw=
@@ -95,6 +97,7 @@ addons:
     - libedit-dev
     - libselinux1-dev
     - cmake
+    - lcov
 
 cache:
   apt: true
diff --git a/.travis/klee.sh b/.travis/klee.sh
index 98e1995b..88dbdf08 100755
--- a/.travis/klee.sh
+++ b/.travis/klee.sh
@@ -3,6 +3,22 @@
 set -e
 : ${SOLVERS?"Solvers must be specified"}
 
+coverageup()
+{
+  # Create report
+  # (NOTE: "--rc lcov_branch_coverage=1" needs to be added in all calls, otherwise branch coverage gets dropped)
+  lcov --rc lcov_branch_coverage=1 --directory . --capture --output-file coverage.info
+  # Exclude uninteresting coverage goals (LLVM, googletest, and KLEE system and unit tests)
+  lcov --rc lcov_branch_coverage=1 --remove coverage.info '/usr/*' --output-file coverage.info
+  lcov --rc lcov_branch_coverage=1 --remove coverage.info 'test-utils/*' --output-file coverage.info
+  lcov --rc lcov_branch_coverage=1 --remove coverage.info 'klee/test/*' --output-file coverage.info
+  lcov --rc lcov_branch_coverage=1 --remove coverage.info 'klee/unittests/*' --output-file coverage.info
+  # Debug info
+  lcov --rc lcov_branch_coverage=1 --list coverage.info
+  # Uploading report to CodeCov
+  bash <(curl -s https://codecov.io/bash) -X gcov -y ${KLEE_SRC}/codecov.yml -f coverage.info -F $1
+}
+
 ###############################################################################
 # Select the compiler to use to generate LLVM bitcode
 ###############################################################################
@@ -139,6 +155,11 @@ make
 ###############################################################################
 make unittests
 
+# Generate and upload coverage if COVERAGE is set
+if [ ${COVERAGE} -eq 1 ]; then
+  coverageup "unittests"
+fi
+
 ###############################################################################
 # lit tests
 ###############################################################################
@@ -158,34 +179,7 @@ if [ "X${SOLVERS}" == "XmetaSMT" ]; then
   done
 fi
 
-#generate and upload coverage if COVERAGE is set
+# Generate and upload coverage if COVERAGE is set
 if [ ${COVERAGE} -eq 1 ]; then
-
-#get zcov that works with gcov v4.8
-    git clone https://github.com/ddunbar/zcov.git
-    cd zcov
-    sudo python setup.py install
-    sudo mkdir /usr/local/lib/python2.7/dist-packages/zcov-0.3.0.dev0-py2.7.egg/zcov/js
-    cd zcov
-
-#these files are not where zcov expects them to be after install so we move them
-    sudo cp js/sorttable.js /usr/local/lib/python2.7/dist-packages/zcov-0.3.0.dev0-py2.7.egg/zcov/js/sorttable.js
-    sudo cp js/sourceview.js /usr/local/lib/python2.7/dist-packages/zcov-0.3.0.dev0-py2.7.egg/zcov/js/sourceview.js
-    sudo cp style.css /usr/local/lib/python2.7/dist-packages/zcov-0.3.0.dev0-py2.7.egg/zcov/style.css
-
-#install zcov dependency
-    sudo apt-get install -y enscript
-
-#update gcov from v4.6 to v4.8. This is becauase gcda files are made for v4.8 and cause
-#a segmentation fault in v4.6
-    sudo apt-get install -y ggcov
-    sudo rm /usr/bin/gcov
-    sudo ln -s /usr/bin/gcov-4.8 /usr/bin/gcov
-
-#scan and generate coverage
-    zcov scan output.zcov ${BUILD_DIR}
-    zcov genhtml output.zcov coverage/
-#upload the coverage data, currently to a random ftp server
-    tar -zcvf coverage.tar.gz coverage/
-    curl --form "file=@coverage.tar.gz" -u ${USER}:${PASSWORD} ${COVERAGE_SERVER}
+  coverageup "systemtests"
 fi
diff --git a/README.md b/README.md
index e894ebc1..5feab3ee 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@ KLEE Symbolic Virtual Machine
 =============================
 
 [![Build Status](https://travis-ci.org/klee/klee.svg?branch=master)](https://travis-ci.org/klee/klee)
+[![Coverage](https://codecov.io/gh/klee/klee/branch/master/graph/badge.svg)](https://codecov.io/gh/klee/klee)
 
 `KLEE` is a symbolic virtual machine built on top of the LLVM compiler
 infrastructure. Currently, there are two primary components:
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 00000000..4fd8129f
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,16 @@
+codecov:
+  disable_default_path_fixes: true
+
+coverage:
+  status:
+    project: no
+    patch: yes
+    changes: no
+
+fixes:
+  - "home/travis/build/klee/klee::"
+ignore:
+  - "usr/"
+  - "test/"
+  - "unittests"
+  - "**/test-utils"