@@ -185,6 +185,7 @@ def _bisect_benchmark(argv, bisect_id, email_to):
185
185
args .benchmark_command = sec ['benchmark_command' ]
186
186
args .benchmark_criterion = sec .get ('benchmark_criterion' , 'BEST' )
187
187
args .enterprise = sec .getboolean ('enterprise' , False )
188
+ args .no_clean = sec .getboolean ('no_clean' , False )
188
189
else :
189
190
parser = argparse .ArgumentParser ()
190
191
parser .add_argument ('bad' , help = "Bad commit for bisection" )
@@ -195,6 +196,7 @@ def _bisect_benchmark(argv, bisect_id, email_to):
195
196
parser .add_argument ('--benchmark-criterion' , default = 'BEST' ,
196
197
help = "Which result parameter should be used for comparisons" )
197
198
parser .add_argument ('--enterprise' , action = 'store_true' , help = "Whether to checkout graal-enterprise" )
199
+ parser .add_argument ('--no-clean' , action = 'store_true' , help = "Do not run 'mx clean' between runs" )
198
200
args = parser .parse_args (argv )
199
201
200
202
primary_suite = mx .primary_suite ()
@@ -221,14 +223,20 @@ def benchmark_callback(suite, commit):
221
223
if args .enterprise :
222
224
debug_str += " graal-enterprise={}" .format (get_commit (get_suite ('/vm-enterprise' )))
223
225
print (debug_str )
224
- env = os .environ .copy ()
225
- env ['MX_ALT_OUTPUT_ROOT' ] = 'mxbuild-{}' .format (commit )
226
- retcode = mx .run (shlex .split (args .build_command ), env = env , nonZeroIsFatal = False )
226
+ build_command = shlex .split (args .build_command )
227
+ if not args .no_clean :
228
+ try :
229
+ clean_command = build_command [:build_command .index ('build' )] + ['clean' ]
230
+ retcode = mx .run (clean_command , nonZeroIsFatal = False )
231
+ if retcode :
232
+ print ("Warning: clean command failed" )
233
+ except ValueError :
234
+ pass
235
+ retcode = mx .run (build_command , nonZeroIsFatal = False )
227
236
if retcode :
228
237
raise RuntimeError ("Failed to execute the build command for {}" .format (commit ))
229
238
output = mx .OutputCapture ()
230
- retcode = mx .run (shlex .split (args .benchmark_command ), env = env , out = mx .TeeOutputCapture (output ),
231
- nonZeroIsFatal = False )
239
+ retcode = mx .run (shlex .split (args .benchmark_command ), out = mx .TeeOutputCapture (output ), nonZeroIsFatal = False )
232
240
if retcode :
233
241
raise RuntimeError ("Failed to execute benchmark for {}" .format (commit ))
234
242
match = re .search (r'{}.*duration: ([\d.]+)' .format (re .escape (args .benchmark_criterion )), output .data )
@@ -247,10 +255,6 @@ def benchmark_callback(suite, commit):
247
255
print ()
248
256
print (summary )
249
257
250
- if 'CI' not in os .environ :
251
- print ("You can rerun a benchmark for a particular commit using:\n MX_ALT_OUTPUT_ROOT=mxbuild-$commit {}" .format (
252
- args .benchmark_command ))
253
-
254
258
send_email (
255
259
bisect_id ,
256
260
email_to ,
0 commit comments