aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/test
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-10-10 13:29:02 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-10 18:22:41 +0100
commit67ef2a52c3cdcc37538d77711bbcea2f0e5655e5 (patch)
tree8d25bcb2c10cba8945ae4638695d879e88b9d259 /src/profiling/test
parent8efc500a7465c03877db8bbe443134f2b1bbc1af (diff)
downloadarmnn-67ef2a52c3cdcc37538d77711bbcea2f0e5655e5.tar.gz
IVGCVSW-3964 Change the type held by the Packet class to unsigned char
* Updated the Packet class * Updated the pertinent code accordingly Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com> Change-Id: I73eab5b1ead67a610cd17fd33f8a74f764ad8cc4
Diffstat (limited to 'src/profiling/test')
-rw-r--r--src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp8
-rw-r--r--src/profiling/test/ProfilingTests.cpp26
-rw-r--r--src/profiling/test/ProfilingTests.hpp6
3 files changed, 19 insertions, 21 deletions
diff --git a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
index fac93c5ddf..a7acdd63cc 100644
--- a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
+++ b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
@@ -32,7 +32,7 @@ class DummyProfilingConnection : public IProfilingConnection
public:
DummyProfilingConnection()
: m_Open(true)
- , m_PacketData(std::make_unique<char[]>(g_DataLength))
+ , m_PacketData(std::make_unique<unsigned char[]>(g_DataLength))
{
// populate packet data and construct packet
std::memcpy(m_PacketData.get(), g_DataPtr, g_DataLength);
@@ -65,8 +65,8 @@ public:
}
private:
- bool m_Open;
- std::unique_ptr<char[]> m_PacketData;
+ bool m_Open;
+ std::unique_ptr<unsigned char[]> m_PacketData;
std::unique_ptr<Packet> m_Packet;
};
@@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(DumpIncomingValidFile)
decorator.Close();
std::vector<char> data = ReadDumpFile(settings.m_IncomingDumpFileName);
- const char* packetData = packet->GetData();
+ const char* packetData = reinterpret_cast<const char*>(packet->GetData());
// check if the data read back from the dump file matches the original
constexpr unsigned int bytesToSkip = 2u * sizeof(uint32_t); // skip header and packet length
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp
index 57a11d0503..27bacf7145 100644
--- a/src/profiling/test/ProfilingTests.cpp
+++ b/src/profiling/test/ProfilingTests.cpp
@@ -198,9 +198,9 @@ BOOST_AUTO_TEST_CASE(CheckEncodeVersion)
BOOST_AUTO_TEST_CASE(CheckPacketClass)
{
uint32_t length = 4;
- std::unique_ptr<char[]> packetData0 = std::make_unique<char[]>(length);
- std::unique_ptr<char[]> packetData1 = std::make_unique<char[]>(0);
- std::unique_ptr<char[]> nullPacketData;
+ std::unique_ptr<unsigned char[]> packetData0 = std::make_unique<unsigned char[]>(length);
+ std::unique_ptr<unsigned char[]> packetData1 = std::make_unique<unsigned char[]>(0);
+ std::unique_ptr<unsigned char[]> nullPacketData;
Packet packetTest0(472580096, length, packetData0);
@@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE(CheckPacketClass)
BOOST_CHECK(packetTest3.GetLength() == 0);
BOOST_CHECK(packetTest3.GetData() == nullptr);
- const char* packetTest0Data = packetTest0.GetData();
+ const unsigned char* packetTest0Data = packetTest0.GetData();
Packet packetTest4(std::move(packetTest0));
BOOST_CHECK(packetTest0.GetData() == nullptr);
@@ -260,9 +260,9 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandlerFunctor)
it++;
BOOST_CHECK(it->first==keyC);
- std::unique_ptr<char[]> packetDataA;
- std::unique_ptr<char[]> packetDataB;
- std::unique_ptr<char[]> packetDataC;
+ std::unique_ptr<unsigned char[]> packetDataA;
+ std::unique_ptr<unsigned char[]> packetDataB;
+ std::unique_ptr<unsigned char[]> packetDataC;
Packet packetA(500000000, 0, packetDataA);
Packet packetB(600000000, 0, packetDataB);
@@ -302,9 +302,9 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandlerRegistry)
registry.RegisterFunctor(&testFunctorB);
registry.RegisterFunctor(&testFunctorC);
- std::unique_ptr<char[]> packetDataA;
- std::unique_ptr<char[]> packetDataB;
- std::unique_ptr<char[]> packetDataC;
+ std::unique_ptr<unsigned char[]> packetDataA;
+ std::unique_ptr<unsigned char[]> packetDataB;
+ std::unique_ptr<unsigned char[]> packetDataC;
Packet packetA(500000000, 0, packetDataA);
Packet packetB(600000000, 0, packetDataB);
@@ -1707,7 +1707,7 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData)
uint32_t dataLength1 = 8;
uint32_t offset = 0;
- std::unique_ptr<char[]> uniqueData1 = std::make_unique<char[]>(dataLength1);
+ std::unique_ptr<unsigned char[]> uniqueData1 = std::make_unique<unsigned char[]>(dataLength1);
unsigned char* data1 = reinterpret_cast<unsigned char*>(uniqueData1.get());
WriteUint32(data1, offset, period1);
@@ -1758,7 +1758,7 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData)
uint32_t period2 = 11;
uint32_t dataLength2 = 4;
- std::unique_ptr<char[]> uniqueData2 = std::make_unique<char[]>(dataLength2);
+ std::unique_ptr<unsigned char[]> uniqueData2 = std::make_unique<unsigned char[]>(dataLength2);
WriteUint32(reinterpret_cast<unsigned char*>(uniqueData2.get()), 0, period2);
@@ -1802,7 +1802,7 @@ BOOST_AUTO_TEST_CASE(CheckConnectionAcknowledged)
uint32_t dataLength1 = 8;
uint32_t offset = 0;
- std::unique_ptr<char[]> uniqueData1 = std::make_unique<char[]>(dataLength1);
+ std::unique_ptr<unsigned char[]> uniqueData1 = std::make_unique<unsigned char[]>(dataLength1);
unsigned char* data1 = reinterpret_cast<unsigned char*>(uniqueData1.get());
WriteUint32(data1, offset, period1);
diff --git a/src/profiling/test/ProfilingTests.hpp b/src/profiling/test/ProfilingTests.hpp
index e1686162db..4d2f974344 100644
--- a/src/profiling/test/ProfilingTests.hpp
+++ b/src/profiling/test/ProfilingTests.hpp
@@ -71,8 +71,7 @@ public:
std::this_thread::sleep_for(std::chrono::milliseconds(timeout));
// Return connection acknowledged packet
- std::unique_ptr<char[]> packetData;
- return Packet(65536, 0, packetData);
+ return Packet(65536);
}
};
@@ -94,8 +93,7 @@ public:
}
// Return connection acknowledged packet after three timeouts
- std::unique_ptr<char[]> packetData;
- return Packet(65536, 0, packetData);
+ return Packet(65536);
}
private: