Repository navigation
Description
Problem
The corpus checker's --timeout argument uses type=float without validating the result. It accepts 0, negative values, nan, inf, and -inf, then forwards them as subprocess deadlines. These values do not provide the intended finite positive per-file time budget, and invalid input is not diagnosed at the CLI boundary.
Confirmed by invoking the actual argument parser on master ecb1637602ff409aab3d0c480fd9ec1e73e645ba. This report demonstrates input acceptance; it does not claim a particular crash or hang occurred in CI.
Reproduce from the repository root
python3 - <<'PYTHON'
import sys
from unittest.mock import patch
from tools.check_wave_corpus import parse_args
for value in ("0", "-1", "nan", "inf", "-inf", "0.25"):
with patch.object(sys, "argv", ["check_wave_corpus.py", "--timeout=" + value]):
print(value, "=>", parse_args().timeout)
PYTHONActual: every value is accepted, including all five invalid budgets. 0.25 is a valid fractional timeout and should remain accepted.
Starting points
- tools/check_wave_corpus.py:
parse_args, particularly--timeout. - Add focused argument-validation tests in
tools/test_check_wave_corpus.py.
Small contribution scope
- Require a finite value greater than zero at argument parsing, using the Python standard library.
- Produce a concise argparse usage error naming
--timeoutand the accepted range. - Keep the 15-second default and positive fractional values.
- Add table-driven tests for zero, negative values, NaN, both infinities, non-numeric input, the default, and positive values.
- Confirm invalid input exits with status 2 before compiler discovery or process creation.
Done when
- Invalid budgets fail immediately with an actionable message and no traceback.
--help, the default, and valid finite positive timeouts retain their behavior.python3 -m unittest tools.test_check_wave_corpuspasses after adding the focused test module.
No LLVM build, subprocess lifecycle redesign, or real sleeping compiler is necessary. #354 tracks broader corpus-checker test coverage; this issue is limited to fixing and testing this concrete CLI validation defect. The process-tree cleanup fixed in #507 is outside this task.
Activity
fix: validate --timeout as finite and greater than zero
fix(tools): validate corpus checker timeout as finite positive float (#…