Skip to content

Commit

Permalink
tests: modularize failure mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Sep 13, 2024
1 parent c700d61 commit e1c18c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/memory_leak.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
NO_LEAK_OUTPUT = "All heap blocks were freed -- no leaks are possible"


def failure_mode():
def failure_mode(fail_cmd):
test_status = 0
# Start binary
print("Start binary")
z_pub_command = f"stdbuf -oL -eL valgrind ./{DIR_EXAMPLES}/z_pub -m peer"
z_pub_command = f"stdbuf -oL -eL valgrind ./{DIR_EXAMPLES}/" + fail_cmd
z_pub_process = subprocess.Popen(
z_pub_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
)
Expand Down Expand Up @@ -157,7 +157,7 @@ def query_and_queryable(query_cmd, queryable_cmd):

# Test failure mode
print("*** Failure mode ***")
if failure_mode() == 1:
if failure_mode(f'z_pub -m peer') == 1:
EXIT_STATUS = 1
# Test pub and sub examples
print("*** Pub & sub test ***")
Expand Down

0 comments on commit e1c18c4

Please sign in to comment.