[DO NOT MERGE] Code coverage tests
This commit is contained in:
parent
f532386567
commit
49c36f0015
17 changed files with 109 additions and 50 deletions
|
|
@ -18,7 +18,7 @@ build:
|
|||
- rm -rf build
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
- cmake -DENABLE_COVERAGE_TESTING=true ..
|
||||
- make -j$(nproc)
|
||||
artifacts:
|
||||
untracked: true
|
||||
|
|
@ -34,8 +34,13 @@ test:
|
|||
dependencies:
|
||||
- build
|
||||
script:
|
||||
- ./build/tests/betting_test --log_level=message
|
||||
- ./build/tests/chain_test --log_level=message
|
||||
- ./build/tests/cli_test --log_level=message
|
||||
- ./build/tests/all_graphene_tests --log_level=message
|
||||
- lcov --capture --directory ./build/ --output-file ./build/coverage.info
|
||||
- genhtml --output-directory ./build/coverage ./build/coverage.info
|
||||
artifacts:
|
||||
untracked: true
|
||||
paths:
|
||||
- build/coverage
|
||||
- build/coverage.info
|
||||
tags:
|
||||
- builder
|
||||
|
|
|
|||
|
|
@ -147,10 +147,10 @@ else( WIN32 ) # Apple AND Linux
|
|||
|
||||
endif( WIN32 )
|
||||
|
||||
set(ENABLE_COVERAGE_TESTING FALSE CACHE BOOL "Build Peerplays for code coverage analysis")
|
||||
#set(ENABLE_COVERAGE_TESTING FALSE CACHE BOOL "Build Peerplays for code coverage analysis")
|
||||
|
||||
if(ENABLE_COVERAGE_TESTING)
|
||||
SET(CMAKE_CXX_FLAGS "--coverage ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -O0")
|
||||
endif()
|
||||
|
||||
add_subdirectory( libraries )
|
||||
|
|
|
|||
|
|
@ -62,4 +62,10 @@ file(GLOB ES_SOURCES "elasticsearch/*.cpp")
|
|||
add_executable( es_test ${ES_SOURCES} )
|
||||
target_link_libraries( es_test PRIVATE graphene_tests_common )
|
||||
|
||||
list(FILTER UNIT_TESTS EXCLUDE REGEX "[/]init_tests[.]cpp$")
|
||||
list(FILTER BETTING_TESTS EXCLUDE REGEX "[/]init_tests[.]cpp$")
|
||||
list(FILTER CLI_SOURCES EXCLUDE REGEX "[/]init_tests[.]cpp$")
|
||||
add_executable( all_graphene_tests ./all_graphene_tests/init_tests.cpp ${UNIT_TESTS} ${BETTING_TESTS} ${CLI_SOURCES} )
|
||||
target_link_libraries( all_graphene_tests PRIVATE graphene_wallet graphene_witness graphene_tests_common ${PLATFORM_SPECIFIC_LIBS} )
|
||||
|
||||
add_subdirectory( generate_empty_blocks )
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
|
||||
* Copyright (c) 2019 PBSA, and contributors.
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
|
|
@ -21,20 +21,9 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
extern uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP;
|
||||
#define BOOST_TEST_MODULE "All Graphene Tests"
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
std::srand(time(NULL));
|
||||
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
|
||||
const char* genesis_timestamp_str = getenv("GRAPHENE_TESTING_GENESIS_TIMESTAMP");
|
||||
if( genesis_timestamp_str != nullptr )
|
||||
{
|
||||
GRAPHENE_TESTING_GENESIS_TIMESTAMP = std::stoul( genesis_timestamp_str );
|
||||
}
|
||||
std::cout << "GRAPHENE_TESTING_GENESIS_TIMESTAMP is " << GRAPHENE_TESTING_GENESIS_TIMESTAMP << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
BOOST_AUTO_TEST_SUITE(AllGrapheneTests)
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
#include "../common/genesis_file_util.hpp"
|
||||
|
||||
#define BOOST_TEST_MODULE Test Application
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace graphene;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,4 +22,4 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
#define BOOST_TEST_MODULE "C++ Benchmarks for Graphene Blockchain Database"
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
|
|
|||
|
|
@ -3000,21 +3000,3 @@ BOOST_AUTO_TEST_CASE( wimbledon_2017_gentelmen_singles_final_test )
|
|||
// }
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
||||
|
||||
//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database"
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
std::srand(time(NULL));
|
||||
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
|
||||
|
||||
// betting operations don't take effect until HARDFORK 1000
|
||||
GRAPHENE_TESTING_GENESIS_TIMESTAMP = HARDFORK_1000_TIME.sec_since_epoch() + 2;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
|||
26
tests/betting/init_tests.cpp
Normal file
26
tests/betting/init_tests.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2019 PBSA, and contributors.
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define BOOST_TEST_MODULE "Betting Tests"
|
||||
#include <boost/test/unit_test.hpp>
|
||||
26
tests/cli/init_tests.cpp
Normal file
26
tests/cli/init_tests.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2019 PBSA, and contributors.
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define BOOST_TEST_MODULE CLI Tests
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
|
@ -27,8 +27,7 @@
|
|||
|
||||
#include <graphene/utilities/tempdir.hpp>
|
||||
|
||||
#define BOOST_TEST_MODULE Test Application
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
///////////////////////////////
|
||||
// Tests
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#include "../common/database_fixture.hpp"
|
||||
|
||||
#define BOOST_TEST_MODULE Elastic Search Database Tests
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace graphene::chain;
|
||||
using namespace graphene::chain::test;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
std::srand(time(NULL));
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
BOOST_AUTO_TEST_CASE(peerplays_sidechain) {
|
||||
}
|
||||
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE( transfer_benchmark )
|
|||
//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database"
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
std::srand(time(NULL));
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ BOOST_AUTO_TEST_SUITE_END()
|
|||
//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database"
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
for (int i=1; i<argc; i++)
|
||||
|
|
|
|||
26
tests/tests/init_tests.cpp
Normal file
26
tests/tests/init_tests.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2019 PBSA, and contributors.
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define BOOST_TEST_MODULE "Chain Tests"
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
|
@ -2260,7 +2260,7 @@ BOOST_AUTO_TEST_SUITE_END()
|
|||
//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database"
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
std::srand(time(NULL));
|
||||
|
|
|
|||
Loading…
Reference in a new issue