Skip to content

Commit e4f62cb

Browse files
committed
wifi: Fix valgrind warnings in TX duration tests
1 parent 781080e commit e4f62cb

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/wifi/test/tx-duration-test.cc

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,7 @@ class HeSigBDurationTest : public TestCase
14741474

14751475
private:
14761476
void DoRun() override;
1477+
void DoTeardown() override;
14771478

14781479
/**
14791480
* Build a TXVECTOR for HE MU.
@@ -1482,6 +1483,8 @@ class HeSigBDurationTest : public TestCase
14821483
*/
14831484
WifiTxVector BuildTxVector() const;
14841485

1486+
Ptr<YansWifiPhy> m_phy; ///< the PHY under test
1487+
14851488
std::list<HeMuUserInfo> m_userInfos; ///< HE MU specific per-user information
14861489
WifiMode m_sigBMode; ///< Mode used to transmit HE-SIG-B
14871490
MHz_u m_channelWidth; ///< Channel width
@@ -1538,19 +1541,19 @@ HeSigBDurationTest::BuildTxVector() const
15381541
void
15391542
HeSigBDurationTest::DoRun()
15401543
{
1541-
auto phy = CreateObject<YansWifiPhy>();
1544+
m_phy = CreateObject<YansWifiPhy>();
15421545
auto channelNum = WifiPhyOperatingChannel::FindFirst(0,
15431546
MHz_u{0},
15441547
MHz_u{160},
15451548
WIFI_STANDARD_80211ax,
15461549
WIFI_PHY_BAND_6GHZ)
15471550
->number;
1548-
phy->SetOperatingChannel(
1551+
m_phy->SetOperatingChannel(
15491552
WifiPhy::ChannelTuple{channelNum, 160, WIFI_PHY_BAND_6GHZ, m_p20Index});
1550-
phy->ConfigureStandard(WIFI_STANDARD_80211ax);
1553+
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
15511554

15521555
const auto& txVector = BuildTxVector();
1553-
const auto& hePhy = phy->GetPhyEntity(WIFI_MOD_CLASS_HE);
1556+
const auto& hePhy = m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE);
15541557

15551558
// Verify mode for HE-SIG-B field
15561559
NS_TEST_EXPECT_MSG_EQ(hePhy->GetSigMode(WIFI_PPDU_FIELD_SIG_B, txVector),
@@ -1597,7 +1600,7 @@ HeSigBDurationTest::DoRun()
15971600
auto psdu = Create<WifiPsdu>(Create<Packet>(1000), hdr);
15981601
ppduDuration = std::max(
15991602
ppduDuration,
1600-
WifiPhy::CalculateTxDuration(psdu->GetSize(), txVector, phy->GetPhyBand(), i + 1));
1603+
WifiPhy::CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand(), i + 1));
16011604
psdus.insert(std::make_pair(i, psdu));
16021605
}
16031606
auto ppdu = hePhy->BuildPpdu(psdus, txVector, ppduDuration);
@@ -1606,6 +1609,15 @@ HeSigBDurationTest::DoRun()
16061609
NS_TEST_EXPECT_MSG_EQ((txVector.GetHeMuUserInfoMap() == rxVector.GetHeMuUserInfoMap()),
16071610
true,
16081611
"Incorrect user infos in reconstructed TXVECTOR");
1612+
1613+
Simulator::Destroy();
1614+
}
1615+
1616+
void
1617+
HeSigBDurationTest::DoTeardown()
1618+
{
1619+
m_phy->Dispose();
1620+
m_phy = nullptr;
16091621
}
16101622

16111623
/**

0 commit comments

Comments
 (0)