Skip to content

Commit

Permalink
Fix CI failures (#394)
Browse files Browse the repository at this point in the history
* add support for qos settings in sample

* - silence cpp compiler regading compound literals and type conversions,
- add missing dots in docs

* fix _z_qos_t definition and doc

* fix z_qos_t definition and doc

* - replace binary literals (non-core C) with hexadecimal ones
- replace _z_n_qos_unmake with _z_n_qos_unmake_public in subscription.c

* make _z_n_qos_unmake static inline to prevent linking errors

* fix format

* reduce qos size to 1 byte; use getters to extract individual qos settings

* fix _z_n_qos_make to no longer use compund literals to avoid warnings from zenoh-cpp

* fix z_qos_default() signature

* Add Flipper platform (#351)

* Add Flipper platform

* Fix warnings and other platform builds

* move z_n_qos_t related functions into .c (to hide designated initializers from c++)

* z_sample_t docs update to include qos

* move qos functions back to header and remove usage of designated initializers

* format

* fix: Bump sphinx doc build dep to `7.2.6` (#361)

* replac zp_ prefix for platform functions that are also available in zenoh-c

* fix format

* replace zp_ prefix with z_ for zp_random_u64

* put back previously removed zp_ functions as deprecated

* added missing new line at the end of the file

* typo fix

* move deprecated platform header to a separate folder

* Add config endpoint in raweth locator (#364)

* feat: add ethtype to reth endpoint config

* feat: type renaming

* fix: remove unused macro call

* feat: remove static raweth config

* feat: use defines for separators

* feat: add mapping function

* fix: add default raweth mapping

* feat: add debug traces on raweth config  parsing

* fix: ethtype validity test

* fix: strtok parsing calls

* chore: clang-format

* fix: include first mapping entry in lookup

* fix: appease the tyran codacy

* Fix bug reading from ws (#370)

* Expose timeout option in z_get_options_t (#375)

* Expose timeout option in z_get_options_t

* Add default get timeout

* Align examples and remove reading from stdin (#359)

* Remove reading from stdin, align example implementations

* Update examples tests

* Adjust z_sub_thr output

* Fix z_get single query examples

* Replace pthread uses with z_mutex and z_condvar

* Add multi-thread feature condition to z_get examples

* Update error message for features absence

* Update z_get expected output in modularity test

* Update sample count for freertos single-thread examples

* fix: remove unused variable warning (#379)

* Changing references to zenoh:master to zenoh:main. (#381)

* correct unsigned atomic in refcount.h (#382)

* Fix refcount cast (#384)

* Fix esp32 CI (#386)

* fix: const discard warning

* build: fix platformio dependency check

* Serial timeout (#383)

* correct unsigned atomic in refcount.h

* made espidf freertos compatible with timeout on read

---------

Co-authored-by: Luca Cominardi <[email protected]>

* Run clang-format (#388)

* Fix misra violations (#390)

* chore: run clang format

* fix: misra issues

* ci: Allow building zenoh from arbitrary branch in build-check workflow (#389)

* ci: Allow building Zenoh from arbitrary branch in build-check workflow

* Update other jobs

---------

Co-authored-by: OlivierHecart <[email protected]>

* build: point ci to zenoh protocol_changes branch

* fix: check declare <I> flag at declare level

* fix: missing function prototype warning

* build: switch zenoh branch to interests

* fix: ignore unknown final interest

* fix: missing argument in tigger_local_subs

* fix: add wait join step in z_pub for raweth testing

* fix: raweth memory leaks

* feat: add message number option to z_sub

* fix: null malloc when cloning rc list

* doc: remove obsolete types

* fix: encoding option made fragment test fail

* fix: replace all deprecated system calls

* fix: improve raweth test stability

---------

Co-authored-by: Denis Biryukov <[email protected]>
Co-authored-by: Alexander <[email protected]>
Co-authored-by: Michael Ilyin <[email protected]>
Co-authored-by: Mahmoud Mazouz <[email protected]>
Co-authored-by: OlivierHecart <[email protected]>
Co-authored-by: Alexander <[email protected]>
Co-authored-by: oteffahi <[email protected]>
Co-authored-by: Geoff Martin <[email protected]>
Co-authored-by: Lieven <[email protected]>
Co-authored-by: Luca Cominardi <[email protected]>
Co-authored-by: OlivierHecart <[email protected]>
  • Loading branch information
12 people authored Apr 5, 2024
1 parent 084b087 commit 265405d
Show file tree
Hide file tree
Showing 182 changed files with 2,905 additions and 1,683 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/arduino_esp32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
mkdir -p $ARDUINO_BASE
cd $ARDUINO_BASE
platformio init -b esp32thing_plus --project-option="build_flags=-DZ_FEATURE_LINK_BLUETOOTH=1 -DZENOH_DEBUG=3 -DZENOH_COMPILER_GCC"
platformio init -b esp32thing_plus -O "build_flags=-DZ_FEATURE_LINK_BLUETOOTH=1 -DZENOH_DEBUG=3 -DZENOH_COMPILER_GCC" -O "lib_ldf_mode=deep+"
cd $ARDUINO_BASE/lib
ln -s $ZENOH_PICO_BASE
Expand Down
83 changes: 65 additions & 18 deletions .github/workflows/build-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,25 @@ jobs:
sudo apt install -y ninja-build
FORCE_C99=ON CMAKE_GENERATOR=Ninja make
zenoh_build:
name: Build Zenoh from source
runs-on: ubuntu-latest
outputs:
artifact-name: ${{ steps.main.outputs.artifact-name }}
steps:
- id: main
name: Build Zenoh
uses: eclipse-zenoh/ci/build-crates-standalone@main
with:
repo: eclipse-zenoh/zenoh
branch: interests
artifact-patterns: |
^zenohd$
^libzenoh_plugin_rest.so$
^libzenoh_plugin_storage_manager.so$
modular_build:
needs: zenoh_build
name: Modular build on ubuntu-latest
runs-on: ubuntu-latest
strategy:
Expand All @@ -67,8 +85,19 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Run docker image
run: docker run --name zenoh_router --init --net host -d eclipse/zenoh:latest
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}

- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone

- id: run-zenoh
name: Run Zenoh router
run: |
RUST_LOG=debug ./zenoh-standalone/zenohd &
echo "zenohd-pid=$!" >> $GITHUB_OUTPUT
- name: Build project
run: |
Expand All @@ -82,11 +111,9 @@ jobs:
Z_FEATURE_QUERYABLE: ${{ matrix.feature_queryable }}
Z_FEATURE_QUERY: ${{ matrix.feature_query }}

- name: Stop docker image
- name: Kill Zenoh router
if: always()
run: |
docker stop zenoh_router
docker rm zenoh_router
run: kill ${{ steps.run-zenoh.outputs.zenohd-pid }}

raweth_build:
name: Build and test raweth transport on ubuntu-latest
Expand All @@ -108,14 +135,26 @@ jobs:
Z_FEATURE_RAWETH_TRANSPORT: ${{ matrix.feature_reth }}

st_build:
needs: zenoh_build
name: Build and test in single thread on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run docker image
run: docker run --name zenoh_router --init --net host -d eclipse/zenoh:latest
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}

- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone

- id: run-zenoh
name: Run Zenoh router
run: |
RUST_LOG=debug ./zenoh-standalone/zenohd &
echo "zenohd-pid=$!" >> $GITHUB_OUTPUT
- name: Build project and run test
run: |
Expand All @@ -126,21 +165,31 @@ jobs:
env:
Z_FEATURE_MULTI_THREAD: 0

- name: Stop docker image
- name: Kill Zenoh router
if: always()
run: |
docker stop zenoh_router
docker rm zenoh_router
run: kill ${{ steps.run-zenoh.outputs.zenohd-pid }}

fragment_test:
needs: zenoh_build
name: Test multicast and unicast fragmentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run docker image
run: docker run --name zenoh_router --init --net host -d eclipse/zenoh:latest
- name: Download Zenoh artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.zenoh_build.outputs.artifact-name }}

- name: Unzip Zenoh artifacts
run: unzip ${{ needs.zenoh_build.outputs.artifact-name }} -d zenoh-standalone

- id: run-zenoh
name: Run Zenoh router
run: |
RUST_LOG=debug ./zenoh-standalone/zenohd &
echo "zenohd-pid=$!" >> $GITHUB_OUTPUT
- name: Build project and run test
run: |
Expand All @@ -150,8 +199,6 @@ jobs:
python3 ./build/tests/fragment.py
timeout-minutes: 5

- name: Stop docker image
- name: Kill Zenoh router
if: always()
run: |
docker stop zenoh_router
docker rm zenoh_router
run: kill ${{ steps.run-zenoh.outputs.zenohd-pid }}
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ target_include_directories(${Libname} PUBLIC ${PROJECT_SOURCE_DIR}/include)
file(GLOB_RECURSE Sources
"src/api/*.c"
"src/collections/*.c"
"src/deprecated/*.c"
"src/link/*.c"
"src/net/*.c"
"src/protocol/*.c"
Expand Down
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Z_FEATURE_SUBSCRIPTION?=1
Z_FEATURE_QUERY?=1
Z_FEATURE_QUERYABLE?=1
Z_FEATURE_ATTACHMENT?=1
Z_FEATURE_INTEREST?=0
Z_FEATURE_INTEREST?=1
Z_FEATURE_RAWETH_TRANSPORT?=0

# zenoh-pico/ directory
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,15 @@ The simplest way to run some of the example is to get a Docker image of the **ze
### 3.1. Starting the Zenoh Router
Assuming you've pulled the Docker image of the **zenoh** router on a Linux host (to leverage UDP multicast scouting as explained [here](https://zenoh.io/docs/getting-started/quick-test/#run-zenoh-router-in-a-docker-container), then simply do:
```bash
$ docker run --init --net host eclipse/zenoh:master
$ docker run --init --net host eclipse/zenoh:main
```

To see the zenoh manual page, simply do:
```bash
$ docker run --init --net host eclipse/zenoh:master --help
$ docker run --init --net host eclipse/zenoh:main --help
```

:warning: **Please notice that the `--net host` option in Docker is restricted to Linux only.**
:warning: **Please notice that the `--net host` option in Docker is restricted to Linux only.**
The cause is that Docker doesn't support UDP multicast between a container and its host (see cases [moby/moby#23659](https://github.com/moby/moby/issues/23659), [moby/libnetwork#2397](https://github.com/moby/libnetwork/issues/2397) or [moby/libnetwork#552](https://github.com/moby/libnetwork/issues/552)). The only known way to make it work is to use the `--net host` option that is [only supported on Linux hosts](https://docs.docker.com/network/host/).

### 3.2. Basic Pub/Sub Example
Expand Down Expand Up @@ -385,7 +385,7 @@ where `lo0` is the network interface you want to use for multicast communication
### 3.4. Basic Pub/Sub Example - Mixing Client and P2P communication
To allow Zenoh-Pico unicast clients to talk to Zenoh-Pico multicast peers, as well as with any other Zenoh client/peer, you need to start a Zenoh Router that listens on both multicast and unicast:
```bash
$ docker run --init --net host eclipse/zenoh:master -l udp/224.0.0.123:7447#iface=lo0 -l tcp/127.0.0.1:7447
$ docker run --init --net host eclipse/zenoh:main -l udp/224.0.0.123:7447#iface=lo0 -l tcp/127.0.0.1:7447
```

Assuming that (1) you are running the **zenoh** router as indicated above, and (2) you are under the build directory, do:
Expand Down
11 changes: 0 additions & 11 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Enums
.. autocenum:: constants.h::z_reply_tag_t
.. autocenum:: constants.h::z_congestion_control_t
.. autocenum:: constants.h::z_priority_t
.. autocenum:: constants.h::z_submode_t
.. autocenum:: constants.h::z_query_target_t

Data Structures
Expand All @@ -45,13 +44,11 @@ Data Structures
.. autoctype:: types.h::z_config_t
.. autoctype:: types.h::z_session_t
.. autoctype:: types.h::z_subscriber_t
.. autoctype:: types.h::z_pull_subscriber_t
.. autoctype:: types.h::z_publisher_t
.. autoctype:: types.h::z_queryable_t
.. autoctype:: types.h::z_encoding_t
.. autoctype:: types.h::z_value_t
.. autoctype:: types.h::z_subscriber_options_t
.. autoctype:: types.h::z_pull_subscriber_options_t
.. autoctype:: types.h::z_query_consolidation_t
.. autoctype:: types.h::z_publisher_options_t
.. autoctype:: types.h::z_queryable_options_t
Expand Down Expand Up @@ -118,10 +115,6 @@ To check if ``val`` is still valid, you may use ``z_X_check(&val)`` or ``z_check
A zenoh-allocated :c:type:`z_subscriber_t`.

.. c:type:: z_owned_pull_subscriber_t
A zenoh-allocated :c:type:`z_pull_subscriber_t`.

.. c:type:: z_owned_publisher_t
A zenoh-allocated :c:type:`z_publisher_t`.
Expand Down Expand Up @@ -239,10 +232,6 @@ Primitives
.. autocfunction:: primitives.h::z_subscriber_options_default
.. autocfunction:: primitives.h::z_declare_subscriber
.. autocfunction:: primitives.h::z_undeclare_subscriber
.. autocfunction:: primitives.h::z_pull_subscriber_options_default
.. autocfunction:: primitives.h::z_declare_pull_subscriber
.. autocfunction:: primitives.h::z_undeclare_pull_subscriber
.. autocfunction:: primitives.h::z_subscriber_pull
.. autocfunction:: primitives.h::z_queryable_options_default
.. autocfunction:: primitives.h::z_declare_queryable
.. autocfunction:: primitives.h::z_undeclare_queryable
Expand Down
8 changes: 4 additions & 4 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx==4.5.0
sphinx_c_autodoc
sphinx_rtd_theme
clang==14
sphinx==7.2.6
sphinx_c_autodoc==1.3.0
sphinx_rtd_theme==2.0.0
clang==14.0
3 changes: 1 addition & 2 deletions examples/arduino/z_pub.ino
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void setup() {
}

void loop() {
delay(1000);
char buf[256];
sprintf(buf, "[%4d] %s", idx++, VALUE);
Serial.print("Writing Data ('");
Expand All @@ -105,8 +106,6 @@ void loop() {
if (z_publisher_put(z_publisher_loan(&pub), (const uint8_t *)buf, strlen(buf), NULL) < 0) {
Serial.println("Error while publishing data");
}

delay(1000);
}
#else
void setup() {
Expand Down
2 changes: 1 addition & 1 deletion examples/arduino/z_queryable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void setup() {
delay(300);
}

void loop() { delay(5000); }
void loop() { delay(1000); }

#else
void setup() {
Expand Down
2 changes: 1 addition & 1 deletion examples/arduino/z_sub.ino
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void setup() {
delay(300);
}

void loop() { delay(5000); }
void loop() { delay(1000); }

#else
void setup() {
Expand Down
2 changes: 1 addition & 1 deletion examples/espidf/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void app_main() {
printf("Zenoh setup finished!\n");

while (1) {
sleep(5);
sleep(1);
}

printf("Closing Zenoh Session...");
Expand Down
2 changes: 1 addition & 1 deletion examples/espidf/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void app_main() {
printf("OK!\n");

while (1) {
sleep(5);
sleep(1);
}

printf("Closing Zenoh Session...");
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void app_main(void) {
}

while (1) {
zp_sleep_s(5);
z_sleep_s(5);
printf("Sending Query '%s'...\n", KEYEXPR);
z_get_options_t opts = z_get_options_default();
if (strcmp(VALUE, "") != 0) {
Expand Down
6 changes: 3 additions & 3 deletions examples/freertos_plus_tcp/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void app_main(void) {
static StackType_t read_task_stack[1000];
static StaticTask_t read_task_buffer;

zp_task_attr_t read_task_attr = {
z_task_attr_t read_task_attr = {
.name = "ZenohReadTask",
.priority = 10,
.stack_depth = 1000,
Expand All @@ -62,7 +62,7 @@ void app_main(void) {
static StackType_t lease_task_stack[1000];
static StaticTask_t lease_task_buffer;

zp_task_attr_t lease_task_attr = {
z_task_attr_t lease_task_attr = {
.name = "ZenohLeaseTask",
.priority = 10,
.stack_depth = 1000,
Expand All @@ -89,7 +89,7 @@ void app_main(void) {

char *buf = (char *)pvPortMalloc(256);
for (int idx = 0; 1; ++idx) {
zp_sleep_s(1);
z_sleep_s(1);
snprintf(buf, 256, "[%4d] %s", idx, VALUE);
printf("Putting Data ('%s': '%s')...\n", KEYEXPR, buf);

Expand Down
9 changes: 5 additions & 4 deletions examples/freertos_plus_tcp/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#define KEYEXPR "demo/example/zenoh-pico-pub"
#define VALUE "[FreeRTOS-Plus-TCP] Pub from Zenoh-Pico!"
#define N 2147483647 // max int value by default

void app_main(void) {
z_owned_config_t config = z_config_default();
Expand All @@ -53,15 +54,15 @@ void app_main(void) {
}

char *buf = (char *)pvPortMalloc(256);
zp_clock_t now = zp_clock_now();
for (int idx = 0; 1;) {
if (zp_clock_elapsed_ms(&now) > 1000) {
z_clock_t now = z_clock_now();
for (int idx = 0; idx < N;) {
if (z_clock_elapsed_ms(&now) > 1000) {
snprintf(buf, 256, "[%4d] %s", idx, VALUE);
printf("Putting Data ('%s': '%s')...\n", KEYEXPR, buf);
z_publisher_put(z_loan(pub), (const uint8_t *)buf, strlen(buf), NULL);
++idx;

now = zp_clock_now();
now = z_clock_now();
}

zp_read(z_loan(s), NULL);
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void app_main(void) {
// }

// while (1) {
// zp_sleep_s(5);
// z_sleep_s(5);
// printf("Pulling data from '%s'...\n", KEYEXPR);
// z_subscriber_pull(z_loan(sub));
// }
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void app_main(void) {
}

while (1) {
zp_sleep_s(1);
z_sleep_s(1);
}

// Clean up
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void app_main(void) {
}

while (1) {
zp_sleep_s(5);
z_sleep_s(1);
}

z_undeclare_queryable(z_move(qable));
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void app_main(void) {
}

while (1) {
zp_sleep_s(5);
z_sleep_s(1);
}

z_undeclare_subscriber(z_move(sub));
Expand Down
Loading

0 comments on commit 265405d

Please sign in to comment.