Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport same PRs as done in bitcoin#11445 #3110

Merged
merged 48 commits into from
Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f55da3a
Merge #10711: [tests] Introduce TestNode
Aug 15, 2017
cc124c9
Remove Dash specific leftovers of node.stop optimization
codablock Sep 23, 2019
96966e5
Use TestNode.node_encrypt_wallet
codablock Sep 23, 2019
4049754
Dashify test_node.py
codablock Sep 23, 2019
1596b1d
Move -createwalletbackups=0 into test_node.py
codablock Sep 23, 2019
0a8ad8b
Merge #11091: test: Increase initial RPC timeout to 60 seconds
laanwj Aug 20, 2017
d09f88d
Merge #11077: [tests] fix timeout issues from TestNode
laanwj Aug 23, 2017
956e6bc
Merge #11068: qa: Move wait_until to util
Aug 23, 2017
1b77cc8
No need to assert wait_until
codablock Sep 23, 2019
1adc200
Merge #10798: [tests] [utils] test bitcoin-cli
Aug 24, 2017
ebfec22
Dashify BITCOINCLI
codablock Sep 23, 2019
74325db
Merge #10859: RPC: gettxout: Slightly improve doc and tests
Aug 28, 2017
37250c0
Merge #11150: [tests] Add getmininginfo test
Aug 29, 2017
17bb230
Merge #11121: TestNode tidyups
Sep 1, 2017
f51a4df
Allow calling add_nodes multiple times without reusing datadirs
codablock Sep 23, 2019
8ba042b
Fix dip3-deterministicmns.py
codablock Sep 23, 2019
39a1c64
Allow to set self.stderr when using vanilla setup_nodes()
codablock Sep 23, 2019
703f4c7
Fix stderr related issues
codablock Sep 23, 2019
ac0f483
Fix issues with set_test_params and start/stop_node
codablock Sep 23, 2019
a304d4d
Fix DashTestFramework and tests depending on it
codablock Sep 23, 2019
b9ce848
Merge #11215: [tests] fixups from set_test_params()
sipa Sep 1, 2017
d643ada
Merge #11241: [tests] Improve signmessages functional test
laanwj Sep 5, 2017
ec892d4
Merge #11234: Remove redundant testutil.cpp|h files
laanwj Sep 5, 2017
a2e8cb4
Merge #11210: Stop test_bitcoin-qt touching ~/.bitcoin
laanwj Sep 6, 2017
ded0187
Merge #11067: [qa] TestNode: Add wait_until_stopped helper method
Sep 6, 2017
b9599c2
Partially backport bitcoin#10838 for bitcoin_cli.py
codablock Sep 23, 2019
d446cc5
[test] Improve assert_raises_jsonrpc docstring
promag Sep 6, 2017
6245ce9
[test] Add support for custom arguments to TestNodeCLI
promag Sep 6, 2017
6548154
[test] Add assert_raises_process_error to assert process errors
promag Sep 6, 2017
102c3f2
[test] Replace check_output with low level version
promag Sep 6, 2017
797b474
Merge #11230: [tests] fixup dbcrash interaction with add_nodes()
Sep 12, 2017
bc5918a
Merge #11310: [tests] Test listwallets RPC
Sep 12, 2017
eb68d88
Merge #11116: [script] Unit tests for script/standard and IsMine func…
laanwj Sep 21, 2017
7ddd169
Merge #10552: [Test] Tests for zmqpubrawtx and zmqpubrawblock
Sep 29, 2017
8855f4b
qa: Treat mininode p2p exceptions as fatal
sdaftuar Sep 13, 2017
5c0e3ea
Merge #11422: qa: Verify DBWrapper iterators are taking snapshots
laanwj Oct 2, 2017
377a8fa
Merge #11399: Fix bip68-sequence rpc test
laanwj Oct 2, 2017
c8e17f1
Merge #11433: qa: Restore bitcoin-util-test py2 compatibility
Oct 3, 2017
dc303de
qa: Fix lcov for out-of-tree builds
Oct 2, 2017
5291c27
A few compilation fixes
codablock Sep 23, 2019
5a59538
Remove SegWit tests from script_standard_tests.cpp
codablock Sep 24, 2019
9ef73e6
Fix mining.py
codablock Sep 24, 2019
7b80cc8
Allow ignoring of known messages in mininode.py
codablock Sep 24, 2019
7a44dc1
Fix hash256() imports
codablock Sep 24, 2019
e37bd6d
Fix zmq_test.py
codablock Sep 24, 2019
b93785d
Fix maxuploadtarget.py
codablock Sep 24, 2019
f76d53d
Dashify a few strings in tests
codablock Sep 26, 2019
297e9a0
Remove more SegWit related tests from script_standard_tests.cpp
codablock Sep 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ AC_SUBST(DSYMUTIL_FLAT)
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/config.ini])
AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh])
AC_CONFIG_FILES([doc/Doxyfile])
AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py])
AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py])
AC_CONFIG_LINKS([test/util/bitcoin-util-test.py:test/util/bitcoin-util-test.py])

Expand Down
7 changes: 2 additions & 5 deletions src/Makefile.qttest.include
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ TEST_QT_H = \
qt/test/wallettests.h

TEST_BITCOIN_CPP = \
test/test_dash.cpp \
test/testutil.cpp
test/test_dash.cpp

TEST_BITCOIN_H = \
test/test_dash.h \
test/testutil.h

test/test_dash.h
qt_test_test_dash_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS)

Expand Down
5 changes: 2 additions & 3 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ BITCOIN_TESTS =\
test/script_P2PK_tests.cpp \
test/script_P2PKH_tests.cpp \
test/script_tests.cpp \
test/script_standard_tests.cpp \
test/scriptnum_tests.cpp \
test/serialize_tests.cpp \
test/sighash_tests.cpp \
Expand All @@ -89,8 +90,6 @@ BITCOIN_TESTS =\
test/test_dash.cpp \
test/test_dash.h \
test/test_dash_main.cpp \
test/testutil.cpp \
test/testutil.h \
test/timedata_tests.cpp \
test/torcontrol_tests.cpp \
test/transaction_tests.cpp \
Expand Down Expand Up @@ -163,7 +162,7 @@ dash_test_clean : FORCE

check-local:
@echo "Running test/util/bitcoin-util-test.py..."
$(top_builddir)/test/util/bitcoin-util-test.py
$(PYTHON) $(top_builddir)/test/util/bitcoin-util-test.py
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
if EMBEDDED_UNIVALUE
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue check
Expand Down
8 changes: 0 additions & 8 deletions src/qt/test/rpcnestedtests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "rpc/register.h"
#include "rpc/server.h"
#include "rpcconsole.h"
#include "test/testutil.h"
#include "test/test_dash.h"
#include "univalue.h"
#include "util.h"
Expand Down Expand Up @@ -40,11 +39,6 @@ void RPCNestedTests::rpcNestedTests()
// do some test setup
// could be moved to a more generic place when we add more tests on QT level
tableRPC.appendCommand("rpcNestedTest", &vRPCCommands[0]);
ClearDatadirCache();
std::string path = QDir::tempPath().toStdString() + "/" + strprintf("test_dash_qt_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
QDir dir(QString::fromStdString(path));
dir.mkpath(".");
gArgs.ForceSetArg("-datadir", path);
//mempool.setSanityCheck(1.0);

TestingSetup test;
Expand Down Expand Up @@ -139,6 +133,4 @@ void RPCNestedTests::rpcNestedTests()
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest(abc,,abc)"), std::runtime_error); //don't tollerate empty arguments when using ,
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest(abc,,)"), std::runtime_error); //don't tollerate empty arguments when using ,
#endif

fs::remove_all(fs::path(path));
}
4 changes: 4 additions & 0 deletions src/qt/test/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ int main(int argc, char *argv[])
SetupNetworking();
SelectParams(CBaseChainParams::MAIN);
noui_connect();
ClearDatadirCache();
fs::path pathTemp = fs::temp_directory_path() / strprintf("test_dash-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
fs::create_directories(pathTemp);
gArgs.ForceSetArg("-datadir", pathTemp.string());

bool fInvalid = false;

Expand Down
7 changes: 4 additions & 3 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,9 +1211,10 @@ UniValue gettxout(const JSONRPCRequest& request)
"gettxout \"txid\" n ( include_mempool )\n"
"\nReturns details about an unspent transaction output.\n"
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id\n"
"2. n (numeric, required) vout number\n"
"3. include_mempool (boolean, optional) Whether to include the mempool\n"
"1. \"txid\" (string, required) The transaction id\n"
"2. \"n\" (numeric, required) vout number\n"
"3. \"include_mempool\" (boolean, optional) Whether to include the mempool. Default: true."
" Note that an unspent output that is spent in the mempool won't appear.\n"
"\nResult:\n"
"{\n"
" \"bestblock\" : \"hash\", (string) the block hash\n"
Expand Down
16 changes: 14 additions & 2 deletions src/test/dbwrapper_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,31 @@ BOOST_AUTO_TEST_CASE(iterator_ordering)
for (int x=0x00; x<256; ++x) {
uint8_t key = x;
uint32_t value = x*x;
BOOST_CHECK(dbw.Write(key, value));
if (!(x & 1)) BOOST_CHECK(dbw.Write(key, value));
}

// Check that creating an iterator creates a snapshot
std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper&>(dbw).NewIterator());

for (int x=0x00; x<256; ++x) {
uint8_t key = x;
uint32_t value = x*x;
if (x & 1) BOOST_CHECK(dbw.Write(key, value));
}

for (int seek_start : {0x00, 0x80}) {
it->Seek((uint8_t)seek_start);
for (int x=seek_start; x<256; ++x) {
for (int x=seek_start; x<255; ++x) {
uint8_t key;
uint32_t value;
BOOST_CHECK(it->Valid());
if (!it->Valid()) // Avoid spurious errors about invalid iterator's key and value in case of failure
break;
BOOST_CHECK(it->GetKey(key));
if (x & 1) {
BOOST_CHECK_EQUAL(key, x + 1);
continue;
}
BOOST_CHECK(it->GetValue(value));
BOOST_CHECK_EQUAL(key, x);
BOOST_CHECK_EQUAL(value, x*x);
Expand Down
91 changes: 0 additions & 91 deletions src/test/multisig_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#include <boost/test/unit_test.hpp>

typedef std::vector<unsigned char> valtype;

BOOST_FIXTURE_TEST_SUITE(multisig_tests, BasicTestingSetup)

CScript
Expand Down Expand Up @@ -173,95 +171,6 @@ BOOST_AUTO_TEST_CASE(multisig_IsStandard)
BOOST_CHECK(!::IsStandard(malformed[i], whichType));
}

BOOST_AUTO_TEST_CASE(multisig_Solver1)
{
// Tests Solver() that returns lists of keys that are
// required to satisfy a ScriptPubKey
//
// Also tests IsMine() and ExtractDestination()
//
// Note: ExtractDestination for the multisignature transactions
// always returns false for this release, even if you have
// one key that would satisfy an (a|b) or 2-of-3 keys needed
// to spend an escrow transaction.
//
CBasicKeyStore keystore, emptykeystore, partialkeystore;
CKey key[3];
CTxDestination keyaddr[3];
for (int i = 0; i < 3; i++)
{
key[i].MakeNewKey(true);
keystore.AddKey(key[i]);
keyaddr[i] = key[i].GetPubKey().GetID();
}
partialkeystore.AddKey(key[0]);

{
std::vector<valtype> solutions;
txnouttype whichType;
CScript s;
s << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG;
BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK(solutions.size() == 1);
CTxDestination addr;
BOOST_CHECK(ExtractDestination(s, addr));
BOOST_CHECK(addr == keyaddr[0]);
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
}
{
std::vector<valtype> solutions;
txnouttype whichType;
CScript s;
s << OP_DUP << OP_HASH160 << ToByteVector(key[0].GetPubKey().GetID()) << OP_EQUALVERIFY << OP_CHECKSIG;
BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK(solutions.size() == 1);
CTxDestination addr;
BOOST_CHECK(ExtractDestination(s, addr));
BOOST_CHECK(addr == keyaddr[0]);
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
}
{
std::vector<valtype> solutions;
txnouttype whichType;
CScript s;
s << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG;
BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(solutions.size(), 4U);
CTxDestination addr;
BOOST_CHECK(!ExtractDestination(s, addr));
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
BOOST_CHECK(!IsMine(partialkeystore, s));
}
{
std::vector<valtype> solutions;
txnouttype whichType;
CScript s;
s << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG;
BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(solutions.size(), 4U);
std::vector<CTxDestination> addrs;
int nRequired;
BOOST_CHECK(ExtractDestinations(s, whichType, addrs, nRequired));
BOOST_CHECK(addrs[0] == keyaddr[0]);
BOOST_CHECK(addrs[1] == keyaddr[1]);
BOOST_CHECK(nRequired == 1);
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
BOOST_CHECK(!IsMine(partialkeystore, s));
}
{
std::vector<valtype> solutions;
txnouttype whichType;
CScript s;
s << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG;
BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK(solutions.size() == 5);
}
}

BOOST_AUTO_TEST_CASE(multisig_Sign)
{
// Test SignSignature() (and therefore the version of Solver() that signs transactions)
Expand Down
Loading