|
| 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