diff options
author | Filipe Brandenburger <filbranden@google.com> | 2014-12-25 11:40:46 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-12-25 11:55:12 -0500 |
commit | 0289a5bcb5eec84783f771e634ccafe5a2e4936c (patch) | |
tree | 0a9202591aadb6c1c7c5b55bb97cc59bbbfbc22b /src/initctl | |
parent | e50221bf1ae8bc8e14f242efa4c9d26b7a47639b (diff) |
test: wait for cloned thread to exit
In test_raw_clone, make sure the cloned thread calls _exit() and in the parent
thread call waitpid(..., __WCLONE) to wait for the child thread to terminate,
otherwise there is a race condition where the child thread will log to the
console after the test process has already exited and the assertion from the
child thread might not be enforced.
The absence of this patch might also create problems for other tests that would
be added after this one, since potentially both parent and child would run
those tests as the child would continue running.
Tested by confirming that the logs from the child are printed before the test
terminates and that a false assertion in the child aborts the test with a core
dump.
[zj: also add check for the return value.]
Diffstat (limited to 'src/initctl')
0 files changed, 0 insertions, 0 deletions