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 2f3e16b commit df21f20
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
3 changes: 1 addition & 2 deletions examples/unix/c11/z_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>

#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -98,7 +97,7 @@ int main(int argc, char **argv) {
printf("Press CTRL-C to undeclare liveliness token and quit...\n");
z_clock_t clock = z_clock_now();
while (timeout == 0 || z_clock_elapsed_s(&clock) < timeout) {
z_sleep_s(1);
z_sleep_ms(100);
}

// LivelinessTokens are automatically closed when dropped
Expand Down
40 changes: 20 additions & 20 deletions tests/memory_leak.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ def query_and_queryable(query_cmd, queryable_cmd):
z_query_process.wait()

print(f"Stop {queryable_cmd}")
time.sleep(10)
time.sleep(5)
if z_queryable_process.poll() is None:
# send SIGINT to group
z_quaryable_process_gid = os.getpgid(z_queryable_process.pid)
# os.killpg(z_quaryable_process_gid, signal.SIGINT)
os.killpg(z_quaryable_process_gid, signal.SIGINT)

# Wait for z_queryable to finish
z_queryable_process.wait()
Expand Down Expand Up @@ -159,31 +159,31 @@ def query_and_queryable(query_cmd, queryable_cmd):
EXIT_STATUS = 0

# Test failure mode
# print("*** Failure mode ***")
# if failure_mode('z_pub -m peer') == 1:
# EXIT_STATUS = 1
print("*** Failure mode ***")
if failure_mode('z_pub -m peer') == 1:
EXIT_STATUS = 1
## Test pub and sub examples
# print("*** Pub & sub test ***")
# if pub_and_sub('z_pub -n 1', 'z_sub -n 1') == 1:
# EXIT_STATUS = 1
# print("*** Pub & sub attachment test ***")
# if pub_and_sub('z_pub_attachment -n 1', 'z_sub_attachment -n 1') == 1:
# EXIT_STATUS = 1
print("*** Pub & sub test ***")
if pub_and_sub('z_pub -n 1', 'z_sub -n 1') == 1:
EXIT_STATUS = 1
print("*** Pub & sub attachment test ***")
if pub_and_sub('z_pub_attachment -n 1', 'z_sub_attachment -n 1') == 1:
EXIT_STATUS = 1
# Test query and queryable examples
# print("*** Query & queryable test ***")
# if query_and_queryable('z_get', 'z_queryable -n 1') == 1:
# EXIT_STATUS = 1
# print("*** Query & queryable attachment test ***")
# if query_and_queryable('z_get_attachment -v Something', 'z_queryable_attachment -n 1') == 1:
# EXIT_STATUS = 1
print("*** Query & queryable test ***")
if query_and_queryable('z_get', 'z_queryable -n 1') == 1:
EXIT_STATUS = 1
print("*** Query & queryable attachment test ***")
if query_and_queryable('z_get_attachment -v Something', 'z_queryable_attachment -n 1') == 1:
EXIT_STATUS = 1
# Test liveliness query
print("*** Get liveliness test ***")
if query_and_queryable('z_get_liveliness', 'z_liveliness -t 5') == 1:
EXIT_STATUS = 1
# Test liveliness subscriber
print("*** Liveliness subscriber test ***")
sys.exit(0)
# if query_and_queryable('z_sub_liveliness -h -n 1', 'z_liveliness') == 1:
# EXIT_STATUS = 1
if query_and_queryable('z_sub_liveliness -h -n 1', 'z_liveliness -t 1') == 1:
EXIT_STATUS = 1
# Exit
# sys.exit(EXIT_STATUS)
sys.exit(EXIT_STATUS)

0 comments on commit df21f20

Please sign in to comment.