1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
RIOT/tests/pthread_barrier/tests/01-run.py
Francisco Molina 3db9eab6d9 tests: expect match \r\n or \s
- Since `printf()` is buffered it might not arrive in a single
  read to pexpect. Regex which terminate in a group match might
  match only some elements, this might break tests that depend
  on exact group matching.
2019-11-27 14:12:12 +01:00

24 lines
608 B
Python
Executable File

#!/usr/bin/env python3
import sys
from testrunner import run
def testfunc(child):
child.expect(r'NUM_CHILDREN: (\d+), NUM_ITERATIONS: (\d+)\r\n')
children = int(child.match.group(1))
iterations = int(child.match.group(2))
for i in range(children):
child.expect('Start {}'.format(i + 1))
for _ in range(children * iterations):
child.expect(r'Child \d sleeps for [" "\d]+ us.')
child.expect('Done 2')
child.expect('Done 1')
child.expect('Done 3')
child.expect('Done 4')
child.expect('SUCCESS')
if __name__ == "__main__":
sys.exit(run(testfunc))