@@ -42,6 +42,8 @@ class BugRunInfo:
42
42
43
43
@dataclass
44
44
class BugsDetails :
45
+ test_name : str = ""
46
+ run_count : dict [str , int ] = field (default_factory = dict ) # {job_name: run_count}
45
47
total : int = 0
46
48
test_variants : set = field (default_factory = set )
47
49
per_repositories : dict [str , int ] = field (default_factory = dict ) # {repo1: 1, repo2: 2, ...}
@@ -443,18 +445,27 @@ def build_bug_map(self, bugs, option_collection_map, start_day, end_day):
443
445
all_variants = set ()
444
446
for bug in bugs :
445
447
bug_id = bug ["bug__bugzilla_id" ]
446
- manifest = self .get_test_manifest ( bug [ "bug__summary" ] )
447
- task_labels = self .get_task_labels_and_count ( manifest , start_day , end_day )
448
- print ( task_labels )
448
+ all_tests = self .get_tests_from_manifests ( )
449
+ test_name = self .get_test_name ( all_tests , bug [ "bug__summary" ] )
450
+ manifest = None
449
451
bug_testrun_matrix = []
450
- if manifest :
451
- testrun_matrix = (
452
- fetch .fetch_testrun_matrix ()
453
- if self .testrun_matrix is None
454
- else self .testrun_matrix
455
- )
456
- self .testrun_matrix = testrun_matrix
457
- bug_testrun_matrix = testrun_matrix [manifest ]
452
+ run_count = 0
453
+ if test_name :
454
+ manifest = all_tests [test_name ][0 ]
455
+ tasks_count = self .get_task_labels_and_count (manifest , start_day , end_day )
456
+ job_name = bug ["job__signature__job_type_name" ]
457
+ for task_name , count in tasks_count .items ():
458
+ if task_name in job_name :
459
+ run_count = count
460
+ break
461
+ if manifest :
462
+ testrun_matrix = (
463
+ fetch .fetch_testrun_matrix ()
464
+ if self .testrun_matrix is None
465
+ else self .testrun_matrix
466
+ )
467
+ self .testrun_matrix = testrun_matrix
468
+ bug_testrun_matrix = testrun_matrix [manifest ]
458
469
bug_run_info = self .get_bug_run_info (bug )
459
470
all_variants = bug_run_info .variants
460
471
if bug_testrun_matrix and bug_run_info .os_name in bug_testrun_matrix :
@@ -470,10 +481,14 @@ def build_bug_map(self, bugs, option_collection_map, start_day, end_day):
470
481
platform_and_build = f"{ bug_run_info .platform } /{ bug_run_info .build_type } "
471
482
if bug_id not in bug_map :
472
483
bug_infos = BugsDetails ()
484
+ bug_infos .test_name = test_name
473
485
bug_infos .total = 1
474
486
bug_infos .test_variants |= all_variants
475
487
bug_infos .per_repositories [repo ] = 1
476
- bug_infos .data_table [platform_and_build ] = {test_variant : 1 }
488
+ bug_infos .data_table [platform_and_build ] = {
489
+ test_variant : 1 ,
490
+ "total_runs" : run_count ,
491
+ }
477
492
bug_map [bug_id ] = bug_infos
478
493
else :
479
494
bug_infos = bug_map [bug_id ]
@@ -485,6 +500,7 @@ def build_bug_map(self, bugs, option_collection_map, start_day, end_day):
485
500
data_table = bug_infos .data_table
486
501
platform_and_build_data = data_table .get (platform_and_build , {})
487
502
data_table [platform_and_build ] = platform_and_build_data
503
+ data_table [platform_and_build ]["total_runs" ] = run_count
488
504
data_table [platform_and_build ][test_variant ] = (
489
505
platform_and_build_data .get (test_variant , 0 ) + 1
490
506
)
@@ -556,8 +572,7 @@ def fix_wpt_name(self, test_name):
556
572
test_name = test_name .split ("?" )[0 ]
557
573
return test_name
558
574
559
- def get_test_manifest (self , summary ):
560
- all_tests = self .get_tests_from_manifests ()
575
+ def get_test_name (self , all_tests , summary ):
561
576
tv_strings = [
562
577
" TV " ,
563
578
" TV-nofis " ,
@@ -620,7 +635,5 @@ def get_test_manifest(self, summary):
620
635
# 3) test has been deleted from the source tree
621
636
# 4) sometimes test was deleted but is valid on beta
622
637
return None
623
- # matching test- we can access manifest
624
- manifests = all_tests [test_name ]
625
- return manifests [0 ]
638
+ return test_name
626
639
return None
0 commit comments