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:
parent
00c21e2f8c
commit
1ff9f7f631
@ -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];
|
||||
|
||||
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user