diff --git a/.github/workflows/build-check.yaml b/.github/workflows/build-check.yaml new file mode 100644 index 000000000..b8a13d880 --- /dev/null +++ b/.github/workflows/build-check.yaml @@ -0,0 +1,54 @@ +# +# Copyright (c) 2022 ZettaScale Technology +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +# which is available at https://www.apache.org/licenses/LICENSE-2.0. +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +# +# Contributors: +# ZettaScale Zenoh Team, +# +name: build-check + +on: + push: + branches: [ '**' ] + pull_request: + branches: [ '**' ] + +jobs: + modular_build: + name: Modular build on ubuntu-latest + runs-on: ubuntu-latest + strategy: + matrix: + feature_publication: [1, 0] + feature_subscription: [1, 0] + feature_queryable: [1, 0] + feature_query: [1, 0] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run docker image + run: docker run --name zenoh_router --init --net host -d eclipse/zenoh:master + + - name: Build project + run: | + make all + python3 ./build/tests/modularity.py --pub $Z_FEATURE_PUBLICATION --sub $Z_FEATURE_SUBSCRIPTION --queryable $Z_FEATURE_QUERYABLE --query $Z_FEATURE_QUERY + timeout-minutes: 5 + env: + Z_FEATURE_PUBLICATION: ${{ matrix.feature_publication }} + Z_FEATURE_SUBSCRIPTION: ${{ matrix.feature_subscription }} + Z_FEATURE_QUERYABLE: ${{ matrix.feature_queryable }} + Z_FEATURE_QUERY: ${{ matrix.feature_query }} + + - name: Stop docker image + if: always() + run: | + docker stop zenoh_router + docker rm zenoh_router \ No newline at end of file diff --git a/.github/workflows/build-shared.yaml b/.github/workflows/build-shared.yaml index 055524f04..a5b6d2a52 100644 --- a/.github/workflows/build-shared.yaml +++ b/.github/workflows/build-shared.yaml @@ -50,4 +50,4 @@ jobs: env: BUILD_TYPE: Debug BUILD_SHARED_LIBS: ON - ZENOH_DEBUG: 3 + ZENOH_DEBUG: 3 \ No newline at end of file diff --git a/.github/workflows/freertos_plus_tcp.yaml b/.github/workflows/freertos_plus_tcp.yaml index 1e8ee0fe7..65231e75f 100644 --- a/.github/workflows/freertos_plus_tcp.yaml +++ b/.github/workflows/freertos_plus_tcp.yaml @@ -40,3 +40,8 @@ jobs: cmake -Bbuild -G"Ninja Multi-Config" cmake --build ./build --config Debug cmake --build ./build --config Release + env: + Z_FEATURE_PUBLICATION: 1 + Z_FEATURE_SUBSCRIPTION: 1 + Z_FEATURE_QUERYABLE: 1 + Z_FEATURE_QUERY: 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2838ec142..3d562f411 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,21 @@ endif() add_definition(ZENOH_DEBUG=${ZENOH_DEBUG}) +# Zenoh pico feature configuration options +option(Z_FEATURE_PUBLICATION "Toggle publication feature" 1) +option(Z_FEATURE_SUBSCRIPTION "Toggle subscription feature" 1) +option(Z_FEATURE_QUERY "Toggle query feature" 1) +option(Z_FEATURE_QUERYABLE "Toggle queryable feature" 1) +add_definition(Z_FEATURE_PUBLICATION=${Z_FEATURE_PUBLICATION}) +add_definition(Z_FEATURE_SUBSCRIPTION=${Z_FEATURE_SUBSCRIPTION}) +add_definition(Z_FEATURE_QUERY=${Z_FEATURE_QUERY}) +add_definition(Z_FEATURE_QUERYABLE=${Z_FEATURE_QUERYABLE}) +message(STATUS "Building with feature confing:\n\ +* PUBLICATION: ${Z_FEATURE_PUBLICATION}\n\ +* SUBSCRIPTION: ${Z_FEATURE_SUBSCRIPTION}\n\ +* QUERY: ${Z_FEATURE_QUERY}\n\ +* QUERYABLE: ${Z_FEATURE_QUERYABLE}") + # Print summary of CMAKE configurations message(STATUS "Building in ${CMAKE_BUILD_TYPE} mode") message(STATUS "Build shared library: ${BUILD_SHARED_LIBS}") @@ -284,6 +299,8 @@ if(UNIX OR MSVC) target_link_libraries(z_api_null_drop_test ${Libname}) target_link_libraries(z_api_double_drop_test ${Libname}) + configure_file(${PROJECT_SOURCE_DIR}/tests/modularity.py ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/modularity.py COPYONLY) + enable_testing() add_test(z_data_struct_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/z_data_struct_test) add_test(z_endpoint_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/z_endpoint_test) diff --git a/GNUmakefile b/GNUmakefile index cf4512a1b..67932a3bc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -45,6 +45,13 @@ BUILD_TOOLS?=OFF # 3: DEBUG + INFO + ERROR ZENOH_DEBUG?=0 +# Feature config toggle +# Accepted values: 0, 1 +Z_FEATURE_PUBLICATION?=1 +Z_FEATURE_SUBSCRIPTION?=1 +Z_FEATURE_QUERY?=1 +Z_FEATURE_QUERYABLE?=1 + # zenoh-pico/ directory ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) @@ -58,7 +65,9 @@ CROSSIMG_PREFIX=zenoh-pico_ # NOTES: # - ARM: old versions of dockcross/dockcross were creating some issues since they used an old GCC (4.8.3) which lacks (even using -std=gnu11) -CMAKE_OPT=-DZENOH_DEBUG=$(ZENOH_DEBUG) -DBUILD_EXAMPLES=$(BUILD_EXAMPLES) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DBUILD_TESTING=$(BUILD_TESTING) -DBUILD_MULTICAST=$(BUILD_MULTICAST) -DBUILD_INTEGRATION=$(BUILD_INTEGRATION) -DBUILD_TOOLS=$(BUILD_TOOLS) -DBUILD_SHARED_LIBS=$(BUILD_SHARED_LIBS) -H. +CMAKE_OPT=-DZENOH_DEBUG=$(ZENOH_DEBUG) -DBUILD_EXAMPLES=$(BUILD_EXAMPLES) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DBUILD_TESTING=$(BUILD_TESTING) -DBUILD_MULTICAST=$(BUILD_MULTICAST)\ + -DZ_FEATURE_PUBLICATION=$(Z_FEATURE_PUBLICATION) -DZ_FEATURE_SUBSCRIPTION=$(Z_FEATURE_SUBSCRIPTION) -DZ_FEATURE_QUERY=$(Z_FEATURE_QUERY) -DZ_FEATURE_QUERYABLE=$(Z_FEATURE_QUERYABLE)\ + -DBUILD_INTEGRATION=$(BUILD_INTEGRATION) -DBUILD_TOOLS=$(BUILD_TOOLS) -DBUILD_SHARED_LIBS=$(BUILD_SHARED_LIBS) -H. all: make diff --git a/examples/freertos_plus_tcp/include/FreeRTOSConfig.h b/examples/freertos_plus_tcp/include/FreeRTOSConfig.h index cbd027ce3..faeb5bbd5 100644 --- a/examples/freertos_plus_tcp/include/FreeRTOSConfig.h +++ b/examples/freertos_plus_tcp/include/FreeRTOSConfig.h @@ -20,7 +20,7 @@ #define configUSE_PREEMPTION 1 #define configTICK_RATE_HZ ((TickType_t)1000) #define configMAX_PRIORITIES (56) -#define configMINIMAL_STACK_SIZE ((uint16_t) PTHREAD_STACK_MIN) +#define configMINIMAL_STACK_SIZE ((uint16_t)PTHREAD_STACK_MIN) #define configMAX_TASK_NAME_LEN (16) #define configUSE_16_BIT_TICKS 0 #define configQUEUE_REGISTRY_SIZE 0 diff --git a/examples/freertos_plus_tcp/include/FreeRTOSIPConfig.h b/examples/freertos_plus_tcp/include/FreeRTOSIPConfig.h index 2070ad000..430e92b4d 100644 --- a/examples/freertos_plus_tcp/include/FreeRTOSIPConfig.h +++ b/examples/freertos_plus_tcp/include/FreeRTOSIPConfig.h @@ -48,7 +48,7 @@ // Set ipconfigBUFFER_PADDING on 64-bit platforms #if INTPTR_MAX == INT64_MAX - #define ipconfigBUFFER_PADDING 14U +#define ipconfigBUFFER_PADDING 14U #endif #endif /* FREERTOS_IP_CONFIG_H */ \ No newline at end of file diff --git a/examples/freertos_plus_tcp/z_get.c b/examples/freertos_plus_tcp/z_get.c index 8a0f74b4f..3a95518c1 100644 --- a/examples/freertos_plus_tcp/z_get.c +++ b/examples/freertos_plus_tcp/z_get.c @@ -16,6 +16,7 @@ #include "FreeRTOS.h" +#if Z_FEATURE_QUERY == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -47,7 +48,7 @@ void reply_handler(z_owned_reply_t *reply, void *ctx) { } } -void app_main() { +void app_main(void) { z_owned_config_t config = z_config_default(); zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(MODE)); if (strcmp(CONNECT, "") != 0) { @@ -92,4 +93,9 @@ void app_main() { zp_stop_lease_task(z_loan(s)); z_close(z_move(s)); -} \ No newline at end of file +} +#else +void app_main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n"); +} +#endif \ No newline at end of file diff --git a/examples/freertos_plus_tcp/z_pub.c b/examples/freertos_plus_tcp/z_pub.c index 969202074..f53a786da 100644 --- a/examples/freertos_plus_tcp/z_pub.c +++ b/examples/freertos_plus_tcp/z_pub.c @@ -16,6 +16,7 @@ #include "FreeRTOS.h" +#if Z_FEATURE_PUBLICATION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -30,7 +31,7 @@ #define KEYEXPR "demo/example/zenoh-pico-pub" #define VALUE "[FreeRTOS-Plus-TCP] Pub from Zenoh-Pico!" -void app_main() { +void app_main(void) { z_owned_config_t config = z_config_default(); zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(MODE)); if (strcmp(CONNECT, "") != 0) { @@ -104,3 +105,8 @@ void app_main() { z_close(z_move(s)); } +#else +void app_main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); +} +#endif diff --git a/examples/freertos_plus_tcp/z_pub_st.c b/examples/freertos_plus_tcp/z_pub_st.c index f31516b72..03311e25c 100644 --- a/examples/freertos_plus_tcp/z_pub_st.c +++ b/examples/freertos_plus_tcp/z_pub_st.c @@ -16,6 +16,7 @@ #include "FreeRTOS.h" +#if Z_FEATURE_PUBLICATION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -30,7 +31,7 @@ #define KEYEXPR "demo/example/zenoh-pico-pub" #define VALUE "[FreeRTOS-Plus-TCP] Pub from Zenoh-Pico!" -void app_main() { +void app_main(void) { z_owned_config_t config = z_config_default(); zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(MODE)); if (strcmp(CONNECT, "") != 0) { @@ -72,3 +73,8 @@ void app_main() { z_close(z_move(s)); } +#else +void app_main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); +} +#endif diff --git a/examples/freertos_plus_tcp/z_pull.c b/examples/freertos_plus_tcp/z_pull.c index b6d5d84f8..601bfe720 100644 --- a/examples/freertos_plus_tcp/z_pull.c +++ b/examples/freertos_plus_tcp/z_pull.c @@ -14,6 +14,7 @@ #include +#if Z_FEATURE_PUBLICATION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -35,7 +36,7 @@ void data_handler(const z_sample_t *sample, void *ctx) { z_drop(z_move(keystr)); } -void app_main() { +void app_main(void) { z_owned_config_t config = z_config_default(); zp_config_insert(z_config_loan(&config), Z_CONFIG_MODE_KEY, z_string_make(MODE)); if (strcmp(CONNECT, "") != 0) { @@ -77,3 +78,8 @@ void app_main() { z_close(z_move(s)); } +#else +void app_main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); +} +#endif diff --git a/examples/freertos_plus_tcp/z_put.c b/examples/freertos_plus_tcp/z_put.c index f8913146d..43c6a4975 100644 --- a/examples/freertos_plus_tcp/z_put.c +++ b/examples/freertos_plus_tcp/z_put.c @@ -14,6 +14,7 @@ #include +#if Z_FEATURE_PUBLICATION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -28,7 +29,7 @@ #define KEYEXPR "demo/example/zenoh-pico-put" #define VALUE "[FreeRTOS-Plus-TCP] Pub from Zenoh-Pico!" -void app_main() { +void app_main(void) { z_owned_config_t config = z_config_default(); zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(MODE)); if (strcmp(CONNECT, "") != 0) { @@ -74,3 +75,8 @@ void app_main() { z_close(z_move(s)); } +#else +void app_main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); +} +#endif diff --git a/examples/freertos_plus_tcp/z_queryable.c b/examples/freertos_plus_tcp/z_queryable.c index 1a9f19514..de60b9c53 100644 --- a/examples/freertos_plus_tcp/z_queryable.c +++ b/examples/freertos_plus_tcp/z_queryable.c @@ -14,6 +14,7 @@ #include +#if Z_FEATURE_QUERYABLE == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -43,7 +44,7 @@ void query_handler(const z_query_t *query, void *ctx) { z_drop(z_move(keystr)); } -void app_main() { +void app_main(void) { z_owned_config_t config = z_config_default(); zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(MODE)); if (strcmp(CONNECT, "") != 0) { @@ -89,3 +90,8 @@ void app_main() { z_close(z_move(s)); } +#else +void app_main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n"); +} +#endif \ No newline at end of file diff --git a/examples/freertos_plus_tcp/z_scout.c b/examples/freertos_plus_tcp/z_scout.c index c73785779..0f3087eee 100644 --- a/examples/freertos_plus_tcp/z_scout.c +++ b/examples/freertos_plus_tcp/z_scout.c @@ -82,7 +82,7 @@ void drop(void *context) { } } -void app_main() { +void app_main(void) { int *context = (int *)pvPortMalloc(sizeof(int)); *context = 0; z_owned_scouting_config_t config = z_scouting_config_default(); diff --git a/examples/freertos_plus_tcp/z_sub.c b/examples/freertos_plus_tcp/z_sub.c index 62e39ba59..7f403d58a 100644 --- a/examples/freertos_plus_tcp/z_sub.c +++ b/examples/freertos_plus_tcp/z_sub.c @@ -14,6 +14,7 @@ #include +#if Z_FEATURE_SUBSCRIPTION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -35,7 +36,7 @@ void data_handler(const z_sample_t *sample, void *ctx) { z_drop(z_move(keystr)); } -void app_main() { +void app_main(void) { z_owned_config_t config = z_config_default(); zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(MODE)); if (strcmp(CONNECT, "") != 0) { @@ -75,3 +76,8 @@ void app_main() { z_close(z_move(s)); } +#else +void app_main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); +} +#endif diff --git a/examples/freertos_plus_tcp/z_sub_st.c b/examples/freertos_plus_tcp/z_sub_st.c index b051ed467..811a49877 100644 --- a/examples/freertos_plus_tcp/z_sub_st.c +++ b/examples/freertos_plus_tcp/z_sub_st.c @@ -14,6 +14,7 @@ #include +#if Z_FEATURE_SUBSCRIPTION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -35,7 +36,7 @@ void data_handler(const z_sample_t *sample, void *ctx) { z_drop(z_move(keystr)); } -void app_main() { +void app_main(void) { z_owned_config_t config = z_config_default(); zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(MODE)); if (strcmp(CONNECT, "") != 0) { @@ -67,3 +68,8 @@ void app_main() { z_close(z_move(s)); } +#else +void app_main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); +} +#endif diff --git a/examples/mbed/z_get.cpp b/examples/mbed/z_get.cpp index 39ea2c5fd..283dd8f43 100644 --- a/examples/mbed/z_get.cpp +++ b/examples/mbed/z_get.cpp @@ -98,6 +98,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/mbed/z_pub.cpp b/examples/mbed/z_pub.cpp index b51127a37..309cb3d7b 100644 --- a/examples/mbed/z_pub.cpp +++ b/examples/mbed/z_pub.cpp @@ -89,6 +89,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/mbed/z_pull.cpp b/examples/mbed/z_pull.cpp index 8a5e0522c..c54c83ad6 100644 --- a/examples/mbed/z_pull.cpp +++ b/examples/mbed/z_pull.cpp @@ -95,6 +95,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/mbed/z_queryable.cpp b/examples/mbed/z_queryable.cpp index 5a0dd4901..fa8b8046b 100644 --- a/examples/mbed/z_queryable.cpp +++ b/examples/mbed/z_queryable.cpp @@ -98,6 +98,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/mbed/z_sub.cpp b/examples/mbed/z_sub.cpp index 27297b1c8..51699f9ca 100644 --- a/examples/mbed/z_sub.cpp +++ b/examples/mbed/z_sub.cpp @@ -93,6 +93,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c11/z_get.c b/examples/unix/c11/z_get.c index 6c47a550b..b72ea0e9f 100644 --- a/examples/unix/c11/z_get.c +++ b/examples/unix/c11/z_get.c @@ -133,6 +133,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c11/z_ping.c b/examples/unix/c11/z_ping.c index af13efb2a..379ff6dcf 100644 --- a/examples/unix/c11/z_ping.c +++ b/examples/unix/c11/z_ping.c @@ -177,6 +177,6 @@ int main(void) { printf( "ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example " "requires them.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c11/z_pong.c b/examples/unix/c11/z_pong.c index 0a9ee2d26..6202b38b1 100644 --- a/examples/unix/c11/z_pong.c +++ b/examples/unix/c11/z_pong.c @@ -74,6 +74,6 @@ int main(void) { printf( "ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example " "requires them.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c11/z_pub.c b/examples/unix/c11/z_pub.c index 35df1383d..f6f9e6bd5 100644 --- a/examples/unix/c11/z_pub.c +++ b/examples/unix/c11/z_pub.c @@ -121,6 +121,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif diff --git a/examples/unix/c11/z_pub_st.c b/examples/unix/c11/z_pub_st.c index 7dda9936e..ae152104b 100644 --- a/examples/unix/c11/z_pub_st.c +++ b/examples/unix/c11/z_pub_st.c @@ -107,6 +107,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c11/z_pull.c b/examples/unix/c11/z_pull.c index cc8297a29..4ed568f76 100644 --- a/examples/unix/c11/z_pull.c +++ b/examples/unix/c11/z_pull.c @@ -102,6 +102,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c11/z_put.c b/examples/unix/c11/z_put.c index 557a128a5..70838a062 100644 --- a/examples/unix/c11/z_put.c +++ b/examples/unix/c11/z_put.c @@ -105,6 +105,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c11/z_queryable.c b/examples/unix/c11/z_queryable.c index 01a04410b..92f13c652 100644 --- a/examples/unix/c11/z_queryable.c +++ b/examples/unix/c11/z_queryable.c @@ -128,6 +128,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c11/z_sub.c b/examples/unix/c11/z_sub.c index 77fdb29a8..0f1d07c6f 100644 --- a/examples/unix/c11/z_sub.c +++ b/examples/unix/c11/z_sub.c @@ -111,6 +111,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c11/z_sub_st.c b/examples/unix/c11/z_sub_st.c index d6ee0966f..a95e93188 100644 --- a/examples/unix/c11/z_sub_st.c +++ b/examples/unix/c11/z_sub_st.c @@ -100,6 +100,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_get.c b/examples/unix/c99/z_get.c index 7b45b13f7..766cca309 100644 --- a/examples/unix/c99/z_get.c +++ b/examples/unix/c99/z_get.c @@ -133,6 +133,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_ping.c b/examples/unix/c99/z_ping.c index 94fe42424..6528bfdd7 100644 --- a/examples/unix/c99/z_ping.c +++ b/examples/unix/c99/z_ping.c @@ -177,6 +177,6 @@ int main(void) { printf( "ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example " "requires them.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_pong.c b/examples/unix/c99/z_pong.c index b175c49b0..2614f7bc9 100644 --- a/examples/unix/c99/z_pong.c +++ b/examples/unix/c99/z_pong.c @@ -84,6 +84,6 @@ int main(void) { printf( "ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example " "requires them.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_pub.c b/examples/unix/c99/z_pub.c index 0e0c22f1f..a1c12adda 100644 --- a/examples/unix/c99/z_pub.c +++ b/examples/unix/c99/z_pub.c @@ -110,6 +110,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_pub_st.c b/examples/unix/c99/z_pub_st.c index 237a892d9..07680e557 100644 --- a/examples/unix/c99/z_pub_st.c +++ b/examples/unix/c99/z_pub_st.c @@ -107,6 +107,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_pull.c b/examples/unix/c99/z_pull.c index 88361ff27..c2a1ecd2f 100644 --- a/examples/unix/c99/z_pull.c +++ b/examples/unix/c99/z_pull.c @@ -103,6 +103,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_put.c b/examples/unix/c99/z_put.c index 20d13fb11..15273aecd 100644 --- a/examples/unix/c99/z_put.c +++ b/examples/unix/c99/z_put.c @@ -105,6 +105,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_queryable.c b/examples/unix/c99/z_queryable.c index 8c8539bfe..f5093d370 100644 --- a/examples/unix/c99/z_queryable.c +++ b/examples/unix/c99/z_queryable.c @@ -124,6 +124,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_sub.c b/examples/unix/c99/z_sub.c index 7cb1d2354..2a1cd2aee 100644 --- a/examples/unix/c99/z_sub.c +++ b/examples/unix/c99/z_sub.c @@ -112,6 +112,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/unix/c99/z_sub_st.c b/examples/unix/c99/z_sub_st.c index 37c7d48cc..6b3c8728f 100644 --- a/examples/unix/c99/z_sub_st.c +++ b/examples/unix/c99/z_sub_st.c @@ -101,6 +101,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/windows/z_get.c b/examples/windows/z_get.c index 0d082a63e..e89c2f3f3 100644 --- a/examples/windows/z_get.c +++ b/examples/windows/z_get.c @@ -98,6 +98,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/windows/z_ping.c b/examples/windows/z_ping.c index f1a218386..6a0a3cb82 100644 --- a/examples/windows/z_ping.c +++ b/examples/windows/z_ping.c @@ -174,6 +174,6 @@ int main(void) { printf( "ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example " "requires them.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/windows/z_pong.c b/examples/windows/z_pong.c index 0a9ee2d26..6202b38b1 100644 --- a/examples/windows/z_pong.c +++ b/examples/windows/z_pong.c @@ -74,6 +74,6 @@ int main(void) { printf( "ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example " "requires them.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/windows/z_pub.c b/examples/windows/z_pub.c index aecc29806..89c542ad4 100644 --- a/examples/windows/z_pub.c +++ b/examples/windows/z_pub.c @@ -78,6 +78,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif diff --git a/examples/windows/z_pub_st.c b/examples/windows/z_pub_st.c index 4623098ae..caa342504 100644 --- a/examples/windows/z_pub_st.c +++ b/examples/windows/z_pub_st.c @@ -74,6 +74,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/windows/z_pull.c b/examples/windows/z_pull.c index efaa7676e..3c31de4be 100644 --- a/examples/windows/z_pull.c +++ b/examples/windows/z_pull.c @@ -82,6 +82,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/windows/z_put.c b/examples/windows/z_put.c index dff826725..ca89e386c 100644 --- a/examples/windows/z_put.c +++ b/examples/windows/z_put.c @@ -72,6 +72,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/windows/z_queryable.c b/examples/windows/z_queryable.c index 8fafa11d9..ef166b73a 100644 --- a/examples/windows/z_queryable.c +++ b/examples/windows/z_queryable.c @@ -93,6 +93,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/windows/z_sub.c b/examples/windows/z_sub.c index e46e1fbcb..afe3b4785 100644 --- a/examples/windows/z_sub.c +++ b/examples/windows/z_sub.c @@ -81,6 +81,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/windows/z_sub_st.c b/examples/windows/z_sub_st.c index d34a2d17f..fb808e1ea 100644 --- a/examples/windows/z_sub_st.c +++ b/examples/windows/z_sub_st.c @@ -70,6 +70,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/zephyr/z_get.c b/examples/zephyr/z_get.c index 279bd69a5..08a1ccb17 100644 --- a/examples/zephyr/z_get.c +++ b/examples/zephyr/z_get.c @@ -92,6 +92,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/zephyr/z_pub.c b/examples/zephyr/z_pub.c index 09623fd49..4bfd33d88 100644 --- a/examples/zephyr/z_pub.c +++ b/examples/zephyr/z_pub.c @@ -86,6 +86,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/zephyr/z_pull.c b/examples/zephyr/z_pull.c index 7b3522529..e2906063f 100644 --- a/examples/zephyr/z_pull.c +++ b/examples/zephyr/z_pull.c @@ -89,6 +89,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/examples/zephyr/z_queryable.c b/examples/zephyr/z_queryable.c index 154075dfa..b92be70c1 100644 --- a/examples/zephyr/z_queryable.c +++ b/examples/zephyr/z_queryable.c @@ -16,6 +16,7 @@ #include #include +#if Z_FEATURE_QUERYABLE == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -89,3 +90,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n"); + return -2; +} +#endif \ No newline at end of file diff --git a/examples/zephyr/z_sub.c b/examples/zephyr/z_sub.c index 4f1831154..0293954ef 100644 --- a/examples/zephyr/z_sub.c +++ b/examples/zephyr/z_sub.c @@ -87,6 +87,6 @@ int main(int argc, char **argv) { #else int main(void) { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); - return -1; + return -2; } #endif \ No newline at end of file diff --git a/include/zenoh-pico/config.h b/include/zenoh-pico/config.h index 3d55a7edd..fc7fe5f97 100644 --- a/include/zenoh-pico/config.h +++ b/include/zenoh-pico/config.h @@ -103,6 +103,7 @@ #define Z_CONFIG_ADD_TIMESTAMP_DEFAULT "false" /*------------------ Compile-time feature configuration ------------------*/ +// WARNING: Default values may always be overridden by CMake/make values /** * Enable multi-thread support. diff --git a/tests/modularity.py b/tests/modularity.py new file mode 100644 index 000000000..44c66d8e5 --- /dev/null +++ b/tests/modularity.py @@ -0,0 +1,275 @@ +import argparse +import subprocess +import sys +import time + +# Specify the directory for the binaries +DIR_EXAMPLES = "build/examples" + +def pub_and_sub(args): + print("*** Pub & sub test ***") + test_status = 0 + + # Expected z_pub output & status + if args.pub == 1: + z_pub_expected_status = 0 + z_pub_expected_output = '''Opening session... +Declaring publisher for 'demo/example/zenoh-pico-pub'... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')... +Putting Data ('demo/example/zenoh-pico-pub': 'Pub from Pico!')...''' + else : + z_pub_expected_status = 254 + z_pub_expected_output = "ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it." + + # Expected z_sub output & status + if args.sub == 1: + z_sub_expected_status = 0 + if args.pub == 1: + z_sub_expected_output = '''Opening session... +Declaring Subscriber on 'demo/example/**'... +Enter 'q' to quit... +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!') +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!') +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!') +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!') +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!') +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!') +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!') +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!') +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!') +>> [Subscriber] Received ('demo/example/zenoh-pico-pub': 'Pub from Pico!')''' + else: + z_sub_expected_output = '''Opening session... +Declaring Subscriber on 'demo/example/**'... +Enter 'q' to quit...''' + else : + z_sub_expected_status = 254 + z_sub_expected_output = "ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it." + + print("Start subscriber") + # Start z_sub in the background + z_sub_command = f"./{DIR_EXAMPLES}/z_sub" + z_sub_process = subprocess.Popen(z_sub_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + + # Introduce a delay to ensure z_sub starts + time.sleep(2) + + print("Start publisher") + # Start z_pub + z_pub_command = f"./{DIR_EXAMPLES}/z_pub" + z_pub_process = subprocess.Popen(z_pub_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + + # Wait for z_pub to finish + z_pub_process.wait() + + print("Stop subscriber") + if z_sub_process.poll() is None: + # Send "q" command to z_sub to stop it + z_sub_process.stdin.write("q\n") + z_sub_process.stdin.flush() + + # Wait for z_sub to finish + z_sub_process.wait() + + print("Check publisher status & output") + # Check the exit status of z_pub + z_pub_status = z_pub_process.returncode + if z_pub_status == z_pub_expected_status: + print("z_pub status valid") + else: + print(f"z_pub status invalid, expected: {z_pub_expected_status}, received: {z_pub_status}") + test_status = 1 + + # Check output of z_pub + z_pub_output = z_pub_process.stdout.read() + if z_pub_output.__contains__(z_pub_expected_output): + print("z_pub output valid") + else: + print("z_pub output invalid:") + print(f"Expected: \"{z_pub_expected_output}\"") + print(f"Received: \"{z_pub_output}\"") + test_status = 1 + + print("Check subscriber status & output") + # Check the exit status of z_sub + z_sub_status = z_sub_process.returncode + if z_sub_status == z_sub_expected_status: + print("z_sub status valid") + else: + print(f"z_sub status invalid, expected: {z_sub_expected_status}, received: {z_sub_status}") + test_status = 1 + + # Check output of z_sub + z_sub_output = z_sub_process.stdout.read() + if z_sub_output.__contains__(z_sub_expected_output): + print("z_sub output valid") + else: + print("z_sub output invalid:") + print(f"Expected: \"{z_sub_expected_output}\"") + print(f"Received: \"{z_sub_output}\"") + test_status = 1 + # Return value + return test_status + +def query_and_queryable(args): + print("*** Query & queryable test ***") + test_status = 0 + + # Expected z_query output & status + if args.query == 1: + z_query_expected_status = 0 + if args.queryable == 1: + z_query_expected_output = '''Opening session... +Enter any key to pull data or 'q' to quit... +Sending Query 'demo/example/**'... +>> Received ('demo/example/zenoh-pico-queryable': 'Queryable from Pico!') +>> Received query final notification +Sending Query 'demo/example/**'... +>> Received ('demo/example/zenoh-pico-queryable': 'Queryable from Pico!') +>> Received query final notification +Sending Query 'demo/example/**'... +>> Received ('demo/example/zenoh-pico-queryable': 'Queryable from Pico!') +>> Received query final notification''' + else: + z_query_expected_output = '''Opening session... +Enter any key to pull data or 'q' to quit... +Sending Query 'demo/example/**'... +>> Received query final notification +Sending Query 'demo/example/**'... +>> Received query final notification +Sending Query 'demo/example/**'... +>> Received query final notification''' + else : + z_query_expected_status = 254 + z_query_expected_output = "ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it." + + # Expected z_queryable output & status + if args.queryable == 1: + z_queryable_expected_status = 0 + if args.query == 1: + z_queryable_expected_output = '''Opening session... +Creating Queryable on 'demo/example/zenoh-pico-queryable'... +Enter 'q' to quit... + >> [Queryable handler] Received Query 'demo/example/**?' + >> [Queryable handler] Received Query 'demo/example/**?' + >> [Queryable handler] Received Query 'demo/example/**?''' + else: + z_queryable_expected_output = '''Opening session... +Creating Queryable on 'demo/example/zenoh-pico-queryable'... +Enter 'q' to quit...''' + else : + z_queryable_expected_status = 254 + z_queryable_expected_output = "ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it." + + print("Start queryable") + # Start z_queryable in the background + z_queryable_command = f"./{DIR_EXAMPLES}/z_queryable" + z_queryable_process = subprocess.Popen(z_queryable_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + + # Introduce a delay to ensure z_queryable starts + time.sleep(2) + + print("Start query") + # Start z_query + z_query_command = f"./{DIR_EXAMPLES}/z_get" + z_query_process = subprocess.Popen(z_query_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + + # Introduce a delay to ensure z_query starts + time.sleep(2) + + print("Send requests") + if z_query_process.poll() is None: + z_query_process.stdin.write("\n") + z_query_process.stdin.flush() + time.sleep(1) + z_query_process.stdin.write("\n") + z_query_process.stdin.flush() + time.sleep(1) + z_query_process.stdin.write("\n") + z_query_process.stdin.flush() + time.sleep(1) + + print("Stop query") + if z_query_process.poll() is None: + z_query_process.stdin.write("q\n") + z_query_process.stdin.flush() + + # Wait for z_query to finish + z_query_process.wait() + + print("Stop queryable") + if z_queryable_process.poll() is None: + # Send "q" command to z_sub to stop it + z_queryable_process.stdin.write("q\n") + z_queryable_process.stdin.flush() + + # Wait for z_queryable to finish + z_queryable_process.wait() + + print("Check query status & output") + # Check the exit status of z_query + z_query_status = z_query_process.returncode + if z_query_status == z_query_expected_status: + print("z_query status valid") + else: + print(f"z_query status invalid, expected: {z_query_expected_status}, received: {z_query_status}") + test_status = 1 + + # Check output of z_query + z_query_output = z_query_process.stdout.read() + if z_query_output.__contains__(z_query_expected_output): + print("z_query output valid") + else: + print("z_query output invalid:") + print(f"Expected: \"{z_query_expected_output}\"") + print(f"Received: \"{z_query_output}\"") + test_status = 1 + + print("Check queryable status & output") + # Check the exit status of z_queryable + z_queryable_status = z_queryable_process.returncode + if z_queryable_status == z_queryable_expected_status: + print("z_queryable status valid") + else: + print(f"z_queryable status invalid, expected: {z_queryable_expected_status}, received: {z_queryable_status}") + test_status = 1 + + # Check output of z_queryable + z_queryable_output = z_queryable_process.stdout.read() + if z_queryable_output.__contains__(z_queryable_expected_output): + print("z_queryable output valid") + else: + print("z_queryable output invalid:") + print(f"Expected: \"{z_queryable_expected_output}\"") + print(f"Received: \"{z_queryable_output}\"") + test_status = 1 + # Return status + return test_status + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="This script runs zenoh-pico examples and checks them according to the given configuration") + parser.add_argument("--pub", type=int, choices=[0, 1], help="Z_FEATURE_PUBLICATION (0 or 1)") + parser.add_argument("--sub", type=int, choices=[0, 1], help="Z_FEATURE_SUBSCRIPTION (0 or 1)") + parser.add_argument("--queryable", type=int, choices=[0, 1], help="Z_FEATURE_QUERYABLE (0 or 1)") + parser.add_argument("--query", type=int, choices=[0, 1], help="Z_FEATURE_QUERY (0 or 1)") + + exit_status = 0 + args = parser.parse_args() + print(f"Args value, pub:{args.pub}, sub:{args.sub}, queryable:{args.queryable}, query:{args.query}") + + # Test pub and sub examples + if pub_and_sub(args) == 1: + exit_status = 1 + # Test query and queryable examples + if query_and_queryable(args) == 1: + exit_status = 1 + # Exit + sys.exit(exit_status) \ No newline at end of file diff --git a/zenohpico.pc b/zenohpico.pc index bcc1e5d18..e08e8cce2 100644 --- a/zenohpico.pc +++ b/zenohpico.pc @@ -3,6 +3,6 @@ prefix=/usr/local Name: zenohpico Description: URL: -Version: 0.11.20231019dev +Version: 0.11.20231031dev Cflags: -I${prefix}/include Libs: -L${prefix}/lib -lzenohpico