Report errors when running LoadedNetwork in End to End tests


Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com>
Change-Id: I8d65673580924907db51d903d9054d1b0914493c
diff --git a/src/backends/backendsCommon/test/EndToEndTestImpl.hpp b/src/backends/backendsCommon/test/EndToEndTestImpl.hpp
index 44ae2be..795fc13 100644
--- a/src/backends/backendsCommon/test/EndToEndTestImpl.hpp
+++ b/src/backends/backendsCommon/test/EndToEndTestImpl.hpp
@@ -1,5 +1,5 @@
 //
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
 // SPDX-License-Identifier: MIT
 //
 #pragma once
@@ -56,7 +56,9 @@
 
     // Loads it into the runtime.
     NetworkId netId;
-    runtime->LoadNetwork(netId, std::move(optNet));
+    std::string errorMessage;
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
 
     // Creates structures for input & output.
     std::vector<T> outputData(inputData.size());
@@ -141,7 +143,9 @@
 
     // Loads it into the runtime.
     NetworkId netId;
-    runtime->LoadNetwork(netId, std::move(optNet));
+    std::string errorMessage;
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
 
     InputTensors inputTensors;
     inputTensors.reserve(inputTensorData.size());
@@ -211,10 +215,11 @@
 
     // Loads it into the runtime.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     // Enable Importing
     INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Undefined);
-    runtime->LoadNetwork(netId, std::move(optNet), ignoredErrorMessage, networkProperties);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
 
     // Creates structures for input & output
     std::vector<float> inputData
@@ -279,10 +284,11 @@
 
     // Loads it into the runtime.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     // Enable Importing and Exporting
     INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Malloc);
-    runtime->LoadNetwork(netId, std::move(optNet), ignoredErrorMessage, networkProperties);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
 
     // Creates structures for input & output
     std::vector<float> inputData
@@ -353,10 +359,11 @@
 
     // Loads it into the runtime.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     // Enable Importing
     INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Malloc);
-    runtime->LoadNetwork(netId, std::move(optNet), ignoredErrorMessage, networkProperties);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
 
     // Creates structures for input & output
     std::vector<float> inputData
@@ -439,12 +446,10 @@
     INFO("Load Network");
     // Load it into the runtime. It should pass.
     NetworkId netId;
-    std::string ignoredErrorMessage;
-
+    std::string errorMessage;
     INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Undefined);
-
-    CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties)
-               == Status::Success);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
 
     INFO("Generate Data");
     // Creates structures for input & output
@@ -531,10 +536,10 @@
     INFO("Load Network");
     // Load it into the runtime. It should pass.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Malloc);
-    CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties)
-               == Status::Success);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
 
     INFO("Generate Data");
     // Creates structures for input & output
@@ -621,12 +626,10 @@
     INFO("Load Network");
     // Load it into the runtime. It should pass.
     NetworkId netId;
-    std::string ignoredErrorMessage;
-
+    std::string errorMessage;
     INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Malloc);
-
-    CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties)
-               == Status::Success);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
 
     INFO("Generate Data");
     // Creates structures for input & output
@@ -716,10 +719,11 @@
 
     // Loads it into the runtime.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     // Enable Importing
     INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Malloc);
-    runtime->LoadNetwork(netId, std::move(optNet), ignoredErrorMessage, networkProperties);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
 
     // Creates structures for input & output
     std::vector<float> inputData
@@ -852,10 +856,11 @@
 
     // Load it into the runtime. It should pass.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Undefined);
-    CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties)
-               == Status::Success);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
+
     INFO("Generate Data");
 
     // Creates structures for input & output
@@ -955,10 +960,11 @@
     INFO("Load Network");
     // Load it into the runtime. It should pass.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Undefined);
-    CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties)
-               == Status::Success);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
+
     INFO("Generate Data");
 
     // This code looks a little funky but the idea is to create a buffer of floats but offset by the size of a char
@@ -1077,10 +1083,11 @@
     INFO("Load Network");
     // Load it into the runtime. It should pass.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Undefined);
-    CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties)
-               == Status::Success);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
+
     INFO("Generate Data");
 
     // This code looks a little funky but the idea is to create a buffer of floats but offset by the size of a char
@@ -1198,10 +1205,10 @@
     INFO("Load Network");
     // Load it into the runtime. It should pass.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Undefined);
-    CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties)
-               == Status::Success);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
     INFO("Generate Data");
 
     // This code looks a little funky but the idea is to create a buffer of floats but offset by the size of a char
@@ -1316,10 +1323,10 @@
     INFO("Load Network");
     // Load it into the runtime. It should pass.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Undefined);
-    CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties)
-               == Status::Success);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
     INFO("Generate Data");
 
     // Creates structures for input & output
@@ -1502,10 +1509,10 @@
     INFO("Load Network");
     // Load it into the runtime. It should pass.
     NetworkId netId;
-    std::string ignoredErrorMessage;
+    std::string errorMessage;
     INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Undefined);
-    CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties)
-               == Status::Success);
+    armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties);
+    CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage);
     INFO("Generate Data");
 
     // This code looks a little funky but the idea is to create a buffer of floats but offset by the size of a char