aboutsummaryrefslogtreecommitdiff
path: root/src/qt/test/test_main.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-01-17 09:10:10 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-01-17 09:10:21 +0100
commitd0bf9bb6a539f151ec92725d20a2b6c22cb095a5 (patch)
tree76d3ea14296c73d0580b7117c956371e7a81bfa7 /src/qt/test/test_main.cpp
parent427e9c9435f6c4a52b372265128534dbf1221a04 (diff)
parent7f122a4188af7130be9251611e41136a17c814f1 (diff)
Merge bitcoin/bitcoin#23373: test: Parse command line arguments from unit and fuzz tests, make addrman consistency check ratio easier to change
7f122a4188af7130be9251611e41136a17c814f1 fuzz: non-addrman fuzz tests: override-able check ratio (Vasil Dimov) 3bd83e273d104e9474af8f1bdf4f969163e33ade fuzz: addrman fuzz tests: override-able check ratio (Vasil Dimov) 46b0fe78298c8f416a91dec9d4e0f3f4cb1e68b0 test: non-addrman unit tests: override-able check ratio (Vasil Dimov) 81e4d54d3a95f7bffeb353217a6c32eb2aca8b5c test: addrman unit tests: override-able check ratio (Vasil Dimov) 6dff6214be768a3fab6d5201daf5ef6071764746 bench: put addrman check ratio in a variable (Vasil Dimov) 6f7c7567c578b5a41f8e90ce4491e40f7faeaa56 fuzz: parse the command line arguments in fuzz tests (Vasil Dimov) 92a0f7e58d4b6323d21f1c45d4c20266c35df030 test: parse the command line arguments in unit tests (Vasil Dimov) Pull request description: Previously command line arguments passed to unit and fuzz tests would be ignored by the tests themselves. They would be used by the boost test framework (e.g. `--run_test="addrman_tests/*"`) or by the fuzzer (e.g. `-runs=1`). However both provide ways to pass down the extra arguments to the test itself. Use that, parse the arguments and make them available to the tests via `gArgs`. This makes the tests more flexible as they can be run with any bitcoind config option specified on the command line. When creating `AddrMan` objects in tests, use `-checkaddrman=` (if provided) instead of hardcoding the check ratio in many different places. See https://github.com/bitcoin/bitcoin/pull/20233#issuecomment-889813074 for further motivation for this. ACKs for top commit: mzumsande: re-ACK 7f122a4188af7130be9251611e41136a17c814f1 josibake: reACK https://github.com/bitcoin/bitcoin/pull/23373/commits/7f122a4188af7130be9251611e41136a17c814f1 Tree-SHA512: 3a05e61e4d70a0569bb67594bcce3aad8fdef63cdcc54e2823a3bc9f18679571985004412b6c332a210f67849bab32d8467b4115fbff8f5fac9834982e60dcf3
Diffstat (limited to 'src/qt/test/test_main.cpp')
-rw-r--r--src/qt/test/test_main.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp
index 11aa61c7fc..10b7e2ffe7 100644
--- a/src/qt/test/test_main.cpp
+++ b/src/qt/test/test_main.cpp
@@ -22,6 +22,7 @@
#include <QApplication>
#include <QObject>
#include <QTest>
+#include <functional>
#if defined(QT_STATICPLUGIN)
#include <QtPlugin>
@@ -43,6 +44,8 @@ using node::NodeContext;
const std::function<void(const std::string&)> G_TEST_LOG_FUN{};
+const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS{};
+
// This is all you need to run all the tests
int main(int argc, char* argv[])
{