@@ -208,8 +208,10 @@ def summarize_logs(dir, markdown=False, github_log=False):
208
208
# {"test": {"errors": [configs]},
209
209
# {"failures": {failed_test: [configs]}},
210
210
# {"flakiness": {flaky_test: [configs]}}}}
211
+ all_tested_configs = { "build_configs" : [], "test_configs" : []}
211
212
for build_log_file in build_log_files :
212
213
configs = get_configs_from_file_name (build_log_file , build_log_name_re )
214
+ all_tested_configs ["build_configs" ].append (configs )
213
215
with open (build_log_file , "r" ) as log_reader :
214
216
log_text = log_reader .read ()
215
217
if "__SUMMARY_MISSING__" in log_text :
@@ -223,6 +225,7 @@ def summarize_logs(dir, markdown=False, github_log=False):
223
225
224
226
for test_log_file in test_log_files :
225
227
configs = get_configs_from_file_name (test_log_file , test_log_name_re )
228
+ all_tested_configs ["test_configs" ].append (configs )
226
229
with open (test_log_file , "r" ) as log_reader :
227
230
log_text = log_reader .read ()
228
231
if "__SUMMARY_MISSING__" in log_text :
@@ -251,7 +254,9 @@ def summarize_logs(dir, markdown=False, github_log=False):
251
254
# if failures (include flakiness) exist:
252
255
# log_results format:
253
256
# { testapps: {configs: [failed tests]} }
254
- log_results = reorganize_log (log_data )
257
+ all_tested_configs = reorganize_all_tested_configs (all_tested_configs )
258
+ logging .info ("all_tested_configs: %s" , all_tested_configs )
259
+ log_results = reorganize_log (log_data , all_tested_configs )
255
260
log_lines = []
256
261
if markdown :
257
262
log_lines = print_markdown_table (log_results )
@@ -276,33 +281,44 @@ def get_configs_from_file_name(file_name, file_name_re):
276
281
if "desktop" in configs : configs .remove ("desktop" )
277
282
return configs
278
283
279
- def reorganize_log (log_data ):
284
+
285
+ def reorganize_all_tested_configs (tested_configs ):
286
+ build_configs = reorganize_configs (tested_configs ["build_configs" ])
287
+ test_configs = reorganize_configs (tested_configs ["test_configs" ])
288
+ return { "build_configs" : build_configs , "test_configs" : test_configs }
289
+
290
+
291
+ def reorganize_log (log_data , all_tested_configs ):
280
292
log_results = {}
281
293
for (testapp , errors ) in log_data .items ():
282
294
if errors .get ("build" ):
283
- combined_configs = combine_configs (errors .get ("build" ))
295
+ reorganized_configs = reorganize_configs (errors .get ("build" ))
296
+ combined_configs = combine_configs (reorganized_configs , all_tested_configs ["build_configs" ])
284
297
for (platform , configs ) in combined_configs .items ():
285
298
for config in configs :
286
299
all_configs = [["BUILD" ], ["ERROR" ], [CAPITALIZATIONS [platform ]]]
287
300
all_configs .extend (config )
288
301
log_results .setdefault (testapp , {}).setdefault (flat_config (all_configs ), [])
289
302
290
303
if errors .get ("test" ,{}).get ("errors" ):
291
- combined_configs = combine_configs (errors .get ("test" ,{}).get ("errors" ))
304
+ reorganized_configs = reorganize_configs (errors .get ("test" ,{}).get ("errors" ))
305
+ combined_configs = combine_configs (reorganized_configs , all_tested_configs ["test_configs" ])
292
306
for (platform , configs ) in combined_configs .items ():
293
307
for config in configs :
294
308
all_configs = [["TEST" ], ["ERROR" ], [CAPITALIZATIONS [platform ]]]
295
309
all_configs .extend (config )
296
310
log_results .setdefault (testapp , {}).setdefault (flat_config (all_configs ), [])
297
311
for (test , configs ) in errors .get ("test" ,{}).get ("failures" ,{}).items ():
298
- combined_configs = combine_configs (configs )
312
+ reorganized_configs = reorganize_configs (configs )
313
+ combined_configs = combine_configs (reorganized_configs , all_tested_configs ["test_configs" ])
299
314
for (platform , configs ) in combined_configs .items ():
300
315
for config in configs :
301
316
all_configs = [["TEST" ], ["FAILURE" ], [CAPITALIZATIONS [platform ]]]
302
317
all_configs .extend (config )
303
318
log_results .setdefault (testapp , {}).setdefault (flat_config (all_configs ), []).append (test )
304
319
for (test , configs ) in errors .get ("test" ,{}).get ("flakiness" ,{}).items ():
305
- combined_configs = combine_configs (configs )
320
+ reorganized_configs = reorganize_configs (configs )
321
+ combined_configs = combine_configs (reorganized_configs , all_tested_configs ["test_configs" ])
306
322
for (platform , configs ) in combined_configs .items ():
307
323
for config in configs :
308
324
all_configs = [["TEST" ], ["FLAKINESS" ], [CAPITALIZATIONS [platform ]]]
@@ -312,11 +328,11 @@ def reorganize_log(log_data):
312
328
return log_results
313
329
314
330
315
- # Combine Config Lists
331
+ # Reorganize Config Lists
316
332
# e.g.
317
333
# [['macos', 'simulator_min'], ['macos', 'simulator_target']]
318
334
# -> [[['macos'], ['simulator_min', 'simulator_target']]]
319
- def combine_configs (configs ):
335
+ def reorganize_configs (configs ):
320
336
platform_configs = {}
321
337
for config in configs :
322
338
platform = config [0 ]
@@ -339,47 +355,58 @@ def combine_configs(configs):
339
355
if equals (configs_i , configs_j ):
340
356
remove_configs .append (configs_list [j ])
341
357
configk .append (configs_list [j ][k ])
342
- configk = combine_config (configk , platform , k )
358
+ # configk = combine_config(configk, platform, k)
343
359
configs_list [i ][k ] = configk
344
360
for config in remove_configs :
345
361
configs_list .remove (config )
346
362
347
363
return platform_configs
348
364
349
-
350
365
# If possible, combine kth config to "All *"
351
366
# e.g.
352
367
# ['ubuntu', 'windows', 'macos']
353
- # -> ['All os']
354
- def combine_config (config , platform , k ):
368
+ # -> ['All 3 os']
369
+ # ['ubuntu', 'windows']
370
+ # -> ['2/3 os: ubuntu,windows': ]
371
+ def combine_configs (error_configs , all_configs ):
372
+ for (platform , configs_list ) in error_configs .items ():
373
+ for i in range (len (configs_list )):
374
+ for j in range (len (configs_list [i ])):
375
+ configs_list [i ][j ] = combine_config (platform , configs_list [i ][j ], all_configs [platform ][0 ][j ], j )
376
+ return error_configs
377
+
378
+
379
+ def combine_config (platform , config , config_value , k ):
380
+ config_before_combination = config .copy ()
381
+ logging .info ("platform: %s; config: %s; config_value: %s" , platform , config , config_value )
355
382
if k == 1 and platform in ("android" , "ios" , "tvos" ):
356
383
# config_name = test_device here
357
384
k = - 1
358
385
config_name = BUILD_CONFIGS [platform ][k ]
359
- if PARAMETERS ["integration_tests" ]["matrix" ]["expanded" ].get (config_name ):
360
- config_value = PARAMETERS ["integration_tests" ]["matrix" ]["expanded" ][config_name ]
361
- else :
362
- config_value = PARAMETERS ["integration_tests" ]["matrix" ][config_name ]
386
+ # if certain config failed for all values, add message "All *"
363
387
if len (config_value ) > 1 and len (config ) == len (config_value ):
364
388
config = ["All %d %s" % (len (config_value ), config_name )]
365
389
elif config_name == "ios_device" :
366
390
ftl_devices = set (filter (lambda device : TEST_DEVICES .get (device ).get ("type" ) in "real" , config_value ))
367
391
simulators = set (filter (lambda device : TEST_DEVICES .get (device ).get ("type" ) in "virtual" , config_value ))
368
- if ftl_devices .issubset (set (config )):
392
+ if len ( ftl_devices ) > 1 and ftl_devices .issubset (set (config )):
369
393
config .insert (0 , "All %d FTL Devices" % len (ftl_devices ))
370
394
config = [x for x in config if (x not in ftl_devices )]
371
- elif simulators .issubset (set (config )):
395
+ if len ( simulators ) > 1 and simulators .issubset (set (config )):
372
396
config .insert (0 , "All %d Simulators" % len (simulators ))
373
397
config = [x for x in config if (x not in simulators )]
374
398
elif config_name == "android_device" :
375
399
ftl_devices = set (filter (lambda device : TEST_DEVICES .get (device ).get ("type" ) in "real" , config_value ))
376
400
emulators = set (filter (lambda device : TEST_DEVICES .get (device ).get ("type" ) in "virtual" , config_value ))
377
- if ftl_devices .issubset (set (config )):
401
+ if len ( ftl_devices ) > 1 and ftl_devices .issubset (set (config )):
378
402
config .insert (0 , "All %d FTL Devices" % len (ftl_devices ))
379
403
config = [x for x in config if (x not in ftl_devices )]
380
- elif emulators .issubset (set (config )):
404
+ if len ( emulators ) > 1 and emulators .issubset (set (config )):
381
405
config .insert (0 , "All %d Emulators" % len (emulators ))
382
406
config = [x for x in config if (x not in emulators )]
407
+ # if certain config failed for more than 1 value but not all, add message "x/y" which means "x" out of "y" configs has errors.
408
+ if len (config_value ) > 1 and config_before_combination == config :
409
+ config = ["%d/%d %s: %s" % (len (config ), len (config_value ), config_name , flat_config (config ))]
383
410
384
411
return config
385
412
0 commit comments