@@ -208,8 +208,10 @@ def summarize_logs(dir, markdown=False, github_log=False):
208208 # {"test": {"errors": [configs]},
209209 # {"failures": {failed_test: [configs]}},
210210 # {"flakiness": {flaky_test: [configs]}}}}
211+ all_tested_configs = { "build_configs" : [], "test_configs" : []}
211212 for build_log_file in build_log_files :
212213 configs = get_configs_from_file_name (build_log_file , build_log_name_re )
214+ all_tested_configs ["build_configs" ].append (configs )
213215 with open (build_log_file , "r" ) as log_reader :
214216 log_text = log_reader .read ()
215217 if "__SUMMARY_MISSING__" in log_text :
@@ -223,6 +225,7 @@ def summarize_logs(dir, markdown=False, github_log=False):
223225
224226 for test_log_file in test_log_files :
225227 configs = get_configs_from_file_name (test_log_file , test_log_name_re )
228+ all_tested_configs ["test_configs" ].append (configs )
226229 with open (test_log_file , "r" ) as log_reader :
227230 log_text = log_reader .read ()
228231 if "__SUMMARY_MISSING__" in log_text :
@@ -251,7 +254,9 @@ def summarize_logs(dir, markdown=False, github_log=False):
251254 # if failures (include flakiness) exist:
252255 # log_results format:
253256 # { 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 )
255260 log_lines = []
256261 if markdown :
257262 log_lines = print_markdown_table (log_results )
@@ -276,33 +281,44 @@ def get_configs_from_file_name(file_name, file_name_re):
276281 if "desktop" in configs : configs .remove ("desktop" )
277282 return configs
278283
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 ):
280292 log_results = {}
281293 for (testapp , errors ) in log_data .items ():
282294 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" ])
284297 for (platform , configs ) in combined_configs .items ():
285298 for config in configs :
286299 all_configs = [["BUILD" ], ["ERROR" ], [CAPITALIZATIONS [platform ]]]
287300 all_configs .extend (config )
288301 log_results .setdefault (testapp , {}).setdefault (flat_config (all_configs ), [])
289302
290303 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" ])
292306 for (platform , configs ) in combined_configs .items ():
293307 for config in configs :
294308 all_configs = [["TEST" ], ["ERROR" ], [CAPITALIZATIONS [platform ]]]
295309 all_configs .extend (config )
296310 log_results .setdefault (testapp , {}).setdefault (flat_config (all_configs ), [])
297311 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" ])
299314 for (platform , configs ) in combined_configs .items ():
300315 for config in configs :
301316 all_configs = [["TEST" ], ["FAILURE" ], [CAPITALIZATIONS [platform ]]]
302317 all_configs .extend (config )
303318 log_results .setdefault (testapp , {}).setdefault (flat_config (all_configs ), []).append (test )
304319 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" ])
306322 for (platform , configs ) in combined_configs .items ():
307323 for config in configs :
308324 all_configs = [["TEST" ], ["FLAKINESS" ], [CAPITALIZATIONS [platform ]]]
@@ -312,11 +328,11 @@ def reorganize_log(log_data):
312328 return log_results
313329
314330
315- # Combine Config Lists
331+ # Reorganize Config Lists
316332# e.g.
317333# [['macos', 'simulator_min'], ['macos', 'simulator_target']]
318334# -> [[['macos'], ['simulator_min', 'simulator_target']]]
319- def combine_configs (configs ):
335+ def reorganize_configs (configs ):
320336 platform_configs = {}
321337 for config in configs :
322338 platform = config [0 ]
@@ -339,47 +355,58 @@ def combine_configs(configs):
339355 if equals (configs_i , configs_j ):
340356 remove_configs .append (configs_list [j ])
341357 configk .append (configs_list [j ][k ])
342- configk = combine_config (configk , platform , k )
358+ # configk = combine_config(configk, platform, k)
343359 configs_list [i ][k ] = configk
344360 for config in remove_configs :
345361 configs_list .remove (config )
346362
347363 return platform_configs
348364
349-
350365# If possible, combine kth config to "All *"
351366# e.g.
352367# ['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 )
355382 if k == 1 and platform in ("android" , "ios" , "tvos" ):
356383 # config_name = test_device here
357384 k = - 1
358385 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 *"
363387 if len (config_value ) > 1 and len (config ) == len (config_value ):
364388 config = ["All %d %s" % (len (config_value ), config_name )]
365389 elif config_name == "ios_device" :
366390 ftl_devices = set (filter (lambda device : TEST_DEVICES .get (device ).get ("type" ) in "real" , config_value ))
367391 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 )):
369393 config .insert (0 , "All %d FTL Devices" % len (ftl_devices ))
370394 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 )):
372396 config .insert (0 , "All %d Simulators" % len (simulators ))
373397 config = [x for x in config if (x not in simulators )]
374398 elif config_name == "android_device" :
375399 ftl_devices = set (filter (lambda device : TEST_DEVICES .get (device ).get ("type" ) in "real" , config_value ))
376400 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 )):
378402 config .insert (0 , "All %d FTL Devices" % len (ftl_devices ))
379403 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 )):
381405 config .insert (0 , "All %d Emulators" % len (emulators ))
382406 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 ))]
383410
384411 return config
385412
0 commit comments