Skip to content

Commit b552675

Browse files
committed
Stop using MX_ALT_OUTPUT_ROOT in bisection script
1 parent 1e3ee23 commit b552675

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

mx.graalpython/mx_graalpython_bisect.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def _bisect_benchmark(argv, bisect_id, email_to):
185185
args.benchmark_command = sec['benchmark_command']
186186
args.benchmark_criterion = sec.get('benchmark_criterion', 'BEST')
187187
args.enterprise = sec.getboolean('enterprise', False)
188+
args.no_clean = sec.getboolean('no_clean', False)
188189
else:
189190
parser = argparse.ArgumentParser()
190191
parser.add_argument('bad', help="Bad commit for bisection")
@@ -195,6 +196,7 @@ def _bisect_benchmark(argv, bisect_id, email_to):
195196
parser.add_argument('--benchmark-criterion', default='BEST',
196197
help="Which result parameter should be used for comparisons")
197198
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")
198200
args = parser.parse_args(argv)
199201

200202
primary_suite = mx.primary_suite()
@@ -221,14 +223,20 @@ def benchmark_callback(suite, commit):
221223
if args.enterprise:
222224
debug_str += " graal-enterprise={}".format(get_commit(get_suite('/vm-enterprise')))
223225
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)
227236
if retcode:
228237
raise RuntimeError("Failed to execute the build command for {}".format(commit))
229238
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)
232240
if retcode:
233241
raise RuntimeError("Failed to execute benchmark for {}".format(commit))
234242
match = re.search(r'{}.*duration: ([\d.]+)'.format(re.escape(args.benchmark_criterion)), output.data)
@@ -247,10 +255,6 @@ def benchmark_callback(suite, commit):
247255
print()
248256
print(summary)
249257

250-
if 'CI' not in os.environ:
251-
print("You can rerun a benchmark for a particular commit using:\nMX_ALT_OUTPUT_ROOT=mxbuild-$commit {}".format(
252-
args.benchmark_command))
253-
254258
send_email(
255259
bisect_id,
256260
email_to,

0 commit comments

Comments
 (0)