Skip to content

Commit 06bfe9d

Browse files
authored
Fix #1896: Fix report generation when there is only one fuzzer. (#2106)
Fix #1896 When there is only one fuzzer, the `df.groupby(grouping2, group_keys=False).apply(is_unique_crash)` is something like: ``` Name: firsts, dtype: bool c1 firsts 0 fuzzer benchmark trial_id aflplusplus libxml2_xml 58 True ``` which has only one row, even after reset_index <img width="1002" height="428" alt="67f7ae6b97f3443e83b7690c78b09cca%2Fo%2F1768892165269" src="https://github.com/user-attachments/assets/f808b511-a605-481a-89bc-e37a00a7d4fd" /> This change uses `.stack().reset_index(drop=True)` to fix the issue only when the orignal code does not work
1 parent fe8c15e commit 06bfe9d

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

analysis/data_utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,14 @@ def add_bugs_covered_column(experiment_df):
159159
grouping2 = ['fuzzer', 'benchmark', 'trial_id']
160160
grouping3 = ['fuzzer', 'benchmark', 'trial_id', 'time']
161161
df = experiment_df.sort_values(grouping3)
162-
df['firsts'] = (
163-
df.groupby(grouping2, group_keys=False).apply(is_unique_crash) &
164-
~df.crash_key.isna())
162+
firsts_data = df.groupby(grouping2, group_keys=False).apply(is_unique_crash) & ~df.crash_key.isna()
163+
try:
164+
df['firsts'] = (firsts_data)
165+
except:
166+
import traceback; traceback.print_exc()
167+
firsts_data = firsts_data.stack().reset_index(drop=True)
168+
df['firsts'] = (firsts_data)
169+
165170
df['bugs_cumsum'] = df.groupby(grouping2)['firsts'].transform('cumsum')
166171
df['bugs_covered'] = (
167172
df.groupby(grouping3)['bugs_cumsum'].transform('max').astype(int))

0 commit comments

Comments
 (0)