1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests: gnrc_lwip_udp: remove timing tests from pexpect script

This commit is contained in:
Martine Lenders 2017-10-24 15:20:09 +02:00
parent d76785fc38
commit 970169bc49
No known key found for this signature in database
GPG Key ID: 8E97A9FE55F25D62

View File

@ -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
@ -44,20 +41,8 @@ def testfunc(child):
child.expect_exact(u"Calling test_sock_udp_recv4__EAGAIN()")
child.expect_exact(u"Calling test_sock_udp_recv4__ENOBUFS()")
child.expect_exact(u"Calling test_sock_udp_recv4__ETIMEDOUT()")
child.match # get to ensure program reached that point
start = datetime.now()
child.expect_exact(u" * Calling sock_udp_recv()")
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(u"Calling test_sock_udp_recv4__socketed()")
child.expect_exact(u"Calling test_sock_udp_recv4__socketed_with_remote()")
child.expect_exact(u"Calling test_sock_udp_recv4__unsocketed()")
@ -96,20 +81,8 @@ def testfunc(child):
child.expect_exact(u"Calling test_sock_udp_recv6__EAGAIN()")
child.expect_exact(u"Calling test_sock_udp_recv6__ENOBUFS()")
child.expect_exact(u"Calling test_sock_udp_recv6__ETIMEDOUT()")
child.match # get to ensure program reached that point
start = datetime.now()
child.expect_exact(u" * Calling sock_udp_recv()")
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(u"Calling test_sock_udp_recv6__socketed()")
child.expect_exact(u"Calling test_sock_udp_recv6__socketed_with_remote()")
child.expect_exact(u"Calling test_sock_udp_recv6__unsocketed()")