|
| 1 | +/** |
| 2 | + * Copyright (c) 2011-2014 libbitcoin developers (see AUTHORS) |
| 3 | + * |
| 4 | + * This file is part of libbitcoin-protocol. |
| 5 | + * |
| 6 | + * libbitcoin-protocol is free software: you can redistribute it and/or |
| 7 | + * modify it under the terms of the GNU Affero General Public License with |
| 8 | + * additional permissions to the one published by the Free Software |
| 9 | + * Foundation, either version 3 of the License, or (at your option) |
| 10 | + * any later version. For more information see LICENSE. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU Affero General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU Affero General Public License |
| 18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | +#include <boost/test/unit_test.hpp> |
| 21 | +#include <bitcoin/server.hpp> |
| 22 | + |
| 23 | +using namespace bc; |
| 24 | +using namespace bc::chain; |
| 25 | +using namespace bc::network; |
| 26 | +using namespace bc::node; |
| 27 | +using namespace bc::server; |
| 28 | + |
| 29 | +struct low_thread_priority_fixture |
| 30 | +{ |
| 31 | + low_thread_priority_fixture() |
| 32 | + { |
| 33 | + set_thread_priority(thread_priority::lowest); |
| 34 | + } |
| 35 | + |
| 36 | + ~low_thread_priority_fixture() |
| 37 | + { |
| 38 | + set_thread_priority(thread_priority::normal); |
| 39 | + } |
| 40 | +}; |
| 41 | + |
| 42 | +static void uninitchain(const char prefix[]) |
| 43 | +{ |
| 44 | + boost::filesystem::remove_all(prefix); |
| 45 | +} |
| 46 | + |
| 47 | +static void initchain(const char prefix[]) |
| 48 | +{ |
| 49 | + const size_t history_height = 0; |
| 50 | + const auto genesis = genesis_block(); |
| 51 | + |
| 52 | + uninitchain(prefix); |
| 53 | + boost::filesystem::create_directories(prefix); |
| 54 | + initialize_blockchain(prefix); |
| 55 | + |
| 56 | + db_paths paths(prefix); |
| 57 | + db_interface interface(paths, { history_height }); |
| 58 | + |
| 59 | + interface.start(); |
| 60 | + interface.push(genesis); |
| 61 | +} |
| 62 | + |
| 63 | +BOOST_FIXTURE_TEST_SUITE(server_tests, low_thread_priority_fixture) |
| 64 | + |
| 65 | +BOOST_AUTO_TEST_CASE(server_test) |
| 66 | +{ |
| 67 | + BOOST_REQUIRE(true); |
| 68 | +} |
| 69 | + |
| 70 | +BOOST_AUTO_TEST_SUITE_END() |
0 commit comments