Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Dec 13, 2024
1 parent a703475 commit 2f3e16b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
20 changes: 9 additions & 11 deletions examples/unix/c11/z_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,15 @@

#if Z_FEATURE_LIVELINESS == 1

static volatile int keepRunning = 1;
/*
void intHandler(int dummy) {
(void)dummy;
keepRunning = 0;
}
*/
int main(int argc, char **argv) {
const char *keyexpr = "group1/zenoh-pico";
const char *mode = "client";
const char *clocator = NULL;
const char *llocator = NULL;
unsigned int timeout = 0;

int opt;
while ((opt = getopt(argc, argv, "k:e:m:l:")) != -1) {
while ((opt = getopt(argc, argv, "k:e:m:l:t:")) != -1) {
switch (opt) {
case 'k':
keyexpr = optarg;
Expand All @@ -48,8 +42,12 @@ int main(int argc, char **argv) {
case 'l':
llocator = optarg;
break;
case 't':
timeout = atoi(optarg);
break;
case '?':
if (optopt == 'k' || optopt == 'e' || optopt == 'm' || optopt == 'v' || optopt == 'l') {
if (optopt == 'k' || optopt == 'e' || optopt == 'm' || optopt == 'v' || optopt == 'l' ||
optopt == 't') {
fprintf(stderr, "Option -%c requires an argument.\n", optopt);
} else {
fprintf(stderr, "Unknown option `-%c'.\n", optopt);
Expand Down Expand Up @@ -98,8 +96,8 @@ int main(int argc, char **argv) {
}

printf("Press CTRL-C to undeclare liveliness token and quit...\n");
// signal(SIGINT, intHandler);
while (keepRunning) {
z_clock_t clock = z_clock_now();
while (timeout == 0 || z_clock_elapsed_s(&clock) < timeout) {
z_sleep_s(1);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/memory_leak.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def query_and_queryable(query_cmd, queryable_cmd):
z_query_process.wait()

print(f"Stop {queryable_cmd}")
time.sleep(2)
time.sleep(10)
if z_queryable_process.poll() is None:
# send SIGINT to group
z_quaryable_process_gid = os.getpgid(z_queryable_process.pid)
Expand Down Expand Up @@ -178,7 +178,7 @@ def query_and_queryable(query_cmd, queryable_cmd):
# EXIT_STATUS = 1
# Test liveliness query
print("*** Get liveliness test ***")
if query_and_queryable('z_get_liveliness', 'z_liveliness') == 1:
if query_and_queryable('z_get_liveliness', 'z_liveliness -t 5') == 1:
EXIT_STATUS = 1
# Test liveliness subscriber
print("*** Liveliness subscriber test ***")
Expand Down

0 comments on commit 2f3e16b

Please sign in to comment.