Fix bug#839: TestSuite wimax-ss-mac-layer crashes on Darwin 9.8.0 Power Macintosh
1.1 --- a/src/devices/wimax/bandwidth-manager.cc Thu Mar 11 14:21:17 2010 +0100
1.2 +++ b/src/devices/wimax/bandwidth-manager.cc Thu Mar 11 14:22:33 2010 +0100
1.3 @@ -182,7 +182,7 @@
1.4 else
1.5 {
1.6 serviceFlow->GetRecord ()->SetRequestedBandwidth (bwRequestHdr.GetBr ());
1.7 - bs->GetUplinkScheduler()->OnSetRequestedBandwidth(serviceFlow->GetRecord());
1.8 + bs->GetUplinkScheduler ()->OnSetRequestedBandwidth (serviceFlow->GetRecord ());
1.9 }
1.10 bs->GetUplinkScheduler ()->ProcessBandwidthRequest (bwRequestHdr);
1.11 // update backlogged
2.1 --- a/src/devices/wimax/service-flow.cc Thu Mar 11 14:21:17 2010 +0100
2.2 +++ b/src/devices/wimax/service-flow.cc Thu Mar 11 14:22:33 2010 +0100
2.3 @@ -251,7 +251,10 @@
2.4 Ptr<WimaxMacQueue>
2.5 ServiceFlow::GetQueue (void) const
2.6 {
2.7 - if (!m_connection) return 0;
2.8 + if (!m_connection)
2.9 + {
2.10 + return 0;
2.11 + }
2.12 return m_connection->GetQueue ();
2.13 }
2.14
2.15 @@ -264,14 +267,20 @@
2.16 bool
2.17 ServiceFlow::HasPackets (void) const
2.18 {
2.19 - if (!m_connection) return false;
2.20 + if (!m_connection)
2.21 + {
2.22 + return false;
2.23 + }
2.24 return m_connection->HasPackets ();
2.25 }
2.26
2.27 bool
2.28 ServiceFlow::HasPackets (MacHeaderType::HeaderType packetType) const
2.29 {
2.30 - if (!m_connection) return false;
2.31 + if (!m_connection)
2.32 + {
2.33 + return false;
2.34 + }
2.35 return m_connection->HasPackets (packetType);
2.36 }
2.37
2.38 @@ -282,20 +291,21 @@
2.39 Time timeStamp;
2.40 Ptr<Packet> packet;
2.41 Time currentTime = Simulator::Now ();
2.42 - if (m_connection){
2.43 - while (m_connection->HasPackets ())
2.44 - {
2.45 - packet = m_connection->GetQueue ()->Peek (hdr, timeStamp);
2.46 + if (m_connection)
2.47 + {
2.48 + while (m_connection->HasPackets ())
2.49 + {
2.50 + packet = m_connection->GetQueue ()->Peek (hdr, timeStamp);
2.51
2.52 - if (currentTime - timeStamp > MilliSeconds (GetMaximumLatency ()))
2.53 - {
2.54 - m_connection->Dequeue ();
2.55 - }
2.56 - else
2.57 - {
2.58 - break;
2.59 - }
2.60 - }
2.61 + if (currentTime - timeStamp > MilliSeconds (GetMaximumLatency ()))
2.62 + {
2.63 + m_connection->Dequeue ();
2.64 + }
2.65 + else
2.66 + {
2.67 + break;
2.68 + }
2.69 + }
2.70 }
2.71 }
2.72
3.1 --- a/src/devices/wimax/simple-ofdm-wimax-phy.cc Thu Mar 11 14:21:17 2010 +0100
3.2 +++ b/src/devices/wimax/simple-ofdm-wimax-phy.cc Thu Mar 11 14:22:33 2010 +0100
3.3 @@ -815,7 +815,7 @@
3.4 SimpleOfdmWimaxPhy::DoGetFrameDurationCode (void) const
3.5 {
3.6 uint16_t duration = 0;
3.7 - duration = (uint16_t) (GetFrameDuration ().GetSeconds () * 10000);
3.8 + duration = (uint16_t)(GetFrameDuration ().GetSeconds () * 10000);
3.9 switch (duration)
3.10 {
3.11 case 25:
4.1 --- a/src/devices/wimax/ss-mac-test.cc Thu Mar 11 14:21:17 2010 +0100
4.2 +++ b/src/devices/wimax/ss-mac-test.cc Thu Mar 11 14:22:33 2010 +0100
4.3 @@ -88,14 +88,12 @@
4.4 WimaxHelper::DEVICE_TYPE_BASE_STATION,
4.5 WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
4.6 scheduler);
4.7 - Simulator::Stop (Seconds (0.5));
4.8 + Simulator::Stop (Seconds (1));
4.9 Simulator::Run ();
4.10 for (int i = 0; i < 10; i++)
4.11 {
4.12 - if (ssDevs.Get (i)->GetObject<SubscriberStationNetDevice> ()->IsRegistered () == false)
4.13 - {
4.14 - return true; // Test fail because SS[i] is not registered
4.15 - }
4.16 + NS_TEST_EXPECT_MSG_EQ (ssDevs.Get (i)->GetObject<SubscriberStationNetDevice> ()->IsRegistered (),true,
4.17 + "SS[" << i << "] IsNotRegistered");
4.18 }
4.19 Simulator::Destroy ();
4.20 return (false); // Test was ok, all the SS are registered
4.21 @@ -151,14 +149,12 @@
4.22 WimaxHelper::DEVICE_TYPE_BASE_STATION,
4.23 WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
4.24 scheduler);
4.25 - Simulator::Stop (Seconds (0.5));
4.26 + Simulator::Stop (Seconds (1));
4.27 Simulator::Run ();
4.28 for (int i = 0; i < 10; i++)
4.29 {
4.30 - if (ssDevs.Get (i)->GetObject<SubscriberStationNetDevice> ()->GetAreManagementConnectionsAllocated () == false)
4.31 - {
4.32 - return true; // Test fail because management connections of SS[i] are not allocated
4.33 - }
4.34 + NS_TEST_EXPECT_MSG_EQ (ssDevs.Get (i)->GetObject<SubscriberStationNetDevice> ()->GetAreManagementConnectionsAllocated (),
4.35 + true, "Management connections for SS[" << i << "] are not allocated");
4.36 }
4.37 Simulator::Destroy ();
4.38 return (false);
5.1 --- a/src/devices/wimax/wimax-fragmentation-test.cc Thu Mar 11 14:21:17 2010 +0100
5.2 +++ b/src/devices/wimax/wimax-fragmentation-test.cc Thu Mar 11 14:22:33 2010 +0100
5.3 @@ -76,7 +76,7 @@
5.4 Cid cid;
5.5 WimaxConnection *connectionTx = new WimaxConnection (cid, Cid::TRANSPORT);
5.6 WimaxConnection *connectionRx = new WimaxConnection (cid, Cid::TRANSPORT);
5.7 - bool testResult=false;
5.8 + bool testResult = false;
5.9
5.10 // A Packet of 1000 bytes has been created.
5.11 // It will be fragmentated into 4 fragments and then defragmentated into fullPacket.
5.12 @@ -115,8 +115,8 @@
5.13 if (((tmpType >> 2) & 1) != 1)
5.14 {
5.15 // The packet is not a fragment
5.16 - testResult=true;
5.17 - break;
5.18 + testResult = true;
5.19 + break;
5.20 }
5.21 }
5.22
5.23 @@ -128,19 +128,19 @@
5.24 if (fc == 1 && i != 0)
5.25 {
5.26 // the fragment in not the first one
5.27 - testResult=true;
5.28 - break;
5.29 + testResult = true;
5.30 + break;
5.31 }
5.32 if (fc == 2 && i != 3)
5.33 {
5.34 // the fragment in not the latest one
5.35 - testResult=true;
5.36 - break;
5.37 + testResult = true;
5.38 + break;
5.39 }
5.40 if ((fc == 3 && i != 1) && (fc == 3 && i != 2))
5.41 {
5.42 // the fragment in not the middle one
5.43 - testResult= true;
5.44 + testResult = true;
5.45 break;
5.46 }
5.47
5.48 @@ -170,7 +170,7 @@
5.49 if (fullPacket->GetSize () != 1000)
5.50 {
5.51 // The defragmentation is correct.
5.52 - testResult= true; // Test is passed
5.53 + testResult = true; // Test is passed
5.54 break;
5.55 }
5.56 }