From aa89922904e96832a330dac6263b13b141ce6071 Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Mon, 14 Jan 2019 11:03:14 +1100 Subject: [PATCH] Add code coverage reporting --- .travis.yml | 12 ++++++++++++ ci/upload-coverage | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 ci/upload-coverage diff --git a/.travis.yml b/.travis.yml index 40b1d7c..f93d219 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,3 +8,15 @@ rust: matrix: allow_failures: - rust: beta + +addons: + apt: + packages: + - binutils-dev + - libcurl4-openssl-dev + - zlib1g-dev + - libdw-dev + - libiberty-dev + +after_success: + - ci/upload-coverage diff --git a/ci/upload-coverage b/ci/upload-coverage new file mode 100755 index 0000000..f24edc6 --- /dev/null +++ b/ci/upload-coverage @@ -0,0 +1,25 @@ +#!/bin/bash + +KCOV_VERSION="36" +CRATE=ssd1675 + +set -e + +curl -OL "https://github.com/SimonKagstrom/kcov/archive/v$KCOV_VERSION.tar.gz" +tar zxf "v$KCOV_VERSION.tar.gz" +cd "kcov-$KCOV_VERSION" +mkdir build +cd build +cmake .. +make +make install DESTDIR=../../kcov-build +cd ../.. +rm -rf "kcov-$KCOV_VERSION" + +for file in target/debug/"$CRATE"-*[^\.d]; do + mkdir -p "target/cov/$(basename "$file")"; + ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename "$file")" "$file"; +done + +bash <(curl -s https://codecov.io/bash) +echo "Uploaded code coverage"