semctl01: wait for children to exit between tests

This testcase occasionally hanged:
 semctl01    1  TPASS  :  buf.sem_nsems and buf.sem_perm.mode are correct
 semctl01    2  TPASS  :  buf.sem_perm.mode is correct
 semctl01    3  TPASS  :  semaphores have expected values
 semctl01    4  TPASS  :  number of sleeping processes is correct
 semctl01    5  TPASS  :  last pid value is correct
 semctl01    6  TPASS  :  semaphore value is correct
 semctl01    7  TBROK  :  semctl01.c:338: semop succeeded - cnt_setup
<hangs here>

because semop in GETZCNT test unexpectedly suceeded. All children
are supposed to block here, because semval is not zero.

Problem is that semctl01 sends SIGKILL to children from previous
test (GETNCNT), but it doesn't wait for them to finish. Then it
proceeds to increase semval for GETZCNT test and one child from
previous test, which is still blocked on sem_op == -1 for SEM4
and has not exited yet, will decrease semval to 0. This breaks
GETZCNT test, child unexpectedly completes and becomes zombie.
Parent process then waits forever in TST_PROCESS_STATE_WAIT()
for state to be 'S' - sleeping.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Wanlong Gao <wanlong.gao@gmail.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
1 file changed