Skip to content

Commit c3a4c1d

Browse files
committedMar 13, 2024
Enable test before adding subdirectory; use make test in build.sh
1 parent d2b226f commit c3a4c1d

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed
 

‎cpp/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)
22
project(torchserve_cpp VERSION 0.1)
33

4+
enable_testing()
5+
46
set(CMAKE_CXX_STANDARD 17)
57
set(CMAKE_CXX_STANDARD_REQUIRED True)
68
set(CMAKE_CXX_EXTENSIONS OFF)
@@ -73,5 +75,3 @@ add_subdirectory(test)
7375
FILE(COPY src/resources/logging.yaml DESTINATION "${CMAKE_INSTALL_PREFIX}/resources")
7476

7577
install(SCRIPT "install.cmake")
76-
77-
enable_testing()

‎cpp/build.sh

+6-10
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,12 @@ function build() {
5757

5858
make -j "$JOBS"
5959
make install
60-
echo -e "${COLOR_GREEN}torchserve_cpp build is complete. To run unit test: \
61-
./_build/test/torchserve_cpp_test ${COLOR_OFF}"
62-
63-
# cd $DEPS_DIR/../..
64-
# if [ -f "$DEPS_DIR/../test/torchserve_cpp_test" ]; then
65-
# $DEPS_DIR/../test/torchserve_cpp_test
66-
# else
67-
# echo -e "${COLOR_RED}[ ERROR ] _build/test/torchserve_cpp_test not exist ${COLOR_OFF}"
68-
# exit 1
69-
# fi
60+
echo -e "${COLOR_GREEN}torchserve_cpp build is complete. ${COLOR_OFF}"
61+
62+
63+
if [ -z "$NO_BUILD_TESTS" ]; then
64+
make test
65+
fi
7066
}
7167

7268
# Parse args

0 commit comments

Comments
 (0)
Please sign in to comment.