Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update z_api_alignment_test for compatiblity with zenoh-c build #296

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions tests/z_api_alignment_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <unistd.h>
#endif

// This only one line which can be different between zenoh-c and zenoh-pico instances of this file
// TODO: make the files completely identical
#include "zenoh-pico.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are also failing because the ZENOH_PICO checked before its definition in zenoh-pico.h include


#define SLEEP 2
Expand Down Expand Up @@ -121,7 +123,9 @@ void data_handler(const z_sample_t *sample, void *arg) {
}

int main(int argc, char **argv) {
#ifdef ZENOH_PICO
assert_eq(argc, 2);
#endif
(void)(argc);
setvbuf(stdout, NULL, _IOLBF, 1024);

Expand Down Expand Up @@ -215,9 +219,9 @@ int main(int argc, char **argv) {
assert(hellos >= 1);

uint32_t _scouting_timeout = strtoul(SCOUTING_TIMEOUT, NULL, 10);
z_sleep_ms(_scouting_timeout);
sleep(_scouting_timeout / 1000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Zenoh-Pico/Zenoh-C we should better use z_sleep_* and avoid using platform-specific syscalls.
However, those functions are still missing in Zenoh-C (see eclipse-zenoh/zenoh-c#183).
Nevertheless, they are present in Zenoh-Pico, so better keep them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But as far as I understand, the idea is for the files to be identical in both repos, do you think adding a #define here would be reasonable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that the additional functions shall be added in zenoh-c, as referred by @Mallets.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sure, but until we have no them in zenohc, api alignment test on them has no sense.

printf("Ok\n");
z_sleep_s(SLEEP);
sleep(SLEEP);

z_owned_session_t s1 = z_open(z_move(_ret_config));
assert(z_check(s1));
Expand All @@ -234,11 +238,13 @@ int main(int argc, char **argv) {
sleep(SLEEP);
assert_eq(zids, 0);

#ifdef ZENOH_PICO // zenoh-c test has no router
_ret_int8 = z_info_routers_zid(z_loan(s1), z_move(_ret_closure_zid));
assert_eq(_ret_int8, 0);

sleep(SLEEP);
assert_eq(zids, 1);
#endif

#ifdef ZENOH_PICO
zp_task_read_options_t _ret_read_opt = zp_task_read_options_default();
Expand Down