mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 19:37:27 -03:00
Merge bitcoin/bitcoin#27919: ci: Run fuzz target even if input folder is empty
0000f55293
ci: Run fuzz target even if input folder is empty (MarcoFalke) Pull request description: This should catch trivial integer sanitizer bugs if the author and all reviewers forget to look for them. ACKs for top commit: brunoerg: reACK0000f55293
dergoegge: reACK0000f55293
Tree-SHA512: f139b9d56f0cf1aae339c2890721c77c88d1fea77b73d492c1386ec99b4f393c5b664029919ff4a22e4e8a2929f085699a148c6acc2cc3e40df8a72fd39ff474
This commit is contained in:
commit
a596bdf3e9
2 changed files with 19 additions and 5 deletions
|
@ -170,5 +170,5 @@ if [ "${RUN_TIDY}" = "true" ]; then
|
|||
fi
|
||||
|
||||
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
|
||||
bash -c "LD_LIBRARY_PATH=${DEPENDS_DIR}/${HOST}/lib test/fuzz/test_runner.py ${FUZZ_TESTS_CONFIG} $MAKEJOBS -l DEBUG ${DIR_FUZZ_IN}"
|
||||
bash -c "LD_LIBRARY_PATH=${DEPENDS_DIR}/${HOST}/lib test/fuzz/test_runner.py ${FUZZ_TESTS_CONFIG} $MAKEJOBS -l DEBUG ${DIR_FUZZ_IN} --empty_min_time=60"
|
||||
fi
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"""
|
||||
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from pathlib import Path
|
||||
import argparse
|
||||
import configparser
|
||||
import logging
|
||||
|
@ -41,6 +42,11 @@ def main():
|
|||
action='store_true',
|
||||
help='If true, run fuzzing binaries under the valgrind memory error detector',
|
||||
)
|
||||
parser.add_argument(
|
||||
"--empty_min_time",
|
||||
type=int,
|
||||
help="If set, run at least this long, if the existing fuzz inputs directory is empty.",
|
||||
)
|
||||
parser.add_argument(
|
||||
'-x',
|
||||
'--exclude',
|
||||
|
@ -76,6 +82,7 @@ def main():
|
|||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
args.corpus_dir = Path(args.corpus_dir)
|
||||
|
||||
# Set up logging
|
||||
logging.basicConfig(
|
||||
|
@ -180,6 +187,7 @@ def main():
|
|||
src_dir=config['environment']['SRCDIR'],
|
||||
build_dir=config["environment"]["BUILDDIR"],
|
||||
use_valgrind=args.valgrind,
|
||||
empty_min_time=args.empty_min_time,
|
||||
)
|
||||
|
||||
|
||||
|
@ -251,16 +259,22 @@ def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dir)
|
|||
future.result()
|
||||
|
||||
|
||||
def run_once(*, fuzz_pool, corpus, test_list, src_dir, build_dir, use_valgrind):
|
||||
def run_once(*, fuzz_pool, corpus, test_list, src_dir, build_dir, use_valgrind, empty_min_time):
|
||||
jobs = []
|
||||
for t in test_list:
|
||||
corpus_path = os.path.join(corpus, t)
|
||||
corpus_path = corpus / t
|
||||
os.makedirs(corpus_path, exist_ok=True)
|
||||
args = [
|
||||
os.path.join(build_dir, 'src', 'test', 'fuzz', 'fuzz'),
|
||||
'-runs=1',
|
||||
corpus_path,
|
||||
]
|
||||
empty_dir = not any(corpus_path.iterdir())
|
||||
if empty_min_time and empty_dir:
|
||||
args += [f"-max_total_time={empty_min_time}"]
|
||||
else:
|
||||
args += [
|
||||
"-runs=1",
|
||||
corpus_path,
|
||||
]
|
||||
if use_valgrind:
|
||||
args = ['valgrind', '--quiet', '--error-exitcode=1'] + args
|
||||
|
||||
|
|
Loading…
Reference in a new issue