aboutsummaryrefslogtreecommitdiff
path: root/tests/profiling/GatordMockService.hpp
diff options
context:
space:
mode:
authorColm Donelan <Colm.Donelan@arm.com>2019-09-09 11:59:08 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-09-09 16:24:39 +0000
commita85e215dd1b027c5ef88621d1b4d5f6e078605da (patch)
tree2c5b1046788ad231daaecdedad08519ee8ae1a39 /tests/profiling/GatordMockService.hpp
parent8fccd86b95be418d1b0397bfd5f48a319f210180 (diff)
downloadarmnn-a85e215dd1b027c5ef88621d1b4d5f6e078605da.tar.gz
IVGCVSW-3720 Start a UDS server that accepts connections.
* Add a CLI paramter to the Gatord mock client to specify a namespace. * Open a listening socket on that namespace. * Wait for one connection on the socket. Signed-off-by: Colm Donelan <Colm.Donelan@arm.com> Change-Id: Ic85b4defd5ad2010bb255472c030a91a23cec1d9
Diffstat (limited to 'tests/profiling/GatordMockService.hpp')
-rw-r--r--tests/profiling/GatordMockService.hpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/profiling/GatordMockService.hpp b/tests/profiling/GatordMockService.hpp
new file mode 100644
index 0000000000..c19e710d69
--- /dev/null
+++ b/tests/profiling/GatordMockService.hpp
@@ -0,0 +1,50 @@
+//
+// Copyright © 2019 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <string>
+
+namespace armnn
+{
+
+namespace gatordmock
+{
+
+
+/**
+ * A class that implements a Mock Gatord server. It will listen on a specified Unix domain socket (UDS)
+ * namespace for client connections.
+ */
+class GatordMockService
+{
+public:
+
+ /**
+ * Establish the Unix domain socket and set it to listen for connections.
+ *
+ * @param udsNamespace the namespace (socket address) associated with the listener.
+ * @return true only if the socket has been correctly setup.
+ */
+ bool OpenListeningSocket(std::string udsNamespace);
+
+ /**
+ * Block waiting to accept one client to connect to the UDS.
+ *
+ * @return the file descriptor of the client connection.
+ */
+ int BlockForOneClient();
+
+private:
+
+ int m_ListeningSocket;
+};
+
+
+} // namespace gatordmock
+
+} // namespace armnn
+
+