Skip to content

Commit

Permalink
Segregate obnoxiously slow test
Browse files Browse the repository at this point in the history
The main test driver should run fairly quickly; extremely slow tests should be moved to a
separate driver so developer time isn't wasted waiting for many runs of a slow test.

Really more tests should be moved over, but I'm too lazy right now.
  • Loading branch information
nathanielhourt committed Jul 7, 2018
1 parent 7f17d17 commit 00c9188
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ if(MSVC)
set_source_files_properties( tests/serialization_tests.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
endif(MSVC)

file(GLOB SLOW_UNIT_TESTS "slow_tests/*.cpp")
add_executable( slow_chain_test ${SLOW_UNIT_TESTS} ${COMMON_SOURCES} )
target_link_libraries( slow_chain_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_egenesis_none fc graphene_wallet ${PLATFORM_SPECIFIC_LIBS} )

file(GLOB PERFORMANCE_TESTS "performance/*.cpp")
add_executable( performance_test ${PERFORMANCE_TESTS} ${COMMON_SOURCES} )
target_link_libraries( performance_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} )
Expand Down
File renamed without changes.
40 changes: 40 additions & 0 deletions tests/slow_tests/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.

This comment has been minimized.

Copy link
@xeroc

xeroc Jul 7, 2018

Member

Can you PLEASE use another copyright here? Cryptonomex doesnt contribute code for years :/

*
* 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.
*/
#include <cstdlib>
#include <iostream>
#include <boost/test/included/unit_test.hpp>

extern uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP;

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;
}

0 comments on commit 00c9188

Please sign in to comment.