2 # Copyright © 2017 Arm Ltd. All rights reserved.
3 # SPDX-License-Identifier: MIT
6 list(APPEND armnnBackendsCommonUnitTests_sources
10 BackendRegistryTests.cpp
15 ConvertFp16ToFp32TestImpl.hpp
16 ConvertFp32ToFp16TestImpl.hpp
18 DequantizeTestImpl.hpp
19 DequantizeEndToEndTestImpl.hpp
20 DetectionPostProcessLayerTestImpl.hpp
21 DetectionPostProcessTestImpl.hpp
22 DynamicBackendTests.cpp
23 DynamicBackendTests.hpp
25 FullyConnectedTestImpl.hpp
27 GatherEndToEndTestImpl.hpp
28 IsLayerSupportedTestImpl.hpp
29 JsonPrinterTestImpl.cpp
30 JsonPrinterTestImpl.hpp
31 LayerReleaseConstantDataTest.cpp
40 OptimizedNetworkTests.cpp
41 OptimizeSubgraphViewTests.cpp
42 OptimizationViewsTests.cpp
45 PreluEndToEndTestImpl.hpp
48 ResizeEndToEndTestImpl.hpp
51 SpaceToDepthTestImpl.hpp
52 SpaceToDepthEndToEndTestImpl.hpp
53 SplitterEndToEndTestImpl.hpp
55 StridedSliceTestImpl.hpp
58 WorkloadDataValidation.cpp
59 WorkloadFactoryHelper.hpp
63 add_library(armnnBackendsCommonUnitTests OBJECT ${armnnBackendsCommonUnitTests_sources})
64 target_include_directories(armnnBackendsCommonUnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
65 target_include_directories(armnnBackendsCommonUnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/armnnUtils)
66 target_include_directories(armnnBackendsCommonUnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
68 # Dummy shared object for testing.
69 # This is a simple library used to test the utility functions that will be used to handle the shared objects.
71 list(APPEND testSharedObject_sources
76 add_library_ex(TestSharedObject MODULE ${testSharedObject_sources})
77 set_target_properties(TestSharedObject PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testSharedObject)
78 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/testSharedObject/libNoSharedObject.txt "This is not a shared object")
80 # Dummy dynamic backends for testing.
81 # Both a valid and a number of invalid dummy dynamic backends (covering various use cases) share the
82 # same source code. The various test cases are put together in the code using compiler directives.
84 list(APPEND testDynamicBackend_sources
85 TestDynamicBackend.cpp
86 TestDynamicBackend.hpp
89 add_library_ex(ValidTestDynamicBackend MODULE ${testDynamicBackend_sources})
90 target_compile_definitions(ValidTestDynamicBackend PRIVATE -DVALID_TEST_DYNAMIC_BACKEND)
91 target_include_directories(ValidTestDynamicBackend PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
92 target_include_directories(ValidTestDynamicBackend PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
93 target_link_libraries(ValidTestDynamicBackend armnn)
94 set_target_properties(ValidTestDynamicBackend PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testDynamicBackend)
96 add_library_ex(InvalidTestDynamicBackend1 MODULE ${testDynamicBackend_sources})
97 target_compile_definitions(InvalidTestDynamicBackend1 PRIVATE -DINVALID_TEST_DYNAMIC_BACKEND_1)
98 target_include_directories(InvalidTestDynamicBackend1 PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
99 target_include_directories(InvalidTestDynamicBackend1 PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
100 target_link_libraries(InvalidTestDynamicBackend1 armnn)
101 set_target_properties(InvalidTestDynamicBackend1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testDynamicBackend)
103 add_library_ex(InvalidTestDynamicBackend2 MODULE ${testDynamicBackend_sources})
104 target_compile_definitions(InvalidTestDynamicBackend2 PRIVATE -DINVALID_TEST_DYNAMIC_BACKEND_2)
105 target_include_directories(InvalidTestDynamicBackend2 PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
106 target_include_directories(InvalidTestDynamicBackend2 PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
107 target_link_libraries(InvalidTestDynamicBackend2 armnn)
108 set_target_properties(InvalidTestDynamicBackend2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testDynamicBackend)
110 add_library_ex(InvalidTestDynamicBackend3 MODULE ${testDynamicBackend_sources})
111 target_compile_definitions(InvalidTestDynamicBackend3 PRIVATE -DINVALID_TEST_DYNAMIC_BACKEND_3)
112 target_include_directories(InvalidTestDynamicBackend3 PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
113 target_include_directories(InvalidTestDynamicBackend3 PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
114 target_link_libraries(InvalidTestDynamicBackend3 armnn)
115 set_target_properties(InvalidTestDynamicBackend3 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testDynamicBackend)
117 add_library_ex(InvalidTestDynamicBackend4 MODULE ${testDynamicBackend_sources})
118 target_compile_definitions(InvalidTestDynamicBackend4 PRIVATE -DINVALID_TEST_DYNAMIC_BACKEND_4)
119 target_include_directories(InvalidTestDynamicBackend4 PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
120 target_include_directories(InvalidTestDynamicBackend4 PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
121 target_link_libraries(InvalidTestDynamicBackend4 armnn)
122 set_target_properties(InvalidTestDynamicBackend4 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testDynamicBackend)
124 add_library_ex(InvalidTestDynamicBackend5 MODULE ${testDynamicBackend_sources})
125 target_compile_definitions(InvalidTestDynamicBackend5 PRIVATE -DINVALID_TEST_DYNAMIC_BACKEND_5)
126 target_include_directories(InvalidTestDynamicBackend5 PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
127 target_include_directories(InvalidTestDynamicBackend5 PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
128 target_link_libraries(InvalidTestDynamicBackend5 armnn)
129 set_target_properties(InvalidTestDynamicBackend5 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testDynamicBackend)
131 add_library_ex(InvalidTestDynamicBackend6 MODULE ${testDynamicBackend_sources})
132 target_compile_definitions(InvalidTestDynamicBackend6 PRIVATE -DINVALID_TEST_DYNAMIC_BACKEND_6)
133 target_include_directories(InvalidTestDynamicBackend6 PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
134 target_include_directories(InvalidTestDynamicBackend6 PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
135 target_link_libraries(InvalidTestDynamicBackend6 armnn)
136 set_target_properties(InvalidTestDynamicBackend6 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testDynamicBackend)
138 add_library_ex(InvalidTestDynamicBackend7 MODULE ${testDynamicBackend_sources})
139 target_compile_definitions(InvalidTestDynamicBackend7 PRIVATE -DINVALID_TEST_DYNAMIC_BACKEND_7)
140 target_include_directories(InvalidTestDynamicBackend7 PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
141 target_include_directories(InvalidTestDynamicBackend7 PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
142 target_link_libraries(InvalidTestDynamicBackend7 armnn)
143 set_target_properties(InvalidTestDynamicBackend7 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testDynamicBackend)
145 # Dummy files and directories for testing the dynamic backend file parsing.
147 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend.so "Test file for dynamic backend file parsing")
148 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend.so.1 "Test file for dynamic backend file parsing")
149 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend.so.1.2 "Test file for dynamic backend file parsing")
150 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend.so.1.2.3 "Test file for dynamic backend file parsing")
151 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend.so.10.1.27 "Test file for dynamic backend file parsing")
152 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend.so.10.1.33. "Test file for dynamic backend file parsing")
153 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend.so.3.4..5 "Test file for dynamic backend file parsing")
154 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend.so.1,1.1 "Test file for dynamic backend file parsing")
156 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm123_GpuAcc_backend.so "Test file for dynamic backend file parsing")
157 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc456_backend.so "Test file for dynamic backend file parsing")
158 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm%Co_GpuAcc_backend.so "Test file for dynamic backend file parsing")
159 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_Gpu.Acc_backend.so "Test file for dynamic backend file parsing")
161 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/GpuAcc_backend.so "Test file for dynamic backend file parsing")
162 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/_GpuAcc_backend.so "Test file for dynamic backend file parsing")
163 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm__backend.so "Test file for dynamic backend file parsing")
164 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc.so "Test file for dynamic backend file parsing")
165 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/__backend.so "Test file for dynamic backend file parsing")
166 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/__.so "Test file for dynamic backend file parsing")
168 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend "Test file for dynamic backend file parsing")
169 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath1/Arm_GpuAcc_backend_v1.2.so "Test file for dynamic backend file parsing")
171 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath2/Arm_CpuAcc_backend.so "Test file for dynamic backend file parsing")
172 add_custom_target(link_dummy_dynamic_backend ALL
173 COMMAND ${CMAKE_COMMAND} -E create_symlink Arm_CpuAcc_backend.so backendsTestPath2/Arm_CpuAcc_backend.so.1
174 COMMAND ${CMAKE_COMMAND} -E create_symlink Arm_CpuAcc_backend.so.1 backendsTestPath2/Arm_CpuAcc_backend.so.1.2
175 COMMAND ${CMAKE_COMMAND} -E create_symlink Arm_CpuAcc_backend.so.1.2 backendsTestPath2/Arm_CpuAcc_backend.so.1.2.3
176 COMMAND ${CMAKE_COMMAND} -E create_symlink nothing backendsTestPath2/Arm_no_backend.so)
177 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath2/Arm_GpuAcc_backend.so "Test file for dynamic backend file parsing")
179 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/backendsTestPath3)