Move backend unittest (#4870)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 27 Mar 2019 05:06:34 +0000 (14:06 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 27 Mar 2019 05:06:34 +0000 (14:06 +0900)
Move backend unittest into each backend

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
runtimes/neurun/CMakeLists.txt
runtimes/neurun/backend/cpu/CMakeLists.txt
runtimes/neurun/backend/cpu/MemoryPlanner.test.cc [moved from runtimes/neurun/test/backend/cpu/MemoryPlanner.cc with 100% similarity]
runtimes/neurun/core/CMakeLists.txt

index a8b970d..7a8ba0e 100644 (file)
@@ -33,7 +33,6 @@ add_executable(${TEST_NEURUN} ${TESTS})
 
 # NOTE This line is a workaround to resolve compilation error
 target_include_directories(${TEST_NEURUN} PRIVATE frontend/nnapi)
-target_include_directories(${TEST_NEURUN} PRIVATE backend/cpu)
 target_include_directories(${TEST_NEURUN} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/core/src)
 
 target_link_libraries(${TEST_NEURUN} ${LIB_NEURUN})
@@ -41,8 +40,6 @@ target_link_libraries(${TEST_NEURUN} neurun-core)
 target_link_libraries(${TEST_NEURUN} gtest)
 target_link_libraries(${TEST_NEURUN} gtest_main)
 target_link_libraries(${TEST_NEURUN} ${LIB_PTHREAD})
-target_link_libraries(${TEST_NEURUN} ${LIB_NEURUN_BACKEND_CPU})
-target_link_libraries(${TEST_NEURUN} ${LIB_NEURUN_BACKEND_ACL_CL})
 add_test(${TEST_NEURUN} ${TEST_NEURUN})
 
 install(TARGETS ${TEST_NEURUN} DESTINATION unittest)
index b830637..37fbfd8 100644 (file)
@@ -9,7 +9,9 @@ add_subdirectory(kernel)
 
 file(GLOB_RECURSE SOURCES "*.cc")
 file(GLOB_RECURSE REMOVE_KERNEL_SOURCES "kernel/*.cc")
+file(GLOB_RECURSE TESTS "*.test.cc")
 list(REMOVE_ITEM SOURCES ${REMOVE_KERNEL_SOURCES})
+list(REMOVE_ITEM SOURCES ${TESTS})
 
 add_library(${LIB_NEURUN_BACKEND_CPU} SHARED ${SOURCES})
 
@@ -26,3 +28,13 @@ target_compile_options(${LIB_NEURUN_BACKEND_CPU} PRIVATE -Wall -Wextra -Werror)
 
 set_target_properties(${LIB_NEURUN_BACKEND_CPU} PROPERTIES OUTPUT_NAME backend_cpu)
 install(TARGETS ${LIB_NEURUN_BACKEND_CPU} DESTINATION lib/neurun)
+
+# Unit Tests
+set(TEST_NEURUN_BACKEND_CPU test_neurun_backend_cpu)
+
+add_executable(${TEST_NEURUN_BACKEND_CPU} ${TESTS})
+target_link_libraries(${TEST_NEURUN_BACKEND_CPU} ${LIB_NEURUN_BACKEND_CPU})
+target_link_libraries(${TEST_NEURUN_BACKEND_CPU} gtest gtest_main ${LIB_PTHREAD})
+add_test(${TEST_NEURUN_BACKEND_CPU} ${TEST_NEURUN_BACKEND_CPU})
+
+install(TARGETS ${TEST_NEURUN_BACKEND_CPU} DESTINATION unittest)
index 2e2bcb7..3bb8346 100644 (file)
@@ -5,6 +5,5 @@ set_target_properties(neurun-core PROPERTIES POSITION_INDEPENDENT_CODE ON)
 target_include_directories(neurun-core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
 target_include_directories(neurun-core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
 target_link_libraries(neurun-core nnapi-header) # TODO Remove this dependency
-target_link_libraries(neurun-core nnfw_lib_misc)
-target_link_libraries(neurun-core nnfw_lib_cpp14)
+target_link_libraries(neurun-core nnfw_lib_misc nnfw_lib_cpp14 dl)
 target_compile_options(neurun-core PRIVATE -Wall -Wextra -Werror)