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
diff --git a/src/backends/neon/test/CMakeLists.txt b/src/backends/neon/test/CMakeLists.txt
index 384a5e1..e6a2859 100644
--- a/src/backends/neon/test/CMakeLists.txt
+++ b/src/backends/neon/test/CMakeLists.txt
@@ -8,6 +8,7 @@
     NeonLayerSupportTests.cpp
     NeonLayerTests.cpp
     NeonMemCopyTests.cpp
+    NeonRuntimeTests.cpp
     NeonTimerTest.cpp
 )
 
diff --git a/src/backends/neon/test/NeonRuntimeTests.cpp b/src/backends/neon/test/NeonRuntimeTests.cpp
new file mode 100644
index 0000000..6e6b1e9
--- /dev/null
+++ b/src/backends/neon/test/NeonRuntimeTests.cpp
@@ -0,0 +1,68 @@
+//
+// 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(NeonRuntime)
+
+BOOST_AUTO_TEST_CASE(RuntimeValidateCpuAccDeviceSupportLayerNoFallback)
+{
+    // build up the structure of the network
+    armnn::INetworkPtr net(armnn::INetwork::Create());
+
+    armnn::IConnectableLayer* input = net->AddInputLayer(0);
+    armnn::IConnectableLayer* output = net->AddOutputLayer(0);
+
+    input->GetOutputSlot(0).Connect(output->GetInputSlot(0));
+    input->GetOutputSlot(0).SetTensorInfo(armnn::TensorInfo({ 1, 1, 4, 4 }, armnn::DataType::Float32));
+
+    armnn::IRuntime::CreationOptions options;
+    armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
+
+    std::vector<armnn::BackendId> backends = { armnn::Compute::CpuAcc };
+    armnn::IOptimizedNetworkPtr optNet = armnn::Optimize(*net, backends, runtime->GetDeviceSpec());
+    BOOST_CHECK(optNet);
+
+    // Load it into the runtime. It should success.
+    armnn::NetworkId netId;
+    BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == armnn::Status::Success);
+}
+
+#ifdef ARMNN_LEAK_CHECKING_ENABLED
+BOOST_AUTO_TEST_CASE(RuntimeMemoryLeaksCpuAcc)
+{
+    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::CpuAcc};
+    {
+        // 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("LoadAndUnloadNetworkCpuAcc");
+        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