Skip to content

Commit f59ce2b

Browse files
committed
Log minimization progress.
1 parent 1ea3e07 commit f59ce2b

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/clusterfuzz/_internal/bot/tasks/utasks/minimize_task.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,9 @@ def utask_main(uworker_input: uworker_msg_pb2.Input): # pylint: disable=no-memb
452452
warmup_timeout = environment.get_value('WARMUP_TIMEOUT')
453453
required_arguments = environment.get_value('REQUIRED_APP_ARGS', '')
454454

455+
logs.info('Warming up for minimization, checking for crashes ' +
456+
f'(thread count: {max_threads}).')
457+
455458
# Add any testcase-specific required arguments if needed.
456459
additional_required_arguments = testcase.get_metadata(
457460
'additional_required_app_args')
@@ -474,6 +477,7 @@ def utask_main(uworker_input: uworker_msg_pb2.Input): # pylint: disable=no-memb
474477

475478
saved_unsymbolized_crash_state, flaky_stack, crash_times = (
476479
check_for_initial_crash(test_runner, crash_retries, testcase))
480+
logs.info(f'Warmup crashed {crash_times}/{crash_retries} times.')
477481

478482
# If the warmup crash occurred but we couldn't reproduce this in with
479483
# multiple processes running in parallel, try to minimize single threaded.
@@ -490,6 +494,7 @@ def utask_main(uworker_input: uworker_msg_pb2.Input): # pylint: disable=no-memb
490494

491495
saved_unsymbolized_crash_state, flaky_stack, crash_times = (
492496
check_for_initial_crash(test_runner, crash_retries, testcase))
497+
logs.info(f'Single-threaded warmup crashed {crash_times} times.')
493498

494499
if not crash_times:
495500
# We didn't crash at all. This might be a legitimately unreproducible
@@ -519,12 +524,13 @@ def utask_main(uworker_input: uworker_msg_pb2.Input): # pylint: disable=no-memb
519524

520525
# Use the max crash time unless this would be greater than the max timeout.
521526
test_timeout = min(max(crash_times), max_timeout) + 1
522-
logs.info(f'Using timeout {test_timeout} (was {max_timeout})')
527+
logs.info(f'Using per-test timeout {test_timeout} (was {max_timeout})')
523528
test_runner.timeout = test_timeout
524529

525-
logs.info('Starting minimization.')
530+
logs.info(f'Starting minimization with overall {deadline}s timeout.')
526531

527532
if should_attempt_phase(testcase, MinimizationPhase.GESTURES):
533+
logs.info('Starting gesture minimization phase.')
528534
gestures = minimize_gestures(test_runner, testcase)
529535

530536
# We can't call check_deadline_exceeded_and_store_partial_minimized_testcase
@@ -547,39 +553,48 @@ def utask_main(uworker_input: uworker_msg_pb2.Input): # pylint: disable=no-memb
547553
minimize_task_output.minimization_phase = MinimizationPhase.MAIN_FILE
548554

549555
if time.time() > test_runner.deadline:
556+
logs.info('Timed out during gesture minimization.')
550557
return uworker_msg_pb2.Output( # pylint: disable=no-member
551558
minimize_task_output=minimize_task_output,
552559
error_type=uworker_msg_pb2.ErrorType. # pylint: disable=no-member
553560
MINIMIZE_DEADLINE_EXCEEDED_IN_MAIN_FILE_PHASE)
554561

562+
logs.info('Minimized gestures.')
563+
555564
# Minimize the main file.
556565
data = utils.get_file_contents_with_fatal_error_on_failure(testcase_file_path)
557566
if should_attempt_phase(testcase, MinimizationPhase.MAIN_FILE):
567+
logs.info('Starting main file minimization phase.')
558568
data = minimize_main_file(test_runner, testcase_file_path, data)
559569

560570
if check_deadline_exceeded_and_store_partial_minimized_testcase(
561571
deadline, testcase, input_directory, file_list, data,
562572
testcase_file_path, minimize_task_input, minimize_task_output):
573+
logs.info('Timed out during main file minimization.')
563574
return uworker_msg_pb2.Output( # pylint: disable=no-member
564575
error_type=uworker_msg_pb2.ErrorType.MINIMIZE_DEADLINE_EXCEEDED, # pylint: disable=no-member
565576
minimize_task_output=minimize_task_output)
566577

578+
logs.info('Minimized main file.')
567579
testcase.set_metadata('minimization_phase', MinimizationPhase.FILE_LIST,
568580
False)
569581
minimize_task_output.minimization_phase = MinimizationPhase.FILE_LIST
570582

571583
# Minimize the file list.
572584
if should_attempt_phase(testcase, MinimizationPhase.FILE_LIST):
573585
if environment.get_value('MINIMIZE_FILE_LIST', True):
586+
logs.info('Starting file list minimization phase.')
574587
file_list = minimize_file_list(test_runner, file_list, input_directory,
575588
testcase_file_path)
576589

577590
if check_deadline_exceeded_and_store_partial_minimized_testcase(
578591
deadline, testcase, input_directory, file_list, data,
579592
testcase_file_path, minimize_task_input, minimize_task_output):
593+
logs.info('Timed out during file list minimization.')
580594
return uworker_msg_pb2.Output( # pylint: disable=no-member
581595
error_type=uworker_msg_pb2.ErrorType.MINIMIZE_DEADLINE_EXCEEDED, # pylint: disable=no-member
582596
minimize_task_output=minimize_task_output)
597+
logs.info('Minimized file list.')
583598
else:
584599
logs.info('Skipping minimization of file list.')
585600

@@ -590,16 +605,20 @@ def utask_main(uworker_input: uworker_msg_pb2.Input): # pylint: disable=no-memb
590605
# Minimize any files remaining in the file list.
591606
if should_attempt_phase(testcase, MinimizationPhase.RESOURCES):
592607
if environment.get_value('MINIMIZE_RESOURCES', True):
608+
logs.info('Starting resources minimization phase.')
593609
for dependency in file_list:
594610
minimize_resource(test_runner, dependency, input_directory,
595611
testcase_file_path)
596612

597613
if check_deadline_exceeded_and_store_partial_minimized_testcase(
598614
deadline, testcase, input_directory, file_list, data,
599615
testcase_file_path, minimize_task_input, minimize_task_output):
616+
logs.info('Timed out during resources minimization.')
600617
return uworker_msg_pb2.Output( # pylint: disable=no-member
601618
error_type=uworker_msg_pb2.ErrorType.MINIMIZE_DEADLINE_EXCEEDED, # pylint: disable=no-member
602619
minimize_task_output=minimize_task_output)
620+
621+
logs.info('Minimized resources.')
603622
else:
604623
logs.info('Skipping minimization of resources.')
605624

@@ -608,6 +627,7 @@ def utask_main(uworker_input: uworker_msg_pb2.Input): # pylint: disable=no-memb
608627
minimize_task_output.minimization_phase = MinimizationPhase.ARGUMENTS
609628

610629
if should_attempt_phase(testcase, MinimizationPhase.ARGUMENTS):
630+
logs.info('Starting arguments minimization phase.')
611631
app_arguments = minimize_arguments(test_runner, app_arguments)
612632

613633
# Arguments must be stored here in case we time out below.
@@ -617,10 +637,15 @@ def utask_main(uworker_input: uworker_msg_pb2.Input): # pylint: disable=no-memb
617637
if check_deadline_exceeded_and_store_partial_minimized_testcase(
618638
deadline, testcase, input_directory, file_list, data,
619639
testcase_file_path, minimize_task_input, minimize_task_output):
640+
logs.info('Timed out during arguments minimization.')
620641
return uworker_msg_pb2.Output( # pylint: disable=no-member
621642
error_type=uworker_msg_pb2.ErrorType.MINIMIZE_DEADLINE_EXCEEDED, # pylint: disable=no-member
622643
minimize_task_output=minimize_task_output)
623644

645+
logs.info('Minimized arguments.')
646+
647+
logs.info('Finished minization.')
648+
624649
command = testcase_manager.get_command_line_for_application(
625650
testcase_file_path, app_args=app_arguments, needs_http=testcase.http_flag)
626651
last_crash_result = test_runner.last_failing_result

0 commit comments

Comments
 (0)