aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-11-29 16:04:29 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2013-12-04 12:46:13 +0100
commit48ba56cdfd1f0d2478b0d8cffb828efb6982ed76 (patch)
tree9616a93d913e09f9a7b63878c107a591615cc6e0 /src/test
parent991685d3dc208cfcbc2f27900a7252fb14c8f7ad (diff)
downloadbitcoin-48ba56cdfd1f0d2478b0d8cffb828efb6982ed76.tar.xz
Delimit code with #ifdef ENABLE_WALLET
Delimit all code that uses the wallet functions in implementation files that conditionally use the wallet.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rpc_tests.cpp5
-rw-r--r--src/test/test_bitcoin.cpp10
2 files changed, 14 insertions, 1 deletions
diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp
index 76580bae43..e56aae225e 100644
--- a/src/test/rpc_tests.cpp
+++ b/src/test/rpc_tests.cpp
@@ -23,6 +23,7 @@ createArgs(int nRequired, const char* address1=NULL, const char* address2=NULL)
return result;
}
+#ifdef ENABLE_WALLET
BOOST_AUTO_TEST_CASE(rpc_addmultisig)
{
rpcfn_type addmultisig = tableRPC["addmultisigaddress"]->actor;
@@ -59,6 +60,7 @@ BOOST_AUTO_TEST_CASE(rpc_addmultisig)
string short2(address1Hex+1, address1Hex+sizeof(address1Hex)); // first byte missing
BOOST_CHECK_THROW(addmultisig(createArgs(2, short2.c_str()), false), runtime_error);
}
+#endif
static Value CallRPC(string args)
{
@@ -79,6 +81,7 @@ static Value CallRPC(string args)
}
}
+#ifdef ENABLE_WALLET
BOOST_AUTO_TEST_CASE(rpc_wallet)
{
// Test RPC calls for various wallet statistics
@@ -106,7 +109,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet)
BOOST_CHECK_NO_THROW(CallRPC("listreceivedbyaccount 0 true"));
BOOST_CHECK_THROW(CallRPC("listreceivedbyaccount 0 true extra"), runtime_error);
}
-
+#endif
BOOST_AUTO_TEST_CASE(rpc_rawparams)
{
diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp
index 443e7735d7..a804ff3803 100644
--- a/src/test/test_bitcoin.cpp
+++ b/src/test/test_bitcoin.cpp
@@ -7,7 +7,9 @@
#include "txdb.h"
#include "ui_interface.h"
#include "util.h"
+#ifdef ENABLE_WALLET
#include "wallet.h"
+#endif
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.hpp>
@@ -26,7 +28,9 @@ struct TestingSetup {
TestingSetup() {
fPrintToDebugger = true; // don't want to write to debug.log file
noui_connect();
+#ifdef ENABLE_WALLET
bitdb.MakeMock();
+#endif
pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
boost::filesystem::create_directories(pathTemp);
mapArgs["-datadir"] = pathTemp.string();
@@ -34,10 +38,12 @@ struct TestingSetup {
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
pcoinsTip = new CCoinsViewCache(*pcoinsdbview);
InitBlockIndex();
+#ifdef ENABLE_WALLET
bool fFirstRun;
pwalletMain = new CWallet("wallet.dat");
pwalletMain->LoadWallet(fFirstRun);
RegisterWallet(pwalletMain);
+#endif
nScriptCheckThreads = 3;
for (int i=0; i < nScriptCheckThreads-1; i++)
threadGroup.create_thread(&ThreadScriptCheck);
@@ -46,12 +52,16 @@ struct TestingSetup {
{
threadGroup.interrupt_all();
threadGroup.join_all();
+#ifdef ENABLE_WALLET
delete pwalletMain;
pwalletMain = NULL;
+#endif
delete pcoinsTip;
delete pcoinsdbview;
delete pblocktree;
+#ifdef ENABLE_WALLET
bitdb.Flush(true);
+#endif
boost::filesystem::remove_all(pathTemp);
}
};