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
diff --git a/src/backends/backendsCommon/test/BackendRegistryTests.cpp b/src/backends/backendsCommon/test/BackendRegistryTests.cpp
index d9c19d6..ba407d2 100644
--- a/src/backends/backendsCommon/test/BackendRegistryTests.cpp
+++ b/src/backends/backendsCommon/test/BackendRegistryTests.cpp
@@ -117,18 +117,14 @@
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 @@
{
// 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.");
}
}