Fixing coverage script.

This commit is contained in:
Tomasz Drwięga 2016-07-11 18:30:58 +02:00
parent 248428657d
commit d65a1d2b2a
7 changed files with 100 additions and 4 deletions

View File

@ -45,14 +45,14 @@ script:
- if [ "$RUN_TESTS" = "true" ]; then ./test.sh; fi
install: |
[ "$RUN_COVERAGE" = "true" ] &&
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
[ "$RUN_COVERAGE" = "false" ] ||
(wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
tar xzf master.tar.gz &&
mkdir kcov-master/build &&
mkdir -p kcov-master/build &&
cd kcov-master/build &&
cmake .. &&
make && make install DESTDIR=../tmp &&
cd ../..
cd)
after_success:
- true && [ "$RUN_COVERAGE" = "true" ] && ./scripts/cov.sh "$KCOV_CMD"

6
scripts/add_license.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
for f in $(find . -name '*.rs'); do
cat license_header $f > $f.new
mv $f.new $f
done

39
scripts/cov.sh Executable file
View File

@ -0,0 +1,39 @@
#!/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
KCOV_CMD=${1:-kcov}
if ! type $KCOV_CMD > /dev/null; then
echo "Install kcov first (details inside this file). Aborting."
exit 1
fi
. ./scripts/targets.sh
cargo test $TARGETS --no-run || exit $?
rm -rf target/coverage
mkdir -p target/coverage
EXCLUDE="~/.multirust,rocksdb,secp256k1,/usr/,/.cargo,/root/.multirust,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests target/kcov"
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethkey-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethstore-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethash-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_util-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethsync-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_rpc-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_signer-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_dapps-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethjson-*
$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/parity-*
xdg-open target/coverage/index.html

7
scripts/doc.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# generate documentation only for partiy and ethcore libraries
. ./scripts/targets.sh
cargo doc --no-deps --verbose $TARGETS &&
echo '<meta http-equiv=refresh content=0;url=ethcore/index.html>' > target/doc/index.html

16
scripts/fmt.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
RUSTFMT="rustfmt --write-mode overwrite"
$RUSTFMT ./ethash/src/lib.rs
$RUSTFMT ./ethcore/src/lib.rs
$RUSTFMT ./evmjit/src/lib.rs
$RUSTFMT ./json/src/lib.rs
$RUSTFMT ./miner/src/lib.rs
$RUSTFMT ./parity/main.rs
$RUSTFMT ./rpc/src/lib.rs
$RUSTFMT ./signer/src/lib.rs
$RUSTFMT ./dapps/src/lib.rs
$RUSTFMT ./sync/src/lib.rs
$RUSTFMT ./util/src/lib.rs

14
scripts/hook.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
FILE=./.git/hooks/pre-push
. ./scripts/targets.sh
echo "#!/bin/sh\n" > $FILE
# Exit on any error
echo "set -e" >> $FILE
# Run release build
echo "cargo build --features dev" >> $FILE
# Build tests
echo "cargo test --no-run --features dev \\" >> $FILE
echo $TARGETS >> $FILE
echo "" >> $FILE
chmod +x $FILE

14
scripts/targets.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
export TARGETS="
-p ethkey \
-p ethstore \
-p ethash \
-p ethcore-util \
-p ethcore \
-p ethsync \
-p ethcore-rpc \
-p ethcore-signer \
-p ethcore-dapps \
-p parity \
-p bigint"