@@ -29,8 +29,13 @@ NEW_INSTANCE = 'new'
29
29
30
30
31
31
def get_workspace_for_instance (instance , args ):
32
- return common .private_workspace (
33
- os .path .join (args .swift_branch , instance ))
32
+ if instance == OLD_INSTANCE and args .old_workspace is not None :
33
+ return args .old_workspace
34
+ elif instance == NEW_INSTANCE and args .new_workspace is not None :
35
+ return args .new_workspace
36
+ else :
37
+ return common .private_workspace (
38
+ os .path .join (args .swift_branch , instance ))
34
39
35
40
36
41
def setup_workspace (instance , workspace , args ):
@@ -84,6 +89,7 @@ def main():
84
89
with open (ws_comment , 'w' ) as f :
85
90
f .write ("Compilation-performance test failed" )
86
91
92
+ failures = []
87
93
for instance in instances :
88
94
workspace = get_workspace_for_instance (instance , args )
89
95
@@ -95,9 +101,9 @@ def main():
95
101
build_swift_toolchain (workspace , args )
96
102
97
103
if not args .skip_runner :
98
- execute_runner (instance , workspace , configs , args )
104
+ failures += execute_runner (instance , workspace , configs , args )
99
105
100
- regressions = analyze_results (configs , args )
106
+ regressions = analyze_results (configs , failures , args )
101
107
102
108
# Crude hack to write output to workspace when in CI,
103
109
# regardless of --output passed.
@@ -143,8 +149,12 @@ def get_sandbox_profile_flags():
143
149
return sandbox_flags
144
150
145
151
146
- def get_swiftc_path (workspace ):
147
- if platform .system () == 'Darwin' :
152
+ def get_swiftc_path (instance , workspace , args ):
153
+ if instance == OLD_INSTANCE and args .old_swiftc is not None :
154
+ return args .old_swiftc
155
+ elif instance == NEW_INSTANCE and args .new_swiftc is not None :
156
+ return args .new_swiftc
157
+ elif platform .system () == 'Darwin' :
148
158
swiftc_path = os .path .join (workspace , 'build/compat_macos/install/toolchain/usr/bin/swiftc' )
149
159
elif platform .system () == 'Linux' :
150
160
swiftc_path = os .path .join (workspace , 'build/compat_linux/install/usr/bin/swiftc' )
@@ -245,7 +255,7 @@ def get_stats_dir(instance, variant):
245
255
246
256
247
257
def get_actual_config_and_flags (config , stats ):
248
- flags = ("-stats-output-dir '%s'" % stats )
258
+ flags = ("-stats-output-dir " + stats )
249
259
# Handle pseudo-configs
250
260
if config == 'wmo-onone' :
251
261
flags += ' -wmo -Onone '
@@ -262,29 +272,41 @@ def get_variant(config, args):
262
272
263
273
def execute_runner (instance , workspace , configs , args ):
264
274
projects = get_projects (args .suite )
265
- swiftc_path = get_swiftc_path (workspace )
275
+ swiftc_path = get_swiftc_path (instance , workspace , args )
276
+ failures = []
266
277
for config in configs :
267
278
variant = get_variant (config , args )
268
279
stats = get_stats_dir (instance , variant )
269
280
if os .path .exists (stats ):
270
281
shutil .rmtree (stats )
271
282
os .makedirs (stats )
272
283
(config , flags ) = get_actual_config_and_flags (config , stats )
284
+ actions = 'action.startswith("BuildSwiftPackage")'
285
+ if platform .system () == 'Darwin' :
286
+ # Darwin can handle xcodebuild as well
287
+ actions = 'action.startswith("Build")'
273
288
runner_command = [
274
289
'./runner.py' ,
275
290
'--swiftc' , swiftc_path ,
276
291
'--projects' , projects ,
277
292
'--build-config' , config ,
278
293
'--swift-version' , '3' ,
279
- '--include-actions' , 'action.startswith("Build")' ,
294
+ '--include-actions' , actions ,
280
295
'--swift-branch' , args .swift_branch ,
281
296
'--add-swift-flags' , flags ,
282
297
]
283
298
if args .sandbox :
284
299
runner_command += get_sandbox_profile_flags ()
285
300
if args .verbose :
286
301
runner_command += ["--verbose" ]
287
- common .check_execute (runner_command , timeout = 9999999 )
302
+ try :
303
+ common .check_execute (runner_command , timeout = 9999999 )
304
+ except common .ExecuteCommandFailure :
305
+ fail_logs = [ re .sub ('FAIL_.*_(\\ w+).log' , '\\ 1' , n )
306
+ for n in os .listdir ("." )
307
+ if re .match ('FAIL.*.log' , n )]
308
+ failures += (fail_logs if len (fail_logs ) != 0 else ["unknown" ])
309
+ return failures
288
310
289
311
290
312
def get_table_name (reference , subset , variant ):
@@ -328,7 +350,7 @@ def get_baseline_name(variant):
328
350
'cperf-baselines' , variant + '.csv' )
329
351
330
352
331
- def analyze_results (configs , args ):
353
+ def analyze_results (configs , failures , args ):
332
354
# Make a separate random run_id for each comment, to uniquify links.
333
355
run_id = hex (random .randint (1 , 2 ** 63 ))[2 :]
334
356
old_ws = get_workspace_for_instance (OLD_INSTANCE , args )
@@ -383,6 +405,9 @@ def analyze_results(configs, args):
383
405
out = args .output
384
406
regressions = any (x != 0 for x in returncodes )
385
407
out .write ("# Summary for %s %s\n \n " % (args .swift_branch , args .suite ))
408
+ if len (failures ) != 0 :
409
+ out .write ("**Unexpected test results, stats may be off for %s**\n \n " %
410
+ ", " .join (set (failures )))
386
411
if regressions :
387
412
out .write ("**Regressions found (see below)**\n \n " )
388
413
else :
@@ -477,6 +502,14 @@ def parse_args():
477
502
action = 'store_true' )
478
503
parser .add_argument ('--setup-workspaces-for-pr' ,
479
504
type = int , default = None )
505
+ parser .add_argument ('--old-workspace' ,
506
+ type = str , default = None )
507
+ parser .add_argument ('--new-workspace' ,
508
+ type = str , default = None )
509
+ parser .add_argument ('--old-swiftc' ,
510
+ type = str , default = None )
511
+ parser .add_argument ('--new-swiftc' ,
512
+ type = str , default = None )
480
513
return parser .parse_args ()
481
514
482
515
0 commit comments