You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.6 KiB

10 years ago
#!/bin/bash
CPP_ETHEREUM_PATH=$(pwd)
10 years ago
BUILD_DIR=$CPP_ETHEREUM_PATH/build
TEST_MODE=""
for i in "$@"
do
case $i in
-builddir)
shift
((i++))
BUILD_DIR=${!i}
shift
;;
--all)
TEST_MODE="--all"
shift
;;
esac
done
which $BUILD_DIR/test/testeth >/dev/null 2>&1
10 years ago
if [ $? != 0 ]
then
echo "You need to compile and build ethereum with cmake -DPROFILING option to the build dir!"
exit;
10 years ago
fi
10 years ago
OUTPUT_DIR=$BUILD_DIR/test/coverage
10 years ago
if which lcov >/dev/null; then
10 years ago
if which genhtml >/dev/null; then
10 years ago
echo Cleaning previous report...
if [ -d "$OUTPUT_DIR" ]; then
rm -r $OUTPUT_DIR
fi
mkdir $OUTPUT_DIR
10 years ago
lcov --directory $BUILD_DIR --zerocounters
lcov --capture --initial --directory $BUILD_DIR --output-file $OUTPUT_DIR/coverage_base.info
10 years ago
echo Running testeth...
10 years ago
$CPP_ETHEREUM_PATH/build/test/testeth $TEST_MODE
$CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit $TEST_MODE
$CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit $TEST_MODE
10 years ago
echo Prepearing coverage info...
10 years ago
lcov --capture --directory $BUILD_DIR --output-file $OUTPUT_DIR/coverage_test.info
10 years ago
lcov --add-tracefile $OUTPUT_DIR/coverage_base.info --add-tracefile $OUTPUT_DIR/coverage_test.info --output-file $OUTPUT_DIR/coverage_all.info
lcov --extract $OUTPUT_DIR/coverage_all.info *cpp-ethereum/* --output-file $OUTPUT_DIR/coverage_export.info
genhtml $OUTPUT_DIR/coverage_export.info --output-directory $OUTPUT_DIR/testeth
10 years ago
else
10 years ago
echo genhtml not found
exit;
10 years ago
fi
10 years ago
else
10 years ago
echo lcov not found
exit;
fi
echo "Coverage info should be located at: $OUTPUT_DIR/testeth"
10 years ago
echo "Opening index..."
10 years ago
xdg-open $OUTPUT_DIR/testeth/index.html &