aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAron Virginas-Tar <Aron.Virginas-Tar@arm.com>2019-11-07 18:41:40 +0000
committerÁron Virginás-Tar <aron.virginas-tar@arm.com>2019-11-07 18:44:35 +0000
commit8bf442e9d121323d48525ab80c45fa816ba0c82c (patch)
tree89e499834c82b399e3aaad336a721d9620f09e56
parentc4946c7addd65f032951dbf16fb824cdd67fd463 (diff)
downloadarmnn-8bf442e9d121323d48525ab80c45fa816ba0c82c.tar.gz
IVGCVSW-4107 Fix bug in ProfilingConnectionDumpToFileDecoratorTests
* Replace predefined file name with randomly generated file name to avoid reading back old dumps Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> Change-Id: Ia48a9cda4527c585453383a5d758e1831c38604a
-rw-r--r--src/profiling/test/FileOnlyProfilingDecoratorTests.cpp9
-rw-r--r--src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp20
2 files changed, 10 insertions, 19 deletions
diff --git a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
index 7f927bdeee..9bf177c096 100644
--- a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
+++ b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
@@ -4,6 +4,8 @@
//
#include "../FileOnlyProfilingConnection.hpp"
+
+#include <ProfilingService.hpp>
#include <Runtime.hpp>
#include <boost/core/ignore_unused.hpp>
@@ -11,18 +13,11 @@
#include <boost/numeric/conversion/cast.hpp>
#include <boost/test/unit_test.hpp>
-#include <ProfilingService.hpp>
#include <cstdio>
#include <fstream>
#include <sstream>
#include <sys/stat.h>
-#if defined(__ANDROID__)
-#define ARMNN_PROFILING_CONNECTION_TEST_DUMP_DIR "/data/local/tmp"
-#else
-#define ARMNN_PROFILING_CONNECTION_TEST_DUMP_DIR "/tmp"
-#endif
-
using namespace armnn::profiling;
using namespace armnn;
diff --git a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
index ec4e591836..c393ec9b07 100644
--- a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
+++ b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
@@ -10,15 +10,10 @@
#include <sstream>
#include <boost/core/ignore_unused.hpp>
+#include <boost/filesystem.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/test/unit_test.hpp>
-#if defined(__ANDROID__)
-#define ARMNN_PROFILING_CONNECTION_TEST_DUMP_DIR "/data/local/tmp"
-#else
-#define ARMNN_PROFILING_CONNECTION_TEST_DUMP_DIR "/tmp"
-#endif
-
using namespace armnn::profiling;
namespace
@@ -101,10 +96,11 @@ BOOST_AUTO_TEST_CASE(DumpIncomingInvalidFileIgnoreErrors)
BOOST_AUTO_TEST_CASE(DumpIncomingValidFile)
{
- std::stringstream fileName;
- fileName << ARMNN_PROFILING_CONNECTION_TEST_DUMP_DIR << "/test_dump_file_incoming.dat";
+ boost::filesystem::path fileName =
+ boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
+
armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
- options.m_IncomingCaptureFile = fileName.str();
+ options.m_IncomingCaptureFile = fileName.c_str();
options.m_OutgoingCaptureFile = "";
ProfilingConnectionDumpToFileDecorator decorator(std::make_unique<DummyProfilingConnection>(), options, false);
@@ -148,12 +144,12 @@ BOOST_AUTO_TEST_CASE(DumpOutgoingInvalidFileIgnoreErrors)
BOOST_AUTO_TEST_CASE(DumpOutgoingValidFile)
{
- std::stringstream fileName;
- fileName << ARMNN_PROFILING_CONNECTION_TEST_DUMP_DIR << "/test_dump_file.dat";
+ boost::filesystem::path fileName =
+ boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
options.m_IncomingCaptureFile = "";
- options.m_OutgoingCaptureFile = fileName.str();
+ options.m_OutgoingCaptureFile = fileName.c_str();
ProfilingConnectionDumpToFileDecorator decorator(std::make_unique<DummyProfilingConnection>(), options, false);