mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-12 12:52:35 -03:00
Merge #18159: tests: Add --valgrind option to test/fuzz/test_runner.py for running fuzzing test cases under valgrind
1b068c50dd
tests: Add --valgrind option to test/fuzz/test_runner.py for running fuzzing test cases under valgrind (practicalswift) Pull request description: Add `--valgrind` option to `test/fuzz/test_runner.py` for running fuzzing test cases under `valgrind`. Test this PR using: ``` $ make distclean $ ./autogen.sh $ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=fuzzer $ make $ git clone https://github.com/bitcoin-core/qa-assets $ test/fuzz/test_runner.py --valgrind -l DEBUG qa-assets/fuzz_seed_corpus/ ``` ACKs for top commit: MarcoFalke: ACK1b068c50dd
🌒 Tree-SHA512: e6eb99af1bceaa6f36f49092a05de415848099ccc1497cc098a62e925954c978cb37a46410b44ed5eef2c6464ca4ecb06397b75b5d35701f5a8525436e47b9fd
This commit is contained in:
commit
94c0287aec
1 changed files with 9 additions and 1 deletions
|
@ -61,6 +61,11 @@ def main():
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='If true, export coverage information to files in the seed corpus',
|
help='If true, export coverage information to files in the seed corpus',
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--valgrind',
|
||||||
|
action='store_true',
|
||||||
|
help='If true, run fuzzing binaries under the valgrind memory error detector. Valgrind 3.14 or later required.',
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'seed_dir',
|
'seed_dir',
|
||||||
help='The seed corpus to run on (must contain subfolders for each fuzz target).',
|
help='The seed corpus to run on (must contain subfolders for each fuzz target).',
|
||||||
|
@ -129,10 +134,11 @@ def main():
|
||||||
test_list=test_list_selection,
|
test_list=test_list_selection,
|
||||||
build_dir=config["environment"]["BUILDDIR"],
|
build_dir=config["environment"]["BUILDDIR"],
|
||||||
export_coverage=args.export_coverage,
|
export_coverage=args.export_coverage,
|
||||||
|
use_valgrind=args.valgrind,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def run_once(*, corpus, test_list, build_dir, export_coverage):
|
def run_once(*, corpus, test_list, build_dir, export_coverage, use_valgrind):
|
||||||
for t in test_list:
|
for t in test_list:
|
||||||
corpus_path = os.path.join(corpus, t)
|
corpus_path = os.path.join(corpus, t)
|
||||||
if t in FUZZERS_MISSING_CORPORA:
|
if t in FUZZERS_MISSING_CORPORA:
|
||||||
|
@ -143,6 +149,8 @@ def run_once(*, corpus, test_list, build_dir, export_coverage):
|
||||||
'-detect_leaks=0',
|
'-detect_leaks=0',
|
||||||
corpus_path,
|
corpus_path,
|
||||||
]
|
]
|
||||||
|
if use_valgrind:
|
||||||
|
args = ['valgrind', '--quiet', '--error-exitcode=1', '--exit-on-first-error=yes'] + args
|
||||||
logging.debug('Run {} with args {}'.format(t, args))
|
logging.debug('Run {} with args {}'.format(t, args))
|
||||||
result = subprocess.run(args, stderr=subprocess.PIPE, universal_newlines=True)
|
result = subprocess.run(args, stderr=subprocess.PIPE, universal_newlines=True)
|
||||||
output = result.stderr
|
output = result.stderr
|
||||||
|
|
Loading…
Reference in a new issue