Skip to content

Commit b61dd83

Browse files
committed
manager: enable manager unit test
1 parent 9c63172 commit b61dd83

File tree

4 files changed

+78
-1
lines changed

4 files changed

+78
-1
lines changed

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ endif()
3838
set(TEST_SOURCE
3939
${MODELBOX_SERVER_SOURCES}
4040
${MODELBOX_TOOL_SOURCES}
41-
${MODELBOX_MANAGER_SOURCES}
4241
${MODELBOX_SERVING_SOURCES}
4342
)
4443

@@ -67,6 +66,7 @@ if(NOT DISABLE_MODELBOX_TEST)
6766
add_subdirectory(unit)
6867
add_subdirectory(drivers)
6968
add_subdirectory(function)
69+
add_subdirectory(manager)
7070
endif()
7171
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_OLD})
7272

test/manager/CMakeLists.txt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#
2+
# Copyright 2021 The Modelbox Project Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
17+
cmake_minimum_required(VERSION 3.10)
18+
19+
file(GLOB MANAGER_TEST_SOURCE *.cpp *.cc *.c)
20+
21+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
22+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
23+
include_directories(${MOCK_DRIVER_CTRL_INCLUDE})
24+
include_directories(${TEST_INCLUDE})
25+
include_directories(${DRIVER_UNIT_TEST_INCLUDE})
26+
27+
set(MANAGER_TEST_SOURCE ${MANAGER_TEST_SOURCE} CACHE INTERNAL "")
28+
29+
add_executable(manager-unit EXCLUDE_FROM_ALL
30+
${MANAGER_TEST_SOURCE}
31+
${MODELBOX_MANAGER_SOURCES}
32+
)
33+
34+
target_link_libraries(manager-unit pthread)
35+
target_link_libraries(manager-unit rt)
36+
target_link_libraries(manager-unit gtest_main)
37+
target_link_libraries(manager-unit gmock_main)
38+
target_link_libraries(manager-unit ${HUAWEI_SECURE_C_LIBRARIES})
39+
target_link_libraries(manager-unit ${TLOG_STATIC_LIBRARIES})
40+
41+
add_custom_target(unittest-manager
42+
COMMAND ${TEST_RUNNER_LIST} ${CMAKE_CURRENT_BINARY_DIR}/manager-unit
43+
DEPENDS manager-unit
44+
WORKING_DIRECTORY ${TEST_WORKING_DIR}
45+
COMMENT "Run manager-unit Test..."
46+
)
47+
48+
list(APPEND MODELBOX_UNIT_TEST_TARGETS manager)
49+
set(MODELBOX_UNIT_TEST_TARGETS ${MODELBOX_UNIT_TEST_TARGETS} CACHE INTERNAL "")
50+
51+
list(APPEND MODELBOX_UNIT_TEST_RUN_TARGETS unittest-manager)
52+
set(MODELBOX_UNIT_TEST_RUN_TARGETS ${MODELBOX_UNIT_TEST_RUN_TARGETS} CACHE INTERNAL "")
File renamed without changes.

test/manager/test_main.cc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2021 The Modelbox Project Authors. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include "gtest/gtest.h"
18+
19+
int main(int argc, char **argv) {
20+
int ret = 0;
21+
::testing::InitGoogleTest(&argc, argv);
22+
ret |= RUN_ALL_TESTS();
23+
24+
return ret;
25+
}

0 commit comments

Comments
 (0)