Skip to content

Commit

Permalink
Fixing coverage script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Drwięga committed Jul 11, 2016
1 parent 2484286 commit d65a1d2
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions scripts/add_license.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 39 additions & 0 deletions scripts/cov.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions scripts/doc.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions scripts/fmt.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions scripts/hook.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions scripts/targets.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit d65a1d2

Please sign in to comment.