Skip to content

Commit

Permalink
feat: add needinfo flag if bug fixed prematurely
Browse files Browse the repository at this point in the history
  • Loading branch information
pyoor committed Jun 3, 2022
1 parent 79ea363 commit b16fde7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions bugmon/bugmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import os
import zipfile
from pathlib import Path
from typing import Optional, List, Dict, cast
from typing import Optional, List, Dict, cast, Union

from autobisect.bisect import BisectionResult, Bisector
from autobisect.build_manager import BuildManager
Expand Down Expand Up @@ -73,16 +73,18 @@ def __init__(

self._close_bug = False

def _bisect(self, config: Optional[BugConfiguration] = None) -> None:
def _bisect(
self, config: Optional[BugConfiguration] = None
) -> Union[BisectionResult, None]:
"""Attempt to enumerate the changeset that introduced or fixed the bug"""
config = config if config is not None else self.detect_config()
if config is None:
return
return None

tip = self._reproduce_bug(config, self.bug.branch)
if tip.status == EvaluatorResult.BUILD_FAILED:
log.warning("Failed to bisect bug (bad build)")
return
return None

# If tip doesn't crash, bisect the fix
find_fix = tip.status != EvaluatorResult.BUILD_CRASHED
Expand All @@ -106,7 +108,7 @@ def _bisect(self, config: Optional[BugConfiguration] = None) -> None:
except FetcherException as e:
self.add_command("bisected")
self.report(f"Unable to bisect testcase ({str(e).lower()})")
return
return None

result = bisector.bisect()

Expand Down Expand Up @@ -140,6 +142,8 @@ def _bisect(self, config: Optional[BugConfiguration] = None) -> None:
if not find_fix and "regression" not in self.bug.keywords:
self.bug.keywords.append("regression")

return result

def _confirm_open(self) -> None:
"""Attempt to confirm open test cases"""
config = self.detect_config()
Expand All @@ -163,7 +167,15 @@ def _confirm_open(self) -> None:
f"Testcase crashes using the initial build ({orig.build_str}) "
f"but not with tip ({tip.build_str}.)"
)
self._bisect(config)
result = self._bisect(config)
if result and result.status == BisectionResult.SUCCESS:
if self.bug.add_needinfo(self.bug.assignee["email"]):
nick = self.bug.assignee["nick"]
self.report(
f"{nick}, can you confirm that the above bisection range "
"is responsible for fixing this issue?"
)

elif orig.status == EvaluatorResult.BUILD_PASSED:
self.report(
"Unable to reproduce bug using the following builds:",
Expand Down

0 comments on commit b16fde7

Please sign in to comment.