From a97a0be5f16cb876d7226b733ac6aaa3b79dabd3 Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Tue, 3 Mar 2020 10:44:56 +0000 Subject: 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 Change-Id: Ideb85b00771864e332226635aeff3096fbea8e5f --- src/profiling/test/ProfilingTests.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/profiling/test') 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 #include #include +#include #include #include #include @@ -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) -- cgit v1.2.1