diff --git a/grizzly/adapter/adapter.py b/grizzly/adapter/adapter.py index 67cc54a6..d0669f04 100644 --- a/grizzly/adapter/adapter.py +++ b/grizzly/adapter/adapter.py @@ -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 @@ -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! *** @@ -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! *** @@ -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! *** diff --git a/grizzly/target/puppet_target.py b/grizzly/target/puppet_target.py index fecbb1b7..5f4c498e 100644 --- a/grizzly/target/puppet_target.py +++ b/grizzly/target/puppet_target.py @@ -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 diff --git a/grizzly/target/target.py b/grizzly/target/target.py index 2847c018..582743fb 100644 --- a/grizzly/target/target.py +++ b/grizzly/target/target.py @@ -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 @@ -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.