aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorstratospher <44024636+stratospher@users.noreply.github.com>2023-12-15 13:41:30 +0530
committerstratospher <44024636+stratospher@users.noreply.github.com>2024-01-08 21:54:55 +0530
commit802e6e128bba5ffa6d4ec53ff45acccb7cb28f21 (patch)
tree9983622bd37ac9166494bf1634ec681e9810e042 /src/common
parentc2d04f1319a6af6140d17339c4814e0cfc605dd2 (diff)
[init] Add new command line arg for use only in functional tests
some of the existing command line args are to be only used in functional tests. ex: addrmantest, fastprune etc.. make a separate category -test=<option> for these so that code is cleaner and user's debug-help output is straightforward.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/args.cpp11
-rw-r--r--src/common/args.h5
2 files changed, 16 insertions, 0 deletions
diff --git a/src/common/args.cpp b/src/common/args.cpp
index a9108e5916..efd132f541 100644
--- a/src/common/args.cpp
+++ b/src/common/args.cpp
@@ -682,6 +682,17 @@ std::string HelpMessageOpt(const std::string &option, const std::string &message
std::string("\n\n");
}
+const std::vector<std::string> TEST_OPTIONS_DOC{
+};
+
+bool HasTestOption(const ArgsManager& args, const std::string& test_option)
+{
+ const auto options = args.GetArgs("-test");
+ return std::any_of(options.begin(), options.end(), [test_option](const auto& option) {
+ return option == test_option;
+ });
+}
+
fs::path GetDefaultDataDir()
{
// Windows: C:\Users\Username\AppData\Roaming\Bitcoin
diff --git a/src/common/args.h b/src/common/args.h
index 6451b194d1..78a61313b9 100644
--- a/src/common/args.h
+++ b/src/common/args.h
@@ -447,6 +447,11 @@ bool HelpRequested(const ArgsManager& args);
/** Add help options to the args manager */
void SetupHelpOptions(ArgsManager& args);
+extern const std::vector<std::string> TEST_OPTIONS_DOC;
+
+/** Checks if a particular test option is present in -test command-line arg options */
+bool HasTestOption(const ArgsManager& args, const std::string& test_option);
+
/**
* Format a string to be used as group of options in help messages
*