Fix/hcqfuzz harnesss bug (#10923)

* update command so extra module is found

* fix empty range in randrange errors

* lint
This commit is contained in:
alpharush
2025-06-23 03:22:30 -05:00
committed by GitHub
parent f037f85532
commit 22f9696522
3 changed files with 6 additions and 3 deletions

View File

@@ -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
```

View File

@@ -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))

View File

@@ -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: