tests/pthread_barrier: improve test script

Add intermediate child.expect to avoid timeout on platforms
where time between `start` and `done` is a little over 10s.
This commit is contained in:
Francisco Molina 2019-11-21 09:57:53 +01:00
parent 00c21e2f8c
commit 1ff9f7f631
2 changed files with 8 additions and 3 deletions

View File

@ -56,7 +56,8 @@ int main(void)
{
random_init(RAND_SEED);
puts("START\n");
printf("NUM_CHILDREN: %d, NUM_ITERATIONS: %d\n", NUM_CHILDREN,
NUM_ITERATIONS);
pthread_barrier_init(&barrier, NULL, NUM_CHILDREN);
pthread_t children[NUM_CHILDREN];

View File

@ -5,9 +5,13 @@ from testrunner import run
def testfunc(child):
child.expect('START')
for i in range(4):
child.expect(r'NUM_CHILDREN: (\d+), NUM_ITERATIONS: (\d+)')
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')