@@ -147,7 +147,7 @@ def from_testcase_manager_crash(cls, crash):
147147 get_unsymbolized_crash_stacktrace (crash .stack_file_path ))
148148 except Exception :
149149 logs .error (
150- 'Unable to read stacktrace from file %s.' % crash .stack_file_path )
150+ f 'Unable to read stacktrace from file { crash .stack_file_path } .' )
151151 return None
152152
153153 # If there are per-testcase additional flags, we need to store them.
@@ -230,8 +230,7 @@ def __init__(self,
230230 self .crash_categories = state .crash_categories
231231 self .security_flag = crash_analyzer .is_security_issue (
232232 self .unsymbolized_crash_stacktrace , self .crash_type , self .crash_address )
233- self .key = '%s,%s,%s' % (self .crash_type , self .crash_state ,
234- self .security_flag ) # pylint: disable=attribute-defined-outside-init
233+ self .key = f'{ self .crash_type } ,{ self .crash_state } ,{ self .security_flag } '
235234 self .should_be_ignored = crash_analyzer .ignore_stacktrace (
236235 state .crash_stacktrace )
237236
@@ -278,9 +277,9 @@ def get_error(self):
278277 return f'Functional crash is ignored: { self .crash_state } '
279278
280279 if self .should_be_ignored :
281- return ('False crash: %s \n \n ---%s \n \n ---%s' %
282- ( self .crash_state , self . unsymbolized_crash_stacktrace ,
283- self .crash_stacktrace ) )
280+ return (f 'False crash: { self . crash_state } \n \n '
281+ f'--- { self .unsymbolized_crash_stacktrace } \n \n '
282+ f'--- { self .crash_stacktrace } ' )
284283
285284 if self .is_uploaded () and not self .fuzzed_key :
286285 return f'Unable to store testcase in blobstore: { self .crash_state } '
@@ -503,7 +502,7 @@ def _last_sync_time(sync_file_path):
503502 last_sync_time = datetime .datetime .utcfromtimestamp (float (file_contents ))
504503 except Exception as e :
505504 logs .error (
506- 'Malformed last sync file: "%s ".' % str ( e ) ,
505+ f 'Malformed last sync file: "{ e } ".' ,
507506 path = sync_file_path ,
508507 contents = file_contents )
509508
@@ -551,7 +550,7 @@ def sync_from_gcs(self):
551550 """Update sync state after a sync from GCS."""
552551 already_synced = False
553552 sync_file_path = os .path .join (
554- self ._data_directory , '.%s_sync' % self ._project_qualified_target_name )
553+ self ._data_directory , f'. { self ._project_qualified_target_name } _sync' )
555554
556555 # Get last time we synced corpus.
557556 if environment .is_trusted_host ():
@@ -658,7 +657,7 @@ def get_testcases(testcase_count, testcase_directory, data_directory):
658657
659658 # Create output strings.
660659 generated_testcase_string = (
661- 'Generated %d/%d testcases.' % ( generated_testcase_count , testcase_count ) )
660+ f 'Generated { generated_testcase_count } / { testcase_count } testcases.' )
662661
663662 # Log the number of testcases generated.
664663 logs .info (generated_testcase_string )
@@ -754,7 +753,7 @@ def store_fuzzer_run_results(testcase_file_paths, fuzzer, fuzzer_command,
754753 # Store fuzzer console output.
755754 bot_name = environment .get_value ('BOT_NAME' )
756755 if fuzzer_return_code is not None :
757- fuzzer_return_code_string = 'Return code (%d ).' % fuzzer_return_code
756+ fuzzer_return_code_string = f 'Return code ({ fuzzer_return_code } ).'
758757 else :
759758 fuzzer_return_code_string = 'Fuzzer timed out.'
760759 truncated_fuzzer_output = truncate_fuzzer_output (fuzzer_output ,
@@ -1151,8 +1150,8 @@ def key_fn(crash):
11511150 # Archiving testcase to blobstore might fail for all crashes within this
11521151 # group.
11531152 if not group .main_crash :
1154- logs .info ('Unable to store testcase in blobstore: %s' %
1155- group .crashes [0 ].crash_state )
1153+ logs .info ('Unable to store testcase in blobstore: '
1154+ f' { group .crashes [0 ].crash_state } ' )
11561155 continue
11571156
11581157 group_proto = uworker_msg_pb2 .FuzzTaskCrashGroup (
@@ -1379,6 +1378,7 @@ def generate_blackbox_testcases(
13791378 # Make sure we have a file to execute for the fuzzer.
13801379 if not fuzzer .executable_path :
13811380 logs .error (f'Fuzzer { fuzzer_name } does not have an executable path.' )
1381+
13821382 return error_return_value
13831383
13841384 # Get the fuzzer executable and chdir to its base directory. This helps to
@@ -1410,7 +1410,7 @@ def generate_blackbox_testcases(
14101410 fuzzer_timeout = environment .get_value ('FUZZER_TIMEOUT' )
14111411
14121412 # Run the fuzzer.
1413- logs .info ('Running fuzzer - %s.' % fuzzer_command )
1413+ logs .info (f 'Running fuzzer - { fuzzer_command } .' )
14141414 fuzzer_return_code , fuzzer_duration , fuzzer_output = (
14151415 process_handler .run_process (
14161416 fuzzer_command ,
@@ -1655,10 +1655,10 @@ def do_blackbox_fuzzing(self, fuzzer, fuzzer_directory, job_type):
16551655 trial_selector .setup_additional_args_for_app ()
16561656
16571657 logs .info ('Starting to process testcases.' )
1658- logs .info ('Redzone is %d bytes.' % self . redzone )
1659- logs .info ('Timeout multiplier is %s.' % str ( self .timeout_multiplier ) )
1660- logs .info ('App launch command is %s.' %
1661- testcase_manager .get_command_line_for_application ())
1658+ logs .info (f 'Redzone is { self . redzone } bytes.' )
1659+ logs .info (f 'Timeout multiplier is { self .timeout_multiplier } .' )
1660+ logs .info ('App launch command is '
1661+ f' { testcase_manager .get_command_line_for_application ()} .' )
16621662
16631663 # Start processing the testcases.
16641664 while test_number < len (testcase_file_paths ):
@@ -1718,9 +1718,7 @@ def do_blackbox_fuzzing(self, fuzzer, fuzzer_directory, job_type):
17181718 crashes .append (temp_queue .get ())
17191719
17201720 process_handler .close_queue (temp_queue )
1721-
1722- logs .info ('Upto %d' % test_number )
1723-
1721+ logs .info (f'Upto { test_number } ' )
17241722 if thread_error_occurred :
17251723 break
17261724
@@ -1824,10 +1822,9 @@ def run(self):
18241822 self .data_directory = setup .get_data_bundle_directory (
18251823 self .fuzzer , self .uworker_input .setup_input )
18261824 if not self .data_directory :
1827- logs .error (
1828- 'Unable to setup data bundle %s.' % self .fuzzer .data_bundle_name )
1825+ logs .error (f'Unable to setup data bundle { self .fuzzer .data_bundle_name } .' )
18291826 return uworker_msg_pb2 .Output ( # pylint: disable=no-member
1830- error_type = uworker_msg_pb2 .ErrorType .FUZZ_DATA_BUNDLE_SETUP_FAILURE ) # pylint: disable=no-member
1827+ error_type = uworker_msg_pb2 .ErrorType .FUZZ_DATA_BUNDLE_SETUP_FAILURE )
18311828
18321829 if engine_impl :
18331830 crashes , fuzzer_metadata = self .do_engine_fuzzing (engine_impl )
0 commit comments