mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Merge e9dc26cb20
into 65714c162c
This commit is contained in:
commit
ed4fefdf61
1 changed files with 28 additions and 0 deletions
|
@ -251,6 +251,10 @@ def generate_corpus(*, fuzz_pool, src_dir, fuzz_bin, corpus_dir, targets):
|
||||||
targets = transform_process_message_target(targets, Path(src_dir))
|
targets = transform_process_message_target(targets, Path(src_dir))
|
||||||
targets = transform_rpc_target(targets, Path(src_dir))
|
targets = transform_rpc_target(targets, Path(src_dir))
|
||||||
|
|
||||||
|
# Counter for completed jobs
|
||||||
|
completed_jobs = 0
|
||||||
|
last_reported = -5
|
||||||
|
|
||||||
def job(command, t, t_env):
|
def job(command, t, t_env):
|
||||||
logging.debug(f"Running '{command}'")
|
logging.debug(f"Running '{command}'")
|
||||||
logging.debug("Command '{}' output:\n'{}'\n".format(
|
logging.debug("Command '{}' output:\n'{}'\n".format(
|
||||||
|
@ -284,11 +288,17 @@ def generate_corpus(*, fuzz_pool, src_dir, fuzz_bin, corpus_dir, targets):
|
||||||
|
|
||||||
for future in as_completed(futures):
|
for future in as_completed(futures):
|
||||||
future.result()
|
future.result()
|
||||||
|
completed_jobs, last_reported = log_and_update_percent_complete(completed_jobs, len(targets), last_reported)
|
||||||
|
|
||||||
|
|
||||||
def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, fuzz_bin, merge_dirs):
|
def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, fuzz_bin, merge_dirs):
|
||||||
logging.info(f"Merge the inputs from the passed dir into the corpus_dir. Passed dirs {merge_dirs}")
|
logging.info(f"Merge the inputs from the passed dir into the corpus_dir. Passed dirs {merge_dirs}")
|
||||||
jobs = []
|
jobs = []
|
||||||
|
|
||||||
|
# Counter for completed jobs
|
||||||
|
completed_jobs = 0
|
||||||
|
last_reported = -5
|
||||||
|
|
||||||
for t in test_list:
|
for t in test_list:
|
||||||
args = [
|
args = [
|
||||||
fuzz_bin,
|
fuzz_bin,
|
||||||
|
@ -326,10 +336,25 @@ def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, fuzz_bin, merge_dirs)
|
||||||
|
|
||||||
for future in as_completed(jobs):
|
for future in as_completed(jobs):
|
||||||
future.result()
|
future.result()
|
||||||
|
completed_jobs, last_reported = log_and_update_percent_complete(completed_jobs, len(test_list), last_reported)
|
||||||
|
|
||||||
|
|
||||||
|
def log_and_update_percent_complete(completed_jobs, number_of_jobs, last_reported):
|
||||||
|
completed_jobs += 1
|
||||||
|
percentage = (completed_jobs / number_of_jobs) * 100
|
||||||
|
if percentage >= last_reported + 5:
|
||||||
|
logging.info(f"Progress: {completed_jobs}/{number_of_jobs} jobs completed ({percentage:.2f}%)")
|
||||||
|
last_reported = (percentage // 5) * 5
|
||||||
|
return completed_jobs, last_reported
|
||||||
|
|
||||||
|
|
||||||
def run_once(*, fuzz_pool, corpus, test_list, src_dir, fuzz_bin, using_libfuzzer, use_valgrind, empty_min_time):
|
def run_once(*, fuzz_pool, corpus, test_list, src_dir, fuzz_bin, using_libfuzzer, use_valgrind, empty_min_time):
|
||||||
jobs = []
|
jobs = []
|
||||||
|
|
||||||
|
# Counter for completed jobs
|
||||||
|
completed_jobs = 0
|
||||||
|
last_reported = -5
|
||||||
|
|
||||||
for t in test_list:
|
for t in test_list:
|
||||||
corpus_path = corpus / t
|
corpus_path = corpus / t
|
||||||
os.makedirs(corpus_path, exist_ok=True)
|
os.makedirs(corpus_path, exist_ok=True)
|
||||||
|
@ -366,6 +391,9 @@ def run_once(*, fuzz_pool, corpus, test_list, src_dir, fuzz_bin, using_libfuzzer
|
||||||
stats = []
|
stats = []
|
||||||
for future in as_completed(jobs):
|
for future in as_completed(jobs):
|
||||||
output, result, target = future.result()
|
output, result, target = future.result()
|
||||||
|
|
||||||
|
completed_jobs, last_reported = log_and_update_percent_complete(completed_jobs, len(test_list), last_reported)
|
||||||
|
|
||||||
logging.debug(output)
|
logging.debug(output)
|
||||||
try:
|
try:
|
||||||
result.check_returncode()
|
result.check_returncode()
|
||||||
|
|
Loading…
Add table
Reference in a new issue