Skip to content

Commit 2efbd33

Browse files
committed
Add ucx_plugin gtest
1 parent 1b60b99 commit 2efbd33

File tree

6 files changed

+533
-1
lines changed

6 files changed

+533
-1
lines changed

meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ if get_option('buildtype') == 'debug'
123123
run_command('truncate', '-s 0', plugfile, check: true)
124124
endif
125125

126-
nixl_inc_dirs = include_directories('src/api/cpp', 'src/infra', 'src/core')
126+
nixl_inc_dirs = include_directories('src/api/cpp', 'src/api/cpp/backend', 'src/infra', 'src/core')
127+
ucx_inc_dirs = include_directories('src/plugins/ucx')
127128
utils_inc_dirs = include_directories('src/utils')
128129

129130
subdir('src')

test/gtest/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ else
2929
endif
3030

3131
subdir('mocks')
32+
subdir('plugins')
3233

3334
plugin_dirs_arg = '--tests_plugin_dirs=' + mocks_dep.get_variable('path')
3435

test/gtest/plugins/meson.build

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
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+
gtest_dep = dependency('gtest', version : '>=1.11.0', required : false)
17+
absl_strings_dep = abseil_proj.get_variable('absl_strings_dep')
18+
absl_time_dep = abseil_proj.get_variable('absl_time_dep')
19+
20+
if not gtest_dep.found()
21+
message('GTest not found, skipping gtest build')
22+
subdir_done()
23+
endif
24+
25+
if cuda_dep.found()
26+
cuda_dependencies = [cuda_dep]
27+
else
28+
cuda_dependencies = []
29+
endif
30+
31+
cpp_flags = []
32+
33+
if get_option('test_all_plugins')
34+
cpp_flags+='-DTEST_ALL_PLUGINS'
35+
endif
36+
37+
# for loading plugins from build directory
38+
cpp_flags += '-DBUILD_DIR="' + meson.project_build_root() + '"'
39+
40+
plugins_test_exe = executable('plugins_gtest',
41+
sources : ['../main.cpp', 'ucx_plugin.cpp', 'plugin_test.cpp'],
42+
include_directories: [nixl_inc_dirs, utils_inc_dirs, ucx_inc_dirs, '.'],
43+
cpp_args : cpp_flags,
44+
dependencies : [nixl_dep, cuda_dep, gtest_dep, absl_strings_dep, absl_time_dep, ucx_backend_interface],
45+
link_with: [nixl_build_lib, ucx_backend_lib],
46+
install : true
47+
)
48+
49+
test('plugins_gtest', plugins_test_exe)
50+
51+
if get_option('b_sanitize').split(',').contains('thread')
52+
test_env = environment()
53+
test_env.set('TSAN_OPTIONS', 'halt_on_error=1')
54+
test_env.set('NIXL_PLUGIN_DIR', mocks_dep.get_variable('path'))
55+
56+
mt_test_exe = executable('mt_test',
57+
sources : ['main.cpp', 'multi_threading.cpp'],
58+
include_directories: [nixl_inc_dirs, utils_inc_dirs],
59+
cpp_args : cpp_flags,
60+
dependencies : [nixl_dep, nixl_infra, cuda_dep, gtest_dep],
61+
link_with: [nixl_build_lib],
62+
)
63+
64+
test('mt_test', mt_test_exe, is_parallel: false, env: test_env)
65+
endif

0 commit comments

Comments
 (0)