Fix bug#839: TestSuite wimax-ss-mac-layer crashes on Darwin 9.8.0 Power Macintosh

This commit is contained in:
Mohamed Amine Ismail
2010-03-11 14:22:33 +01:00
parent fde7b7c890
commit 32e966df92
5 changed files with 43 additions and 37 deletions

View File

@@ -182,7 +182,7 @@ BandwidthManager::ProcessBandwidthRequest (const BandwidthRequestHeader &bwReque
else
{
serviceFlow->GetRecord ()->SetRequestedBandwidth (bwRequestHdr.GetBr ());
bs->GetUplinkScheduler()->OnSetRequestedBandwidth(serviceFlow->GetRecord());
bs->GetUplinkScheduler ()->OnSetRequestedBandwidth (serviceFlow->GetRecord ());
}
bs->GetUplinkScheduler ()->ProcessBandwidthRequest (bwRequestHdr);
// update backlogged

View File

@@ -251,7 +251,10 @@ ServiceFlow::GetRecord (void) const
Ptr<WimaxMacQueue>
ServiceFlow::GetQueue (void) const
{
if (!m_connection) return 0;
if (!m_connection)
{
return 0;
}
return m_connection->GetQueue ();
}
@@ -264,14 +267,20 @@ ServiceFlow::GetSchedulingType (void) const
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 @@ ServiceFlow::CleanUpQueue (void)
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;
}
}
}
}

View File

@@ -815,7 +815,7 @@ uint8_t
SimpleOfdmWimaxPhy::DoGetFrameDurationCode (void) const
{
uint16_t duration = 0;
duration = (uint16_t) (GetFrameDuration ().GetSeconds () * 10000);
duration = (uint16_t)(GetFrameDuration ().GetSeconds () * 10000);
switch (duration)
{
case 25:

View File

@@ -88,14 +88,12 @@ Ns3WimaxNetworkEntryTestCase::DoRun (void)
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 @@ Ns3WimaxManagementConnectionsTestCase::DoRun (void)
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);

View File

@@ -76,7 +76,7 @@ Ns3WimaxFragmentationTestCase::DoRun (void)
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 @@ Ns3WimaxFragmentationTestCase::DoRun (void)
if (((tmpType >> 2) & 1) != 1)
{
// The packet is not a fragment
testResult=true;
break;
testResult = true;
break;
}
}
@@ -128,19 +128,19 @@ Ns3WimaxFragmentationTestCase::DoRun (void)
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 @@ Ns3WimaxFragmentationTestCase::DoRun (void)
if (fullPacket->GetSize () != 1000)
{
// The defragmentation is correct.
testResult= true; // Test is passed
testResult = true; // Test is passed
break;
}
}