Skip to content

Commit

Permalink
fix: don't check existing bug flags when generating products
Browse files Browse the repository at this point in the history
  • Loading branch information
pyoor committed Jul 20, 2023
1 parent 12467e1 commit a56aad9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
11 changes: 2 additions & 9 deletions bugmon/evaluator_configs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,7 @@ def iter_build_flags(cls, bug: EnhancedBug) -> Iterator[BuildFlags]:
if not (bug.build_flags.debug and not bug.build_flags.fuzzing):
yield bug.build_flags

for asan, debug, fuzzing in itertools.product(
(True, None) if not bug.build_flags.asan else (None,),
(True, None) if not bug.build_flags.debug else (None,),
(True, None) if not bug.build_flags.fuzzing else (None,),
):
# Don't yield and empty build flags object
if all(bug.build_flags):
continue
for asan, debug, fuzzing in itertools.product([True, None], repeat=3):

# Avoid non-fuzzing debug builds
if debug and not fuzzing:
Expand All @@ -67,7 +60,7 @@ def iter_build_flags(cls, bug: EnhancedBug) -> Iterator[BuildFlags]:
raw_flags["fuzzing"] = fuzzing

new_flags = BuildFlags(**raw_flags)
if new_flags != bug.build_flags:
if new_flags != bug.build_flags and not all(new_flags) and any(new_flags):
yield new_flags

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions tests/test_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_bug_configuration_iter_build_flags_001(bug_data):
build_flags = list(BugConfiguration.iter_build_flags(bug))

# Check for the expected number of flag combinations
assert len(build_flags) == 5
assert len(build_flags) == 4
# Check that all results are BuildFlags
assert all(isinstance(x, BuildFlags) for x in build_flags)
# Check for duplicates
Expand All @@ -41,7 +41,7 @@ def test_bug_configuration_iter_build_flags_002(bug_data):
build_flags = list(BugConfiguration.iter_build_flags(bug))

# Check for the expected number of flag combinations
assert len(build_flags) == 3
assert len(build_flags) == 5
# Check that all results are BuildFlags
assert all(isinstance(x, BuildFlags) for x in build_flags)
# Check for duplicates
Expand Down

0 comments on commit a56aad9

Please sign in to comment.