# Copyright 2026 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("@rules_cc//cc:cc_binary.bzl", "cc_binary") load("@rules_shell//shell:sh_test.bzl", "sh_test") alias( name = "zenohd", actual = "@zenoh_cpp_bindeps//:zenohd__zenohd", ) UNIVERSAL_TESTS = { "tests_build_warnings": "build/warnings.cxx", "tests_universal_bytes": "universal/bytes.cxx", "tests_universal_closures": "universal/closures.cxx", "tests_universal_details": "universal/details.cxx", "tests_universal_network_advanced_pub_sub": "universal/network/advanced_pub_sub.cxx", "tests_universal_network_cancellation": "universal/network/cancellation.cxx", "tests_universal_network_keyexpr": "universal/network/keyexpr.cxx", "tests_universal_network_liveliness": "universal/network/liveliness.cxx", "tests_universal_network_pub_sub": "universal/network/pub_sub.cxx", "tests_universal_network_queryable_get": "universal/network/queryable_get.cxx", "tests_universal_network_source_info": "universal/network/source_info.cxx", "tests_universal_serialization": "universal/serialization.cxx", } [ cc_binary( name = "{}_bin".format(name), srcs = [src], copts = [ "-Wno-parentheses", "-Wno-sign-compare", "-Wno-unused-variable", ], deps = ["@zenoh-cpp"], ) for name, src in UNIVERSAL_TESTS.items() ] [ sh_test( name = name, srcs = ["run_with_router.sh"], args = [ "$(location :{}_bin)".format(name), "$(location :zenohd)", ], data = [ ":{}_bin".format(name), ":zenohd", ], tags = [ "exclusive", "requires-network", ], ) for name in UNIVERSAL_TESTS.keys() ] # zenoh-pico tests ZENOH_PICO_TESTS = { "tests_zenohpico_network_batching": "zenohpico/network/batching.cxx", "tests_zenohpico_config": "zenohpico/config.cxx", "tests_zenohpico_network_tasks": "zenohpico/network/tasks.cxx", } [ cc_binary( name = "{}_bin".format(name), srcs = [src], copts = [ "-Wno-parentheses", "-Wno-sign-compare", "-Wno-unused-variable", ], tags = [ "exclusive", "requires-network", ], target_compatible_with = select({ "@zenoh-cpp//:use_zenoh_pico_true": [], "//conditions:default": ["@platforms//:incompatible"], }), deps = ["@zenoh-cpp"], ) for name, src in ZENOH_PICO_TESTS.items() ] [ sh_test( name = name, srcs = ["run_with_router.sh"], args = [ "$(location :{}_bin)".format(name), "$(location :zenohd)", ], data = [ ":{}_bin".format(name), ":zenohd", ], tags = [ "exclusive", "requires-network", ], target_compatible_with = select({ "@zenoh-cpp//:use_zenoh_pico_true": [], "//conditions:default": ["@platforms//:incompatible"], }), ) for name in ZENOH_PICO_TESTS.keys() ] # zenoh-c tests ZENOH_C_TESTS = { "tests_zenohc_config": "zenohc/config.cxx", "tests_zenohc_shm_api": "zenohc/shm_api.cxx", } [ cc_binary( name = "{}_bin".format(name), srcs = [src], copts = [ "-Wno-parentheses", "-Wno-sign-compare", "-Wno-unused-variable", ], tags = [ "exclusive", "requires-network", ], target_compatible_with = select({ "@zenoh-cpp//:use_zenoh_pico_true": ["@platforms//:incompatible"], "//conditions:default": [], }), deps = ["@zenoh-cpp"], ) for name, src in ZENOH_C_TESTS.items() ] [ sh_test( name = name, srcs = ["run_with_router.sh"], args = [ "$(location :{}_bin)".format(name), "$(location :zenohd)", ], data = [ ":{}_bin".format(name), ":zenohd", ], tags = [ "exclusive", "requires-network", ], target_compatible_with = select({ "@zenoh-cpp//:use_zenoh_pico_true": ["@platforms//:incompatible"], "//conditions:default": [], }), ) for name in ZENOH_C_TESTS.keys() ]