Skip to content

Commit

Permalink
bugfix: crash with iterable variables in type-lax mode (#581)
Browse files Browse the repository at this point in the history
## Misc. Enhancements/Bugfixes

* `openlane.config.Variable`

* Fixed an issue when strict type-checking is disabled where empty
strings would crash iterable objects.

## Tool Updates

* Fixed mypy to 1.9.0 to match NixOS 24.05.

* Checked `poetry.lock` into version control to improve reproducibility.
  • Loading branch information
donn authored Oct 15, 2024
1 parent 8871ff3 commit eac539e
Show file tree
Hide file tree
Showing 8 changed files with 1,864 additions and 12 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ build/
dist/
requirements.frz.txt
openlane_ipynb/
requirements_tmp.txt

# Nix
result
Expand All @@ -41,7 +42,3 @@ sandbox/
node_modules/
yarn.lock
package.json

# We're not using poetry2nix just yet
poetry.lock
requirements_tmp.txt
27 changes: 23 additions & 4 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,38 @@
## Documentation
-->

# 2.1.10

## Misc. Enhancements/Bugfixes

* `openlane.config.Variable`

* Fixed an issue when strict type-checking is disabled where empty strings
would crash iterable objects.

## Tool Updates

* Fixed mypy to 1.9.0 to match NixOS 24.05.

* Checked `poetry.lock` into version control to improve reproducibility.

# 2.1.9

## Steps

* `OpenROAD.CheckAntennas`
* Fixed table being printed to file with wrong width

* Fixed table being printed to file with wrong width.

* `OpenROAD.STA*PnR`
* Fixed table being printed to file with wrong width

* Fixed table being printed to file with wrong width.

## Flows

* `SynthesisExploration`
* Fixed table being printed to file with wrong width

* Fixed table being printed to file with wrong width.

# 2.1.8

Expand All @@ -35,7 +54,7 @@
* `OpenROAD.STA*PnR`

* Fixed a bug in STA metrics where paths with exactly zero slack are counted
as violations
as violations.

# 2.1.7

Expand Down
2 changes: 1 addition & 1 deletion openlane/config/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def __process(
raw = raw.split(";")
else:
raw = raw.split()
if raw[-1] == "":
if len(raw) and raw[-1] == "":
raw.pop() # Trailing commas
else:
raise ValueError(
Expand Down
1,823 changes: 1,823 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openlane"
version = "2.1.9"
version = "2.1.10"
description = "An infrastructure for implementing chip design flows"
authors = ["Efabless Corporation and Contributors <[email protected]>"]
readme = "Readme.md"
Expand Down Expand Up @@ -35,7 +35,7 @@ flake8 = ">=4"
flake8-no-implicit-concat = "0.3.3"
flake8-pytest-style = "*"

mypy = "*"
mypy = ">=1.9.0,<1.10.0"
lxml-stubs = "*"
types-urllib3 = "*"
types-typed-ast = "*"
Expand Down
9 changes: 8 additions & 1 deletion test/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def test_dict_config():
)
},
"DEFAULT_CORNER": "nom_tt_025C_1v80",
"RANDOM_ARRAY": None,
},
meta=Meta(version=2, flow=None),
)
Expand Down Expand Up @@ -107,6 +108,7 @@ def test_json_config():
)
},
"DEFAULT_CORNER": "nom_tt_025C_1v80",
"RANDOM_ARRAY": None,
},
meta=Meta(version=2, flow="Whatever"),
), "Generated configuration does not match expected value"
Expand All @@ -127,8 +129,11 @@ def test_tcl_config():
set ::env(DESIGN_NAME) "whatever"
set ::env(VERILOG_FILES) "\\
/cwd/src/a.v\\
/cwd/src/b.v\\
/cwd/src/b.v\\
"
set ::env(RANDOM_ARRAY) ""
# cant test glob because of the mock filesystem
"""
)
Expand Down Expand Up @@ -160,6 +165,7 @@ def test_tcl_config():
)
},
"DEFAULT_CORNER": "nom_tt_025C_1v80",
"RANDOM_ARRAY": [],
},
meta=Meta(version=1, flow=None),
), "Generated configuration does not match expected value"
Expand Down Expand Up @@ -221,6 +227,7 @@ def test_mixed_configs():
)
},
"DEFAULT_CORNER": "whatever",
"RANDOM_ARRAY": None,
},
meta=Meta(version=2, flow="Whatever"),
), "Generated configuration does not match expected value"
Expand Down
5 changes: 5 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ def _chdir_tmp(request: SubRequest):
default="nom_tt_025C_1v80",
pdk=True,
),
Variable(
"RANDOM_ARRAY",
Optional[List[str]],
description="x",
),
]
MOCK_FLOW_VARS = [
Variable(
Expand Down
1 change: 1 addition & 0 deletions test/steps/test_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ class StepTest(Step):
"nom_*": "/pdk/dummy/libs.ref/techlef/dummy_scl/dummy_tech_lef.tlef"
},
"DEFAULT_CORNER": "nom_tt_025C_1v80",
"RANDOM_ARRAY": None,
}
step = StepTest(
config=Config(config_dict),
Expand Down

0 comments on commit eac539e

Please sign in to comment.