Skip to content

Commit 47aae47

Browse files
committed
test: Reconcile Python namespaces for ifp and pdn in Bazel
- Add 'ifp' and 'pdn' to the list of dynamically generated Python shims in 'test/bazel_test.sh'. This allows Bazel integration tests to use the tool-specific namespaces (e.g., 'import ifp', 'import pdn') seamlessly, matching the CMake namespace behavior. - Remove try-except namespace fallback workarounds from 'init_floorplan_flip_sites.py', 'init_floorplan_gap.py', and 'pdn_aux.py'. - Remove redundant native 'py_test' targets and 'helpers' py_library from 'src/pdn/test/BUILD'. These duplicate targets are already 100% covered by the 'regression_test' macro targets (e.g., ':asap7_taper-py_test') which correctly utilize the test runner's shim environment. TAG=agy CONV=56950afb-bfb2-4074-bfcb-927c5a0f1057 Signed-off-by: Drew Lewis <cannada@google.com>
1 parent 2aae40a commit 47aae47

5 files changed

Lines changed: 6 additions & 59 deletions

File tree

src/ifp/test/init_floorplan_flip_sites.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@
1212

1313
floorplan = design.getFloorplan()
1414
site = floorplan.findSite("FreePDK45_38x28_10R_NP_162NW_34O")
15-
try:
16-
flipped_sites = openroad.site_set()
17-
except AttributeError:
18-
import ifp
19-
20-
flipped_sites = ifp.site_set()
15+
import ifp
16+
flipped_sites = ifp.site_set()
2117
flipped_sites.insert(site)
2218

2319
floorplan.initFloorplan(

src/ifp/test/init_floorplan_gap.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
import helpers
55
import ifp_helpers as ifph
66

7-
try:
8-
site_set = openroad.site_set
9-
except AttributeError:
10-
import ifp
11-
12-
site_set = ifp.site_set
7+
import ifp
8+
site_set = ifp.site_set
139

1410
tech = Tech()
1511
tech.readLef("Nangate45/Nangate45.lef")

src/pdn/test/BUILD

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -141,24 +141,6 @@ COMPULSORY_TESTS = [
141141

142142
ALL_TESTS = COMPULSORY_TESTS
143143

144-
PY_TESTS = [
145-
"asap7_taper",
146-
"core_grid",
147-
"core_grid_with_rings",
148-
"core_grid_with_routing_obstructions",
149-
"existing",
150-
"macros",
151-
"max_width",
152-
"min_width",
153-
"offgrid",
154-
"power_switch",
155-
"repair_vias",
156-
"report",
157-
"reset",
158-
"ripup",
159-
"widthtable",
160-
]
161-
162144
filegroup(
163145
name = "regression_resources",
164146
# Dependencies could be specified more narrowly per test case,
@@ -321,30 +303,6 @@ filegroup(
321303
for test_name in ALL_TESTS
322304
]
323305

324-
py_library(
325-
name = "helpers",
326-
srcs = [
327-
"helpers.py",
328-
"pdn_aux.py",
329-
],
330-
imports = ["."],
331-
deps = [
332-
"//python/openroad:openroadpy",
333-
],
334-
)
335-
336-
[
337-
py_test(
338-
name = test_name,
339-
srcs = [test_name + ".py"],
340-
data = [":" + test_name + "_resources"],
341-
deps = [
342-
":helpers",
343-
"//python/openroad:openroadpy",
344-
],
345-
)
346-
for test_name in PY_TESTS
347-
]
348306

349307
py_test(
350308
name = "pdn_man_tcl_check",

src/pdn/test/pdn_aux.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
import odb
44
from collections import defaultdict
55

6-
try:
7-
import pdn
8-
except ModuleNotFoundError:
9-
import openroad as pdn
6+
import pdn
107

118

129
# In tcl land, this lives in OpenRoad.tcl. However, it seems to be only called

test/bazel_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ try:
5151
except ImportError:
5252
from openroadpy import *
5353
EOF
54-
for module in ant cts drt grt rcx stt tap; do
54+
for module in ant cts drt grt rcx stt tap ifp pdn; do
5555
write_openroad_shim "${module}"
5656
done
5757

0 commit comments

Comments
 (0)