aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/test/ProfilingTests.cpp
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2020-03-03 10:44:56 +0000
committerJim Flynn <jim.flynn@arm.com>2020-03-04 13:14:40 +0000
commita97a0be5f16cb876d7226b733ac6aaa3b79dabd3 (patch)
treeebbaf35fcddb6f0c3c15abf1ee8dd484ac2bc7ec /src/profiling/test/ProfilingTests.cpp
parentc3bf6efb48a4540c8addcc02813c9381e4fceb1f (diff)
downloadarmnn-a97a0be5f16cb876d7226b733ac6aaa3b79dabd3.tar.gz
IVGCVSW-4163 Enhance the error handling in the ReadPacket function
* Introduced armnn::SocketConnectionException with fields error no and socket info. Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: Ideb85b00771864e332226635aeff3096fbea8e5f
Diffstat (limited to 'src/profiling/test/ProfilingTests.cpp')
-rw-r--r--src/profiling/test/ProfilingTests.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp
index 6c1e84b8d0..3dab93d9b8 100644
--- a/src/profiling/test/ProfilingTests.cpp
+++ b/src/profiling/test/ProfilingTests.cpp
@@ -9,6 +9,7 @@
#include <CommandHandler.hpp>
#include <CommandHandlerKey.hpp>
#include <CommandHandlerRegistry.hpp>
+#include <common/include/SocketConnectionException.hpp>
#include <ConnectionAcknowledgedCommandHandler.hpp>
#include <CounterDirectory.hpp>
#include <CounterIdMap.hpp>
@@ -1888,10 +1889,25 @@ BOOST_AUTO_TEST_CASE(CheckConnectionAcknowledged)
BOOST_CHECK_THROW(differentCommandHandler(packetB), armnn::Exception);
}
-BOOST_AUTO_TEST_CASE(CheckSocketProfilingConnection)
+BOOST_AUTO_TEST_CASE(CheckSocketConnectionException)
{
- // Check that creating a SocketProfilingConnection results in an exception as the Gator UDS doesn't exist.
- BOOST_CHECK_THROW(new SocketProfilingConnection(), armnn::Exception);
+ // Check that creating a SocketProfilingConnection armnnProfiling in an exception as the Gator UDS doesn't exist.
+ BOOST_CHECK_THROW(new SocketProfilingConnection(), armnnProfiling::SocketConnectionException);
+}
+
+BOOST_AUTO_TEST_CASE(CheckSocketConnectionException2)
+{
+ try
+ {
+ new SocketProfilingConnection();
+ }
+ catch (armnnProfiling::SocketConnectionException& ex)
+ {
+ BOOST_CHECK(ex.GetSocketFd() == 0);
+ BOOST_CHECK(ex.GetErrorNo() == 111);
+ BOOST_CHECK(ex.what()
+ == std::string("SocketProfilingConnection: Cannot connect to stream socket: Connection refused"));
+ }
}
BOOST_AUTO_TEST_CASE(SwTraceIsValidCharTest)