2018-06-25 11:21:45 +02:00
|
|
|
#!/usr/bin/env bash
|
2016-07-11 18:30:58 +02:00
|
|
|
# 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
|
2018-04-04 11:07:49 +02:00
|
|
|
RUSTFLAGS="-C link-dead-code" cargo test --all --no-run || exit $?
|
2017-03-15 23:21:58 +01:00
|
|
|
KCOV_TARGET="target/cov"
|
2016-07-12 13:25:55 +02:00
|
|
|
KCOV_FLAGS="--verify"
|
|
|
|
mkdir -p $KCOV_TARGET
|
2017-03-15 23:21:58 +01:00
|
|
|
echo "Cover RUST"
|
2016-07-12 13:25:55 +02:00
|
|
|
for FILE in `find target/debug/deps ! -name "*.*"`
|
2018-07-09 10:59:05 +02:00
|
|
|
do
|
|
|
|
timeout --signal=SIGKILL 5m kcov --include-path=$(pwd) --exclude-path=$(pwd)/target $KCOV_FLAGS $KCOV_TARGET $FILE
|
|
|
|
done
|
|
|
|
timeout --signal=SIGKILL 5m kcov --include-path=$(pwd) --exclude-path=$(pwd)/target $KCOV_FLAGS $KCOV_TARGET target/debug/parity-*
|
2018-01-16 22:14:38 +01:00
|
|
|
echo "Cover JS"
|
|
|
|
cd js
|
|
|
|
npm install&&npm run test:coverage
|
|
|
|
cd ..
|
|
|
|
bash <(curl -s https://codecov.io/bash)&&
|
2018-07-09 10:59:05 +02:00
|
|
|
echo "Uploaded code coverage"
|
2016-07-12 10:30:59 +02:00
|
|
|
exit 0
|