Skip to content

Commit

Permalink
fix: notify when pernosco is requested for non 64-bit bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pyoor committed Oct 18, 2023
1 parent b16ff4f commit 6dfaebd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bugmon/bugmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ def _confirm_open(self) -> None:

def _pernosco(self) -> None:
"""Attempt to record a pernosco session"""
if self.bug.platform.machine != "x86_64":
self.report("Pernosco is only supported for x86_64 bugs.")
if "pernosco" in self.bug.commands:
self.remove_command("pernosco")
if "pernosco-wanted" in self.bug.keywords:
self.bug.keywords.remove("pernosco-wanted")
return None

config = self.detect_config()
if config is None:
return None
Expand Down
15 changes: 15 additions & 0 deletions tests/test_bugmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# obtain one at http://mozilla.org/MPL/2.0/.
import pytest
from autobisect.bisect import BisectionResult
from fuzzfetch import Platform

from bugmon import BugMonitor, ReproductionCrashed, ReproductionPassed
from bugmon.bug import EnhancedBug
Expand Down Expand Up @@ -130,6 +131,20 @@ def test_bugmon_pernosco_failed_to_find_trace(
assert caplog.messages[-1] == "Unable to identify a pernosco trace!"


def test_bugmon_pernosco_x86(bugmon):
"""Verify bugmon reports that pernosco is not supported for x86 bugs"""
bugmon.add_command("pernosco")
bugmon.bug.keywords.append("pernosco-wanted")

bugmon.bug._platform = Platform("Linux", "x86")
bugmon._pernosco()

assert len(bugmon.queue) == 1
assert bugmon.queue[0] == "Pernosco is only supported for x86_64 bugs."
assert "pernosco" not in bugmon.bug.commands
assert "pernosco-wanted" not in bugmon.bug.keywords


def test_bugmon_pernosco_no_creds(browser_config, bugmon, build, caplog, mocker):
bugmon.dry_run = False
mocker.patch.object(bugmon, "detect_config", return_value=browser_config)
Expand Down

0 comments on commit 6dfaebd

Please sign in to comment.