diff options
author | Finn Williams <Finn.Williams@arm.com> | 2019-11-29 13:56:33 +0000 |
---|---|---|
committer | Finn Williams <Finn.Williams@arm.com> | 2019-12-04 14:31:41 +0000 |
commit | 109c05bc985d25f513444a7caa1e54557ef0f3c0 (patch) | |
tree | 59b67e3fff31d6d23bb94b235a6463dfcf91a94d /src/profiling/test | |
parent | 73ae7fa28d05babde16fa232c1d823b35c893e3e (diff) | |
download | armnn-109c05bc985d25f513444a7caa1e54557ef0f3c0.tar.gz |
IVGCVSW-4118 Change the SendCounterPacket send thread to use do while
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: I702fdc941e29ddcb31f54513e0a7dc642f0f4685
Diffstat (limited to 'src/profiling/test')
-rw-r--r-- | src/profiling/test/SendCounterPacketTests.cpp | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp index 740ea33c9a..b4564fec29 100644 --- a/src/profiling/test/SendCounterPacketTests.cpp +++ b/src/profiling/test/SendCounterPacketTests.cpp @@ -1793,8 +1793,6 @@ BOOST_AUTO_TEST_CASE(SendThreadTest0) sendCounterPacket.Start(mockProfilingConnection); BOOST_CHECK(sendCounterPacket.IsRunning()); - std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_UNTIL_READABLE_MS)); - sendCounterPacket.Stop(); BOOST_CHECK(!sendCounterPacket.IsRunning()); } @@ -1899,7 +1897,7 @@ BOOST_AUTO_TEST_CASE(SendThreadTest1) sendCounterPacket.SetReadyToRead(); - // To test an exact value of the "read size" in the mock buffer, wait two seconds to allow the send thread to + // To test an exact value of the "read size" in the mock buffer, wait to allow the send thread to // read all what's remaining in the buffer std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_UNTIL_READABLE_MS)); @@ -2022,7 +2020,7 @@ BOOST_AUTO_TEST_CASE(SendThreadTest2) sendCounterPacket.SetReadyToRead(); - // To test an exact value of the "read size" in the mock buffer, wait two seconds to allow the send thread to + // To test an exact value of the "read size" in the mock buffer, wait to allow the send thread to // read all what's remaining in the buffer std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_UNTIL_READABLE_MS)); @@ -2346,10 +2344,6 @@ BOOST_AUTO_TEST_CASE(SendThreadSendStreamMetadataPacket1) sendCounterPacket.Start(mockProfilingConnection); // The profiling state is set to "Uninitialized", so the send thread should throw an exception - - // Wait a bit to make sure that the send thread is properly started - std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_UNTIL_READABLE_MS)); - BOOST_CHECK_THROW(sendCounterPacket.Stop(), armnn::RuntimeException); } @@ -2364,10 +2358,6 @@ BOOST_AUTO_TEST_CASE(SendThreadSendStreamMetadataPacket2) sendCounterPacket.Start(mockProfilingConnection); // The profiling state is set to "NotConnected", so the send thread should throw an exception - - // Wait a bit to make sure that the send thread is properly started - std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_UNTIL_READABLE_MS)); - BOOST_CHECK_THROW(sendCounterPacket.Stop(), armnn::RuntimeException); } @@ -2387,10 +2377,7 @@ BOOST_AUTO_TEST_CASE(SendThreadSendStreamMetadataPacket3) sendCounterPacket.Start(mockProfilingConnection); // The profiling state is set to "WaitingForAck", so the send thread should send a Stream Metadata packet - - // Wait for a bit to make sure that we get the packet - std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_UNTIL_READABLE_MS)); - + // Wait for sendCounterPacket to join BOOST_CHECK_NO_THROW(sendCounterPacket.Stop()); // Check that the buffer contains one Stream Metadata packet @@ -2415,10 +2402,10 @@ BOOST_AUTO_TEST_CASE(SendThreadSendStreamMetadataPacket4) sendCounterPacket.Start(mockProfilingConnection); // The profiling state is set to "WaitingForAck", so the send thread should send a Stream Metadata packet + // Wait for sendCounterPacket to join + sendCounterPacket.Stop(); - // Wait for a bit to make sure that we get the packet - std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_UNTIL_READABLE_MS)); - + sendCounterPacket.Start(mockProfilingConnection); // Check that the profiling state is still "WaitingForAck" BOOST_TEST((profilingStateMachine.GetCurrentState() == ProfilingState::WaitingForAck)); @@ -2432,8 +2419,8 @@ BOOST_AUTO_TEST_CASE(SendThreadSendStreamMetadataPacket4) // Try triggering a new buffer read sendCounterPacket.SetReadyToRead(); - // Wait for a bit to make sure that we get the packet - std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_UNTIL_READABLE_MS)); + // Wait for sendCounterPacket to join + BOOST_CHECK_NO_THROW(sendCounterPacket.Stop()); // Check that the profiling state is still "WaitingForAck" BOOST_TEST((profilingStateMachine.GetCurrentState() == ProfilingState::WaitingForAck)); @@ -2441,8 +2428,6 @@ BOOST_AUTO_TEST_CASE(SendThreadSendStreamMetadataPacket4) // Check that the buffer contains one Stream Metadata packet BOOST_TEST(writtenData.size() == 1); BOOST_TEST(writtenData[0] == streamMetadataPacketsize); - - BOOST_CHECK_NO_THROW(sendCounterPacket.Stop()); } BOOST_AUTO_TEST_SUITE_END() |