2 This module contains utilities for doing coverage analysis on the RPC 5 It provides a way to track which RPC commands are exercised during 12 REFERENCE_FILENAME =
'rpc_interface.txt' 17 An object that wraps AuthServiceProxy to record specific RPC calls. 20 def __init__(self, auth_service_proxy_instance, coverage_logfile=None):
23 auth_service_proxy_instance (AuthServiceProxy): the instance 25 coverage_logfile (str): if specified, write each service_name 26 out to a file when called. 40 Delegates to AuthServiceProxy, then writes the particular RPC method 49 f.write(
"%s\n" % rpc_method)
60 Get a filename unique to the test process ID and node. 62 This file will contain a list of RPC commands covered. 64 pid = str(os.getpid())
66 dirname,
"coverage.pid%s.node%s.txt" % (pid, str(n_node)))
71 Write out a list of all RPC functions available in `bitcoin-cli` for 72 coverage comparison. This will only happen once per coverage 76 dirname (str): temporary test dir 77 node (AuthServiceProxy): client 80 bool. if the RPC interface file was written. 83 filename = os.path.join(dirname, REFERENCE_FILENAME)
85 if os.path.isfile(filename):
88 help_output = node.help().split(
'\n')
91 for line
in help_output:
95 if line
and not line.startswith(
'='):
96 commands.add(
"%s\n" % line.split()[0])
98 with open(filename,
'w')
as f:
99 f.writelines(list(commands))
def write_all_rpc_commands(dirname, node)
auth_service_proxy_instance
def __getattr__(self, args, kwargs)
def get_filename(dirname, n_node)
def __call__(self, args, kwargs)
def __init__(self, auth_service_proxy_instance, coverage_logfile=None)