Skip to content

Commit fa02b22

Browse files
author
MarcoFalke
committed
test: Remove useless test_bitcoin_main.cpp
1 parent fab2daa commit fa02b22

File tree

6 files changed

+39
-66
lines changed

6 files changed

+39
-66
lines changed

build_msvc/test_bitcoin/test_bitcoin.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<ClCompile Include="..\..\src\test\gen\*_gen.cpp" />
2626
<ClCompile Include="..\..\src\wallet\test\*_tests.cpp" />
2727
<ClCompile Include="..\..\src\test\test_bitcoin.cpp" />
28-
<ClCompile Include="..\..\src\test\test_bitcoin_main.cpp" />
28+
<ClCompile Include="..\..\src\test\main.cpp" />
2929
<ClCompile Include="..\..\src\wallet\test\*_fixture.cpp" />
3030
</ItemGroup>
3131
<ItemGroup>

src/Makefile.test.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ RAW_TEST_FILES =
5151
GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)
5252

5353
BITCOIN_TEST_SUITE = \
54-
test/test_bitcoin_main.cpp \
54+
test/main.cpp \
5555
test/test_bitcoin.h \
5656
test/test_bitcoin.cpp
5757

src/test/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (c) 2011-2019 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#define BOOST_TEST_MODULE Bitcoin Core Test Suite
6+
7+
#include <boost/test/unit_test.hpp>

src/test/test_bitcoin.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -66,36 +66,36 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
6666
{
6767
SetDataDir("tempdir");
6868
const CChainParams& chainparams = Params();
69-
// Ideally we'd move all the RPC tests to the functional testing framework
70-
// instead of unit tests, but for now we need these here.
71-
72-
RegisterAllCoreRPCCommands(tableRPC);
73-
ClearDatadirCache();
74-
75-
// We have to run a scheduler thread to prevent ActivateBestChain
76-
// from blocking due to queue overrun.
77-
threadGroup.create_thread(std::bind(&CScheduler::serviceQueue, &scheduler));
78-
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
79-
80-
mempool.setSanityCheck(1.0);
81-
pblocktree.reset(new CBlockTreeDB(1 << 20, true));
82-
pcoinsdbview.reset(new CCoinsViewDB(1 << 23, true));
83-
pcoinsTip.reset(new CCoinsViewCache(pcoinsdbview.get()));
84-
if (!LoadGenesisBlock(chainparams)) {
85-
throw std::runtime_error("LoadGenesisBlock failed.");
86-
}
87-
{
88-
CValidationState state;
89-
if (!ActivateBestChain(state, chainparams)) {
90-
throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", FormatStateMessage(state)));
91-
}
92-
}
93-
nScriptCheckThreads = 3;
94-
for (int i=0; i < nScriptCheckThreads-1; i++)
95-
threadGroup.create_thread(&ThreadScriptCheck);
96-
97-
g_banman = MakeUnique<BanMan>(GetDataDir() / "banlist.dat", nullptr, DEFAULT_MISBEHAVING_BANTIME);
98-
g_connman = MakeUnique<CConnman>(0x1337, 0x1337); // Deterministic randomness for tests.
69+
// Ideally we'd move all the RPC tests to the functional testing framework
70+
// instead of unit tests, but for now we need these here.
71+
72+
RegisterAllCoreRPCCommands(tableRPC);
73+
ClearDatadirCache();
74+
75+
// We have to run a scheduler thread to prevent ActivateBestChain
76+
// from blocking due to queue overrun.
77+
threadGroup.create_thread(std::bind(&CScheduler::serviceQueue, &scheduler));
78+
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
79+
80+
mempool.setSanityCheck(1.0);
81+
pblocktree.reset(new CBlockTreeDB(1 << 20, true));
82+
pcoinsdbview.reset(new CCoinsViewDB(1 << 23, true));
83+
pcoinsTip.reset(new CCoinsViewCache(pcoinsdbview.get()));
84+
if (!LoadGenesisBlock(chainparams)) {
85+
throw std::runtime_error("LoadGenesisBlock failed.");
86+
}
87+
88+
CValidationState state;
89+
if (!ActivateBestChain(state, chainparams)) {
90+
throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", FormatStateMessage(state)));
91+
}
92+
93+
nScriptCheckThreads = 3;
94+
for (int i = 0; i < nScriptCheckThreads - 1; i++)
95+
threadGroup.create_thread(&ThreadScriptCheck);
96+
97+
g_banman = MakeUnique<BanMan>(GetDataDir() / "banlist.dat", nullptr, DEFAULT_MISBEHAVING_BANTIME);
98+
g_connman = MakeUnique<CConnman>(0x1337, 0x1337); // Deterministic randomness for tests.
9999
}
100100

101101
TestingSetup::~TestingSetup()

src/test/test_bitcoin.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ struct BasicTestingSetup {
7171
/** Testing setup that configures a complete environment.
7272
* Included are data directory, coins database, script check threads setup.
7373
*/
74-
class CConnman;
75-
class CNode;
76-
77-
class PeerLogicValidation;
7874
struct TestingSetup : public BasicTestingSetup {
7975
boost::thread_group threadGroup;
8076
CScheduler scheduler;

src/test/test_bitcoin_main.cpp

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)