Browse Source

Coerage Script

cl-refactor
Dimitry 10 years ago
parent
commit
b6ca0d7856
  1. 36
      getcoverage.sh

36
getcoverage.sh

@ -2,38 +2,44 @@
CPP_ETHEREUM_PATH=$(pwd)
if [ ! -d "$CPP_ETHEREUM_PATH/build/test" ]; then
echo "You need to compile and build ethereum with cmake -DPROFILING option to the build dir!"
exit;
which $CPP_ETHEREUM_PATH/build/test/testeth >/dev/null 2>&1
if [ $? != 0 ]
then
echo "You need to compile and build ethereum with cmake -DPROFILING option to the build dir!"
exit;
fi
OUTPUT_DIR="$CPP_ETHEREUM_PATH/build/test/coverage"
TESTETH=$CPP_ETHEREUM_PATH/build #/test/CMakeFiles/testeth.dir
if which lcov >/dev/null; then
if which genhtml >/dev/null; then
if which genhtml >/dev/null; then
lcov --directory $TESTETH --zerocounters
echo Running testeth...
$($CPP_ETHEREUM_PATH/build/test/testeth)
$($CPP_ETHEREUM_PATH/build/test/testeth --all)
$($CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit --all)
$($CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit --all)
echo Prepearing coverage info...
else
else
echo genhtml not found
exit;
fi
fi
else
echo lcov not found
exit;
echo lcov not found
exit;
fi
if [ -d "$OUTPUT_DIR" ]; then
echo Cleaning previous report...
rm -r $OUTPUT_DIR
fi
echo Cleaning previous report...
rm -r $OUTPUT_DIR/testeth
rm $OUTPUT_DIR/full_coverage.info
rm $OUTPUT_DIR/testeth_coverage.info
mkdir $OUTPUT_DIR
lcov --capture --directory $TESTETH --output-file $OUTPUT_DIR/full_coverage.info
lcov --extract $OUTPUT_DIR/full_coverage.info *cpp-ethereum/* --output-file $OUTPUT_DIR/testeth_coverage.info
genhtml $OUTPUT_DIR/testeth_coverage.info --output-directory $OUTPUT_DIR/testeth
echo "Coverage info should be located at: $CPP_ETHEREUM_PATH/build/test/coverage/testeth"
echo "Coverage info should be located at: $OUTPUT_DIR/testeth"
echo "Opening index..."
xdg-open $CPP_ETHEREUM_PATH/build/test/coverage/testeth/index.html &
xdg-open $OUTPUT_DIR/testeth/index.html &

Loading…
Cancel
Save