Repository navigation
shader: validate input paths and add OSError/struct guards in mesh_loop_census with CLI suite - #2574
Conversation
tedin7
left a comment
There was a problem hiding this comment.
Review of head 19b5383 (same change as 59e72eb, plus the merge of main).
Checked: tools/mesh_loop_census.py validation (_validate_directory, _validate_backend, eager read_programs, main error guard) and the new CTest registration mesh_loop_census_cli_check next to mesh_loop_census. Sibling test mesh_loop_census_check is unchanged and still passes. No other open or merged PR covers this slice (#2284 added the tool, #2508 is a lowerer change).
Commands run:
python3 -B tests/mesh_loop_census_cli_check.py-> Ran 6 tests, OKpython3 -B tests/mesh_loop_census_check.py-> 14 programs classified; 14 mutants changed categorypython3 tests/docs_links_check.py-> self-test passedpython3 tests/bidi_controls_check.py-> no bidirectional controlsgit diff --check origin/main...HEAD-> clean- Mutation 1: drop the "not a directory" check in
_validate_directory-> new suite FAILS (1 failure) - Mutation 2: drop
OSErrorfrom themainexcept clause -> new suite FAILS (1 error)
No blocking findings. Win2025 WARP run follows separately.
AI-assisted; commands listed were executed locally.
|
Win2025 WARP receipt for head 19b5383 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
AI-assisted; commands listed were executed locally. |
Summary
Hardens
tools/mesh_loop_census.pyCLI argument validation and error handling and registers a pure-Python CLI test suite in CTest:_validate_directory,_validate_backend): Reject nonexistent or non-directory input paths (upfront inmain()and eagerly inread_programs()before returning the iterator), and reject empty, whitespace-only, or existing-directory--llvm/--llvm-mcvalues before wiring the backend or scanning files.main(argv)): Type-annotatemain(argv: Sequence[str] | None = None) -> intwithraise SystemExit(main()), catch(OSError, ValueError, struct.error)and exit cleanly viaparser.exit(1, f"mesh_loop_census: {error}\n")without raw tracebacks, while preserving per-containerValueError/KeyError/struct.errortallies inPopulationand aggregate Markdown output.tests/mesh_loop_census_cli_check.py,CMakeLists.txt): Registermesh_loop_census_cli_checkcovering loop-free/counted/duplicate/non-DXBC/malformed classification without filename/register leakage,--llvm-mcdisassembler wiring andsys.argv/__main__entrypoint forwarding, missing/file directory and empty/directory backend rejection,OSError/ValueError/struct.errorguards (including subprocess runs against nonexistent backends), and Python 3.14-compatible argparse error checks.Verification
Rebased onto
upstream/main(18f2f85c) and verified:out\pe-env\Scripts\python.exe -B tests\mesh_loop_census_cli_check.py -v->Ran 6 tests in 12.426s/OK(exit 0)out\pe-env\Scripts\python.exe -B tests\mesh_loop_census_check.py->Mesh loop census classified 14 source-built programs; 14 mutants changed category(exit 0)out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py->form coverage checks passed(exit 0)out\pe-env\Scripts\python.exe -B tests\docs_links_check.py->Self-test passed. Checked 19 Markdown files and 488 links.(exit 0)out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py->Self-test passed. Checked 1802 tracked source, script and build/CI files: no bidirectional controls.(exit 0)tools/mesh_loop_census.py: killed 12/12 mutations across_validate_directory,_validate_backend, eagerread_programs, andmain(argv)error guards.AI-assisted.