aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Bentham <matthew.bentham@arm.com>2021-07-05 09:20:23 +0100
committerMatthew Bentham <matthew.bentham@arm.com>2021-07-05 09:27:20 +0100
commita369b890c018d0885c3b7cefed7b914bb4bc9f17 (patch)
treee39a42d1d76b007eeffd5b7080701fefaadc1279
parentf2f108254546136b476af5dcfe77fa8120adc5bc (diff)
downloadarmnn-a369b890c018d0885c3b7cefed7b914bb4bc9f17.tar.gz
Improve ThrowBackendUnavailableException test
Fail test if exception is not thrown. Remove unnecessary references to CpuAcc backend. Remove excess trace message. Signed-off-by: Matthew Bentham <matthew.bentham@arm.com> Change-Id: I22d30b47a092ac2e66f5987c656804cd31b04b21
-rw-r--r--src/backends/backendsCommon/test/BackendRegistryTests.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/backends/backendsCommon/test/BackendRegistryTests.cpp b/src/backends/backendsCommon/test/BackendRegistryTests.cpp
index d9c19d659c..ba407d2908 100644
--- a/src/backends/backendsCommon/test/BackendRegistryTests.cpp
+++ b/src/backends/backendsCommon/test/BackendRegistryTests.cpp
@@ -117,18 +117,14 @@ TEST_CASE("ThrowBackendUnavailableException")
const BackendId mockBackendId("MockDynamicBackend");
- const std::string exceptionMessage("Neon support not found on device, could not register CpuAcc Backend.\n");
+ const std::string exceptionMessage("Mock error message to test unavailable backend");
- // Register the mock backend with a factory function lambda equivalent to NeonRegisterInitializer
+ // Register the mock backend with a factory function lambda that always throws
BackendRegistryInstance().Register(mockBackendId,
[exceptionMessage]()
{
- if (false)
- {
- return IBackendInternalUniquePtr(new RefBackend);
- }
- ARMNN_LOG(info) << "Neon support not found on device, could not register CpuAcc Backend.";
throw armnn::BackendUnavailableException(exceptionMessage);
+ return IBackendInternalUniquePtr(); // Satisfy return type
});
// Get the factory function of the mock backend
@@ -138,12 +134,12 @@ TEST_CASE("ThrowBackendUnavailableException")
{
// Call the factory function as done during runtime backend registering
auto backend = factoryFunc();
+ FAIL("Expected exception to have been thrown");
}
catch (const BackendUnavailableException& e)
{
// Caught
CHECK_EQ(e.what(), exceptionMessage);
- MESSAGE("ThrowBackendUnavailableExceptionImpl: BackendUnavailableException caught.");
}
}