From fa0d838fd7be90b6e1d53aa62da14ccc0cf0eacc Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Thu, 4 Jun 2020 12:30:16 +0100 Subject: IVGCVSW-4923 Fix SampleDynamicBackendTests. * Remove the check introduced by IVGCVSW-4915. * Check that SampleDynamic is loaded. If not output a detailed message. Signed-off-by: Colm Donelan Change-Id: Ib19b238418ea2d9c133e12bd540653ff0969ec5d --- .../backendsCommon/test/DynamicBackendTests.hpp | 36 ++++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src/backends/backendsCommon/test') diff --git a/src/backends/backendsCommon/test/DynamicBackendTests.hpp b/src/backends/backendsCommon/test/DynamicBackendTests.hpp index 16c2f0db7a..0c24ec6f44 100644 --- a/src/backends/backendsCommon/test/DynamicBackendTests.hpp +++ b/src/backends/backendsCommon/test/DynamicBackendTests.hpp @@ -1436,24 +1436,32 @@ void CreateReferenceDynamicBackendTestImpl() #endif #if defined(SAMPLE_DYNAMIC_BACKEND_ENABLED) -void CreateSampleDynamicBackendTestImpl() + +void CheckSampleDynamicBackendLoaded() { using namespace armnn; - // Using the path override in CreationOptions to load the reference dynamic backend - IRuntime::CreationOptions creationOptions; - // If m_DynamicBackendsPath is an empty string then we know this test will fail. - if(creationOptions.m_DynamicBackendsPath.empty()) + // At this point we expect DYNAMIC_BACKEND_PATHS to include a path to where libArm_SampleDynamic_backend.so is. + // If it hasn't been loaded there's no point continuing with the rest of the tests. + BackendIdSet backendIds = BackendRegistryInstance().GetBackendIds(); + if (backendIds.find("SampleDynamic") == backendIds.end()) { - BOOST_FAIL("No dynamic backends paths have been set. Ensure DYNAMIC_BACKEND_PATHS is set at compile time."); + std::string message = "The SampleDynamic backend has not been loaded. This may be a build configuration error. " + "Ensure a DYNAMIC_BACKEND_PATHS was set at compile time to the location of " + "libArm_SampleDynamic_backend.so. " + "To disable this test recompile with: -DSAMPLE_DYNAMIC_BACKEND_ENABLED=0"; + BOOST_FAIL(message); } +} +void CreateSampleDynamicBackendTestImpl() +{ + using namespace armnn; + // Using the path override in CreationOptions to load the reference dynamic backend + IRuntime::CreationOptions creationOptions; IRuntimePtr runtime = IRuntime::Create(creationOptions); const BackendRegistry& backendRegistry = BackendRegistryInstance(); BOOST_TEST(backendRegistry.Size() >= 1); - - BackendIdSet backendIds = backendRegistry.GetBackendIds(); - BOOST_TEST((backendIds.find("SampleDynamic") != backendIds.end())); - + CheckSampleDynamicBackendLoaded(); const DeviceSpec& deviceSpec = *PolymorphicDowncast(&runtime->GetDeviceSpec()); BackendIdSet supportedBackendIds = deviceSpec.GetSupportedBackends(); BOOST_TEST(supportedBackendIds.size()>= 1); @@ -1510,14 +1518,8 @@ void SampleDynamicBackendEndToEndTestImpl() using namespace boost::filesystem; // Create runtime in which test will run IRuntime::CreationOptions options; - // If m_DynamicBackendsPath is an empty string then we know this test will fail. - if(options.m_DynamicBackendsPath.empty()) - { - BOOST_FAIL("No dynamic backends paths have been set. Ensure DYNAMIC_BACKEND_PATHS is set at compile time."); - } - IRuntimePtr runtime(IRuntime::Create(options)); - + CheckSampleDynamicBackendLoaded(); // Builds up the structure of the network. INetworkPtr net(INetwork::Create()); -- cgit v1.2.1