diff --git a/tests/nexus/CMakeLists.txt b/tests/nexus/CMakeLists.txt index 061111bb8..4cd29fad8 100644 --- a/tests/nexus/CMakeLists.txt +++ b/tests/nexus/CMakeLists.txt @@ -47,8 +47,12 @@ set(COMMON_COMPILE_OPTIONS -DOPENTHREAD_CONFIG_USE_STD_NEW=1 ) +option(OT_NEXUS_BUILD_TESTS "Build Nexus test executables" ON) option(OT_NEXUS_GRPC "Enable Nexus gRPC" OFF) +message(STATUS "OT_NEXUS_BUILD_TESTS=\"${OT_NEXUS_BUILD_TESTS}\"") +message(STATUS "OT_NEXUS_GRPC=\"${OT_NEXUS_GRPC}\"") + if(OT_NEXUS_GRPC AND NOT EMSCRIPTEN) find_package(gRPC CONFIG REQUIRED) find_package(Protobuf REQUIRED) @@ -177,33 +181,39 @@ macro(ot_nexus_test name labels) # file `test_{name}.cpp`. The `labels` argument assigns categories to the # test, allowing us to run specific subsets using `ctest -L {label}`. - add_executable(nexus_${name} - test_${name}.cpp ${ARGN} - ) + if(OT_NEXUS_BUILD_TESTS) - target_include_directories(nexus_${name} - PRIVATE - ${COMMON_INCLUDES} - ) + add_executable(nexus_${name} + test_${name}.cpp ${ARGN} + ) - target_link_libraries(nexus_${name} - PRIVATE - ${COMMON_LIBS} - ) + target_include_directories(nexus_${name} + PRIVATE + ${COMMON_INCLUDES} + ) - target_compile_options(nexus_${name} - PRIVATE - ${COMMON_COMPILE_OPTIONS} - ${OT_CFLAGS} - ) + target_link_libraries(nexus_${name} + PRIVATE + ${COMMON_LIBS} + ) - add_test(NAME nexus_${name} COMMAND nexus_${name}) + target_compile_options(nexus_${name} + PRIVATE + ${COMMON_COMPILE_OPTIONS} + ${OT_CFLAGS} + ) + + add_test(NAME nexus_${name} COMMAND nexus_${name}) + + set_tests_properties(nexus_${name} PROPERTIES LABELS "${labels}") + + endif() - set_tests_properties(nexus_${name} PROPERTIES LABELS "${labels}") endmacro() #---------------------------------------------------------------------------------------------------------------------- + # Cert tests ot_nexus_test(1_1_5_1_1 "cert;nexus") ot_nexus_test(1_1_5_1_2 "cert;nexus") diff --git a/tests/nexus/build.sh b/tests/nexus/build.sh index d99e9a5ec..aa5b6209a 100755 --- a/tests/nexus/build.sh +++ b/tests/nexus/build.sh @@ -45,6 +45,7 @@ else fi long_routes=OFF +build_tests=ON case $1 in trel) @@ -60,6 +61,11 @@ case $1 in wasm=OFF long_routes=ON ;; + no_tests) + fifteenfour=ON + wasm=OFF + build_tests=OFF + ;; *) fifteenfour=ON wasm=OFF @@ -81,6 +87,7 @@ CMAKE_ARGS=( -DOT_APP_RCP=OFF -DOT_15_4="${fifteenfour}" -DOT_MLE_LONG_ROUTES="${long_routes}" + -DOT_NEXUS_BUILD_TESTS="${build_tests}" -DOT_PROJECT_CONFIG="${top_srcdir}/tests/nexus/openthread-core-nexus-config.h" )