Skip to content

Commit 58ccf51

Browse files
authored
test: Add backend_api_test to test backend APIs (#8185)
1 parent f46557b commit 58ccf51

File tree

4 files changed

+469
-3
lines changed

4 files changed

+469
-3
lines changed

Dockerfile.QA

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ RUN mkdir -p qa/common && \
144144
mkdir qa/L0_data_compression/models && \
145145
cp -r docs/examples/model_repository/simple qa/L0_data_compression/models && \
146146
cp bin/data_compressor_test qa/L0_data_compression/. && \
147+
cp bin/backend_tensor_size_test qa/L0_input_validation/. && \
147148
cp bin/metrics_api_test qa/L0_metrics/. && \
148149
cp bin/response_cache_test qa/L0_response_cache/. && \
149150
cp bin/request_cancellation_test qa/L0_request_cancellation/. && \

qa/L0_input_validation/test.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ CLIENT_LOG="./input_validation_client.log"
4848
TEST_PY=./input_validation_test.py
4949
TEST_RESULT_FILE='./test_results.txt'
5050
SERVER_LOG="./inference_server.log"
51-
TEST_LOG="./input_byte_size_test.log"
52-
TEST_EXEC=./input_byte_size_test
5351

5452
export CUDA_VISIBLE_DEVICES=0
5553

@@ -151,6 +149,8 @@ kill $SERVER_PID
151149
wait $SERVER_PID
152150

153151
# input_byte_size_test
152+
TEST_LOG="./input_byte_size_test.log"
153+
TEST_EXEC=./input_byte_size_test
154154
cp -r /data/inferenceserver/${REPO_VERSION}/qa_identity_model_repository/{onnx_zero_1_float32,onnx_zero_1_object,onnx_zero_1_bool} ./models
155155

156156
set +e
@@ -162,6 +162,19 @@ if [ $? -ne 0 ]; then
162162
fi
163163
set -e
164164

165+
# backend_tensor_size_test
166+
TEST_LOG="./backend_tensor_size_test.log"
167+
TEST_EXEC=./backend_tensor_size_test
168+
169+
set +e
170+
LD_LIBRARY_PATH=/opt/tritonserver/lib:$LD_LIBRARY_PATH $TEST_EXEC >> $TEST_LOG 2>&1
171+
if [ $? -ne 0 ]; then
172+
cat $TEST_LOG
173+
echo -e "\n***\n*** backend_tensor_size_test FAILED\n***"
174+
RET=1
175+
fi
176+
set -e
177+
165178
if [ $RET -eq 0 ]; then
166179
echo -e "\n***\n*** Input Validation Test Passed\n***"
167180
else

src/test/CMakeLists.txt

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# Copyright 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# Redistribution and use in source and binary forms, with or without
44
# modification, are permitted provided that the following conditions
@@ -77,6 +77,45 @@ if(${TRITON_ENABLE_HTTP} OR ${TRITON_ENABLE_METRICS} OR
7777
)
7878
endif()
7979

80+
#
81+
# Unit test for Backend API
82+
#
83+
add_executable(
84+
backend_tensor_size_test
85+
backend_tensor_size_test.cc
86+
)
87+
88+
set_target_properties(
89+
backend_tensor_size_test
90+
PROPERTIES
91+
SKIP_BUILD_RPATH TRUE
92+
BUILD_WITH_INSTALL_RPATH TRUE
93+
INSTALL_RPATH_USE_LINK_PATH FALSE
94+
INSTALL_RPATH ""
95+
)
96+
97+
target_include_directories(
98+
backend_tensor_size_test
99+
PRIVATE
100+
${CMAKE_CURRENT_SOURCE_DIR}/..
101+
${GTEST_INCLUDE_DIRS}
102+
)
103+
104+
target_link_libraries(
105+
backend_tensor_size_test
106+
PRIVATE
107+
triton-backend-utils # from repo-backend
108+
triton-core-serverapi # from repo-core
109+
triton-core-serverstub # from repo-core
110+
GTest::gtest
111+
GTest::gtest_main
112+
)
113+
114+
install(
115+
TARGETS backend_tensor_size_test
116+
RUNTIME DESTINATION bin
117+
)
118+
80119
add_subdirectory(repoagent/relocation_repoagent repoagent/relocation_repoagent)
81120

82121
add_subdirectory(distributed_addsub distributed_addsub)

0 commit comments

Comments
 (0)