diff options
author | Björn-Egil Dahlberg <[email protected]> | 2010-12-30 17:48:36 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2010-12-30 17:48:36 +0100 |
commit | bcbe0813a0b97f86a7db354e09bf0397cf68f787 (patch) | |
tree | 22d5d112515692f3af2ae645ee77dbf22ad6f536 /lib/erl_interface | |
parent | 384b85a75212cf73253f901a8c88d4286a5962ba (diff) | |
download | otp-bcbe0813a0b97f86a7db354e09bf0397cf68f787.tar.gz otp-bcbe0813a0b97f86a7db354e09bf0397cf68f787.tar.bz2 otp-bcbe0813a0b97f86a7db354e09bf0397cf68f787.zip |
Fix testcases erl_global_whereis, erl_global_names
Enable erl_global_whereis and erl_global names.
Diffstat (limited to 'lib/erl_interface')
-rw-r--r-- | lib/erl_interface/test/erl_global_SUITE.erl | 20 | ||||
-rw-r--r-- | lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c | 4 | ||||
-rw-r--r-- | lib/erl_interface/test/port_call_SUITE.erl | 2 |
3 files changed, 18 insertions, 8 deletions
diff --git a/lib/erl_interface/test/erl_global_SUITE.erl b/lib/erl_interface/test/erl_global_SUITE.erl index 9826e47d55..4f332037c6 100644 --- a/lib/erl_interface/test/erl_global_SUITE.erl +++ b/lib/erl_interface/test/erl_global_SUITE.erl @@ -31,7 +31,7 @@ -define(GLOBAL_NAME, global_register_node_test). all(suite) -> - [erl_global_registration]. + [erl_global_registration, erl_global_whereis, erl_global_names]. init_per_testcase(_Case, Config) -> Dog = ?t:timetrap(?t:minutes(0.25)), @@ -59,7 +59,7 @@ erl_global_whereis(Config) when is_list(Config) -> ?line {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0), ?line Self = self(), - ?line global:register_name(?GLOBAL_NAME, Self), + ?line yes = global:register_name(?GLOBAL_NAME, Self), ?line Self = erl_global_whereis(P, Fd, ?GLOBAL_NAME), ?line global:unregister_name(?GLOBAL_NAME), ?line 0 = erl_close_connection(P, Fd), @@ -73,14 +73,16 @@ erl_global_names(Config) when is_list(Config) -> ?line Self = self(), ?line global:register_name(?GLOBAL_NAME, Self), - ?line {[?GLOBAL_NAME], 1} = erl_global_names(P, Fd), + ?line {Names1, _N1} = erl_global_names(P, Fd), + ?line true = lists:member(atom_to_list(?GLOBAL_NAME), Names1), ?line global:unregister_name(?GLOBAL_NAME), + ?line {Names2, _N2} = erl_global_names(P, Fd), + ?line false = lists:member(atom_to_list(?GLOBAL_NAME), Names2), ?line 0 = erl_close_connection(P, Fd), ?line runner:send_eot(P), ?line runner:recv_eot(P), ok. - %%% Interface functions for erl_interface functions. erl_connect(P, Node, Num, Cookie, Creation) -> @@ -102,11 +104,17 @@ erl_global_register(P, Fd, Name) -> erl_global_whereis(P, Fd, Name) -> send_command(P, erl_global_whereis, [Fd,Name]), - get_send_result(P). + case get_term(P) of + {term, What} -> + What + end. erl_global_names(P, Fd) -> send_command(P, erl_global_names, [Fd]), - get_send_result(P). + case get_term(P) of + {term, What} -> + What + end. erl_global_unregister(P, Fd, Name) -> send_command(P, erl_global_unregister, [Fd,Name]), diff --git a/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c b/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c index fc698ca0c4..dc0d8a0091 100644 --- a/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c +++ b/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c @@ -46,8 +46,8 @@ static struct { "erl_connect", 4, cmd_erl_connect, "erl_close_connection", 1, cmd_erl_close_connection, "erl_global_register", 2, cmd_erl_global_register, - "erl_global_whereis", 1, cmd_erl_global_whereis, - "erl_global_names", 0, cmd_erl_global_names, + "erl_global_whereis", 2, cmd_erl_global_whereis, + "erl_global_names", 1, cmd_erl_global_names, "erl_global_unregister", 2, cmd_erl_global_unregister, }; diff --git a/lib/erl_interface/test/port_call_SUITE.erl b/lib/erl_interface/test/port_call_SUITE.erl index 895e29ad2e..2c550e4c0c 100644 --- a/lib/erl_interface/test/port_call_SUITE.erl +++ b/lib/erl_interface/test/port_call_SUITE.erl @@ -42,6 +42,8 @@ all(suite) -> basic(suite) -> []; basic(Config) when is_list(Config) -> case os:type() of + {unix, linux} -> + do_basic(Config); {unix, sunos} -> do_basic(Config); {win32,_} -> |