Skip to content

[AutoTuner] Add unit tests for parse_flow_variables and parse_tunable_variables#3965

Open
harsh-kumar-patwa wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
harsh-kumar-patwa:autotuner-parse-tests
Open

[AutoTuner] Add unit tests for parse_flow_variables and parse_tunable_variables#3965
harsh-kumar-patwa wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
harsh-kumar-patwa:autotuner-parse-tests

Conversation

@harsh-kumar-patwa
Copy link
Contributor

Summary

  • Add 13 unit tests for parse_flow_variables() and parse_tunable_variables() in tools/AutoTuner/src/autotuner/utils.py
  • Remove resolved TODO: Tests. comments from both functions

Test Coverage

parse_tunable_variables() (7 tests): return type, non-empty, known tunable vars present, non-tunable excluded, filtering with mock YAML, empty YAML, no tunable variables

parse_flow_variables() (6 tests): Makefile failure exit, missing vars.tcl exit, platform argument validation, env() pattern extraction, uppercase normalization, deduplication

Test Plan

  • All 13 tests pass locally (pytest test/parse_test.py -v)
  • Zero flake8 lint errors
  • No changes to production logic — only removed TODO comments
  • All subprocess/file operations are mocked; tests are safe for CI

Closes #3964

…_variables

Add 13 unit tests covering parse_flow_variables() and
parse_tunable_variables() in utils.py, resolving the TODO: Tests
comments in both functions.

Tests for parse_tunable_variables (7):
- Return type and non-empty validation against real variables.yaml
- Known tunable variables present, non-tunable excluded
- Filtering logic with mock YAML data
- Edge cases: empty YAML, no tunable variables

Tests for parse_flow_variables (6):
- Makefile failure and missing vars.tcl exit handling
- Correct platform argument passed to make
- env() pattern extraction from Tcl files
- Variable uppercasing and deduplication

Closes The-OpenROAD-Project#3964

Signed-off-by: Harsh Kumar <harshkumar3446@gmail.com>
@harsh-kumar-patwa
Copy link
Contributor Author

cc @luarss @eszpotanski @maliberty

I noticed that parse_flow_variables() and parse_tunable_variables() in utils.py had TODO comments asking for tests. So I created issue #3964 to track this and raised this PR to add unit tests for both functions. The tests cover return types, edge cases, error handling and variable parsing logic. Would appreciate a review when you get a chance!

@luarss luarss added the autotuner Flow autotuner label Mar 8, 2026
@luarss
Copy link
Contributor

luarss commented Mar 9, 2026

@harsh-kumar-patwa Tests are failing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autotuner Flow autotuner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AutoTuner] Add unit tests for parse_flow_variables() and parse_tunable_variables()

2 participants