Skip to content

Add unit tests for genRuleFile.py#4072

Open
rohithsiddi wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
rohithsiddi:add-tests-genRuleFile
Open

Add unit tests for genRuleFile.py#4072
rohithsiddi wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
rohithsiddi:add-tests-genRuleFile

Conversation

@rohithsiddi
Copy link
Copy Markdown

flow/util/genRuleFile.py is the most actively maintained Python utility in the repo and is used in CI via the update_rules Makefile targets. Despite this, it had zero test coverage. This PR adds 30 unit tests covering all rule calculation modes and edge cases.

Changes

  • flow/test/test_genRuleFile.py: new test file with 30 tests across two classes

Coverage

  • comma_separated_list() argument parser helper
  • All 4 production rule modes: direct, padding, period_padding, metric
  • Rounding behavior (round_value: true produces int, false produces float)
  • Wildcard pattern matching (*flow__warnings__count:*)
  • Old rules interaction: --tighten, --failing, --update modes
  • Edge cases: string metric fields skipped, missing/multiple clocks warnings
  • metrics_to_consider filtering (preserves old rules for unlisted metrics)
  • CTS buffer special case (max(rule_value, metric * 1.1))
  • min_max with min_max_direct option

Test plan

  • cd flow/test && python3 test_genRuleFile.py -v (30/30 pass)
  • All existing util tests still pass (no regressions):
    • test_convertDrc.py (7 tests)
    • test_def2stream.py (14 tests)
    • test_genElapsedTime.py (5 tests)
    • test_generate_klayout_tech.py (13 tests)

Signed-off-by: rohithsiddi <rohithsiddi7@gmail.com>
@maliberty maliberty requested a review from vvbandeira March 30, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant