IVGCVSW-3595 Implement the LoadDynamicBackends function in the Runtime class

 * Changed the way the handle is acquired, loaded symbols are now kept local
 * Updated the makefiles to add more test files for the dynamic backends
 * Fixed the GetSharedObjects method so that the files are parsed in
   alphabetical order
 * Updated the unit tests to make them more strict wrt the order of the
   files
 * Created a new CreateDynamicBackends method in the utils class
 * Added new unit tests for the new function
 * Added LoadDynamicBackends in the Runtime class

!android-nn-driver:1707

Change-Id: I1ef9ff3d5455ca6a7fd51cb7cfb3819686234f70
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
diff --git a/src/backends/backendsCommon/test/TestDynamicBackend.cpp b/src/backends/backendsCommon/test/TestDynamicBackend.cpp
index 7fd996f..bdbc174 100644
--- a/src/backends/backendsCommon/test/TestDynamicBackend.cpp
+++ b/src/backends/backendsCommon/test/TestDynamicBackend.cpp
@@ -9,10 +9,25 @@
 
 constexpr const char* TestDynamicBackendId()
 {
-#if defined(VALID_TEST_DYNAMIC_BACKEND)
+#if defined(VALID_TEST_DYNAMIC_BACKEND_1)
 
     return "ValidTestDynamicBackend";
 
+#elif defined(VALID_TEST_DYNAMIC_BACKEND_2) || \
+      defined(VALID_TEST_DYNAMIC_BACKEND_4) || \
+      defined(INVALID_TEST_DYNAMIC_BACKEND_9)
+
+    // This backend id is shared among different test dynamic backends for testing purposes:
+    // the test dynamic backend 4 is actually a duplicate of the test dynamic backend 2 (with the same version),
+    // the test dynamic backend 9 is actually a duplicate of the test dynamic backend 2 (but with a version
+    // incompatible with the current Backend API)
+    return "TestValid2";
+
+#elif defined(VALID_TEST_DYNAMIC_BACKEND_3)
+
+    // The test dynamic backend 3 is a different backend than the test dynamic backend 2
+    return "TestValid3";
+
 #else
 
     return "InvalidTestDynamicBackend";
@@ -46,7 +61,8 @@
 
 const char* GetBackendId()
 {
-#if defined(INVALID_TEST_DYNAMIC_BACKEND_5)
+#if defined(INVALID_TEST_DYNAMIC_BACKEND_5) || \
+    defined(INVALID_TEST_DYNAMIC_BACKEND_8)
 
     // Return an invalid backend id
     return nullptr;
@@ -66,15 +82,27 @@
         return;
     }
 
-#if defined(INVALID_TEST_DYNAMIC_BACKEND_7)
+#if defined(INVALID_TEST_DYNAMIC_BACKEND_7) || \
+    defined(INVALID_TEST_DYNAMIC_BACKEND_8)
 
     *outMajor = 0;
     *outMinor = 7;
 
 #else
 
-    *outMajor = 1;
-    *outMinor = 0;
+    armnn::BackendVersion apiVersion = armnn::IBackendInternal::GetApiVersion();
+
+    *outMajor = apiVersion.m_Major;
+
+#if defined(INVALID_TEST_DYNAMIC_BACKEND_9)
+
+    *outMinor = apiVersion.m_Minor + 1;
+
+#else
+
+    *outMinor = apiVersion.m_Minor;
+
+#endif
 
 #endif
 }