From bdee4267583a7daaf9ea5284d2ff6d4bbb782229 Mon Sep 17 00:00:00 2001 From: Rob Hughes Date: Tue, 7 Jan 2020 17:05:24 +0000 Subject: Add thin abstraction layer for processes and filesystem This is used instead of some hardcoded Unix calls and means this code now works on Windows (This is a rework of a previous patch which used boost, now that I have been informed that we are trying to move towards removing boost). Change-Id: Ib0d11055279bbd7b710f086e9890369e3ecbfe9a Signed-off-by: Robert Hughes --- src/profiling/test/FileOnlyProfilingDecoratorTests.cpp | 7 +++---- src/profiling/test/SendCounterPacketTests.cpp | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/profiling/test') diff --git a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp index 26634704ae..4112dbac03 100644 --- a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp +++ b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -94,12 +95,10 @@ BOOST_AUTO_TEST_CASE(DumpOutgoingValidFileEndToEnd) profilingService.ResetExternalProfilingOptions(options, true); // The output file size should be greater than 0. - struct stat statusBuffer; - BOOST_CHECK(stat(tempPath.c_str(), &statusBuffer) == 0); - BOOST_CHECK(statusBuffer.st_size > 0); + BOOST_CHECK(armnnUtils::Filesystem::GetFileSize(tempPath.string().c_str()) > 0); // Delete the tmp file. - BOOST_CHECK(remove(tempPath.c_str()) == 0); + BOOST_CHECK(armnnUtils::Filesystem::Remove(tempPath.string().c_str())); } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp index 19423165a9..83bffe4686 100644 --- a/src/profiling/test/SendCounterPacketTests.cpp +++ b/src/profiling/test/SendCounterPacketTests.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -335,7 +336,8 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest) offset += sizeUint32; BOOST_TEST(ReadUint32(readBuffer2, offset) == MAX_METADATA_PACKET_LENGTH); // max_data_len offset += sizeUint32; - BOOST_TEST(ReadUint32(readBuffer2, offset) == numeric_cast(getpid())); // pid + int pid = armnnUtils::Processes::GetCurrentId(); + BOOST_TEST(ReadUint32(readBuffer2, offset) == numeric_cast(pid)); offset += sizeUint32; uint32_t poolOffset = 10 * sizeUint32; BOOST_TEST(ReadUint32(readBuffer2, offset) == (infoSize ? poolOffset : 0)); // offset_info -- cgit v1.2.1