Skip to content

Commit

Permalink
fix: ci issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Nov 11, 2024
1 parent b59d97d commit 8772aae
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 35 deletions.
8 changes: 4 additions & 4 deletions include/zenoh-pico/net/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
* The query to be answered by a queryable.
*/
typedef struct _z_query_t {
_z_value_t _value;
_z_keyexpr_t _key;
_z_value_t _value;
uint32_t _request_id;
_z_session_rc_t _zn;
_z_bytes_t _attachment;
Expand Down Expand Up @@ -60,13 +60,13 @@ static inline _z_query_t _z_query_alias(_z_value_t *value, _z_keyexpr_t *key, co
_z_session_rc_t *zn, uint32_t request_id, const _z_bytes_t *attachment,
bool anyke) {
return (_z_query_t){
._key = *key,
._value = *value,
._request_id = request_id,
._zn = *zn,
._attachment = *attachment,
._parameters = _z_string_alias_slice(parameters),
._anyke = anyke,
._key = *key,
._attachment = *attachment,
._value = *value,
};
}
void _z_queryable_clear(_z_queryable_t *qbl);
Expand Down
24 changes: 9 additions & 15 deletions include/zenoh-pico/net/reply.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,18 @@ static inline _z_reply_t _z_reply_null(void) { return (_z_reply_t){0}; }
static inline _z_reply_t _z_reply_alias(_z_keyexpr_t *keyexpr, _z_id_t id, const _z_bytes_t *payload,
const _z_timestamp_t *timestamp, _z_encoding_t *encoding, z_sample_kind_t kind,
const _z_bytes_t *attachment) {
_z_reply_t r = {
.data.replier_id = id,
.data._tag = _Z_REPLY_TAG_DATA,
.data._result.sample.keyexpr = *keyexpr,
.data._result.sample.kind = kind,
.data._result.sample.timestamp = *timestamp,
.data._result.sample.payload = *payload,
.data._result.sample.attachment = *attachment,
.data._result.sample.encoding = *encoding,
};
_z_reply_t r;
r.data.replier_id = id;
r.data._tag = _Z_REPLY_TAG_DATA;
r.data._result.sample = _z_sample_alias(keyexpr, payload, timestamp, encoding, kind, _Z_N_QOS_DEFAULT, attachment,
Z_RELIABILITY_DEFAULT);
return r;
}
static inline _z_reply_t _z_reply_err_alias(const _z_bytes_t *payload, _z_encoding_t *encoding) {
_z_reply_t r = {
.data._tag = _Z_REPLY_TAG_ERROR,
.data._result.error.payload = *payload,
.data._result.error.encoding = *encoding,
};
_z_reply_t r;
r.data._tag = _Z_REPLY_TAG_ERROR;
r.data._result.error.payload = *payload;
r.data._result.error.encoding = *encoding;
return r;
}
_z_reply_t _z_reply_move(_z_reply_t *src_reply);
Expand Down
17 changes: 9 additions & 8 deletions include/zenoh-pico/net/sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,19 @@ static inline bool _z_sample_check(const _z_sample_t *sample) {
return _z_keyexpr_check(&sample->keyexpr) || _z_encoding_check(&sample->encoding) ||
_z_bytes_check(&sample->payload) || _z_bytes_check(&sample->attachment);
}
static inline _z_sample_t _z_sample_alias(_z_keyexpr_t *key, _z_bytes_t *payload, const _z_timestamp_t *timestamp,
_z_encoding_t *encoding, const z_sample_kind_t kind, const _z_qos_t qos,
_z_bytes_t *attachment, z_reliability_t reliability) {
static inline _z_sample_t _z_sample_alias(const _z_keyexpr_t *key, const _z_bytes_t *payload,
const _z_timestamp_t *timestamp, const _z_encoding_t *encoding,
const z_sample_kind_t kind, const _z_qos_t qos, const _z_bytes_t *attachment,
z_reliability_t reliability) {
return (_z_sample_t){
.kind = kind,
.qos = qos,
.reliability = reliability,
.keyexpr = *key,
.encoding = *encoding,
.attachment = *attachment,
.payload = *payload,
.timestamp = *timestamp,
.encoding = *encoding,
.kind = kind,
.qos = qos,
.attachment = *attachment,
.reliability = reliability,
};
}
void _z_sample_move(_z_sample_t *dst, _z_sample_t *src);
Expand Down
4 changes: 3 additions & 1 deletion include/zenoh-pico/net/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ typedef struct _z_session_t {
_z_subscription_rc_list_t *_remote_subscriptions;
#if Z_FEATURE_RX_CACHE == 1
_z_subscription_cache_t _subscription_cache;
_z_queryable_cache_t _queryable_cache;
#endif
#endif

// Session queryables
#if Z_FEATURE_QUERYABLE == 1
_z_session_queryable_rc_list_t *_local_queryable;
#if Z_FEATURE_RX_CACHE == 1
_z_queryable_cache_t _queryable_cache;
#endif
#endif
#if Z_FEATURE_QUERY == 1
_z_pending_query_list_t *_pending_queries;
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/protocol/definitions/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static inline bool _z_n_qos_get_express(_z_n_qos_t n_qos) { return (bool)(n_qos.
#define _z_n_qos_make(express, nodrop, priority) \
_z_n_qos_create((bool)express, nodrop ? Z_CONGESTION_CONTROL_BLOCK : Z_CONGESTION_CONTROL_DROP, \
(z_priority_t)priority)
#define _Z_N_QOS_DEFAULT _z_n_qos_make(0, 0, 5)
#define _Z_N_QOS_DEFAULT ((_z_qos_t){._val = 5})

// RESPONSE FINAL message flags:
// Z Extensions if Z==1 then Zenoh extensions are present
Expand Down
8 changes: 6 additions & 2 deletions src/session/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ z_result_t _z_session_init(_z_session_rc_t *zsrc, _z_id_t *zid) {
zn->_remote_subscriptions = NULL;
#if Z_FEATURE_RX_CACHE == 1
memset(&zn->_subscription_cache, 0, sizeof(zn->_subscription_cache));
memset(&zn->_queryable_cache, 0, sizeof(zn->_queryable_cache));
#endif
#endif
#if Z_FEATURE_QUERYABLE == 1
zn->_local_queryable = NULL;
#if Z_FEATURE_RX_CACHE == 1
memset(&zn->_queryable_cache, 0, sizeof(zn->_queryable_cache));
#endif
#endif
#if Z_FEATURE_QUERY == 1
zn->_pending_queries = NULL;
Expand Down Expand Up @@ -119,11 +121,13 @@ void _z_session_clear(_z_session_t *zn) {
_z_flush_subscriptions(zn);
#if Z_FEATURE_RX_CACHE == 1
_z_subscription_cache_clear(&zn->_subscription_cache);
_z_queryable_cache_clear(&zn->_queryable_cache);
#endif
#endif
#if Z_FEATURE_QUERYABLE == 1
_z_flush_session_queryable(zn);
#if Z_FEATURE_RX_CACHE == 1
_z_queryable_cache_clear(&zn->_queryable_cache);
#endif
#endif
#if Z_FEATURE_QUERY == 1
_z_flush_pending_queries(zn);
Expand Down
10 changes: 6 additions & 4 deletions tests/modularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def pub_and_sub(args):

# Expected z_sub output & status
if args.sub == 1:
z_sub_expected_status = -2
if args.pub == 1:
z_sub_expected_status = 0
z_sub_expected_output = """Opening session...
Declaring Subscriber on 'demo/example/**'...
Press CTRL-C to quit...
Expand All @@ -63,6 +63,7 @@ def pub_and_sub(args):
>> [Subscriber] Received ('demo/example/zenoh-pico-pub': '[ 8] Pub from Pico!')
>> [Subscriber] Received ('demo/example/zenoh-pico-pub': '[ 9] Pub from Pico!')"""
else:
z_sub_expected_status = -2
z_sub_expected_output = """Opening session...
Declaring Subscriber on 'demo/example/**'...
Press CTRL-C to quit..."""
Expand All @@ -72,7 +73,7 @@ def pub_and_sub(args):

print("Start subscriber")
# Start z_sub in the background
z_sub_command = f"stdbuf -oL -eL ./{DIR_EXAMPLES}/z_sub"
z_sub_command = f"stdbuf -oL -eL ./{DIR_EXAMPLES}/z_sub -n 10"
z_sub_process = subprocess.Popen(
z_sub_command,
shell=True,
Expand Down Expand Up @@ -175,14 +176,15 @@ def query_and_queryable(args):

# Expected z_queryable output & status
if args.queryable == 1:
z_queryable_expected_status = -2
if args.query == 1:
z_queryable_expected_status = 0
z_queryable_expected_output = """Opening session...
Creating Queryable on 'demo/example/zenoh-pico-queryable'...
Press CTRL-C to quit...
>> [Queryable handler] Received Query 'demo/example/**'
"""
else:
z_queryable_expected_status = -2
z_queryable_expected_output = """Opening session...
Creating Queryable on 'demo/example/zenoh-pico-queryable'...
Press CTRL-C to quit..."""
Expand All @@ -192,7 +194,7 @@ def query_and_queryable(args):

print("Start queryable")
# Start z_queryable in the background
z_queryable_command = f"stdbuf -oL -eL ./{DIR_EXAMPLES}/z_queryable"
z_queryable_command = f"stdbuf -oL -eL ./{DIR_EXAMPLES}/z_queryable -n 1"
z_queryable_process = subprocess.Popen(
z_queryable_command,
shell=True,
Expand Down

0 comments on commit 8772aae

Please sign in to comment.