Skip to content

Commit df628f2

Browse files
authored
Merge pull request #7257 from hzeller/feature-20250502-add-more-test
Wire up TestPolygonalFloorplan test.
2 parents f2b5739 + 4df7927 commit df628f2

File tree

4 files changed

+48
-9
lines changed

4 files changed

+48
-9
lines changed

src/odb/test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ filegroup(
171171
"sky130hd/sky130hd_vt.tlef",
172172
"sky130hd/work_around_yosys/formal_pdk.v",
173173
],
174+
visibility = ["//src/odb/test/cpp:__subpackages__"],
174175
)
175176

176177
[

src/odb/test/cpp/BUILD

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,23 @@ cc_test(
4444
],
4545
)
4646

47+
cc_test(
48+
name = "TestPolygonalFloorplan",
49+
srcs = ["TestPolygonalFloorplan.cc",
50+
"nangate45_test_fixture.h"],
51+
defines = [
52+
'DATA_PREFIX=\\"src/odb/test/\\"', # TODO: not needed after no cmake
53+
],
54+
data = [
55+
"//src/odb/test:regression_resources",
56+
],
57+
linkstatic = True, # TODO: remove once deps define all symbols
58+
deps = [
59+
"//src/odb",
60+
"//src/utl",
61+
"@googletest//:gtest",
62+
"@googletest//:gtest_main",
63+
],
64+
)
65+
4766
# TODO: more to come.

src/odb/test/cpp/TestPolygonalFloorplan.cc

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
#include "odb/defin.h"
1919
#include "utl/Logger.h"
2020

21+
// TODO: not needed after fully switching to bazel
22+
#ifndef DATA_PREFIX
23+
#define DATA_PREFIX ""
24+
#endif
25+
2126
namespace odb {
2227

2328
TEST_F(Nangate45TestFixture, PolygonalFloorplanCreatesBlockagesInNegativeSpace)
@@ -27,8 +32,10 @@ TEST_F(Nangate45TestFixture, PolygonalFloorplanCreatesBlockagesInNegativeSpace)
2732
std::vector<dbLib*> libs = {lib_.get()};
2833

2934
// Act
30-
dbChip* chip = def_parser.createChip(
31-
libs, "data/nangate45_polygon_floorplan.def", lib_->getTech());
35+
dbChip* chip = def_parser.createChip(libs,
36+
DATA_PREFIX
37+
"data/nangate45_polygon_floorplan.def",
38+
lib_->getTech());
3239
EXPECT_NE(chip, nullptr);
3340

3441
// Assert
@@ -70,8 +77,10 @@ TEST_F(Nangate45TestFixture, SettingTheFloorplanTwiceClearsSystemBlockages)
7077
std::vector<dbLib*> libs = {lib_.get()};
7178

7279
// Act
73-
dbChip* chip = def_parser.createChip(
74-
libs, "data/nangate45_polygon_floorplan.def", lib_->getTech());
80+
dbChip* chip = def_parser.createChip(libs,
81+
DATA_PREFIX
82+
"data/nangate45_polygon_floorplan.def",
83+
lib_->getTech());
7584
EXPECT_NE(chip, nullptr);
7685

7786
odb::Polygon new_die_area({{0, 0},
@@ -120,8 +129,10 @@ TEST_F(Nangate45TestFixture, DeletingSystemBlockagesThrows)
120129
std::vector<dbLib*> libs = {lib_.get()};
121130

122131
// Act
123-
dbChip* chip = def_parser.createChip(
124-
libs, "data/nangate45_polygon_floorplan.def", lib_->getTech());
132+
dbChip* chip = def_parser.createChip(libs,
133+
DATA_PREFIX
134+
"data/nangate45_polygon_floorplan.def",
135+
lib_->getTech());
125136
EXPECT_NE(chip, nullptr);
126137
dbBlock* block = chip->getBlock();
127138

@@ -149,8 +160,10 @@ TEST_F(Nangate45TestFixture, DeletingSystemObstructionsThrows)
149160
std::vector<dbLib*> libs = {lib_.get()};
150161

151162
// Act
152-
dbChip* chip = def_parser.createChip(
153-
libs, "data/nangate45_polygon_floorplan.def", lib_->getTech());
163+
dbChip* chip = def_parser.createChip(libs,
164+
DATA_PREFIX
165+
"data/nangate45_polygon_floorplan.def",
166+
lib_->getTech());
154167
EXPECT_NE(chip, nullptr);
155168
dbBlock* block = chip->getBlock();
156169
// Assert

src/odb/test/cpp/nangate45_test_fixture.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
#include "odb/lefin.h"
1212
#include "utl/Logger.h"
1313

14+
// TODO: not needed after fully switching to bazel
15+
#ifndef DATA_PREFIX
16+
#define DATA_PREFIX ""
17+
#endif
18+
1419
namespace odb {
1520
class Nangate45TestFixture : public ::testing::Test
1621
{
@@ -26,7 +31,8 @@ class Nangate45TestFixture : public ::testing::Test
2631
odb::lefin lef_reader(
2732
db_.get(), &logger_, /*ignore_non_routing_layers=*/false);
2833
lib_ = OdbUniquePtr<odb::dbLib>(
29-
lef_reader.createTechAndLib("ng45", "ng45", "Nangate45/Nangate45.lef"),
34+
lef_reader.createTechAndLib(
35+
"ng45", "ng45", DATA_PREFIX "Nangate45/Nangate45.lef"),
3036
&odb::dbLib::destroy);
3137
}
3238

0 commit comments

Comments
 (0)