Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PuppetTarget #422

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion grizzly/adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from abc import ABCMeta, abstractmethod
from pathlib import Path
from typing import Any, Dict, Generator, Optional, Tuple
from typing import Any, Dict, Generator, Optional, Tuple, final

from grizzly.common.storage import TestCase
from grizzly.common.utils import DEFAULT_TIME_LIMIT, HARNESS_FILE
Expand Down Expand Up @@ -65,6 +65,7 @@ def __enter__(self) -> "Adapter":
def __exit__(self, *exc: Any) -> None:
self.cleanup()

@final
def cleanup(self) -> None:
"""Automatically called once at shutdown. Used internally by Grizzly.
*** DO NOT OVERRIDE! ***
Expand All @@ -77,6 +78,7 @@ def cleanup(self) -> None:
"""
self.shutdown()

@final
def enable_harness(self, path: Path = HARNESS_FILE) -> None:
"""Enable use of a harness during fuzzing. By default no harness is used.
*** DO NOT OVERRIDE! ***
Expand All @@ -90,6 +92,7 @@ def enable_harness(self, path: Path = HARNESS_FILE) -> None:
self._harness = path.read_bytes()
assert self._harness, f"empty harness file '{path.resolve()}'"

@final
def get_harness(self) -> Optional[bytes]:
"""Get the harness. Used internally by Grizzly.
*** DO NOT OVERRIDE! ***
Expand Down
2 changes: 1 addition & 1 deletion grizzly/target/puppet_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def check_result(self, ignored: Set[str]) -> Result:
result = Result.IGNORED
LOG.debug("log size limit exceeded")
else:
assert self._puppet.reason
assert self._puppet.reason is not None
# crash or hang (forced SIGABRT) has been detected
LOG.debug("result detected (%s)", self._puppet.reason.name)
result = Result.FOUND
Expand Down
3 changes: 2 additions & 1 deletion grizzly/target/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from os import environ
from pathlib import Path
from threading import Lock
from typing import Any, Dict, Optional, Set, Tuple
from typing import Any, Dict, Optional, Set, Tuple, final

from ..common.report import Report
from ..common.utils import CertificateBundle, grz_tmp
Expand Down Expand Up @@ -141,6 +141,7 @@ def check_result(self, ignored: Set[str]) -> Result:
Result code.
"""

@final
def cleanup(self) -> None:
"""Perform necessary cleanup. DO NOT OVERRIDE.

Expand Down
Loading