diff options
| author | xel1uz <16402913+xel1uz@users.noreply.github.com> | 2026-11-25 07:06:02 +0100 |
|---|---|---|
| committer | xel1uz <16402913+xel1uz@users.noreply.github.com> | 2026-11-25 07:06:02 +0100 |
| commit | 0294aed3ddc263d8698f46c9c9c2c225d5ab07a6 (patch) | |
| tree | f0743693f2355f405bf46d5d04273b9ef6e08f6b /tests/test_run_gpu_tests_python_assembler.py | |
| parent | 42537e7b6f84c233ac009b924d3a25d2a1178197 (diff) | |
buffer_format_fuzz: validate --budget
--budget is a count of random elements per format, and a negative one was
accepted with exit 0 and no message. `for _ in range(budget)` simply does not
run, so -1, -100 and -1000000 produced exactly the run of 0 -- 1026 instead of
1106 elements for 8_8_8_8_UNORM -- and every format still reported "ok".
--self-test was worse: it builds its own patterns with a hardcoded budget of 2
and never reads the option, so `--self-test --budget -100` and `--budget
1000000` both printed the same "self-test: ok" in the same 1.4 s.
Before:
$ python -I tools/buffer_format_fuzz.py --self-test --budget -1
self-test: ok # exit 0
$ python -I tools/buffer_format_fuzz.py --oracle hw --budget -3
hardware oracle unavailable: ... # exit 77, no GPU needed to know
After, one check next to the other argument guards and before both the
self-test and the oracle, so the value is validated even where it is not used:
$ python -I tools/buffer_format_fuzz.py --self-test --budget -1
buffer_format_fuzz.py: error: --budget cannot be negative # exit 2
$ python -I tools/buffer_format_fuzz.py --self-test --budget 0
self-test: ok # 0 stays legal: sweeps only
tests/test_buffer_format_fuzz.py (CPU only, hw_oracle stubbed) covers the
negative value on both paths, that it is refused before the oracle is opened,
that 0 stays legal and that -1 is otherwise indistinguishable from 0.
3 of its 7 tests fail without this change, 7 pass with it.
Diffstat (limited to 'tests/test_run_gpu_tests_python_assembler.py')
0 files changed, 0 insertions, 0 deletions