diff options
author | Sverker Eriksson <[email protected]> | 2010-11-26 15:18:59 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2010-11-26 15:18:59 +0100 |
commit | e64306910f2e0d25c4327068ab02b24270be697d (patch) | |
tree | cb7a8a4d086b8c479744cd11a14c704faf863e27 /erts/emulator/test | |
parent | 8339345b4e7e0b2f6520af9ecf512c7a8e538276 (diff) | |
parent | c5b7477a8873e6fd80fab598a8e63a5006e46621 (diff) | |
download | otp-e64306910f2e0d25c4327068ab02b24270be697d.tar.gz otp-e64306910f2e0d25c4327068ab02b24270be697d.tar.bz2 otp-e64306910f2e0d25c4327068ab02b24270be697d.zip |
Merge branch 'sverker/unsafe_CancelIoEx/OTP-8937' into dev
* sverker/unsafe_CancelIoEx/OTP-8937:
Remove use of unreliable CancelIoEx on Windows.
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/port_SUITE.erl | 24 | ||||
-rw-r--r-- | erts/emulator/test/port_SUITE_data/dead_port.c | 6 |
2 files changed, 25 insertions, 5 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). diff --git a/erts/emulator/test/port_SUITE_data/dead_port.c b/erts/emulator/test/port_SUITE_data/dead_port.c index 6fa77112be..68e96fbf14 100644 --- a/erts/emulator/test/port_SUITE_data/dead_port.c +++ b/erts/emulator/test/port_SUITE_data/dead_port.c @@ -72,14 +72,14 @@ char *argv[]; { int x; if (argc < 2) { - fprintf(stderr,"Usage %s <seconds>\n",argv[0]); + fprintf(stderr,"Usage %s <milliseconds>\n",argv[0]); return 1; } if ((x = atoi(argv[1])) <= 0) { - fprintf(stderr,"Usage %s <seconds>\n",argv[0]); + fprintf(stderr,"Usage %s <milliseconds>\n",argv[0]); return 1; } - delay(x*1000); + delay(x); return 0; } |