diff --git a/extra/hcqfuzz/readme b/extra/hcqfuzz/readme index d3176f453d..df1668b068 100644 --- a/extra/hcqfuzz/readme +++ b/extra/hcqfuzz/readme @@ -4,9 +4,9 @@ To add a new test, define a `TestSpec`-based class in a file in the `tests/` fol You can choose which tests to load from which file: ```bash -RUN_FILES="hcq,allocator" python3 extra/hcqfuzz/fuzzer.py +PYTHONPATH=. RUN_FILES="hcq,allocator" python3 extra/hcqfuzz/fuzzer.py ``` Or skip tests from any file: ```bash -SKIP_FILES="allocator" python3 extra/hcqfuzz/fuzzer.py +PYTHONPATH=. SKIP_FILES="allocator" python3 extra/hcqfuzz/fuzzer.py ``` diff --git a/test/external/external_fuzz_ampt.py b/test/external/external_fuzz_ampt.py index e605f14895..d359599375 100644 --- a/test/external/external_fuzz_ampt.py +++ b/test/external/external_fuzz_ampt.py @@ -1,4 +1,5 @@ import random +from typing import Optional from tinygrad.helpers import round_up from tinygrad.runtime.support.am.amdev import AMPageTableTraverseContext from test.external.external_test_am import helper_read_entry_components, FakeAM @@ -59,7 +60,7 @@ class AMPTFuzzer: return True - def random_alloc(self): + def random_alloc(self) -> Optional[int]: if self.total_size - self.alloc_payload < self.min_alloc_size: return None size = random.randint(self.min_alloc_size, min(self.max_alloc_size, self.total_size - self.alloc_payload)) diff --git a/test/external/external_fuzz_tlsf.py b/test/external/external_fuzz_tlsf.py index 66eb85ca90..029c9bee9d 100644 --- a/test/external/external_fuzz_tlsf.py +++ b/test/external/external_fuzz_tlsf.py @@ -30,6 +30,8 @@ class AllocatorFuzzer: return True def random_alloc(self) -> Optional[int]: + if self.total_size - self.alloc_payload < self.min_alloc_size: return None + size = random.randint(self.min_alloc_size, min(self.max_alloc_size, self.total_size - self.alloc_payload)) try: