aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference
diff options
context:
space:
mode:
authorAron Virginas-Tar <Aron.Virginas-Tar@arm.com>2018-10-22 13:32:01 +0100
committerMatthew Bentham <matthew.bentham@arm.com>2018-10-22 16:57:54 +0100
commitc26ba759fe67bd14829a84b5abac80f51ca61946 (patch)
tree0f5696428a899d7734b4264cec6395a8b1fce126 /src/backends/reference
parent5610661023a4170e677027570db18a379842dac3 (diff)
downloadarmnn-c26ba759fe67bd14829a84b5abac80f51ca61946.tar.gz
IVGCVSW-2060: Separate and move backend specific unit tests from the src/armnn/test folder to the backends
* Moved backend-specific memory leak checking tests from RuntimeTests.cpp to the corresponding backend test folder Change-Id: I0a7f4ef52c5350c3cebca23b2b4e61a9446ca11f
Diffstat (limited to 'src/backends/reference')
-rw-r--r--src/backends/reference/backend.mk3
-rw-r--r--src/backends/reference/test/CMakeLists.txt1
-rw-r--r--src/backends/reference/test/RefRuntimeTests.cpp46
3 files changed, 49 insertions, 1 deletions
diff --git a/src/backends/reference/backend.mk b/src/backends/reference/backend.mk
index 9ecb6d75b2..455ab4618e 100644
--- a/src/backends/reference/backend.mk
+++ b/src/backends/reference/backend.mk
@@ -66,4 +66,5 @@ BACKEND_SOURCES := \
BACKEND_TEST_SOURCES := \
test/RefCreateWorkloadTests.cpp \
test/RefLayerSupportTests.cpp \
- test/RefLayerTests.cpp
+ test/RefLayerTests.cpp \
+ test/RefRuntimeTests.cpp
diff --git a/src/backends/reference/test/CMakeLists.txt b/src/backends/reference/test/CMakeLists.txt
index deee364a9a..dea0ef6498 100644
--- a/src/backends/reference/test/CMakeLists.txt
+++ b/src/backends/reference/test/CMakeLists.txt
@@ -7,6 +7,7 @@ list(APPEND armnnRefBackendUnitTests_sources
RefCreateWorkloadTests.cpp
RefLayerSupportTests.cpp
RefLayerTests.cpp
+ RefRuntimeTests.cpp
)
add_library(armnnRefBackendUnitTests OBJECT ${armnnRefBackendUnitTests_sources})
diff --git a/src/backends/reference/test/RefRuntimeTests.cpp b/src/backends/reference/test/RefRuntimeTests.cpp
new file mode 100644
index 0000000000..2536627ea6
--- /dev/null
+++ b/src/backends/reference/test/RefRuntimeTests.cpp
@@ -0,0 +1,46 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include <armnn/test/RuntimeTests.hpp>
+
+#include <armnnUtils/LeakChecking.hpp>
+
+#include <backends/test/RuntimeTestImpl.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_SUITE(RefRuntime)
+
+#ifdef ARMNN_LEAK_CHECKING_ENABLED
+BOOST_AUTO_TEST_CASE(RuntimeMemoryLeaksCpuRef)
+{
+ BOOST_TEST(ARMNN_LEAK_CHECKER_IS_ACTIVE());
+
+ armnn::IRuntime::CreationOptions options;
+ armnn::Runtime runtime(options);
+ armnn::RuntimeLoadedNetworksReserve(&runtime);
+
+ std::vector<armnn::BackendId> backends = {armnn::Compute::CpuRef};
+ {
+ // Do a warmup of this so we make sure that all one-time
+ // initialization happens before we do the leak checking.
+ CreateAndDropDummyNetwork(backends, runtime);
+ }
+
+ {
+ ARMNN_SCOPED_LEAK_CHECKER("LoadAndUnloadNetworkCpuRef");
+ BOOST_TEST(ARMNN_NO_LEAKS_IN_SCOPE());
+ // In the second run we check for all remaining memory
+ // in use after the network was unloaded. If there is any
+ // then it will be treated as a memory leak.
+ CreateAndDropDummyNetwork(backends, runtime);
+ BOOST_TEST(ARMNN_NO_LEAKS_IN_SCOPE());
+ BOOST_TEST(ARMNN_BYTES_LEAKED_IN_SCOPE() == 0);
+ BOOST_TEST(ARMNN_OBJECTS_LEAKED_IN_SCOPE() == 0);
+ }
+}
+#endif
+
+BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file