Skip to content

Commit 3658026

Browse files
author
Chethan Krishna
committed
Remove cpp test for wallet-utility
1 parent efb0d55 commit 3658026

File tree

5 files changed

+305
-351
lines changed

5 files changed

+305
-351
lines changed

src/Makefile.test.include

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ EXTRA_DIST += \
1717
test/data/txcreate2.hex \
1818
test/data/txcreatedata1.hex \
1919
test/data/txcreatedata2.hex \
20-
test/data/txcreatesign.hex
20+
test/data/txcreatesign.hex \
21+
test/wallet-utility.py \
22+
test/data/wallet.dat
2123

2224
JSON_TEST_FILES = \
2325
test/data/script_valid.json \
@@ -92,8 +94,7 @@ if ENABLE_WALLET
9294
BITCOIN_TESTS += \
9395
test/accounting_tests.cpp \
9496
wallet/test/wallet_tests.cpp \
95-
test/rpc_wallet_tests.cpp \
96-
test/walletutil_tests.cpp
97+
test/rpc_wallet_tests.cpp
9798
endif
9899

99100
test_test_bitcoin_SOURCES = $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
@@ -131,8 +132,10 @@ bitcoin_test_clean : FORCE
131132
check-local:
132133
@echo "Running test/bitcoin-util-test.py..."
133134
$(AM_V_at)srcdir=$(srcdir) PYTHONPATH=$(builddir)/test $(srcdir)/test/bitcoin-util-test.py
135+
if ENABLE_WALLET
134136
@echo "Running test/wallet-utility.py..."
135137
$(AM_V_at)srcdir=$(srcdir) PYTHONPATH=$(builddir)/test $(srcdir)/test/wallet-utility.py
138+
endif
136139
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
137140
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue check
138141

src/test/test_bitcoin.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,6 @@ struct TestingSetup: public BasicTestingSetup {
3333
~TestingSetup();
3434
};
3535

36-
/** Wallet setup that configures a complete environment.
37-
* Included are data directory, coins database, script check threads
38-
* and wallet with 5 unused keys.
39-
*/
40-
struct WalletSetup: public BasicTestingSetup {
41-
boost::filesystem::path pathTemp;
42-
43-
WalletSetup(const std::string& chainName = CBaseChainParams::MAIN);
44-
~WalletSetup();
45-
};
46-
4736
class CBlock;
4837
struct CMutableTransaction;
4938
class CScript;

src/test/wallet-utility.py

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,59 @@
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
from subprocess import check_output
7-
import json
8-
6+
import subprocess
97
import os
8+
import json
9+
import sys
10+
import buildenv
11+
import shutil
1012

1113
def assert_equal(thing1, thing2):
1214
if thing1 != thing2:
1315
raise AssertionError("%s != %s"%(str(thing1),str(thing2)))
1416

1517
if __name__ == '__main__':
1618
datadir = os.environ["srcdir"] + "/test/data"
17-
command = os.environ["srcdir"] + "/wallet-utility"
18-
19-
output = json.loads(check_output([command, "-datadir=" + datadir]))
20-
21-
assert_equal(output[0], "13EngsxkRi7SJPPqCyJsKf34U8FoX9E9Av");
22-
assert_equal(output[1], "1FKCLGTpPeYBUqfNxktck8k5nqxB8sjim8");
23-
assert_equal(output[2], "13cdtE9tnNeXCZJ8KQ5WELgEmLSBLnr48F");
24-
25-
26-
19+
execprog = './wallet-utility' + buildenv.exeext
20+
execargs = '-datadir=' + datadir
21+
execrun = execprog + ' ' + execargs
22+
23+
proc = subprocess.Popen(execrun, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)
24+
try:
25+
outs = proc.communicate()
26+
except OSError:
27+
print("OSError, Failed to execute " + execprog)
28+
sys.exit(1)
29+
30+
output = json.loads(outs[0])
31+
32+
assert_equal(output[0], "13EngsxkRi7SJPPqCyJsKf34U8FoX9E9Av")
33+
assert_equal(output[1], "1FKCLGTpPeYBUqfNxktck8k5nqxB8sjim8")
34+
assert_equal(output[2], "13cdtE9tnNeXCZJ8KQ5WELgEmLSBLnr48F")
35+
36+
execargs = '-datadir=' + datadir + ' -dumppass'
37+
execrun = execprog + ' ' + execargs
38+
39+
proc = subprocess.Popen(execrun, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)
40+
try:
41+
outs = proc.communicate()
42+
except OSError:
43+
print("OSError, Failed to execute " + execprog)
44+
sys.exit(1)
45+
46+
output = json.loads(outs[0])
47+
48+
assert_equal(output[0]['addr'], "13EngsxkRi7SJPPqCyJsKf34U8FoX9E9Av")
49+
assert_equal(output[0]['pkey'], "5Jz5BWE2WQxp1hGqDZeisQFV1mRFR2AVBAgiXCbNcZyXNjD9aUd")
50+
assert_equal(output[1]['addr'], "1FKCLGTpPeYBUqfNxktck8k5nqxB8sjim8")
51+
assert_equal(output[1]['pkey'], "5HsX2b3v2GjngYQ5ZM4mLp2b2apw6aMNVaPELV1YmpiYR1S4jzc")
52+
assert_equal(output[2]['addr'], "13cdtE9tnNeXCZJ8KQ5WELgEmLSBLnr48F")
53+
assert_equal(output[2]['pkey'], "5KCWAs1wX2ESiL4PfDR8XYVSSETHFd2jaRGxt1QdanBFTit4XcH")
54+
55+
if os.path.exists(datadir + '/database'):
56+
if os.path.isdir(datadir + '/database'):
57+
shutil.rmtree(datadir + '/database')
58+
59+
if os.path.exists(datadir + '/db.log'):
60+
os.remove(datadir + '/db.log')
61+
sys.exit(0)

src/test/walletutil_tests.cpp

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

0 commit comments

Comments
 (0)