@@ -74,109 +74,109 @@ def get_coverage_report_filestore_path(fuzzer: str, benchmark: str,
7474 fuzzer , 'index.html' )
7575
7676
77- def get_covered_regions_dict (experiment_df : pd .DataFrame ) -> Dict :
77+ def get_covered_branches_dict (experiment_df : pd .DataFrame ) -> Dict :
7878 """Combines json files for different fuzzer-benchmark pair in
79- |experiment_df| and returns a dictionary of the covered regions ."""
79+ |experiment_df| and returns a dictionary of the covered branches ."""
8080 fuzzers_and_benchmarks = set (
8181 zip (experiment_df .fuzzer , experiment_df .benchmark ))
8282 arguments = [(fuzzer , benchmark ,
8383 get_experiment_filestore_path_for_fuzzer_benchmark (
8484 fuzzer , benchmark , experiment_df ))
8585 for fuzzer , benchmark in fuzzers_and_benchmarks ]
86- result = itertools .starmap (get_fuzzer_benchmark_covered_regions_and_key ,
86+ result = itertools .starmap (get_fuzzer_benchmark_covered_branches_and_key ,
8787 arguments )
8888 return dict (result )
8989
9090
91- def get_fuzzer_benchmark_covered_regions_filestore_path (
91+ def get_fuzzer_benchmark_covered_branches_filestore_path (
9292 fuzzer : str , benchmark : str , exp_filestore_path : str ) -> str :
93- """Returns the path to the covered regions json file in the |filestore| for
93+ """Returns the path to the covered branches json file in the |filestore| for
9494 |fuzzer| and |benchmark|."""
9595 return posixpath .join (exp_filestore_path , 'coverage' , 'data' , benchmark ,
96- fuzzer , 'covered_regions .json' )
96+ fuzzer , 'covered_branches .json' )
9797
9898
99- def get_fuzzer_covered_regions (fuzzer : str , benchmark : str , filestore : str ):
100- """Returns the covered regions dict for |fuzzer| from the json file in the
99+ def get_fuzzer_covered_branches (fuzzer : str , benchmark : str , filestore : str ):
100+ """Returns the covered branches dict for |fuzzer| from the json file in the
101101 filestore."""
102- src_file = get_fuzzer_benchmark_covered_regions_filestore_path (
102+ src_file = get_fuzzer_benchmark_covered_branches_filestore_path (
103103 fuzzer , benchmark , filestore )
104104 with tempfile .NamedTemporaryFile () as dst_file :
105105 if filestore_utils .cp (src_file , dst_file .name ,
106106 expect_zero = False ).retcode :
107- logger .warning ('covered_regions.json file: %s could not be copied.' ,
108- src_file )
107+ logger .warning (
108+ 'covered_branches.json file: %s could not be copied.' , src_file )
109109 return {}
110110 with open (dst_file .name ) as json_file :
111111 return json .load (json_file )
112112
113113
114- def get_fuzzer_benchmark_covered_regions_and_key (
114+ def get_fuzzer_benchmark_covered_branches_and_key (
115115 fuzzer : str , benchmark : str , filestore : str ) -> Tuple [str , Dict ]:
116116 """Accepts |fuzzer|, |benchmark|, |filestore|.
117- Returns a tuple containing the fuzzer benchmark key and the regions covered
117+ Returns a tuple containing the fuzzer benchmark key and the branches covered
118118 by the fuzzer on the benchmark."""
119- fuzzer_benchmark_covered_regions = get_fuzzer_covered_regions (
119+ fuzzer_benchmark_covered_branches = get_fuzzer_covered_branches (
120120 fuzzer , benchmark , filestore )
121121 key = fuzzer_and_benchmark_to_key (fuzzer , benchmark )
122- return key , fuzzer_benchmark_covered_regions
122+ return key , fuzzer_benchmark_covered_branches
123123
124124
125- def get_unique_region_dict (benchmark_coverage_dict : Dict ) -> Dict :
125+ def get_unique_branch_dict (benchmark_coverage_dict : Dict ) -> Dict :
126126 """Returns a dictionary containing the covering fuzzers for each unique
127- region , where the |threshold| defines which regions are unique."""
128- region_dict = collections .defaultdict (list )
129- unique_region_dict = {}
127+ branch , where the |threshold| defines which branches are unique."""
128+ branch_dict = collections .defaultdict (list )
129+ unique_branch_dict = {}
130130 threshold_count = 1
131131 for fuzzer in benchmark_coverage_dict :
132- for region in benchmark_coverage_dict [fuzzer ]:
133- region_dict [ region ].append (fuzzer )
134- for region , fuzzers in region_dict .items ():
132+ for branch in benchmark_coverage_dict [fuzzer ]:
133+ branch_dict [ branch ].append (fuzzer )
134+ for branch , fuzzers in branch_dict .items ():
135135 if len (fuzzers ) <= threshold_count :
136- unique_region_dict [ region ] = fuzzers
137- return unique_region_dict
136+ unique_branch_dict [ branch ] = fuzzers
137+ return unique_branch_dict
138138
139139
140- def get_unique_region_cov_df ( unique_region_dict : Dict ,
140+ def get_unique_branch_cov_df ( unique_branch_dict : Dict ,
141141 fuzzer_names : List [str ]) -> pd .DataFrame :
142142 """Returns a DataFrame where the two columns are fuzzers and the number of
143- unique regions covered."""
143+ unique branches covered."""
144144 fuzzers = collections .defaultdict (int )
145- for region in unique_region_dict :
146- for fuzzer in unique_region_dict [ region ]:
145+ for branch in unique_branch_dict :
146+ for fuzzer in unique_branch_dict [ branch ]:
147147 fuzzers [fuzzer ] += 1
148- dict_to_transform = {'fuzzer' : [], 'unique_regions_covered ' : []}
148+ dict_to_transform = {'fuzzer' : [], 'unique_branches_covered ' : []}
149149 for fuzzer in fuzzer_names :
150150 covered_num = fuzzers [fuzzer ]
151151 dict_to_transform ['fuzzer' ].append (fuzzer )
152- dict_to_transform ['unique_regions_covered ' ].append (covered_num )
152+ dict_to_transform ['unique_branches_covered ' ].append (covered_num )
153153 return pd .DataFrame (dict_to_transform )
154154
155155
156156def get_benchmark_cov_dict (coverage_dict , benchmark ):
157- """Returns a dictionary to store the covered regions of each fuzzer. Uses a
158- set of tuples to store the covered regions ."""
157+ """Returns a dictionary to store the covered branches of each fuzzer. Uses a
158+ set of tuples to store the covered branches ."""
159159 benchmark_cov_dict = {}
160- for key , covered_regions in coverage_dict .items ():
160+ for key , covered_braches in coverage_dict .items ():
161161 current_fuzzer , current_benchmark = key_to_fuzzer_and_benchmark (key )
162162 if current_benchmark == benchmark :
163- covered_regions_in_set = set ()
164- for region in covered_regions :
165- covered_regions_in_set .add (tuple (region ))
166- benchmark_cov_dict [current_fuzzer ] = covered_regions_in_set
163+ covered_braches_in_set = set ()
164+ for branch in covered_braches :
165+ covered_braches_in_set .add (tuple (branch ))
166+ benchmark_cov_dict [current_fuzzer ] = covered_braches_in_set
167167 return benchmark_cov_dict
168168
169169
170170def get_benchmark_aggregated_cov_df (coverage_dict , benchmark ):
171171 """Returns a dataframe where each row represents a fuzzer and its aggregated
172172 coverage number."""
173173 dict_to_transform = {'fuzzer' : [], 'aggregated_edges_covered' : []}
174- for key , covered_regions in coverage_dict .items ():
174+ for key , covered_branches in coverage_dict .items ():
175175 current_fuzzer , current_benchmark = key_to_fuzzer_and_benchmark (key )
176176 if current_benchmark == benchmark :
177177 dict_to_transform ['fuzzer' ].append (current_fuzzer )
178178 dict_to_transform ['aggregated_edges_covered' ].append (
179- len (covered_regions ))
179+ len (covered_branches ))
180180 return pd .DataFrame (dict_to_transform )
181181
182182
@@ -186,7 +186,7 @@ def get_pairwise_unique_coverage_table(benchmark_coverage_dict, fuzzers):
186186
187187 The pairwise unique coverage table is a square matrix where each
188188 row and column represents a fuzzer, and each cell contains a number
189- showing the regions covered by the fuzzer of the column but not by
189+ showing the branches covered by the fuzzer of the column but not by
190190 the fuzzer of the row."""
191191
192192 pairwise_unique_coverage_values = []
@@ -204,16 +204,16 @@ def get_pairwise_unique_coverage_table(benchmark_coverage_dict, fuzzers):
204204 columns = fuzzers )
205205
206206
207- def get_unique_covered_percentage (fuzzer_row_covered_regions ,
208- fuzzer_col_covered_regions ):
209- """Returns the number of regions covered by the fuzzer of the column but not
210- by the fuzzer of the row."""
207+ def get_unique_covered_percentage (fuzzer_row_covered_branches ,
208+ fuzzer_col_covered_branches ):
209+ """Returns the number of branches covered by the fuzzer of the
210+ column but not by the fuzzer of the row."""
211211
212- unique_region_count = 0
213- for region in fuzzer_col_covered_regions :
214- if region not in fuzzer_row_covered_regions :
215- unique_region_count += 1
216- return unique_region_count
212+ unique_branch_count = 0
213+ for branch in fuzzer_col_covered_branches :
214+ if branch not in fuzzer_row_covered_branches :
215+ unique_branch_count += 1
216+ return unique_branch_count
217217
218218
219219def rank_by_average_normalized_score (benchmarks_unique_coverage_list ):
0 commit comments