diff --git a/tests/lwip_sock_tcp/tests/01-run.py b/tests/lwip_sock_tcp/tests/01-run.py index d024d6494f..d83707dbc4 100755 --- a/tests/lwip_sock_tcp/tests/01-run.py +++ b/tests/lwip_sock_tcp/tests/01-run.py @@ -14,9 +14,6 @@ from datetime import datetime sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner -class InvalidTimeout(Exception): - pass - def _reuse_tests(code): return code & 1 @@ -46,37 +43,15 @@ def testfunc(child): child.expect_exact("Calling test_tcp_accept4__EAGAIN()") child.expect_exact("Calling test_tcp_accept4__EINVAL()") child.expect_exact("Calling test_tcp_accept4__ETIMEDOUT()") - start = datetime.now() child.expect_exact(" * Calling sock_tcp_accept()") - child.expect(u" \\* \\(timed out with timeout (\\d+)\\)") - exp_diff = int(child.match.group(1)) - stop = datetime.now() - diff = (stop - start) - diff = (diff.seconds * 1000000) + diff.microseconds - # fail within 5% of expected - if diff > (exp_diff + (exp_diff * 0.05)) or \ - diff < (exp_diff - (exp_diff * 0.05)): - raise InvalidTimeout("Invalid timeout %d (expected %d)" % (diff, exp_diff)); - else: - print("Timed out correctly: %d (expected %d)" % (diff, exp_diff)) + child.expect(r" \* \(timed out with timeout \d+\)") child.expect_exact("Calling test_tcp_accept4__success()") child.expect_exact("Calling test_tcp_read4__EAGAIN()") child.expect_exact("Calling test_tcp_read4__ECONNRESET()") child.expect_exact("Calling test_tcp_read4__ENOTCONN()") child.expect_exact("Calling test_tcp_read4__ETIMEDOUT()") - start = datetime.now() child.expect_exact(" * Calling sock_tcp_read()") - child.expect(u" \\* \\(timed out with timeout (\\d+)\\)") - exp_diff = int(child.match.group(1)) - stop = datetime.now() - diff = (stop - start) - diff = (diff.seconds * 1000000) + diff.microseconds - # fail within 5% of expected - if diff > (exp_diff + (exp_diff * 0.05)) or \ - diff < (exp_diff - (exp_diff * 0.05)): - raise InvalidTimeout("Invalid timeout %d (expected %d)" % (diff, exp_diff)); - else: - print("Timed out correctly: %d (expected %d)" % (diff, exp_diff)) + child.expect(r" \* \(timed out with timeout \d+\)") child.expect_exact("Calling test_tcp_read4__success()") child.expect_exact("Calling test_tcp_read4__success_with_timeout()") child.expect_exact("Calling test_tcp_read4__success_non_blocking()") @@ -99,37 +74,15 @@ def testfunc(child): child.expect_exact("Calling test_tcp_accept6__EAGAIN()") child.expect_exact("Calling test_tcp_accept6__EINVAL()") child.expect_exact("Calling test_tcp_accept6__ETIMEDOUT()") - start = datetime.now() child.expect_exact(" * Calling sock_tcp_accept()") - child.expect(u" \\* \\(timed out with timeout (\\d+)\\)") - exp_diff = int(child.match.group(1)) - stop = datetime.now() - diff = (stop - start) - diff = (diff.seconds * 1000000) + diff.microseconds - # fail within 5% of expected - if diff > (exp_diff + (exp_diff * 0.05)) or \ - diff < (exp_diff - (exp_diff * 0.05)): - raise InvalidTimeout("Invalid timeout %d (expected %d)" % (diff, exp_diff)); - else: - print("Timed out correctly: %d (expected %d)" % (diff, exp_diff)) + child.expect(r" \* \(timed out with timeout \d+\)") child.expect_exact("Calling test_tcp_accept6__success()") child.expect_exact("Calling test_tcp_read6__EAGAIN()") child.expect_exact("Calling test_tcp_read6__ECONNRESET()") child.expect_exact("Calling test_tcp_read6__ENOTCONN()") child.expect_exact("Calling test_tcp_read6__ETIMEDOUT()") - start = datetime.now() child.expect_exact(" * Calling sock_tcp_read()") - child.expect(u" \\* \\(timed out with timeout (\\d+)\\)") - exp_diff = int(child.match.group(1)) - stop = datetime.now() - diff = (stop - start) - diff = (diff.seconds * 1000000) + diff.microseconds - # fail within 5% of expected - if diff > (exp_diff + (exp_diff * 0.05)) or \ - diff < (exp_diff - (exp_diff * 0.05)): - raise InvalidTimeout("Invalid timeout %d (expected %d)" % (diff, exp_diff)); - else: - print("Timed out correctly: %d (expected %d)" % (diff, exp_diff)) + child.expect(r" \* \(timed out with timeout \d+\)") child.expect_exact("Calling test_tcp_read6__success()") child.expect_exact("Calling test_tcp_read6__success_with_timeout()") child.expect_exact("Calling test_tcp_read6__success_non_blocking()")