test: fix race condition on exit

Since exit_status is now enabled by default, a test would occasionally
fail depending on how quickly the message was received from the port.
Fix by waiting for the exit_status event to be received.
This commit is contained in:
Michael Santos
2014-11-27 15:50:30 -05:00
parent 965df0c21f
commit 97f6e6187d

View File

@@ -211,12 +211,12 @@ setopt(#state{pid = Drv}) ->
event(#state{pid = Drv}) ->
{ok, Fork} = alcove:fork(Drv),
Reply0 = alcove:exit(Drv, [Fork], 0),
Reply1 = alcove:event(Drv, [Fork]),
Reply1 = alcove:event(Drv, [Fork], 5000),
Reply2 = alcove:event(Drv, [], 5000),
[
?_assertEqual(ok, Reply0),
?_assertEqual(false, Reply1),
?_assertEqual({exit_status,0}, Reply1),
?_assertMatch({signal,_}, Reply2)
].