diff --git a/tests/gnrc_tcp/tests/05-garbage-pkts.py b/tests/gnrc_tcp/tests/05-garbage-pkts.py index ce92a22c637be..955758ee212ac 100755 --- a/tests/gnrc_tcp/tests/05-garbage-pkts.py +++ b/tests/gnrc_tcp/tests/05-garbage-pkts.py @@ -7,6 +7,7 @@ # directory for more details. import base64 +import pexpect import os import socket import sys @@ -96,6 +97,17 @@ def test_short_header(child, src_if, src_ll, dst_if, dst_l2, dst_ll, dst_port): @testfunc def test_send_ack_instead_of_syn(child, src_if, src_ll, dst_if, dst_l2, dst_ll, dst_port): + # check if entering _event_loop in `@testfunc` decorator generates debug + # output + debug = child.expect([pexpect.TIMEOUT, 'GNRC_TCP'], timeout=1) + # with debug output the node can be overwhelmed by packets + output + if debug: + count = 10 + else: + count = 1000 + + print(debug) + print(count) # see https://github.com/RIOT-OS/RIOT/pull/12001 provided_data = base64.b64decode("rwsQf2pekYLaU+exUBBwgPDKAAA=") tcp_hdr = TCP(provided_data) @@ -103,7 +115,7 @@ def test_send_ack_instead_of_syn(child, src_if, src_ll, # set destination port to application specific port tcp_hdr.dport = dst_port sendp(Ether(dst=dst_l2) / IPv6(src=src_ll, dst=dst_ll) / tcp_hdr, - iface=src_if, verbose=0, count=1000) + iface=src_if, verbose=0, count=count) # check if server actually still works with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as sock: @@ -140,7 +152,7 @@ def test_option_parsing_term(child, src_if, src_ll, if type(getattr(script, t)).__name__ == "function" and t.startswith("test_")] for test in tests: - res = run(test, timeout=10, echo=False) + res = run(test, timeout=10, echo=True) if res != 0: sys.exit(res) print(os.path.basename(sys.argv[0]) + ": success\n")