wifi: Fix valgrind warnings in TX duration tests

This commit is contained in:
Sébastien Deronne
2025-03-25 21:00:14 +01:00
parent 781080e68c
commit e4f62cb0e0

View File

@@ -1474,6 +1474,7 @@ class HeSigBDurationTest : public TestCase
private:
void DoRun() override;
void DoTeardown() override;
/**
* Build a TXVECTOR for HE MU.
@@ -1482,6 +1483,8 @@ class HeSigBDurationTest : public TestCase
*/
WifiTxVector BuildTxVector() const;
Ptr<YansWifiPhy> m_phy; ///< the PHY under test
std::list<HeMuUserInfo> m_userInfos; ///< HE MU specific per-user information
WifiMode m_sigBMode; ///< Mode used to transmit HE-SIG-B
MHz_u m_channelWidth; ///< Channel width
@@ -1538,19 +1541,19 @@ HeSigBDurationTest::BuildTxVector() const
void
HeSigBDurationTest::DoRun()
{
auto phy = CreateObject<YansWifiPhy>();
m_phy = CreateObject<YansWifiPhy>();
auto channelNum = WifiPhyOperatingChannel::FindFirst(0,
MHz_u{0},
MHz_u{160},
WIFI_STANDARD_80211ax,
WIFI_PHY_BAND_6GHZ)
->number;
phy->SetOperatingChannel(
m_phy->SetOperatingChannel(
WifiPhy::ChannelTuple{channelNum, 160, WIFI_PHY_BAND_6GHZ, m_p20Index});
phy->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
const auto& txVector = BuildTxVector();
const auto& hePhy = phy->GetPhyEntity(WIFI_MOD_CLASS_HE);
const auto& hePhy = m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE);
// Verify mode for HE-SIG-B field
NS_TEST_EXPECT_MSG_EQ(hePhy->GetSigMode(WIFI_PPDU_FIELD_SIG_B, txVector),
@@ -1597,7 +1600,7 @@ HeSigBDurationTest::DoRun()
auto psdu = Create<WifiPsdu>(Create<Packet>(1000), hdr);
ppduDuration = std::max(
ppduDuration,
WifiPhy::CalculateTxDuration(psdu->GetSize(), txVector, phy->GetPhyBand(), i + 1));
WifiPhy::CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand(), i + 1));
psdus.insert(std::make_pair(i, psdu));
}
auto ppdu = hePhy->BuildPpdu(psdus, txVector, ppduDuration);
@@ -1606,6 +1609,15 @@ HeSigBDurationTest::DoRun()
NS_TEST_EXPECT_MSG_EQ((txVector.GetHeMuUserInfoMap() == rxVector.GetHeMuUserInfoMap()),
true,
"Incorrect user infos in reconstructed TXVECTOR");
Simulator::Destroy();
}
void
HeSigBDurationTest::DoTeardown()
{
m_phy->Dispose();
m_phy = nullptr;
}
/**