more to fix

Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
This commit is contained in:
dsengupta0628 2026-04-05 00:38:29 +00:00
parent fc7ac6c16c
commit 43177bba8f
5 changed files with 78 additions and 47 deletions

View File

@ -143,6 +143,7 @@ TEST_F(IncrementalTimingTest, ReplaceCellDownsize) {
// Get initial worst slack
Slack initial_slack = sta_->worstSlack(MinMax::max());
(void)initial_slack;
// Find buf1 and upsize it first so we have room to downsize
Instance *buf1 = network->findChild(top, "buf1");
@ -423,6 +424,7 @@ TEST_F(IncrementalTimingTest, ClockConstraintAfterEdit) {
Instance *top = network->topInstance();
Slack initial_slack = sta_->worstSlack(MinMax::max());
(void)initial_slack;
// Edit: Replace buf1 with BUF_X4
Instance *buf1 = network->findChild(top, "buf1");
@ -1289,6 +1291,7 @@ TEST_F(IncrementalTimingTest, OutputDelayChangeUpdatesTiming) {
TEST_F(IncrementalTimingTest, ClockLatencyAffectsTiming) {
Network *network = sta_->cmdNetwork();
Instance *top = network->topInstance();
(void)top;
Slack initial_slack = sta_->worstSlack(MinMax::max());

View File

@ -68,37 +68,6 @@ static void expectCallablePointerUsable(FnPtr fn) {
EXPECT_EQ(fn_copy, fn);
}
static std::string makeUniqueSdcPath(const char *tag)
{
static std::atomic<int> counter{0};
char buf[256];
snprintf(buf, sizeof(buf), "%s_%d_%d.sdc",
tag, static_cast<int>(getpid()), counter.fetch_add(1));
return std::string(buf);
}
static void expectSdcFileReadable(const std::string &filename)
{
FILE *f = fopen(filename.c_str(), "r");
ASSERT_NE(f, nullptr);
std::string content;
char chunk[512];
size_t read_count = 0;
while ((read_count = fread(chunk, 1, sizeof(chunk), f)) > 0)
content.append(chunk, read_count);
fclose(f);
EXPECT_FALSE(content.empty());
EXPECT_GT(content.size(), 10u);
EXPECT_NE(content.find('\n'), std::string::npos);
EXPECT_EQ(content.find('\0'), std::string::npos);
const bool has_set_cmd = content.find("set_") != std::string::npos;
const bool has_create_clock = content.find("create_clock") != std::string::npos;
EXPECT_TRUE(has_set_cmd || has_create_clock);
EXPECT_EQ(remove(filename.c_str()), 0);
}
static void expectStaDesignCoreState(Sta *sta, bool design_loaded)
{
ASSERT_NE(sta, nullptr);
@ -107,12 +76,14 @@ static void expectStaDesignCoreState(Sta *sta, bool design_loaded)
EXPECT_NE(sta->search(), nullptr);
EXPECT_NE(sta->cmdSdc(), nullptr);
EXPECT_FALSE(sta->scenes().empty());
if (!sta->scenes().empty())
if (!sta->scenes().empty()) {
EXPECT_GE(sta->scenes().size(), 1);
}
EXPECT_NE(sta->cmdScene(), nullptr);
EXPECT_TRUE(design_loaded);
if (sta->network())
if (sta->network()) {
EXPECT_NE(sta->network()->topInstance(), nullptr);
}
}
// ============================================================
@ -232,6 +203,7 @@ TEST_F(StaDesignTest, VertexArrivalRfPathAP) {
ASSERT_NE(v, nullptr);
Scene *corner = sta_->cmdScene();
const size_t path_idx = corner->pathIndex(MinMax::max());
(void)path_idx;
sta_->arrival(v, RiseFallBoth::rise(), sta_->scenes(), MinMax::max());
}
@ -254,6 +226,7 @@ TEST_F(StaDesignTest, VertexRequiredRfPathAP) {
ASSERT_NE(v, nullptr);
Scene *corner = sta_->cmdScene();
const size_t path_idx = corner->pathIndex(MinMax::max());
(void)path_idx;
sta_->required(v, RiseFallBoth::rise(), sta_->scenes(), MinMax::max());
}
@ -270,6 +243,7 @@ TEST_F(StaDesignTest, VertexSlackRfPathAP) {
ASSERT_NE(v, nullptr);
Scene *corner = sta_->cmdScene();
const size_t path_idx = corner->pathIndex(MinMax::max());
(void)path_idx;
sta_->slack(v, RiseFallBoth::rise(), sta_->scenes(), MinMax::max());
}
@ -288,6 +262,7 @@ TEST_F(StaDesignTest, VertexSlewRfCornerMinMax) {
Vertex *v = findVertex("u1/Z");
ASSERT_NE(v, nullptr);
Scene *corner = sta_->cmdScene();
(void)corner;
sta_->slew(v, RiseFallBoth::rise(), sta_->scenes(), MinMax::max());
}
@ -296,6 +271,7 @@ TEST_F(StaDesignTest, VertexSlewRfDcalcAP) {
ASSERT_NE(v, nullptr);
Scene *corner = sta_->cmdScene();
const DcalcAPIndex dcalc_idx = corner->dcalcAnalysisPtIndex(MinMax::max());
(void)dcalc_idx;
sta_->slew(v, RiseFallBoth::rise(), sta_->scenes(), MinMax::max());
}
@ -639,6 +615,7 @@ TEST_F(StaDesignTest, PvtGetSet) {
sta_->setPvt(top, MinMaxAll::all(), 1.0f, 1.1f, 25.0f, sta_->cmdSdc());
p = sta_->pvt(top, MinMax::max(), sta_->cmdSdc());
(void)p;
}() ));
@ -803,6 +780,7 @@ TEST_F(StaDesignTest, SearchCopyState) {
TEST_F(StaDesignTest, SearchFindPathGroupByName) {
ASSERT_NO_THROW(( [&](){
Search *search = sta_->search();
(void)search;
// First ensure path groups exist
sta_->findPathEnds(
nullptr, nullptr, nullptr,
@ -855,10 +833,11 @@ TEST_F(StaDesignTest, SearchDeletePathGroups) {
TEST_F(StaDesignTest, SearchVisitEndpoints) {
ASSERT_NO_THROW(( [&](){
Search *search = sta_->search();
(void)search;
Network *network = sta_->cmdNetwork();
PinSet pins(network);
VertexPinCollector collector(pins);
true /* Search::visitEndpoints removed */;
(void)true /* Search::visitEndpoints removed */;
}() ));
}
@ -868,10 +847,11 @@ TEST_F(StaDesignTest, SearchVisitEndpoints) {
TEST_F(StaDesignTest, SearchVisitStartpoints) {
ASSERT_NO_THROW(( [&](){
Search *search = sta_->search();
(void)search;
Network *network = sta_->cmdNetwork();
PinSet pins(network);
VertexPinCollector collector(pins);
true /* Search::visitStartpoints removed */;
(void)true /* Search::visitStartpoints removed */;
}() ));
}
@ -903,9 +883,10 @@ TEST_F(StaDesignTest, SearchClockDomainsVertex) {
TEST_F(StaDesignTest, SearchIsGenClkSrc) {
ASSERT_NO_THROW(( [&](){
Search *search = sta_->search();
(void)search;
Vertex *v = findVertex("r1/Q");
if (v) {
true /* Search::isGenClkSrc removed */;
(void)true /* Search::isGenClkSrc removed */;
}
}() ));
@ -922,7 +903,8 @@ TEST_F(StaDesignTest, SearchPathGroups) {
true, false, false, false, false, false);
if (!ends.empty()) {
Search *search = sta_->search();
true /* Search::pathGroups removed */;
(void)search;
(void)true /* Search::pathGroups removed */;
}
}() ));
@ -1118,6 +1100,7 @@ TEST_F(StaDesignTest, SetArcDelayAnnotated) {
if (!arcs.empty()) {
Scene *corner = sta_->cmdScene();
DcalcAPIndex dcalc_idx = corner->dcalcAnalysisPtIndex(MinMax::max());
(void)dcalc_idx;
sta_->setArcDelayAnnotated(edge, arcs[0], corner, MinMax::max(), true);
sta_->setArcDelayAnnotated(edge, arcs[0], corner, MinMax::max(), false);
}
@ -1175,6 +1158,7 @@ TEST_F(StaDesignTest, TotalNegativeSlackCorner) {
TEST_F(StaDesignTest, Endpoints) {
VertexSet &eps = sta_->endpoints();
(void)eps;
// endpoints() returns reference, always valid
}
@ -1362,6 +1346,7 @@ TEST_F(StaDesignTest, PathExpanded) {
TEST_F(StaDesignTest, SearchEndpoints) {
Search *search = sta_->search();
VertexSet &eps = search->endpoints();
(void)eps;
// endpoints() returns reference, always valid
}
@ -1636,6 +1621,7 @@ TEST_F(StaDesignTest, ReadLibertyFile) {
Scene *corner = sta_->cmdScene();
LibertyLibrary *lib = sta_->readLiberty(
"test/nangate45/Nangate45_slow.lib", corner, MinMaxAll::min(), false);
(void)lib;
// May or may not succeed depending on file existence; just check no crash
}() ));
}
@ -2241,7 +2227,7 @@ TEST_F(StaDesignTest, SearchIsClockVertex) {
Search *search = sta_->search();
Vertex *v = findVertex("r1/CK");
ASSERT_NE(v, nullptr);
(search->clocks(v, sta_->cmdMode()).size() > 0);
(void)(search->clocks(v, sta_->cmdMode()).size() > 0);
}
// --- Search: clkPathArrival ---
@ -2370,6 +2356,7 @@ TEST_F(StaDesignTest, ArcDelayAnnotated) {
if (arc_set && !arc_set->arcs().empty()) {
Scene *corner = sta_->cmdScene();
DcalcAPIndex dcalc_idx = corner->dcalcAnalysisPtIndex(MinMax::max());
(void)dcalc_idx;
sta_->arcDelayAnnotated(edge, arc_set->arcs()[0], corner, MinMax::max());
}
}
@ -2406,9 +2393,10 @@ TEST_F(StaDesignTest, SearchRequiredInvalid) {
TEST_F(StaDesignTest, SearchIsSegmentStart) {
Search *search = sta_->search();
(void)search;
Pin *pin = findPin("in1");
ASSERT_NE(pin, nullptr);
true /* Search::isSegmentStart removed */;
(void)true /* Search::isSegmentStart removed */;
}
// --- Search: isInputArrivalSrchStart ---
@ -2661,6 +2649,7 @@ TEST_F(StaDesignTest, RemoveConstraints) {
TEST_F(StaDesignTest, SearchFilter) {
Search *search = sta_->search();
(void)search;
FilterPath *filter = nullptr /* Search::filter() removed */;
// filter should be null since we haven't set one
EXPECT_EQ(filter, nullptr);
@ -2787,7 +2776,11 @@ TEST_F(StaDesignTest, MaxFanoutCheck) {
ASSERT_NO_THROW(( [&](){
sta_->checkFanoutPreamble();
const Pin *pin = nullptr;
(void)pin;
float fanout, slack, limit;
(void)fanout;
(void)slack;
(void)limit;
// maxFanoutCheck removed (renamed to maxFanoutMinSlackPin);
}() ));
@ -4038,7 +4031,7 @@ TEST_F(StaDesignTest, SearchIsClock) {
Search *search = sta_->search();
Vertex *v = findVertex("r1/CK");
if (v) {
(search->clocks(v, sta_->cmdMode()).size() > 0);
(void)(search->clocks(v, sta_->cmdMode()).size() > 0);
}
}() ));
@ -4046,9 +4039,10 @@ TEST_F(StaDesignTest, SearchIsClock) {
TEST_F(StaDesignTest, SearchIsGenClkSrc2) {
Search *search = sta_->search();
(void)search;
Vertex *v = findVertex("r1/Q");
ASSERT_NE(v, nullptr);
true /* Search::isGenClkSrc removed */;
(void)true /* Search::isGenClkSrc removed */;
}
TEST_F(StaDesignTest, SearchClocks) {
@ -4107,12 +4101,14 @@ TEST_F(StaDesignTest, SearchIsEndpoint2) {
TEST_F(StaDesignTest, SearchHavePathGroups) {
ASSERT_NO_THROW(( [&](){
Search *search = sta_->search();
true /* Search::havePathGroups removed */;
(void)search;
(void)true /* Search::havePathGroups removed */;
}() ));
}
TEST_F(StaDesignTest, SearchFindPathGroup) {
Search *search = sta_->search();
(void)search;
Clock *clk = sta_->cmdSdc()->findClock("clk");
ASSERT_NE(clk, nullptr);
// Search::findPathGroup removed

View File

@ -109,12 +109,14 @@ static void expectStaDesignCoreState(Sta *sta, bool design_loaded)
EXPECT_NE(sta->search(), nullptr);
EXPECT_NE(sta->cmdSdc(), nullptr);
EXPECT_FALSE(sta->scenes().empty());
if (!sta->scenes().empty())
if (!sta->scenes().empty()) {
EXPECT_GE(sta->scenes().size(), 1);
}
EXPECT_NE(sta->cmdScene(), nullptr);
EXPECT_TRUE(design_loaded);
if (sta->network())
if (sta->network()) {
EXPECT_NE(sta->network()->topInstance(), nullptr);
}
}
// ============================================================
@ -275,6 +277,7 @@ TEST_F(StaDesignTest, SearchDeratedDelay) {
ASSERT_NE(v, nullptr);
Scene *corner = sta_->cmdScene();
const size_t path_idx = corner->pathIndex(MinMax::max());
(void)path_idx;
VertexInEdgeIterator edge_iter(v, sta_->graph());
if (edge_iter.hasNext()) {
Edge *edge = edge_iter.next();
@ -523,6 +526,7 @@ TEST_F(StaDesignTest, StaVertexSlewRfCorner) {
Vertex *v = findVertex("u1/Z");
ASSERT_NE(v, nullptr);
Scene *corner = sta_->cmdScene();
(void)corner;
Slew slew = sta_->slew(v, RiseFallBoth::rise(), sta_->scenes(), MinMax::max());
EXPECT_FALSE(std::isinf(slew));
}
@ -539,6 +543,7 @@ TEST_F(StaDesignTest, StaVertexRequiredRfPathAP) {
ASSERT_NE(v, nullptr);
Scene *corner = sta_->cmdScene();
const size_t path_idx = corner->pathIndex(MinMax::max());
(void)path_idx;
Required req = sta_->required(v, RiseFallBoth::rise(), sta_->scenes(), MinMax::max());
EXPECT_FALSE(std::isinf(req));
}
@ -1049,6 +1054,7 @@ TEST_F(StaDesignTest, MakeParasiticNetwork) {
Net *net = network->net(pin);
if (net) {
Scene *corner = sta_->cmdScene();
(void)corner;
// ParasiticAnalysisPt and findParasiticAnalysisPt removed from API
// makeParasiticNetwork API changed
}
@ -1183,6 +1189,7 @@ TEST_F(StaDesignTest, SearchVisitStartpoints2) {
TEST_F(StaDesignTest, PathGroupFindByName) {
ASSERT_NO_THROW(( [&](){
Search *search = sta_->search();
(void)search;
// After findPathEnds, path groups should exist
PathEndSeq ends = sta_->findPathEnds(
nullptr, nullptr, nullptr,
@ -1364,6 +1371,7 @@ TEST_F(StaDesignTest, IsInputArrivalSrchStart) {
TEST_F(StaDesignTest, IsSegmentStart) {
ASSERT_NO_THROW(( [&](){
Search *search = sta_->search();
(void)search;
Pin *pin = findPin("in1");
if (pin) {
// Search::isSegmentStart removed from API
@ -1384,6 +1392,7 @@ TEST_F(StaDesignTest, ClockInsertion) {
if (pin) {
Scene *corner = sta_->cmdScene();
const size_t path_idx = corner->pathIndex(MinMax::max());
(void)path_idx;
Arrival ins = search->clockInsertion(clk, pin, RiseFall::rise(),
MinMax::max(), EarlyLate::late(), sta_->cmdMode());
EXPECT_FALSE(std::isinf(ins));
@ -1817,6 +1826,7 @@ TEST_F(StaDesignTest, PathEndUnconstrainedMethods) {
ASSERT_NO_THROW(( [&](){
const SceneSeq &corners = sta_->scenes();
Scene *corner = corners[0];
(void)corner;
PathEndSeq ends = sta_->findPathEnds(
nullptr, nullptr, nullptr, true, corners, MinMaxAll::max(),
5, 5, true, false, -INF, INF, false, group_names,
@ -2019,6 +2029,7 @@ TEST_F(StaDesignTest, ClkSkewPreamble) {
clks.push_back(clk);
const SceneSeq &corners = sta_->scenes();
Scene *corner = corners[0];
(void)corner;
sta_->reportClkSkew(clks, sta_->scenes(), MinMax::max(), false, 3);
}
@ -2073,6 +2084,7 @@ TEST_F(StaDesignTest, ClkSkewInternalLatency) {
clks.push_back(clk);
const SceneSeq &corners = sta_->scenes();
Scene *corner = corners[0];
(void)corner;
sta_->reportClkSkew(clks, sta_->scenes(), MinMax::max(), true, 3);
}
@ -3216,6 +3228,7 @@ TEST_F(StaDesignTest, ReportClkSkew2) {
ConstClockSeq clks;
clks.push_back(clk);
Scene *corner = sta_->cmdScene();
(void)corner;
sta_->reportClkSkew(clks, sta_->scenes(), MinMax::max(), false, 3);
sta_->reportClkSkew(clks, sta_->scenes(), MinMax::min(), false, 3);
}
@ -3242,6 +3255,7 @@ TEST_F(StaDesignTest, ReportClkLatency3) {
ConstClockSeq clks;
clks.push_back(clk);
Scene *corner = sta_->cmdScene();
(void)corner;
sta_->reportClkLatency(clks, sta_->scenes(), false, 3);
}
@ -3650,6 +3664,7 @@ TEST_F(StaDesignTest, ReportClkSkew3) {
ConstClockSeq clks;
clks.push_back(clk);
Scene *corner = sta_->cmdScene();
(void)corner;
sta_->reportClkSkew(clks, sta_->scenes(), MinMax::max(), false, 4);
sta_->reportClkSkew(clks, sta_->scenes(), MinMax::min(), false, 4);
}
@ -3678,6 +3693,7 @@ TEST_F(StaDesignTest, ReportClkLatency4) {
ConstClockSeq clks;
clks.push_back(clk);
Scene *corner = sta_->cmdScene();
(void)corner;
sta_->reportClkLatency(clks, sta_->scenes(), false, 4);
sta_->reportClkLatency(clks, sta_->scenes(), true, 4);
}
@ -3944,6 +3960,7 @@ TEST_F(StaDesignTest, WriteSdcComprehensive) {
Network *network = sta_->cmdNetwork();
Instance *top = network->topInstance();
Scene *corner = sta_->cmdScene();
(void)corner;
Clock *clk = sta_->cmdSdc()->findClock("clk");
Pin *in1 = network->findPin(top, "in1");

View File

@ -74,8 +74,9 @@ static void expectStaCoreState(Sta *sta)
EXPECT_NE(sta->cmdSdc(), nullptr);
EXPECT_NE(sta->report(), nullptr);
EXPECT_FALSE(sta->scenes().empty());
if (!sta->scenes().empty())
if (!sta->scenes().empty()) {
EXPECT_GE(sta->scenes().size(), 1);
}
EXPECT_NE(sta->cmdScene(), nullptr);
}
@ -2176,6 +2177,7 @@ TEST_F(StaInitTest, TagLessConstructor) {
TEST_F(StaInitTest, TagIndexLessComparator) {
TagIndexLess less;
(void)less;
// Just exercise constructor
}
@ -2341,6 +2343,7 @@ TEST_F(StaInitTest, StaSetSlewLimitClock) {
TEST_F(StaInitTest, StaOperatingConditions) {
const OperatingConditions *op = sta_->operatingConditions(MinMax::min(), sta_->cmdSdc());
(void)op;
// May be null without a liberty lib
sta_->operatingConditions(MinMax::max(), sta_->cmdSdc());
}
@ -2652,6 +2655,7 @@ TEST_F(StaInitTest, CornersRangeForIteration) {
TEST_F(StaInitTest, PathGroupsFindByNameNoGroups) {
Mode *mode = sta_->cmdMode();
PathGroups *pgs = mode->pathGroups();
(void)pgs;
// PathGroups may not be initialized yet; just verify mode access works
// PathGroup lookup requires path groups to be built first
EXPECT_NE(mode, nullptr);
@ -3726,7 +3730,9 @@ TEST_F(StaInitTest, CornersFindByIndex) {
TEST_F(StaInitTest, CornersFindByName) {
const SceneSeq &corners = sta_->scenes();
(void)corners;
Scene *c = sta_->findScene("default");
(void)c;
// May or may not find it
}
@ -3771,6 +3777,7 @@ TEST_F(StaInitTest, StaMakeGroupPath) {
// --- Sta.cc: isPathGroupName ---
TEST_F(StaInitTest, StaIsPathGroupNameTestGroup) {
bool val = sta_->isPathGroupName("test_group", sta_->cmdSdc());
(void)val;
// May or may not find it depending on prior makeGroupPath
}

View File

@ -1138,6 +1138,7 @@ TEST_F(StaInitTest, ClkInfoEqualCtor) {
TEST_F(StaInitTest, ClkInfoHashExists) {
ASSERT_NO_THROW(( [&](){
ClkInfoHash hash;
(void)hash;
}() ));
}
@ -1146,6 +1147,7 @@ TEST_F(StaInitTest, ClkInfoHashExists) {
TEST_F(StaInitTest, TagLessCtor) {
ASSERT_NO_THROW(( [&](){
TagLess less(sta_);
(void)less;
}() ));
}
@ -1154,6 +1156,7 @@ TEST_F(StaInitTest, TagLessCtor) {
TEST_F(StaInitTest, TagIndexLessExists) {
ASSERT_NO_THROW(( [&](){
TagIndexLess less;
(void)less;
}() ));
}
@ -1240,6 +1243,7 @@ TEST_F(StaInitTest, ClockPinPairLessExists) {
ASSERT_NO_THROW(( [&](){
// ClockPinPairLess comparison dereferences Clock*, so just test existence
ClockPinPairLess less;
(void)less;
expectStaCoreState(sta_);
}() ));
}
@ -1895,6 +1899,7 @@ TEST_F(StaInitTest, ReportPathFieldSrcAttr) {
ASSERT_NO_THROW(( [&](){
ReportPath *rpt = sta_->reportPath();
ReportField *src = rpt->fieldSrcAttr();
(void)src;
// src_attr field may or may not exist
expectStaCoreState(sta_);
}() ));
@ -2108,6 +2113,7 @@ TEST_F(StaInitTest, CornersIteration) {
TEST_F(StaInitTest, CornerFindName) {
ASSERT_NO_THROW(( [&](){
const SceneSeq &corners = sta_->scenes();
(void)corners;
Scene *corner = sta_->findScene("default");
EXPECT_NE(corner, nullptr);
expectStaCoreState(sta_);
@ -2518,7 +2524,8 @@ TEST_F(StaInitTest, ReportPathReportMpwHeaderShort) {
TEST_F(StaInitTest, ReportPathReportPathEndHeader) {
ASSERT_NO_THROW(( [&](){
ReportPath *rpt = sta_->reportPath();
(void)rpt;
expectStaCoreState(sta_);
}() ));
}
@ -2528,7 +2535,8 @@ TEST_F(StaInitTest, ReportPathReportPathEndHeader) {
TEST_F(StaInitTest, ReportPathReportPathEndFooter) {
ASSERT_NO_THROW(( [&](){
ReportPath *rpt = sta_->reportPath();
(void)rpt;
expectStaCoreState(sta_);
}() ));
}