Coverage for fuzz/run_fuzz.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.17.3, created at 2026-11-22 12:55 +0000

1"""Atheris entry point (V6.6.7, #363): `python fuzz/run_fuzz.py <target> [libFuzzer flags] [corpus dir]`. 

2 

3Runs in `.github/workflows/fuzz.yml` (Atheris has Linux wheels only). The targets live in `fuzz/targets.py`, which 

4the tests drive with hypothesis on any machine. 

5""" 

6 

7from __future__ import annotations 

8 

9import sys 

10from pathlib import Path 

11 

12import atheris 

13 

14sys.path.insert(0, str(Path(__file__).resolve().parent)) 

15 

16with atheris.instrument_imports(): 

17 from targets import TARGETS 

18 

19 

20def main(argv: list[str]) -> None: 

21 if len(argv) < 2 or argv[1] not in TARGETS: 

22 raise SystemExit(f"usage: run_fuzz.py <{'|'.join(sorted(TARGETS))}> [libFuzzer flags] [corpus]") 

23 atheris.Setup([argv[0], *argv[2:]], TARGETS[argv[1]]) 

24 atheris.Fuzz() 

25 

26 

27if __name__ == "__main__": 

28 main(sys.argv)