9
9
import mx
10
10
11
11
12
- SUITE = mx .suite ('graalpython' )
12
+ def get_suite (name ):
13
+ suite_name = name .lstrip ('/' )
14
+ suite = mx .suite (suite_name , fatalIfMissing = False )
15
+ if not suite :
16
+ suite = mx .primary_suite ().import_suite (suite_name , version = None , urlinfos = None , in_subdir = name .startswith ('/' ))
17
+ assert suite
18
+ return suite
19
+
20
+
21
+ def get_downstream_suite (suite ):
22
+ downstreams = {
23
+ 'graalpython-apptests' : 'graalpython' ,
24
+ 'graalpython-extensions' : 'graalpython' ,
25
+ 'graalpython' : '/vm' ,
26
+ 'vm' : '/vm-enterprise' ,
27
+ }
28
+ downstream = downstreams .get (suite .name )
29
+ if downstream :
30
+ return get_suite (downstream )
13
31
14
32
15
33
def get_commit (suite , ref = 'HEAD' ):
@@ -22,16 +40,16 @@ def get_message(suite, commit):
22
40
return suite .vc .git_command (suite .vc_dir , ['log' , '--format=%s' , '-n' , '1' , commit ]).strip ()
23
41
24
42
25
- def run_bisect_benchmark (suite , bad , good , callback , downstreams , threshold = None ):
43
+ def run_bisect_benchmark (suite , bad , good , callback , threshold = None ):
26
44
git_dir = suite .vc_dir
27
- commits = SUITE .vc .git_command (
45
+ commits = suite .vc .git_command (
28
46
git_dir ,
29
47
['log' , '--merges' , '--format=format:%H' , f'{ good } ^..{ bad } ' ],
30
48
abortOnError = True ,
31
49
).splitlines ()
32
50
if not commits :
33
51
sys .exit ("No merge commits found in the range. Did you swap good and bad?" )
34
- downstream_suite = downstreams . get (suite )
52
+ downstream_suite = get_downstream_suite (suite )
35
53
values = [None ] * len (commits )
36
54
if threshold is None :
37
55
bad_index = 0
@@ -66,7 +84,7 @@ def run_bisect_benchmark(suite, bad, good, callback, downstreams, threshold=None
66
84
downstream_bad = get_commit (downstream_suite )
67
85
subresults = {}
68
86
if downstream_bad and downstream_good and downstream_bad != downstream_good :
69
- subresult = run_bisect_benchmark (downstream_suite , downstream_bad , downstream_good , callback , downstreams , threshold )
87
+ subresult = run_bisect_benchmark (downstream_suite , downstream_bad , downstream_good , callback , threshold )
70
88
subresults [bad_index ] = subresult
71
89
return BisectResult (suite , commits , values , good_index , bad_index , subresults )
72
90
@@ -117,18 +135,6 @@ def summarize(self):
117
135
return False
118
136
119
137
120
- def get_suite_py (commit ):
121
- suite_py = SUITE .vc .git_command (['show' , f'{ commit } :mx.graalpython/suite.py' ], abortOnError = True )
122
- namespace = {}
123
- exec (suite_py , namespace , namespace )
124
- return namespace ['suite' ]
125
-
126
-
127
- def get_graal_commit (commit ):
128
- suite_py = get_suite_py (commit )
129
- return [imp for imp in suite_py ['imports' ] if imp ['name' ] == 'sulong' ][0 ]['version' ]
130
-
131
-
132
138
def bisect_benchmark (argv ):
133
139
if 'BISECT_BENCHMARK_CONFIG' in os .environ :
134
140
cp = configparser .ConfigParser ()
@@ -152,12 +158,7 @@ def bisect_benchmark(argv):
152
158
parser .add_argument ('--enterprise' , action = 'store_true' )
153
159
args = parser .parse_args (argv )
154
160
155
- vm_suite = mx .suite ('vm' )
156
- downstreams = {
157
- SUITE : vm_suite ,
158
- }
159
- if args .enterprise :
160
- downstreams [vm_suite ] = mx .suite ('vm-enterprise' )
161
+ primary_suite = mx .primary_suite ()
161
162
162
163
fetched_enterprise = False
163
164
@@ -170,10 +171,10 @@ def benchmark_callback(suite, commit):
170
171
if fetched_enterprise :
171
172
checkout_args .append ('--no-fetch' )
172
173
mx .run_mx (checkout_args , out = mx .OutputCapture ())
173
- mx .run_mx (['--env' , 'ee' , 'sforceimports' ], suite = mx . suite ( ' vm-enterprise' ))
174
+ mx .run_mx (['--env' , 'ee' , 'sforceimports' ], suite = get_suite ( '/ vm-enterprise' ))
174
175
fetched_enterprise = True
175
176
elif suite .name != 'vm' :
176
- mx .run_mx (['--env' , 'ce' , 'sforceimports' ], suite = vm_suite )
177
+ mx .run_mx (['--env' , 'ce' , 'sforceimports' ], suite = get_suite ( '/vm' ) )
177
178
suite .vc .update_to_branch (suite .vc_dir , commit )
178
179
mx .run_mx (['sforceimports' ], suite = suite )
179
180
env = os .environ .copy ()
@@ -191,9 +192,9 @@ def benchmark_callback(suite, commit):
191
192
sys .exit (f"Failed to get result from the benchmark" )
192
193
return float (match .group (1 ))
193
194
194
- bad = get_commit (SUITE , args .bad )
195
- good = get_commit (SUITE , args .good )
196
- result = run_bisect_benchmark (SUITE , bad , good , benchmark_callback , downstreams )
195
+ bad = get_commit (primary_suite , args .bad )
196
+ good = get_commit (primary_suite , args .good )
197
+ result = run_bisect_benchmark (primary_suite , bad , good , benchmark_callback )
197
198
print ()
198
199
result .visualize ()
199
200
print ()
0 commit comments