Skip to content

Commit 3d2bcb1

Browse files
authored
Merge pull request #334 from The-OpenROAD-Project-staging/sta_changes_to_fix_test
Sta changes to fix test
2 parents d6c13c4 + 43177bb commit 3d2bcb1

12 files changed

Lines changed: 151 additions & 92 deletions

dcalc/test/cpp/TestDcalc.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4263,6 +4263,7 @@ TEST_F(NangateDcalcTest, DmpExtremeLoads) {
42634263
ASSERT_NE(out_port, nullptr);
42644264

42654265
Scene *corner = sta_->cmdScene();
4266+
(void)corner;
42664267
float loads[] = {0.00001f, 0.1f, 1.0f, 5.0f, 10.0f};
42674268
Slack prev_slack = 0.0f;
42684269
bool first = true;
@@ -4315,6 +4316,7 @@ TEST_F(NangateDcalcTest, DmpCombinedExtremes) {
43154316
ASSERT_NE(in_port, nullptr);
43164317

43174318
Scene *corner = sta_->cmdScene();
4319+
(void)corner;
43184320

43194321
// Large load + fast slew
43204322
sta_->setPortExtPinCap(out_port, RiseFallBoth::riseFall(),
@@ -4348,6 +4350,7 @@ TEST_F(NangateDcalcTest, TwoPoleExtremeLoads) {
43484350
ASSERT_NE(out_port, nullptr);
43494351

43504352
Scene *corner = sta_->cmdScene();
4353+
(void)corner;
43514354
float loads[] = {0.00001f, 0.1f, 1.0f, 5.0f, 10.0f};
43524355
for (float load : loads) {
43534356
sta_->setPortExtPinCap(out_port, RiseFallBoth::riseFall(),
@@ -4532,6 +4535,7 @@ TEST_F(MultiDriverDcalcTest, DmpCeffLoadSweep) {
45324535
ASSERT_NE(out_port, nullptr);
45334536

45344537
Scene *corner = sta_->cmdScene();
4538+
(void)corner;
45354539
float loads[] = {0.001f, 0.005f, 0.01f, 0.05f, 0.1f};
45364540
Slack prev_slack = 1e30f; // Start with large positive value
45374541
for (float load : loads) {
@@ -4593,6 +4597,7 @@ TEST_F(MultiDriverDcalcTest, IncrementalLoadChanges) {
45934597
Instance *top = network->topInstance();
45944598
Cell *top_cell = network->cell(top);
45954599
Scene *corner = sta_->cmdScene();
4600+
(void)corner;
45964601

45974602
const char *output_ports[] = {"out1", "out2", "out3"};
45984603
for (const char *pname : output_ports) {

liberty/test/cpp/TestLibertyStaBasics.cc

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ static void expectStaLibertyCoreState(Sta *sta, LibertyLibrary *lib)
4040
EXPECT_NE(sta->cmdSdc(), nullptr);
4141
EXPECT_NE(sta->report(), nullptr);
4242
EXPECT_FALSE(sta->scenes().empty());
43-
if (!sta->scenes().empty())
43+
if (!sta->scenes().empty()) {
4444
EXPECT_GE(sta->scenes().size(), 1);
45+
}
4546
EXPECT_NE(sta->cmdScene(), nullptr);
4647
EXPECT_NE(lib, nullptr);
4748
}
@@ -303,6 +304,7 @@ TEST_F(StaLibertyTest, TimingArcSetCondDefault) {
303304
TimingArcSet *arcset = arcsets[0];
304305
// Just call the getter for coverage
305306
bool is_default = arcset->isCondDefault();
307+
(void)is_default;
306308
// is_default value depends on cell type
307309
}
308310

@@ -314,10 +316,15 @@ TEST_F(StaLibertyTest, TimingArcSetSdfCond) {
314316
TimingArcSet *arcset = arcsets[0];
315317
// SDF condition getters - may be empty for simple arcs
316318
const std::string &sdf_cond = arcset->sdfCond();
319+
(void)sdf_cond;
317320
const std::string &sdf_start = arcset->sdfCondStart();
321+
(void)sdf_start;
318322
const std::string &sdf_end = arcset->sdfCondEnd();
323+
(void)sdf_end;
319324
const std::string &mode_name = arcset->modeName();
325+
(void)mode_name;
320326
const std::string &mode_value = arcset->modeValue();
327+
(void)mode_value;
321328
// sdf_cond may be empty for simple arcs
322329
// sdf_start may be empty for simple arcs
323330
// sdf_end may be empty for simple arcs
@@ -353,6 +360,7 @@ TEST_F(StaLibertyTest, TimingArcProperties) {
353360

354361
// Test model
355362
TimingModel *model = arc->model();
363+
(void)model;
356364
// model may be null depending on cell type
357365
}
358366

@@ -431,6 +439,7 @@ TEST_F(StaLibertyTest, LibraryPortProperties) {
431439

432440
// Test capacitanceIsOneValue
433441
bool one_val = a->capacitanceIsOneValue();
442+
(void)one_val;
434443
// one_val value depends on cell type
435444

436445
// Test driveResistance
@@ -467,15 +476,19 @@ TEST_F(StaLibertyTest, PortClockFlags) {
467476
LibertyPort *ck = dff->findLibertyPort("CK");
468477
if (ck) {
469478
bool is_clk = ck->isClock();
479+
(void)is_clk;
470480
bool is_reg_clk = ck->isRegClk();
481+
(void)is_reg_clk;
471482
bool is_check_clk = ck->isCheckClk();
483+
(void)is_check_clk;
472484
// is_clk tested implicitly (bool accessor exercised)
473485
// is_reg_clk tested implicitly (bool accessor exercised)
474486
// is_check_clk tested implicitly (bool accessor exercised)
475487
}
476488
LibertyPort *q = dff->findLibertyPort("Q");
477489
if (q) {
478490
bool is_reg_out = q->isRegOutput();
491+
(void)is_reg_out;
479492
// is_reg_out tested implicitly (bool accessor exercised)
480493
}
481494
}
@@ -600,7 +613,9 @@ TEST_F(StaLibertyTest, PortRelatedPorts) {
600613
LibertyPort *a = buf->findLibertyPort("A");
601614
ASSERT_NE(a, nullptr);
602615
LibertyPort *ground_port = a->relatedGroundPort();
616+
(void)ground_port;
603617
LibertyPort *power_port = a->relatedPowerPort();
618+
(void)power_port;
604619
// ground_port may be null for simple cells
605620
// power_port may be null for simple cells
606621
}
@@ -638,6 +653,7 @@ TEST_F(StaLibertyTest, PortReceiverModel) {
638653
LibertyPort *a = buf->findLibertyPort("A");
639654
ASSERT_NE(a, nullptr);
640655
const ReceiverModel *rm = a->receiverModel();
656+
(void)rm;
641657
// rm may be null depending on cell type
642658
}
643659

@@ -659,6 +675,7 @@ TEST_F(StaLibertyTest, CellInternalPowers) {
659675
}
660676
// relatedPgPin may be nullptr
661677
LibertyPort *pgpin = pwr.relatedPgPin();
678+
(void)pgpin;
662679
// pgpin may be null for simple arcs
663680
EXPECT_EQ(pwr.libertyCell(), buf);
664681
}
@@ -679,6 +696,7 @@ TEST_F(StaLibertyTest, CellDontUse) {
679696
LibertyCell *buf = lib_->findLibertyCell("BUF_X1");
680697
ASSERT_NE(buf, nullptr);
681698
bool dont_use = buf->dontUse();
699+
(void)dont_use;
682700
// dont_use value depends on cell type
683701
}
684702

@@ -1031,6 +1049,7 @@ TEST_F(StaLibertyTest, CellScaleFactors) {
10311049
LibertyCell *buf = lib_->findLibertyCell("BUF_X1");
10321050
ASSERT_NE(buf, nullptr);
10331051
ScaleFactors *sf = buf->scaleFactors();
1052+
(void)sf;
10341053
// sf may be null depending on cell type
10351054
}
10361055

@@ -1045,6 +1064,7 @@ TEST_F(StaLibertyTest, CellOcvDerate) {
10451064
LibertyCell *buf = lib_->findLibertyCell("BUF_X1");
10461065
ASSERT_NE(buf, nullptr);
10471066
OcvDerate *derate = buf->ocvDerate();
1067+
(void)derate;
10481068
// derate may be null depending on cell type
10491069
}
10501070

@@ -2170,10 +2190,12 @@ TEST_F(StaLibertyTest, PortRegClkAndOutput) {
21702190
LibertyPort *clk = dff->findLibertyPort("CK");
21712191
ASSERT_NE(clk, nullptr);
21722192
bool is_reg_clk = clk->isRegClk();
2193+
(void)is_reg_clk;
21732194
// is_reg_clk value depends on cell type
21742195
LibertyPort *q = dff->findLibertyPort("Q");
21752196
ASSERT_NE(q, nullptr);
21762197
bool is_reg_out = q->isRegOutput();
2198+
(void)is_reg_out;
21772199
// is_reg_out value depends on cell type
21782200
}
21792201

@@ -2183,6 +2205,7 @@ TEST_F(StaLibertyTest, PortLatchData) {
21832205
LibertyPort *d = dlh->findLibertyPort("D");
21842206
ASSERT_NE(d, nullptr);
21852207
bool is_latch_data = d->isLatchData();
2208+
(void)is_latch_data;
21862209
// is_latch_data value depends on cell type
21872210
}
21882211

@@ -2281,6 +2304,7 @@ TEST_F(StaLibertyTest, CellHasInternalPorts) {
22812304
LibertyCell *buf = lib_->findLibertyCell("BUF_X1");
22822305
ASSERT_NE(buf, nullptr);
22832306
bool hip = buf->hasInternalPorts();
2307+
(void)hip;
22842308
// hip value depends on cell type
22852309
}
22862310

@@ -3252,8 +3276,9 @@ TEST_F(StaLibertyTest, CellHasSequentials2) {
32523276
ASSERT_NE(buf, nullptr);
32533277
EXPECT_FALSE(buf->hasSequentials());
32543278
LibertyCell *dff = lib_->findLibertyCell("DFF_X1");
3255-
if (dff)
3279+
if (dff) {
32563280
EXPECT_TRUE(dff->hasSequentials());
3281+
}
32573282
}
32583283

32593284
TEST_F(StaLibertyTest, CellTimingArcSets2) {

liberty/test/cpp/TestLibertyStaBasicsB.cc

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ static void expectStaLibertyCoreState(Sta *sta, LibertyLibrary *lib)
4040
EXPECT_NE(sta->cmdSdc(), nullptr);
4141
EXPECT_NE(sta->report(), nullptr);
4242
EXPECT_FALSE(sta->scenes().empty());
43-
if (!sta->scenes().empty())
43+
if (!sta->scenes().empty()) {
4444
EXPECT_GE(sta->scenes().size(), 1);
45+
}
4546
EXPECT_NE(sta->cmdScene(), nullptr);
4647
EXPECT_NE(lib, nullptr);
4748
}
@@ -860,6 +861,7 @@ TEST_F(StaLibertyTest, CellFootprint2) {
860861
LibertyCell *buf = lib_->findLibertyCell("BUF_X1");
861862
ASSERT_NE(buf, nullptr);
862863
const std::string &fp = buf->footprint();
864+
(void)fp;
863865
// fp may be empty for simple arcs
864866
}
865867

@@ -1433,6 +1435,7 @@ TEST(R6_FuncExprTest, PortExprCheckSizeOne) {
14331435
// Port with size 1 should return true for checkSize(1)
14341436
// (depends on port->size())
14351437
bool result = port_expr->checkSize(1);
1438+
(void)result;
14361439
// Just exercise the code path
14371440
// result tested implicitly (bool accessor exercised)
14381441
delete port_expr;
@@ -1462,7 +1465,7 @@ TEST(R6_FuncExprTest, HasPortMatching) {
14621465
FuncExpr *expr_a = FuncExpr::makePort(port_a);
14631466
EXPECT_TRUE(expr_a->hasPort(port_a));
14641467
EXPECT_FALSE(expr_a->hasPort(port_b));
1465-
expr_a; // deleteSubexprs removed
1468+
(void)expr_a; // deleteSubexprs removed
14661469
}
14671470

14681471
TEST(R6_FuncExprTest, LessPortExprs) {
@@ -1478,8 +1481,8 @@ TEST(R6_FuncExprTest, LessPortExprs) {
14781481
bool r1 = FuncExpr::less(expr_a, expr_b);
14791482
bool r2 = FuncExpr::less(expr_b, expr_a);
14801483
EXPECT_NE(r1, r2);
1481-
expr_a; // deleteSubexprs removed
1482-
expr_b; // deleteSubexprs removed
1484+
(void)expr_a; // deleteSubexprs removed
1485+
(void)expr_b; // deleteSubexprs removed
14831486
}
14841487

14851488
TEST(R6_FuncExprTest, EquivPortExprs) {
@@ -1490,8 +1493,8 @@ TEST(R6_FuncExprTest, EquivPortExprs) {
14901493
FuncExpr *expr1 = FuncExpr::makePort(port_a);
14911494
FuncExpr *expr2 = FuncExpr::makePort(port_a);
14921495
EXPECT_TRUE(FuncExpr::equiv(expr1, expr2));
1493-
expr1; // deleteSubexprs removed
1494-
expr2; // deleteSubexprs removed
1496+
(void)expr1; // deleteSubexprs removed
1497+
(void)expr2; // deleteSubexprs removed
14951498
}
14961499

14971500
////////////////////////////////////////////////////////////////
@@ -2255,6 +2258,7 @@ TEST_F(StaLibertyTest, CellFootprint3) {
22552258
LibertyCell *buf = lib_->findLibertyCell("BUF_X1");
22562259
ASSERT_NE(buf, nullptr);
22572260
const std::string &fp = buf->footprint();
2261+
(void)fp;
22582262
// May be empty for simple arcs
22592263
}
22602264

@@ -2271,6 +2275,7 @@ TEST_F(StaLibertyTest, CellUserFunctionClass2) {
22712275
LibertyCell *buf = lib_->findLibertyCell("BUF_X1");
22722276
ASSERT_NE(buf, nullptr);
22732277
const std::string &ufc = buf->userFunctionClass();
2278+
(void)ufc;
22742279
// ufc may be empty for simple arcs
22752280
}
22762281

@@ -2690,7 +2695,7 @@ TEST_F(StaLibertyTest, FuncExprMakeNot) {
26902695
EXPECT_EQ(not_expr->left(), port_expr);
26912696
std::string s = not_expr->to_string();
26922697
EXPECT_FALSE(s.empty());
2693-
not_expr; // deleteSubexprs removed
2698+
(void)not_expr; // deleteSubexprs removed
26942699
}
26952700

26962701
// FuncExpr::makeAnd
@@ -2707,7 +2712,7 @@ TEST_F(StaLibertyTest, FuncExprMakeAnd) {
27072712
EXPECT_EQ(and_expr->op(), FuncExpr::Op::and_);
27082713
std::string s = and_expr->to_string();
27092714
EXPECT_FALSE(s.empty());
2710-
and_expr; // deleteSubexprs removed
2715+
(void)and_expr; // deleteSubexprs removed
27112716
}
27122717

27132718
// FuncExpr::makeOr
@@ -2722,7 +2727,7 @@ TEST_F(StaLibertyTest, FuncExprMakeOr) {
27222727
FuncExpr *right = FuncExpr::makePort(a2);
27232728
FuncExpr *or_expr = FuncExpr::makeOr(left, right);
27242729
EXPECT_EQ(or_expr->op(), FuncExpr::Op::or_);
2725-
or_expr; // deleteSubexprs removed
2730+
(void)or_expr; // deleteSubexprs removed
27262731
}
27272732

27282733
// FuncExpr::makeXor
@@ -2735,7 +2740,7 @@ TEST_F(StaLibertyTest, FuncExprMakeXor) {
27352740
FuncExpr *right = FuncExpr::makePort(a);
27362741
FuncExpr *xor_expr = FuncExpr::makeXor(left, right);
27372742
EXPECT_EQ(xor_expr->op(), FuncExpr::Op::xor_);
2738-
xor_expr; // deleteSubexprs removed
2743+
(void)xor_expr; // deleteSubexprs removed
27392744
}
27402745

27412746
// FuncExpr::makeZero and makeOne
@@ -2772,8 +2777,9 @@ TEST_F(StaLibertyTest, FuncExprHasPort) {
27722777
ASSERT_NE(a, nullptr);
27732778
FuncExpr *expr = FuncExpr::makePort(a);
27742779
EXPECT_TRUE(expr->hasPort(a));
2775-
if (zn)
2780+
if (zn) {
27762781
EXPECT_FALSE(expr->hasPort(zn));
2782+
}
27772783
delete expr;
27782784
}
27792785

@@ -2786,7 +2792,7 @@ TEST_F(StaLibertyTest, FuncExprPortTimingSense) {
27862792
FuncExpr *not_expr = FuncExpr::makeNot(FuncExpr::makePort(a));
27872793
TimingSense sense = not_expr->portTimingSense(a);
27882794
EXPECT_EQ(sense, TimingSense::negative_unate);
2789-
not_expr; // deleteSubexprs removed
2795+
(void)not_expr; // deleteSubexprs removed
27902796
}
27912797

27922798
// FuncExpr::copy
@@ -2905,8 +2911,9 @@ TEST_F(StaLibertyTest, PortIsClock2) {
29052911
ASSERT_NE(ck, nullptr);
29062912
EXPECT_TRUE(ck->isClock());
29072913
LibertyPort *d = dff->findLibertyPort("D");
2908-
if (d)
2914+
if (d) {
29092915
EXPECT_FALSE(d->isClock());
2916+
}
29102917
}
29112918

29122919
// LibertyPort::setIsClock
@@ -3047,6 +3054,7 @@ TEST_F(StaLibertyTest, TimingArcSetIsCondDefault) {
30473054
ASSERT_GT(arcsets.size(), 0u);
30483055
// Default should be false or true depending on library
30493056
bool cd = arcsets[0]->isCondDefault();
3057+
(void)cd;
30503058
// cd value depends on cell type
30513059
}
30523060

@@ -3326,6 +3334,7 @@ TEST_F(StaLibertyTest, PortCapacitanceIsOneValue2) {
33263334
LibertyPort *a = buf->findLibertyPort("A");
33273335
ASSERT_NE(a, nullptr);
33283336
bool one_val = a->capacitanceIsOneValue();
3337+
(void)one_val;
33293338
// one_val value depends on cell type
33303339
}
33313340

@@ -3384,6 +3393,9 @@ TEST_F(StaLibertyTest, ScaleFactorTypeRiseFallSuffix) {
33843393
bool rfs = scaleFactorTypeRiseFallSuffix(ScaleFactorType::cell);
33853394
bool rfp = scaleFactorTypeRiseFallPrefix(ScaleFactorType::cell);
33863395
bool lhs = scaleFactorTypeLowHighSuffix(ScaleFactorType::cell);
3396+
(void)rfs;
3397+
(void)rfp;
3398+
(void)lhs;
33873399
// rfs tested implicitly (bool accessor exercised)
33883400
// rfp tested implicitly (bool accessor exercised)
33893401
// lhs tested implicitly (bool accessor exercised)

liberty/test/cpp/TestLibertyStaCallbacks.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ static void expectStaLibertyCoreState(Sta *sta, LibertyLibrary *lib)
4242
EXPECT_NE(sta->cmdSdc(), nullptr);
4343
EXPECT_NE(sta->report(), nullptr);
4444
EXPECT_FALSE(sta->scenes().empty());
45-
if (!sta->scenes().empty())
45+
if (!sta->scenes().empty()) {
4646
EXPECT_GE(sta->scenes().size(), 1);
47+
}
4748
EXPECT_NE(sta->cmdScene(), nullptr);
4849
EXPECT_NE(lib, nullptr);
4950
}
@@ -3847,8 +3848,9 @@ library(test_r11_bus) {
38473848
if (bus_port) {
38483849
// findLibertyMember on bus port
38493850
LibertyPort *member = bus_port->findLibertyMember(0);
3850-
if (member)
3851+
if (member) {
38513852
EXPECT_NE(member, nullptr);
3853+
}
38523854
}
38533855
}
38543856
}

0 commit comments

Comments
 (0)