openethereum/scripts/cov.sh

56 lines
1.2 KiB
Bash
Raw Normal View History

2016-07-11 18:30:58 +02:00
#!/bin/sh
# Installing KCOV under ubuntu
# https://users.rust-lang.org/t/tutorial-how-to-collect-test-coverages-for-rust-project/650#
### Install deps
# $ sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev
#
### Compile kcov
# $ wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xf master.tar.gz
# $ cd kcov-master && mkdir build && cd build
# $ cmake .. && make && sudo make install
### Running coverage
2016-07-11 19:20:48 +02:00
2016-07-12 13:25:55 +02:00
set -x
2016-07-11 19:20:48 +02:00
KCOV=${1:-kcov}
if ! type $KCOV > /dev/null; then
2016-07-11 18:30:58 +02:00
echo "Install kcov first (details inside this file). Aborting."
exit 1
fi
2016-07-11 19:20:48 +02:00
. ./scripts/targets.sh
2016-07-14 19:32:15 +02:00
cargo test $TARGETS --no-run || exit $?
2016-07-12 13:25:55 +02:00
KCOV_TARGET="target/kcov"
KCOV_FLAGS="--verify"
2016-07-12 16:22:05 +02:00
EXCLUDE="/usr/lib,\
/usr/include,\
$HOME/.cargo,\
$HOME/.multirust,\
rocksdb,\
secp256k1,\
src/tests,\
util/json-tests,\
util/src/network/tests,\
ethcore/src/evm/tests,\
ethstore/tests,\
target/debug/build,\
target/release/build\
2016-07-12 13:25:55 +02:00
"
rm -rf $KCOV_TARGET
mkdir -p $KCOV_TARGET
for FILE in `find target/debug/deps ! -name "*.*"`
do
$KCOV --exclude-pattern $EXCLUDE $KCOV_FLAGS $KCOV_TARGET $FILE
done
2017-03-07 00:16:32 +01:00
$KCOV --coveralls-id=${CI_BUILD_ID} --exclude-pattern $EXCLUDE $KCOV_FLAGS $KCOV_TARGET target/debug/parity-*
2016-07-12 10:30:59 +02:00
exit 0