aboutsummaryrefslogtreecommitdiff
path: root/tests/profiling/gatordmock/tests
diff options
context:
space:
mode:
authorColm Donelan <Colm.Donelan@arm.com>2019-10-16 12:24:20 +0100
committerColm Donelan <colm.donelan@arm.com>2019-10-17 15:59:55 +0000
commitb682d840bb0b4cc34f4febb69c2385feec880ae1 (patch)
tree155457d5c382deec0b45fd85a0609a4c3322613e /tests/profiling/gatordmock/tests
parent5ae78299f117a61c48a67c5381341501571a0b03 (diff)
downloadarmnn-b682d840bb0b4cc34f4febb69c2385feec880ae1.tar.gz
IVGCVSW-3721 Add support for startup sequence (Mock Gatord service).
* Updated ExecuteNetwork to propagate a configured Runtime down to RunTest. * Fixed the creation of PeriodicCounterCaptureCommandHandler to match other handlers. * Moved around some printouts to make the MockGatorD output more useful. * Added details to the exception handling for problems in the GatordMockService receive thread. * Mockutils::ConstructHeader is only used in GatordMockTests. Moved it in there and deleted MockUtils.hpp * Refactored SendPeriodicCounterSelectionList to use ProfilingUtils. * Added PeriodicCounterSelectionResponseHandler to received packet echoed back. Signed-off-by: Colm Donelan <Colm.Donelan@arm.com> Change-Id: I4accdbf6cf5dd3f7dcc12b210b8360b4a5e4e277
Diffstat (limited to 'tests/profiling/gatordmock/tests')
-rw-r--r--tests/profiling/gatordmock/tests/GatordMockTests.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
index a6297e94b8..3f58f39124 100644
--- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp
+++ b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
@@ -4,7 +4,6 @@
//
#include "../GatordMockService.hpp"
-#include "../MockUtils.hpp"
#include "../PeriodicCounterCaptureCommandHandler.hpp"
#include <CommandHandlerRegistry.hpp>
@@ -25,12 +24,22 @@ using namespace std::chrono_literals;
// Required so build succeeds when local variable used only in assert
#define _unused(x) ((void)(x))
+uint32_t ConstructHeader(uint32_t packetFamily, uint32_t packetClass, uint32_t packetType)
+{
+ return ((packetFamily & 0x3F) << 26) | ((packetClass & 0x3FF) << 19) | ((packetType & 0x3FFF) << 16);
+}
+
+uint32_t ConstructHeader(uint32_t packetFamily, uint32_t packetId)
+{
+ return ((packetFamily & 0x3F) << 26) | ((packetId & 0x3FF) << 16);
+}
+
BOOST_AUTO_TEST_CASE(CounterCaptureHandlingTest)
{
using boost::numeric_cast;
// Initialise functors and register into the CommandHandlerRegistry
- uint32_t headerWord1 = gatordmock::ConstructHeader(1, 0, 0);
+ uint32_t headerWord1 = ConstructHeader(1, 0, 0);
// Create the Command Handler Registry
profiling::CommandHandlerRegistry registry;
@@ -56,10 +65,10 @@ BOOST_AUTO_TEST_CASE(CounterCaptureHandlingTest)
// UniqueData required for Packet class
std::unique_ptr<unsigned char[]> uniqueData1 = std::make_unique<unsigned char[]>(dataLength);
- unsigned char* data1 = reinterpret_cast<unsigned char*>(uniqueData1.get());
+ unsigned char* data1 = reinterpret_cast<unsigned char*>(uniqueData1.get());
std::unique_ptr<unsigned char[]> uniqueData2 = std::make_unique<unsigned char[]>(dataLength);
- unsigned char* data2 = reinterpret_cast<unsigned char*>(uniqueData2.get());
+ unsigned char* data2 = reinterpret_cast<unsigned char*>(uniqueData2.get());
uint32_t sizeOfUint64 = numeric_cast<uint32_t>(sizeof(uint64_t));
uint32_t sizeOfUint32 = numeric_cast<uint32_t>(sizeof(uint32_t));
@@ -94,7 +103,7 @@ BOOST_AUTO_TEST_CASE(CounterCaptureHandlingTest)
profiling::Packet packet2(headerWord1, dataLength, uniqueData2);
uint32_t version = 1;
- gatordmock::PeriodicCounterCaptureCommandHandler commandHandler(headerWord1, version, false);
+ gatordmock::PeriodicCounterCaptureCommandHandler commandHandler(headerWord1, version, true);
// Simulate two separate packets coming in to calculate period
commandHandler(packet1);
@@ -114,14 +123,14 @@ BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd)
// performance data.
// Initialise functors and register into the CommandHandlerRegistry
- uint32_t counterCaptureHeader = gatordmock::ConstructHeader(1, 0);
+ uint32_t counterCaptureHeader = ConstructHeader(1, 0);
uint32_t version = 1;
// Create the Command Handler Registry
profiling::CommandHandlerRegistry registry;
// Update with derived functors
- gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(counterCaptureHeader, version, false);
+ gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(counterCaptureHeader, version, true);
// Register different derived functors
registry.RegisterFunctor(&counterCaptureCommandHandler);