diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 085d4f6b016..241ab7f9bf1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,9 +9,9 @@ function(create_test_config) macro(set_configure_variable var conf_var) if(${var}) - set(${conf_var}_TRUE "") + set(${conf_var}_VALUE true) else() - set(${conf_var}_TRUE "#") + set(${conf_var}_VALUE false) endif() endmacro() diff --git a/test/config.ini.in b/test/config.ini.in index 45b69ded41b..26733b8b58c 100644 --- a/test/config.ini.in +++ b/test/config.ini.in @@ -14,19 +14,19 @@ EXEEXT=@EXEEXT@ RPCAUTH=@abs_top_srcdir@/share/rpcauth/rpcauth.py [components] -# Which components are enabled. These are commented out by cmake if they were disabled during configuration. -@ENABLE_WALLET_TRUE@ENABLE_WALLET=true -@BUILD_BENCH_TRUE@BUILD_BENCH=true -@BUILD_BITCOIN_CLI_TRUE@ENABLE_CLI=true -@BUILD_BITCOIN_TX_TRUE@BUILD_BITCOIN_TX=true -@BUILD_BITCOIN_UTIL_TRUE@ENABLE_BITCOIN_UTIL=true -@BUILD_BITCOIN_CHAINSTATE_TRUE@ENABLE_BITCOIN_CHAINSTATE=true -@BUILD_BITCOIN_WALLET_TRUE@ENABLE_WALLET_TOOL=true -@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=true -@ENABLE_FUZZ_BINARY_TRUE@ENABLE_FUZZ_BINARY=true -@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=true -@ENABLE_EMBEDDED_ASMAP_TRUE@ENABLE_EMBEDDED_ASMAP=true -@ENABLE_EXTERNAL_SIGNER_TRUE@ENABLE_EXTERNAL_SIGNER=true -@ENABLE_USDT_TRACEPOINTS_TRUE@ENABLE_USDT_TRACEPOINTS=true -@ENABLE_IPC_TRUE@ENABLE_IPC=true -@BUILD_GUI_TRUE@BUILD_GUI=true +# Which components are enabled. +ENABLE_WALLET=@ENABLE_WALLET_VALUE@ +BUILD_BENCH=@BUILD_BENCH_VALUE@ +ENABLE_CLI=@BUILD_BITCOIN_CLI_VALUE@ +BUILD_BITCOIN_TX=@BUILD_BITCOIN_TX_VALUE@ +ENABLE_BITCOIN_UTIL=@BUILD_BITCOIN_UTIL_VALUE@ +ENABLE_BITCOIN_CHAINSTATE=@BUILD_BITCOIN_CHAINSTATE_VALUE@ +ENABLE_WALLET_TOOL=@BUILD_BITCOIN_WALLET_VALUE@ +ENABLE_BITCOIND=@BUILD_BITCOIND_VALUE@ +ENABLE_FUZZ_BINARY=@ENABLE_FUZZ_BINARY_VALUE@ +ENABLE_ZMQ=@ENABLE_ZMQ_VALUE@ +ENABLE_EMBEDDED_ASMAP=@ENABLE_EMBEDDED_ASMAP_VALUE@ +ENABLE_EXTERNAL_SIGNER=@ENABLE_EXTERNAL_SIGNER_VALUE@ +ENABLE_USDT_TRACEPOINTS=@ENABLE_USDT_TRACEPOINTS_VALUE@ +ENABLE_IPC=@ENABLE_IPC_VALUE@ +BUILD_GUI=@BUILD_GUI_VALUE@ diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index f1a8fdefd01..0617d334119 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -1124,55 +1124,55 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): def is_bench_compiled(self): """Checks whether bench_bitcoin was compiled.""" - return self.config["components"].getboolean("BUILD_BENCH") + return self.config.getboolean("components", "BUILD_BENCH") def is_cli_compiled(self): """Checks whether bitcoin-cli was compiled.""" - return self.config["components"].getboolean("ENABLE_CLI") + return self.config.getboolean("components", "ENABLE_CLI") def is_external_signer_compiled(self): """Checks whether external signer support was compiled.""" - return self.config["components"].getboolean("ENABLE_EXTERNAL_SIGNER") + return self.config.getboolean("components", "ENABLE_EXTERNAL_SIGNER") def is_wallet_compiled(self): """Checks whether the wallet module was compiled.""" - return self.config["components"].getboolean("ENABLE_WALLET") + return self.config.getboolean("components", "ENABLE_WALLET") def is_wallet_tool_compiled(self): """Checks whether bitcoin-wallet was compiled.""" - return self.config["components"].getboolean("ENABLE_WALLET_TOOL") + return self.config.getboolean("components", "ENABLE_WALLET_TOOL") def is_bitcoin_tx_compiled(self): """Checks whether bitcoin-tx was compiled.""" - return self.config["components"].getboolean("BUILD_BITCOIN_TX") + return self.config.getboolean("components", "BUILD_BITCOIN_TX") def is_bitcoin_util_compiled(self): """Checks whether bitcoin-util was compiled.""" - return self.config["components"].getboolean("ENABLE_BITCOIN_UTIL") + return self.config.getboolean("components", "ENABLE_BITCOIN_UTIL") def is_bitcoin_chainstate_compiled(self): """Checks whether bitcoin-chainstate was compiled.""" - return self.config["components"].getboolean("ENABLE_BITCOIN_CHAINSTATE") + return self.config.getboolean("components", "ENABLE_BITCOIN_CHAINSTATE") def is_zmq_compiled(self): """Checks whether the zmq module was compiled.""" - return self.config["components"].getboolean("ENABLE_ZMQ") + return self.config.getboolean("components", "ENABLE_ZMQ") def is_embedded_asmap_compiled(self): """Checks whether ASMap data was embedded during compilation.""" - return self.config["components"].getboolean("ENABLE_EMBEDDED_ASMAP") + return self.config.getboolean("components", "ENABLE_EMBEDDED_ASMAP") def is_usdt_compiled(self): """Checks whether the USDT tracepoints were compiled.""" - return self.config["components"].getboolean("ENABLE_USDT_TRACEPOINTS") + return self.config.getboolean("components", "ENABLE_USDT_TRACEPOINTS") def is_ipc_compiled(self): """Checks whether ipc was compiled.""" - return self.config["components"].getboolean("ENABLE_IPC") + return self.config.getboolean("components", "ENABLE_IPC") def is_gui_compiled(self): """Checks whether the GUI was compiled.""" - return self.config["components"].getboolean("BUILD_GUI", fallback=False) + return self.config.getboolean("components", "BUILD_GUI") def has_blockfile(self, node, filenum: str): return (node.blocks_path/ f"blk{filenum}.dat").is_file() diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index f2c3595e0bc..68fbf4208b1 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -479,7 +479,7 @@ def main(): assert results_filepath.parent.exists(), "Results file parent directory does not exist" logging.debug("Test results will be written to " + str(results_filepath)) - enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND") + enable_bitcoind = config.getboolean("components", "ENABLE_BITCOIND") if not enable_bitcoind: print("No functional tests to run.") @@ -548,7 +548,7 @@ def main(): # Exclude all variants of a test remove_tests([test for test in test_list if test.split('.py')[0] == exclude_test.split('.py')[0]]) - if config["components"].getboolean("BUILD_BENCH") and TOOL_BENCH_SANITY_CHECK in test_list: + if config.getboolean("components", "BUILD_BENCH") and TOOL_BENCH_SANITY_CHECK in test_list: # Remove it, and expand it for each bench in the list test_list.remove(TOOL_BENCH_SANITY_CHECK) bench_cmd = Binaries(get_binary_paths(config), bin_dir=None).bench_argv() + ["-list"] diff --git a/test/fuzz/test_runner.py b/test/fuzz/test_runner.py index 503acdc1c9c..91df295f62c 100755 --- a/test/fuzz/test_runner.py +++ b/test/fuzz/test_runner.py @@ -101,7 +101,7 @@ def main(): configfile = os.path.abspath(os.path.dirname(__file__)) + "/../config.ini" config.read_file(open(configfile)) - if not config["components"].getboolean("ENABLE_FUZZ_BINARY"): + if not config.getboolean("components", "ENABLE_FUZZ_BINARY"): logging.error("Must have fuzz executable built") sys.exit(1)