MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / transform_rpc_target

Function transform_rpc_target

test/fuzz/test_runner.py:223–239  ·  view source on GitHub ↗

Add a target per RPC command, and also keep ("rpc", {}) to allow for cross-pollination, or unlimited search

(targets, src_dir)

Source from the content-addressed store, hash-verified

221
222
223def transform_rpc_target(targets, src_dir):
224 """Add a target per RPC command, and also keep ("rpc", {}) to allow for cross-pollination,
225 or unlimited search"""
226
227 rpc_target = "rpc"
228 if (rpc_target, {}) in targets:
229 lines = subprocess.run(
230 ["git", "grep", "--function-context", "RPC_COMMANDS_SAFE_FOR_FUZZING{", "src/test/fuzz/rpc.cpp"],
231 check=True,
232 stdout=subprocess.PIPE,
233 text=True,
234 cwd=src_dir,
235 ).stdout.splitlines()
236 lines = [l.split("\"", 1)[1].split("\"")[0] for l in lines if l.startswith("src/test/fuzz/rpc.cpp- \"")]
237 assert len(lines)
238 targets += [(rpc_target, {"LIMIT_TO_RPC_COMMAND": r}) for r in lines]
239 return targets
240
241
242def generate_corpus(*, fuzz_pool, src_dir, fuzz_bin, corpus_dir, targets):

Callers 1

generate_corpusFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected