test: parse the command line arguments in unit tests

Retrieve the command line arguments from boost and pass them to
`BasicTestingSetup` so that we gain extra flexibility of passing any
config options on the test command line, e.g.:

```
test_bitcoin -- -printtoconsole=1 -checkaddrman=5
```
This commit is contained in:
Vasil Dimov
2021-10-08 18:11:40 +02:00
parent c561f2f06e
commit 92a0f7e58d
7 changed files with 56 additions and 12 deletions

View File

@@ -12,6 +12,7 @@
#include <cstdint>
#include <exception>
#include <functional>
#include <memory>
#include <string>
#include <unistd.h>
@@ -19,6 +20,8 @@
const std::function<void(const std::string&)> G_TEST_LOG_FUN{};
const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS{};
std::map<std::string_view, std::tuple<TypeTestOneInput, TypeInitialize, TypeHidden>>& FuzzTargets()
{
static std::map<std::string_view, std::tuple<TypeTestOneInput, TypeInitialize, TypeHidden>> g_fuzz_targets;