openethereum/scripts/cov.sh
Jaco Greeff 7bbd48a2bd Merge branch 'master' into ui-2
# Conflicts:
#	js/package.json
#	js/src/api/local/ethkey/worker.js
#	js/src/modals/FirstRun/TnC/tnc.js
#	js/src/modals/FirstRun/Welcome/welcome.js
#	js/src/ui/Form/Input/input.js
#	js/src/ui/VaultCard/Accounts/accounts.spec.js
#	js/src/views/Accounts/accounts.js
#	js/src/views/Application/TabBar/tabBar.js
#	js/src/views/Settings/Views/defaults.js
#	js/src/views/Settings/Views/views.js
#	js/webpack/app.js
#	js/webpack/libraries.js
2017-06-13 11:02:38 +02:00

55 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# 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
set -x
KCOV=${1:-kcov}
if ! type $KCOV > /dev/null; then
echo "Install kcov first (details inside this file). Aborting."
exit 1
fi
. ./scripts/targets.sh
RUSTFLAGS="-C link-dead-code" cargo test $TARGETS --no-run || exit $?
KCOV_TARGET="target/cov"
KCOV_FLAGS="--verify"
EXCLUDE="/usr/lib,\
/usr/include,\
$HOME/.cargo,\
$HOME/.multirust,\
rocksdb,\
secp256k1
"
rm -rf $KCOV_TARGET
mkdir -p $KCOV_TARGET
echo "Cover RUST"
for FILE in `find target/debug/deps ! -name "*.*"`
do
$KCOV --exclude-pattern $EXCLUDE $KCOV_FLAGS $KCOV_TARGET $FILE
done
$KCOV --exclude-pattern $EXCLUDE $KCOV_FLAGS $KCOV_TARGET target/debug/parity-*
echo "Cover JS"
cd js
npm install&&npm run test:coverage
cd ..
codecov
bash <(curl -s https://codecov.io/bash)&&
echo "Uploaded code coverage"
exit 0