aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/port_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2010-11-17 19:40:42 +0100
committerSverker Eriksson <[email protected]>2010-11-24 11:57:31 +0100
commitc5b7477a8873e6fd80fab598a8e63a5006e46621 (patch)
tree334f4933f178548233def9444a5b080e50d3bbd4 /erts/emulator/test/port_SUITE.erl
parentb48be79573171e530d97cdf078488eb66fc23f30 (diff)
downloadotp-c5b7477a8873e6fd80fab598a8e63a5006e46621.tar.gz
otp-c5b7477a8873e6fd80fab598a8e63a5006e46621.tar.bz2
otp-c5b7477a8873e6fd80fab598a8e63a5006e46621.zip
Remove use of unreliable CancelIoEx on Windows.
CancelIoEx has been seen to cause problems with some drivers. Also improve fallback solution to reuse existing handle-closer-threads.
Diffstat (limited to 'erts/emulator/test/port_SUITE.erl')
-rw-r--r--erts/emulator/test/port_SUITE.erl24
1 files changed, 22 insertions, 2 deletions
diff --git a/erts/emulator/test/port_SUITE.erl b/erts/emulator/test/port_SUITE.erl
index a7476ca9bb..6d89653623 100644
--- a/erts/emulator/test/port_SUITE.erl
+++ b/erts/emulator/test/port_SUITE.erl
@@ -2308,8 +2308,28 @@ close_deaf_port(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(100)),
?line DataDir = ?config(data_dir, Config),
?line DeadPort = os:find_executable("dead_port", DataDir),
-
?line Port = open_port({spawn,DeadPort++" 60"},[]),
?line erlang:port_command(Port,"Hello, can you hear me!?!?"),
?line port_close(Port),
- ok.
+
+ close_deaf_port_1(0, DeadPort).
+
+close_deaf_port_1(1000, _) ->
+ ok;
+close_deaf_port_1(N, Cmd) ->
+ Timeout = integer_to_list(random:uniform(10*1000)),
+ try open_port({spawn,Cmd++" "++Timeout},[]) of
+ Port ->
+ ?line erlang:port_command(Port,"Hello, can you hear me!?!?"),
+ ?line port_close(Port),
+ close_deaf_port_1(N+1, Cmd)
+ catch
+ exit:eagain ->
+ {comment, "Could not spawn more than " ++ integer_to_list(N) ++ " OS processes."}
+ end.
+
+
+repeat(0, _) -> ok;
+repeat(Cnt, Fun) ->
+ Fun(),
+ repeat(Cnt-1, Fun).