Wait until process pid completes and check that the process exit code is exitcode.
test.support/wait_process
wait_process