@@ -119,13 +119,54 @@ def compare_builds(merged_data):
119
119
return result
120
120
121
121
122
+ def forecast_tests (merged_data , kbuilds , checkout ):
123
+ tests = []
124
+ for kbuild in kbuilds :
125
+ kbuild_data = merged_data .get ("jobs" , {}).get (kbuild , {})
126
+ jobs = merged_data .get ("scheduler" , [])
127
+ for job in jobs :
128
+ kind = job .get ("event" , {}).get ("kind" )
129
+ if kind != "kbuild" :
130
+ continue
131
+ scheduler_rules = job .get ("rules" , [])
132
+ job_name = job .get ("job" )
133
+ job_data = merged_data .get ("jobs" , {}).get (job_name , {})
134
+ job_rules = job_data .get ("rules" , [])
135
+ # we might have rules in scheduler entries too
136
+ scheduler_rules = job .get ("rules" , [])
137
+ node = {
138
+ "kind" : "kbuild" ,
139
+ "data" : {
140
+ "kernel_revision" : {
141
+ "tree" : checkout .get ("tree" ),
142
+ "branch" : checkout .get ("branch" ),
143
+ "version" : {
144
+ "version" : 6 ,
145
+ "patchlevel" : 16 ,
146
+ "extra" : "-rc3-973-gb7d1bbd97f77"
147
+ },
148
+ }
149
+ },
150
+ }
151
+ if not validate_rules (node , job_rules ) or not validate_rules (node , scheduler_rules ):
152
+ continue
153
+ # runtime/name in scheduler
154
+ runtime = job .get ("runtime" , {}).get ("name" )
155
+ platforms = job .get ("platforms" , [])
156
+ test_name = f"{ job_name } ({ runtime } ) { platforms } "
157
+ tests .append (test_name )
158
+
159
+ return tests
160
+
161
+
122
162
# pylint: disable=too-many-branches disable=too-many-locals
123
163
def do_forecast (merged_data ):
124
164
"""
125
165
We will simulate checkout event on each tree/branch
126
166
and try to build list of builds/tests it will run
127
167
"""
128
168
checkouts = []
169
+ tests = []
129
170
build_configs = merged_data .get ("build_configs" , {})
130
171
for bcfg in build_configs :
131
172
data = build_configs [bcfg ]
@@ -182,10 +223,16 @@ def do_forecast(merged_data):
182
223
print (f" Identical builds: { checkout ['kbuilds_identical' ]} " )
183
224
if checkout .get ("kbuilds" ):
184
225
num_builds = len (checkout ["kbuilds" ])
226
+ if num_builds > 0 :
227
+ tests .extend (forecast_tests (merged_data , checkout ["kbuilds" ], checkout ))
185
228
print (f" Number of builds: { num_builds } " )
186
229
print (" Builds:" )
187
230
for build in checkout ["kbuilds" ]:
188
231
print (f" - { build } " )
232
+ print (f" Number of tests: { len (tests )} " )
233
+ print (f" Tests:" )
234
+ for test in tests :
235
+ print (f" - { test } " )
189
236
else :
190
237
print (" No builds found for this checkout" )
191
238
0 commit comments