aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2018-11-15 10:54:54 +0000
committerAron Virginas-Tar <aron.virginas-tar@arm.com>2018-11-15 12:52:36 +0000
commit9326aabf60f6ea4e62fe5913a20da887805c334b (patch)
tree2375d381922de6eb99e6ba3785ba4b430b03d960
parent430b5d824a17ddfb31bb29c18407e45e0def958c (diff)
downloadarmnn-9326aabf60f6ea4e62fe5913a20da887805c334b.tar.gz
Adedd load/unload warm-up before the memory lek test to put the runtime into a
stable test (memory-wise) This prevents false-positives when running the tests on Master Change-Id: I4348378f3689cb3ec98686a93315d2b88bb7bcc7
-rw-r--r--src/armnn/test/RuntimeTests.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/armnn/test/RuntimeTests.cpp b/src/armnn/test/RuntimeTests.cpp
index 08e3190414..998808c508 100644
--- a/src/armnn/test/RuntimeTests.cpp
+++ b/src/armnn/test/RuntimeTests.cpp
@@ -126,27 +126,27 @@ BOOST_AUTO_TEST_CASE(RuntimeMemoryLeak)
armnn::Runtime runtime(options);
armnn::RuntimeLoadedNetworksReserve(&runtime);
- // Checks for leaks before we load the network and record them so that we can see the delta after unloading.
- VALGRIND_DO_QUICK_LEAK_CHECK;
- VALGRIND_COUNT_LEAKS(leakedBefore, dubious, reachableBefore, suppressed);
-
- // Builds a mock-network and load it into the runtime.
{
- unsigned int inputShape[] = {1, 7, 1, 1};
- armnn::TensorInfo inputTensorInfo(4, inputShape, armnn::DataType::Float32);
+ std::vector<armnn::BackendId> backends = {armnn::Compute::CpuRef};
std::unique_ptr<armnn::Network> mockNetwork1 = std::make_unique<armnn::Network>();
mockNetwork1->AddInputLayer(0, "test layer");
-
- std::vector<armnn::BackendId> backends = {armnn::Compute::CpuRef};
+ // Warm-up load/unload pair to put the runtime in a stable state (memory-wise).
runtime.LoadNetwork(networkIdentifier1, Optimize(*mockNetwork1, backends, runtime.GetDeviceSpec()));
- }
+ runtime.UnloadNetwork(networkIdentifier1);
+
+ // Checks for leaks before we load the network and record them so that we can see the delta after unloading.
+ VALGRIND_DO_QUICK_LEAK_CHECK;
+ VALGRIND_COUNT_LEAKS(leakedBefore, dubious, reachableBefore, suppressed);
- runtime.UnloadNetwork(networkIdentifier1);
+ // The actual test.
+ runtime.LoadNetwork(networkIdentifier1, Optimize(*mockNetwork1, backends, runtime.GetDeviceSpec()));
+ runtime.UnloadNetwork(networkIdentifier1);
- VALGRIND_DO_ADDED_LEAK_CHECK;
- VALGRIND_COUNT_LEAKS(leakedAfter, dubious, reachableAfter, suppressed);
+ VALGRIND_DO_ADDED_LEAK_CHECK;
+ VALGRIND_COUNT_LEAKS(leakedAfter, dubious, reachableAfter, suppressed);
+ }
// If we're not running under Valgrind, these vars will have been initialised to 0, so this will always pass.
BOOST_TEST(leakedBefore == leakedAfter);