Skip to content

Commit

Permalink
fix: expand list of build configurations to avoid
Browse files Browse the repository at this point in the history
  • Loading branch information
pyoor committed Jul 14, 2023
1 parent c29532d commit de44324
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
20 changes: 11 additions & 9 deletions bugmon/evaluator_configs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def iter_build_flags(cls, bug: EnhancedBug) -> Iterator[BuildFlags]:
"""
# Don't yield and empty build flags object
if not all(flag is False for flag in bug.build_flags):
yield bug.build_flags
# Avoid non-fuzzing debug builds now that crashreporter-symbols has been
# removed from taskcluster
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,),
Expand All @@ -45,23 +48,22 @@ def iter_build_flags(cls, bug: EnhancedBug) -> Iterator[BuildFlags]:
if all(bug.build_flags):
continue

# Avoid non-fuzzing debug builds now that crashreporter-symbols has been
# removed from taskcluster
if debug is None and fuzzing is None:
# Avoid non-fuzzing debug builds
if debug and not fuzzing:
continue

# Avoid asan-debug builds because they're not used for fuzzing
if asan is True and debug is True:
if asan and debug:
continue

raw_flags = bug.build_flags._asdict()
if asan is not None:
raw_flags = dict.fromkeys(bug.build_flags._asdict(), None)
if asan:
raw_flags["asan"] = asan

if debug is not None:
if debug:
raw_flags["debug"] = debug

if fuzzing is not None:
if fuzzing:
raw_flags["fuzzing"] = fuzzing

new_flags = BuildFlags(**raw_flags)
Expand Down
8 changes: 4 additions & 4 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) == 4
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 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) == 2
assert len(build_flags) == 3
# Check that all results are BuildFlags
assert all(isinstance(x, BuildFlags) for x in build_flags)
# Check for duplicates
Expand Down Expand Up @@ -95,7 +95,7 @@ def test_browser_configuration_iterate_001(bug_data):
Path(tmp_path / "3.js").touch()

bug = EnhancedBug(None, **bug_data)
assert len(list(BrowserConfiguration.iterate(bug, tmp_path))) == 12
assert len(list(BrowserConfiguration.iterate(bug, tmp_path))) == 16


def test_js_configuration_iterate_001(mocker, bug_data):
Expand All @@ -111,4 +111,4 @@ def test_js_configuration_iterate_001(mocker, bug_data):
)
mock.return_value = []
bug = EnhancedBug(None, **bug_data)
assert len(list(JSConfiguration.iterate(bug, tmp_path))) == 9
assert len(list(JSConfiguration.iterate(bug, tmp_path))) == 12

0 comments on commit de44324

Please sign in to comment.