@@ -44,7 +44,7 @@ def run_bisect_benchmark(suite, bad, good, callback, threshold=None):
44
44
git_dir = suite .vc_dir
45
45
commits = suite .vc .git_command (
46
46
git_dir ,
47
- ['log' , '--first-parent' , '--format=format:%H' , f' { good } ^..{ bad } ' ],
47
+ ['log' , '--first-parent' , '--format=format:%H' , '{ }^..{}' . format ( good , bad ) ],
48
48
abortOnError = True ,
49
49
).splitlines ()
50
50
if not commits :
@@ -62,7 +62,7 @@ def run_bisect_benchmark(suite, bad, good, callback, threshold=None):
62
62
if values [good_index ] * 1.03 > values [bad_index ]:
63
63
sys .exit (
64
64
"Didn't detect a regression - less that 3% difference between good value "
65
- f" { values [ good_index ] } and bad value { values [bad_index ]} "
65
+ "{ } and bad value {}" . format ( values [good_index ], values [ bad_index ])
66
66
)
67
67
else :
68
68
bad_index = - 1
@@ -118,10 +118,10 @@ def bad_commit(self):
118
118
119
119
def visualize (self , level = 1 ):
120
120
level_marker = '=' * level
121
- print (f" { level_marker } { self .repo_name } " )
121
+ print (level_marker , self .repo_name )
122
122
for index , (commit , value ) in enumerate (zip (self .commits , self .values )):
123
123
if value is not None :
124
- print (f" { level_marker } { commit } { value :6.6} { get_message (self .suite , commit )} " )
124
+ print ("{ } {} {:6.6} {}" . format ( level_marker , commit , value , get_message (self .suite , commit )) )
125
125
if self .subresults and index in self .subresults :
126
126
self .subresults [index ].visualize (level + 1 )
127
127
@@ -130,7 +130,8 @@ def summarize(self):
130
130
for subresult in self .subresults .values ():
131
131
if subresult .summarize ():
132
132
return True
133
- print (f"Detected bad commit in { self .repo_name } repository:\n { self .bad_commit } { get_message (self .suite , self .bad_commit )} " )
133
+ print ("Detected bad commit in {} repository:\n {} {}"
134
+ .format (self .repo_name , self .bad_commit , get_message (self .suite , self .bad_commit )))
134
135
return True
135
136
return False
136
137
@@ -160,36 +161,35 @@ def bisect_benchmark(argv):
160
161
161
162
primary_suite = mx .primary_suite ()
162
163
163
- fetched_enterprise = False
164
+ fetched_enterprise = [ False ]
164
165
165
166
def benchmark_callback (suite , commit ):
166
- nonlocal fetched_enterprise
167
167
suite .vc .update_to_branch (suite .vc_dir , commit )
168
168
mx .run_mx (['sforceimports' ], suite = suite )
169
169
if args .enterprise and suite .name != 'vm-enterprise' :
170
170
checkout_args = ['--dynamicimports' , '/vm-enterprise' , 'checkout-downstream' , 'vm' , 'vm-enterprise' ]
171
- if fetched_enterprise :
171
+ if fetched_enterprise [ 0 ] :
172
172
checkout_args .append ('--no-fetch' )
173
173
mx .run_mx (checkout_args , out = mx .OutputCapture ())
174
174
mx .run_mx (['--env' , 'ee' , 'sforceimports' ], suite = get_suite ('/vm-enterprise' ))
175
- fetched_enterprise = True
175
+ fetched_enterprise [ 0 ] = True
176
176
elif suite .name != 'vm' :
177
177
mx .run_mx (['--env' , 'ce' , 'sforceimports' ], suite = get_suite ('/vm' ))
178
178
suite .vc .update_to_branch (suite .vc_dir , commit )
179
179
mx .run_mx (['sforceimports' ], suite = suite )
180
180
env = os .environ .copy ()
181
181
if 'CI' not in os .environ :
182
- env ['MX_ALT_OUTPUT_ROOT' ] = f 'mxbuild-{ commit } '
182
+ env ['MX_ALT_OUTPUT_ROOT' ] = 'mxbuild-{}' . format ( commit )
183
183
retcode = mx .run (shlex .split (args .build_command ), env = env , nonZeroIsFatal = False )
184
184
if retcode :
185
- sys .exit (f "Failed to execute the build command for { commit } " )
185
+ sys .exit ("Failed to execute the build command for {}" . format ( commit ) )
186
186
output = mx .OutputCapture ()
187
187
retcode = mx .run (shlex .split (args .benchmark_command ), env = env , out = mx .TeeOutputCapture (output ), nonZeroIsFatal = False )
188
188
if retcode :
189
- sys .exit (f "Failed to execute benchmark for { commit } " )
190
- match = re .search (rf' { re . escape ( args . benchmark_criterion ) } .*duration: ([\d.]+)' , output .data )
189
+ sys .exit ("Failed to execute benchmark for {}" . format ( commit ) )
190
+ match = re .search (r'{ }.*duration: ([\d.]+)'. format ( re . escape ( args . benchmark_criterion )) , output .data )
191
191
if not match :
192
- sys .exit (f "Failed to get result from the benchmark" )
192
+ sys .exit ("Failed to get result from the benchmark" )
193
193
return float (match .group (1 ))
194
194
195
195
bad = get_commit (primary_suite , args .bad )
@@ -202,4 +202,4 @@ def benchmark_callback(suite, commit):
202
202
print ()
203
203
204
204
if 'CI' not in os .environ :
205
- print (f "You can rerun a benchmark for a particular commit using:\n MX_ALT_OUTPUT_ROOT=mxbuild-$commit { args .benchmark_command } " )
205
+ print ("You can rerun a benchmark for a particular commit using:\n MX_ALT_OUTPUT_ROOT=mxbuild-$commit {}" . format ( args .benchmark_command ) )
0 commit comments