From 5bb3d8a1edeab3f4fdbeb9baf7922cc52bd815fb Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Tue, 12 May 2020 16:36:46 +0100 Subject: IVGCVSW-4775 Centralizing definition of ThreadIdSize to fix MLCE-189 * Introduce a constant definition of the size of a POSIX thread ID. * Update all code to use the new constant definition. * Update all unit tests to use the new constant definition. Signed-off-by: Colm Donelan Change-Id: I836ab1a77ed13f774e66fd7b425923c24b9a6dab --- src/profiling/test/SendTimelinePacketTests.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/profiling/test/SendTimelinePacketTests.cpp') diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp index 4a13ebf824..6d5bf490a8 100644 --- a/src/profiling/test/SendTimelinePacketTests.cpp +++ b/src/profiling/test/SendTimelinePacketTests.cpp @@ -35,7 +35,6 @@ BOOST_AUTO_TEST_CASE(SendTimelineMessageDirectoryPackageTest) unsigned int uint8_t_size = sizeof(uint8_t); unsigned int uint32_t_size = sizeof(uint32_t); unsigned int uint64_t_size = sizeof(uint64_t); - unsigned int threadId_size = sizeof(std::thread::id); // Check the packet header unsigned int offset = 0; @@ -65,7 +64,7 @@ BOOST_AUTO_TEST_CASE(SendTimelineMessageDirectoryPackageTest) BOOST_CHECK(readPointerBytes == uint64_t_size); offset += uint8_t_size; uint8_t readThreadIdBytes = ReadUint8(packetBuffer, offset); - BOOST_CHECK(readThreadIdBytes == threadId_size); + BOOST_CHECK(readThreadIdBytes == ThreadIdSize); offset += uint8_t_size; uint32_t DeclCount = ReadUint32(packetBuffer, offset); @@ -211,7 +210,6 @@ BOOST_AUTO_TEST_CASE(SendEventClassAfterTimelineEntityPacketTest) { unsigned int uint32_t_size = sizeof(uint32_t); unsigned int uint64_t_size = sizeof(uint64_t); - unsigned int threadId_size = sizeof(std::thread::id); // Is platform dependent MockBufferManager bufferManager(512); TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); @@ -338,7 +336,7 @@ BOOST_AUTO_TEST_CASE(SendEventClassAfterTimelineEntityPacketTest) uint32_t eventBinaryPacketSequenceNumbered = (eventBinaryPacketHeaderWord1 >> 24) & 0x00000001; uint32_t eventBinaryPacketDataLength = (eventBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF; BOOST_CHECK(eventBinaryPacketSequenceNumbered == 0); - BOOST_CHECK(eventBinaryPacketDataLength == 20 + threadId_size); + BOOST_CHECK(eventBinaryPacketDataLength == 20 + ThreadIdSize); // Check the decl_id offset += uint32_t_size; @@ -352,12 +350,12 @@ BOOST_AUTO_TEST_CASE(SendEventClassAfterTimelineEntityPacketTest) // Check the thread id offset += uint64_t_size; - std::vector readThreadId(threadId_size, 0); - ReadBytes(packetBuffer, offset, threadId_size, readThreadId.data()); + std::vector readThreadId(ThreadIdSize, 0); + ReadBytes(packetBuffer, offset, ThreadIdSize, readThreadId.data()); BOOST_CHECK(readThreadId == threadId); // Check the profiling GUID - offset += threadId_size; + offset += ThreadIdSize; readProfilingGuid = ReadUint64(packetBuffer, offset); BOOST_CHECK(readProfilingGuid == eventProfilingGuid); } -- cgit v1.2.1