Skip to content

rv/rvgen: Robustness, modernization, and fixes

Wander Lairson Costa linux-trace-kernel lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest19 patches 2 repliesIn review
  2. v220 patches 15 repliesSuperseded
  3. v126 patches 68 repliesSuperseded

Changes in v3 from the cover letter

- Dropped patch "add missing return type annotations" as per Gabriele Monaco's feedback that annotations on stub methods are not needed at this stage.
- Expanded AutomataError exception class patch to also replace generic ValueError exceptions in HA and LTL modules, as suggested by Gabriele Monaco.
- Updated typo fix patch to also correct singular/plural inconsistencies ("automata" to "automaton"), as noted by Gabriele Monaco.
- Included additional f-string conversion in dot2k.py found by Gabriele Monaco after rebase.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19rv/rvgen: introduce AutomataError exception classtools/verification/rvgen/__main__.py tools/verification/rvgen/rvgen/automata.py tools/verification/rvgen/rvgen/dot2c.py +4 more+43 -341 reply
2/19rv/rvgen: remove bare except clauses in generatortools/verification/rvgen/rvgen/generator.py+1 -80 replies
3/19rv/rvgen: replace % string formatting with f-stringstools/verification/rvgen/__main__.py tools/verification/rvgen/rvgen/automata.py tools/verification/rvgen/rvgen/dot2c.py +3 more+83 -850 replies
4/19rv/rvgen: replace __len__() calls with len()tools/verification/rvgen/rvgen/automata.py tools/verification/rvgen/rvgen/dot2c.py+9 -90 replies
5/19rv/rvgen: remove unnecessary semicolonstools/verification/rvgen/rvgen/dot2k.py+3 -30 replies
6/19rv/rvgen: use context managers for file operationstools/verification/rvgen/rvgen/automata.py tools/verification/rvgen/rvgen/generator.py+6 -120 replies
7/19rv/rvgen: fix typos in automata and generator docstring and commentstools/verification/rvgen/rvgen/automata.py tools/verification/rvgen/rvgen/dot2c.py tools/verification/rvgen/rvgen/dot2k.py +1 more+8 -81 reply
8/19rv/rvgen: fix PEP 8 whitespace violationstools/verification/rvgen/rvgen/automata.py tools/verification/rvgen/rvgen/dot2c.py tools/verification/rvgen/rvgen/dot2k.py +1 more+8 -80 replies
9/19rv/rvgen: fix DOT file validation logic errortools/verification/rvgen/rvgen/automata.py+1 -10 replies
10/19rv/rvgen: use class constant for init markertools/verification/rvgen/rvgen/automata.py+3 -20 replies
11/19rv/rvgen: refactor automata.py to use iterator-based parsingtools/verification/rvgen/rvgen/automata.py+71 -450 replies
12/19rv/rvgen: remove unused sys import from dot2ctools/verification/rvgen/dot2c+0 -10 replies
13/19rv/rvgen: remove unused __get_main_name methodtools/verification/rvgen/rvgen/generator.py+0 -60 replies
14/19rv/rvgen: make monitor arguments required in rvgentools/verification/rvgen/__main__.py+4 -30 replies
15/19rv/rvgen: fix isinstance check in Variable.expand()tools/verification/rvgen/rvgen/ltl2ba.py+1 -10 replies
16/19rv/rvgen: extract node marker string to class constanttools/verification/rvgen/rvgen/automata.py+5 -40 replies
17/19rv/rvgen: enforce presence of initial statetools/verification/rvgen/rvgen/automata.py+4 -00 replies
18/19rv/rvgen: fix unbound loop variable warningtools/verification/rvgen/rvgen/ltl2k.py+9 -50 replies
19/19rv/rvgen: fix _fill_states() return type annotationtools/verification/rvgen/rvgen/ltl2k.py+1 -10 replies

Reviews trailers per patch

All 19 patches have a Reviewed-by or Acked-by.

PatchGabriele MonacoNam Cao
1/19Co-authored-by R-b
2/19R-b R-b
3/19R-b R-b
4/19R-b R-b
5/19R-b R-b
6/19R-b R-b
7/19R-b
8/19R-b R-b
9/19R-b R-b
10/19R-b R-b
11/19R-b
12/19R-b
13/19R-b
14/19R-b R-b
15/19R-b
16/19R-b
17/19R-b
18/19R-b
19/19R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/19] rv/rvgen: Robustness, modernization, and fixes

This patch series introduces 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 include fixing logic errors in DOT file validation, resolving unbound variable errors that could lead to runtime crashes, and improving exception handling by removing dangerous bare except clauses. The codebase is updated to use contemporary Python idioms such as f-strings and context managers. Additionally, type annotations are added to resolve static analysis errors.

Changes in v3:
- Dropped patch "add missing return type annotations" as per Gabriele Monaco's feedback that annotations on stub methods are not needed at this stage.
- Expanded AutomataError exception class patch to also replace generic ValueError exceptions in HA and LTL modules, as suggested by Gabriele Monaco.
- Updated typo fix patch to also correct singular/plural inconsistencies ("automata" to "automaton"), as noted by Gabriele Monaco.
- Included additional f-string conversion in dot2k.py found by Gabriele Monaco after rebase.

Changes in v2:
- Dropped patches related to the @not_implemented decorator and abstract method stubs (v1 patches 9, 18, 19) to address class hierarchy improvements in a separate series.
- Dropped trivial cleanup patches (boolean simplification, __contains__) as they were already fixed after rebasing from linux-trace/latency/for-next.
- Merged typo fix patches into a single patch.
- Changed the fix for the unbound loop variable warning in abbreviate_atoms pyright report.
- Reworked initial state validation to strictly enforce the presence of an initial state.

Wander Lairson Costa (19):
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: fix typos in automata and generator docstring and comments rv/rvgen: fix PEP 8 whitespace violations
rv/rvgen: fix DOT file validation logic error
rv/rvgen: use class constant for init marker
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: make monitor arguments required in rvgen rv/rvgen: fix isinstance check in Variable.expand() rv/rvgen: extract node marker string to class constant rv/rvgen: enforce presence of initial state
rv/rvgen: fix unbound loop variable warning
rv/rvgen: fix _fill_states() return type annotation

 tools/verification/rvgen/__main__.py        |  19 +--
 tools/verification/rvgen/dot2c              |   1 -
 tools/verification/rvgen/rvgen/automata.py  | 155 ++++++++++++--------
 tools/verification/rvgen/rvgen/dot2c.py     |  58 ++++----
 tools/verification/rvgen/rvgen/dot2k.py     |  61 ++++----
 tools/verification/rvgen/rvgen/generator.py |  91 +++++-------
 tools/verification/rvgen/rvgen/ltl2ba.py    |  11 +-
 tools/verification/rvgen/rvgen/ltl2k.py     |  54 ++++---
 8 files changed, 237 insertions(+), 213 deletions(-)
Signature · 1 line
2.53.0