Fix bug#839: TestSuite wimax-ss-mac-layer crashes on Darwin 9.8.0 Power Macintosh
--- a/src/devices/wimax/bandwidth-manager.cc Thu Mar 11 14:21:17 2010 +0100
+++ b/src/devices/wimax/bandwidth-manager.cc Thu Mar 11 14:22:33 2010 +0100
@@ -182,7 +182,7 @@
else
{
serviceFlow->GetRecord ()->SetRequestedBandwidth (bwRequestHdr.GetBr ());
- bs->GetUplinkScheduler()->OnSetRequestedBandwidth(serviceFlow->GetRecord());
+ bs->GetUplinkScheduler ()->OnSetRequestedBandwidth (serviceFlow->GetRecord ());
}
bs->GetUplinkScheduler ()->ProcessBandwidthRequest (bwRequestHdr);
// update backlogged
--- a/src/devices/wimax/service-flow.cc Thu Mar 11 14:21:17 2010 +0100
+++ b/src/devices/wimax/service-flow.cc Thu Mar 11 14:22:33 2010 +0100
@@ -251,7 +251,10 @@
Ptr<WimaxMacQueue>
ServiceFlow::GetQueue (void) const
{
- if (!m_connection) return 0;
+ if (!m_connection)
+ {
+ return 0;
+ }
return m_connection->GetQueue ();
}
@@ -264,14 +267,20 @@
bool
ServiceFlow::HasPackets (void) const
{
- if (!m_connection) return false;
+ if (!m_connection)
+ {
+ return false;
+ }
return m_connection->HasPackets ();
}
bool
ServiceFlow::HasPackets (MacHeaderType::HeaderType packetType) const
{
- if (!m_connection) return false;
+ if (!m_connection)
+ {
+ return false;
+ }
return m_connection->HasPackets (packetType);
}
@@ -282,20 +291,21 @@
Time timeStamp;
Ptr<Packet> packet;
Time currentTime = Simulator::Now ();
- if (m_connection){
- while (m_connection->HasPackets ())
- {
- packet = m_connection->GetQueue ()->Peek (hdr, timeStamp);
+ if (m_connection)
+ {
+ while (m_connection->HasPackets ())
+ {
+ packet = m_connection->GetQueue ()->Peek (hdr, timeStamp);
- if (currentTime - timeStamp > MilliSeconds (GetMaximumLatency ()))
- {
- m_connection->Dequeue ();
- }
- else
- {
- break;
- }
- }
+ if (currentTime - timeStamp > MilliSeconds (GetMaximumLatency ()))
+ {
+ m_connection->Dequeue ();
+ }
+ else
+ {
+ break;
+ }
+ }
}
}
--- a/src/devices/wimax/simple-ofdm-wimax-phy.cc Thu Mar 11 14:21:17 2010 +0100
+++ b/src/devices/wimax/simple-ofdm-wimax-phy.cc Thu Mar 11 14:22:33 2010 +0100
@@ -815,7 +815,7 @@
SimpleOfdmWimaxPhy::DoGetFrameDurationCode (void) const
{
uint16_t duration = 0;
- duration = (uint16_t) (GetFrameDuration ().GetSeconds () * 10000);
+ duration = (uint16_t)(GetFrameDuration ().GetSeconds () * 10000);
switch (duration)
{
case 25:
--- a/src/devices/wimax/ss-mac-test.cc Thu Mar 11 14:21:17 2010 +0100
+++ b/src/devices/wimax/ss-mac-test.cc Thu Mar 11 14:22:33 2010 +0100
@@ -88,14 +88,12 @@
WimaxHelper::DEVICE_TYPE_BASE_STATION,
WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
scheduler);
- Simulator::Stop (Seconds (0.5));
+ Simulator::Stop (Seconds (1));
Simulator::Run ();
for (int i = 0; i < 10; i++)
{
- if (ssDevs.Get (i)->GetObject<SubscriberStationNetDevice> ()->IsRegistered () == false)
- {
- return true; // Test fail because SS[i] is not registered
- }
+ NS_TEST_EXPECT_MSG_EQ (ssDevs.Get (i)->GetObject<SubscriberStationNetDevice> ()->IsRegistered (),true,
+ "SS[" << i << "] IsNotRegistered");
}
Simulator::Destroy ();
return (false); // Test was ok, all the SS are registered
@@ -151,14 +149,12 @@
WimaxHelper::DEVICE_TYPE_BASE_STATION,
WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
scheduler);
- Simulator::Stop (Seconds (0.5));
+ Simulator::Stop (Seconds (1));
Simulator::Run ();
for (int i = 0; i < 10; i++)
{
- if (ssDevs.Get (i)->GetObject<SubscriberStationNetDevice> ()->GetAreManagementConnectionsAllocated () == false)
- {
- return true; // Test fail because management connections of SS[i] are not allocated
- }
+ NS_TEST_EXPECT_MSG_EQ (ssDevs.Get (i)->GetObject<SubscriberStationNetDevice> ()->GetAreManagementConnectionsAllocated (),
+ true, "Management connections for SS[" << i << "] are not allocated");
}
Simulator::Destroy ();
return (false);
--- a/src/devices/wimax/wimax-fragmentation-test.cc Thu Mar 11 14:21:17 2010 +0100
+++ b/src/devices/wimax/wimax-fragmentation-test.cc Thu Mar 11 14:22:33 2010 +0100
@@ -76,7 +76,7 @@
Cid cid;
WimaxConnection *connectionTx = new WimaxConnection (cid, Cid::TRANSPORT);
WimaxConnection *connectionRx = new WimaxConnection (cid, Cid::TRANSPORT);
- bool testResult=false;
+ bool testResult = false;
// A Packet of 1000 bytes has been created.
// It will be fragmentated into 4 fragments and then defragmentated into fullPacket.
@@ -115,8 +115,8 @@
if (((tmpType >> 2) & 1) != 1)
{
// The packet is not a fragment
- testResult=true;
- break;
+ testResult = true;
+ break;
}
}
@@ -128,19 +128,19 @@
if (fc == 1 && i != 0)
{
// the fragment in not the first one
- testResult=true;
- break;
+ testResult = true;
+ break;
}
if (fc == 2 && i != 3)
{
// the fragment in not the latest one
- testResult=true;
- break;
+ testResult = true;
+ break;
}
if ((fc == 3 && i != 1) && (fc == 3 && i != 2))
{
// the fragment in not the middle one
- testResult= true;
+ testResult = true;
break;
}
@@ -170,7 +170,7 @@
if (fullPacket->GetSize () != 1000)
{
// The defragmentation is correct.
- testResult= true; // Test is passed
+ testResult = true; // Test is passed
break;
}
}