aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/driver_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-11-20 17:30:25 +0100
committerSverker Eriksson <[email protected]>2018-11-20 17:30:25 +0100
commitbde3ec5d818d1948e8a0008a22bcb2e247ce3cc6 (patch)
treeac39bee800f8c535fc02e645a04de453b1b73d3e /erts/emulator/test/driver_SUITE.erl
parentc0812d51fbb550d4a53df128e4ec322746f015ca (diff)
downloadotp-bde3ec5d818d1948e8a0008a22bcb2e247ce3cc6.tar.gz
otp-bde3ec5d818d1948e8a0008a22bcb2e247ce3cc6.tar.bz2
otp-bde3ec5d818d1948e8a0008a22bcb2e247ce3cc6.zip
erts: Improve driver_SUITE:smp_select
to better detect an actual missing ready_input event on slow machines (valgrind) and without wasting time with long sleep on fast machines.
Diffstat (limited to 'erts/emulator/test/driver_SUITE.erl')
-rw-r--r--erts/emulator/test/driver_SUITE.erl17
1 files changed, 16 insertions, 1 deletions
diff --git a/erts/emulator/test/driver_SUITE.erl b/erts/emulator/test/driver_SUITE.erl
index 6f5d639d04..bd62708aa7 100644
--- a/erts/emulator/test/driver_SUITE.erl
+++ b/erts/emulator/test/driver_SUITE.erl
@@ -1754,7 +1754,7 @@ smp_select0(Config) ->
ProcFun = fun()-> io:format("Worker ~p starting\n",[self()]),
Port = open_port({spawn, DrvName}, []),
smp_select_loop(Port, 100000),
- sleep(1000), % wait for driver to handle pending events
+ smp_select_done(Port),
true = erlang:port_close(Port),
Master ! {ok,self()},
io:format("Worker ~p finished\n",[self()])
@@ -1784,6 +1784,21 @@ smp_select_loop(Port, N) ->
smp_select_loop(Port, N-1)
end.
+smp_select_done(Port) ->
+ case erlang:port_control(Port, ?CHKIO_SMP_SELECT, "done") of
+ "wait" ->
+ receive
+ {Port, done} ->
+ ok
+ after 10*1000 ->
+ %% Seems we have a lost ready_input event.
+ %% Go ahead anyway, port will crash VM when closed.
+ ok
+ end;
+
+ "ok" -> ok
+ end.
+
smp_select_wait([], _) ->
ok;
smp_select_wait(Pids, TimeoutMsg) ->