1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 23:11:19 +01:00
Kees Bakker 370e166f31 tests/thread_msg_seq: better guarantee sequence of output lines
This also changes to expectations of the test script. It does not rely
on fixed thread IDs anymore, because boards with CDC ACM as stdio have
a different first thread then boards with "normal" stdio via UART.

This resolves issue #14256
2020-06-15 21:53:56 +02:00

31 lines
854 B
Python
Executable File

#!/usr/bin/env python3
import sys
from testrunner import run
THREAD_NAMES = ("nr1", "nr2", "nr3")
def testfunc(child):
child.expect_exact("START")
# Collect pids
thread_pids = []
for name in THREAD_NAMES:
child.expect(r"THREAD {} \(pid:(\d+)\) start".format(name))
thread_pids.append(int(child.match.group(1)))
child.expect_exact("THREADS CREATED")
for index, name in enumerate(THREAD_NAMES):
child.expect(r"THREAD {} \(pid:(\d+)\) end.".format(name))
thread_pid = int(child.match.group(1))
assert thread_pid == thread_pids[index]
child.expect(r'Got msg from pid (\d+): "{}"'.format(name))
thread_pid = int(child.match.group(1))
assert thread_pid == thread_pids[index]
child.expect_exact("SUCCESS")
if __name__ == "__main__":
sys.exit(run(testfunc))