diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 53535a489..4009b22a6 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -64,6 +64,13 @@ if (PROFILING AND (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_C set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lprofiler") endif () +if (PROFILING AND (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))) + set(CMAKE_CXX_FLAGS "-g --coverage ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-g --coverage ${CMAKE_C_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS "--coverage ${CMAKE_SHARED_LINKER_FLAGS} -lprofiler") + set(CMAKE_EXE_LINKER_FLAGS "--coverage ${CMAKE_EXE_LINKER_FLAGS} -lprofiler") +endif () + if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")) option(USE_LD_GOLD "Use GNU gold linker" ON) if (USE_LD_GOLD) diff --git a/getcoverage.sh b/getcoverage.sh new file mode 100755 index 000000000..a04ab78fe --- /dev/null +++ b/getcoverage.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +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; +fi + +if which lcov >/dev/null; then + if which genhtml >/dev/null; then + echo Running testeth... + $($CPP_ETHEREUM_PATH/build/test/testeth) + echo Prepearing coverage info... + else + echo genhtml not found + exit; + fi +else + echo lcov not found + exit; +fi + +OUTPUT_DIR="$CPP_ETHEREUM_PATH/build/test/coverage" + +TESTETH=$CPP_ETHEREUM_PATH/build/test/CMakeFiles/testeth.dir +lcov --capture --directory $TESTETH --output-file $OUTPUT_DIR/coverage.info +genhtml $OUTPUT_DIR/coverage.info --output-directory $OUTPUT_DIR/testeth + +echo "Coverage info should be located at: $CPP_ETHEREUM_PATH/build/test/coverage/testeth" +echo "Opening index..." + +xdg-open $CPP_ETHEREUM_PATH/build/test/coverage/testeth/index.html diff --git a/test/libethereum/StateTestsFiller/stPrecompiledContractsTransactionFiller.json b/test/libethereum/StateTestsFiller/stPreCompiledContractsTransactionFiller.json similarity index 100% rename from test/libethereum/StateTestsFiller/stPrecompiledContractsTransactionFiller.json rename to test/libethereum/StateTestsFiller/stPreCompiledContractsTransactionFiller.json diff --git a/test/libethereum/state.cpp b/test/libethereum/state.cpp index 5eb3c76c3..632e7982b 100644 --- a/test/libethereum/state.cpp +++ b/test/libethereum/state.cpp @@ -129,9 +129,9 @@ BOOST_AUTO_TEST_CASE(stPreCompiledContracts) dev::test::executeTests("stPreCompiledContracts", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); } -BOOST_AUTO_TEST_CASE(stPrecompiledContractsTransaction) +BOOST_AUTO_TEST_CASE(stPreCompiledContractsTransaction) { - dev::test::executeTests("stPrecompiledContractsTransaction", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); + dev::test::executeTests("stPreCompiledContractsTransaction", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); } BOOST_AUTO_TEST_CASE(stLogTests)