This patch series introduces a number of fixes and improvements to the RV Generator (rvgen) tool in tools/verification. The primary goal is to enhance the tool's robustness, maintainability, and correctness by addressing several latent bugs, modernizing the Python codebase, and improving its overall structure and error handling.
The changes can be broadly categorized into several areas. A number of bugs have been fixed, including logic errors in DOT file validation, an incorrect isinstance check, and several unbound variable errors that could lead to runtime crashes. Exception handling is now more robust with the introduction of a custom AutomataError class and the removal of dangerous bare except clauses that could mask underlying issues. The codebase has also been updated to use contemporary Python idioms such as f-strings and context managers for file I/O. Finally, a general cleanup pass removes dead code, adds missing abstract method stubs to satisfy class interfaces, and introduces type annotations to resolve pyright errors and improve static analysis. Together, these changes make the rvgen tool more reliable, easier to debug, and more approachable for future development and maintenance. Wander Lairson Costa (26): rv/rvgen: introduce AutomataError exception class rv/rvgen: remove bare except clauses in generator rv/rvgen: replace % string formatting with f-strings rv/rvgen: replace __len__() calls with len() rv/rvgen: remove unnecessary semicolons rv/rvgen: use context managers for file operations rv/rvgen: replace __contains__() with in operator rv/rvgen: simplify boolean comparison rv/rvgen: replace inline NotImplemented with decorator rv/rvgen: fix typos in automata docstring and comments rv/rvgen: fix typo in generator module docstring rv/rvgen: fix PEP 8 whitespace violations rv/rvgen: fix DOT file validation logic error rv/rvgen: remove redundant initial_state removal rv/rvgen: use class constant for init marker rv/rvgen: fix unbound initial_state variable rv/rvgen: fix possibly unbound variable in ltl2k rv/rvgen: add fill_tracepoint_args_skel stub to ltl2k rv/rvgen: add abstract method stubs to Container class rv/rvgen: refactor automata.py to use iterator-based parsing rv/rvgen: remove unused sys import from dot2c rv/rvgen: remove unused __get_main_name method rv/rvgen: add type annotations to fix pyright errors rv/rvgen: make monitor arguments required in rvgen rv/rvgen: fix isinstance check in Variable.expand() rv/rvgen: extract node marker string to class constant tools/verification/rvgen/__main__.py | 36 ++--- tools/verification/rvgen/dot2c | 1 - tools/verification/rvgen/rvgen/automata.py | 155 +++++++++++++------- tools/verification/rvgen/rvgen/container.py | 12 ++ tools/verification/rvgen/rvgen/dot2c.py | 64 ++++---- tools/verification/rvgen/rvgen/dot2k.py | 32 ++-- tools/verification/rvgen/rvgen/generator.py | 141 ++++++++---------- tools/verification/rvgen/rvgen/ltl2ba.py | 54 ++++--- tools/verification/rvgen/rvgen/ltl2k.py | 36 ++--- tools/verification/rvgen/rvgen/utils.py | 36 +++++ 10 files changed, 322 insertions(+), 245 deletions(-) create mode 100644 tools/verification/rvgen/rvgen/utils.py -- 2.52.0
