diff options
author | Sverker Eriksson <[email protected]> | 2017-08-24 21:53:56 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2017-11-15 20:10:33 +0100 |
commit | 38c70e35b6da2571c7bc90442108fe5d5ddbfad1 (patch) | |
tree | 2e932d8098b97499aed4d1ca151a5c22938a0d81 /lib | |
parent | 966b0f9b4095984abd2c5196d40c4e15d5d1a06c (diff) | |
download | otp-38c70e35b6da2571c7bc90442108fe5d5ddbfad1.tar.gz otp-38c70e35b6da2571c7bc90442108fe5d5ddbfad1.tar.bz2 otp-38c70e35b6da2571c7bc90442108fe5d5ddbfad1.zip |
erl_interface: Add tuple fallback tests
DFLAG_EXPORT_PTR_TAG and DFLAG_BIT_BINARIES
Diffstat (limited to 'lib')
-rw-r--r-- | lib/erl_interface/test/ei_accept_SUITE.erl | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/lib/erl_interface/test/ei_accept_SUITE.erl b/lib/erl_interface/test/ei_accept_SUITE.erl index 8881eb85bd..16eb0901ef 100644 --- a/lib/erl_interface/test/ei_accept_SUITE.erl +++ b/lib/erl_interface/test/ei_accept_SUITE.erl @@ -44,34 +44,31 @@ ei_accept(Config) when is_list(Config) -> io:format("Myname ~p ~n", [Myname]), EINode = list_to_atom("c42@"++Myname), io:format("EINode ~p ~n", [EINode]), + + %% We take this opportunity to also test export-funs and bit-strings + %% with (ugly) tuple fallbacks. + %% Test both toward pending connection and established connection. + RealTerms = [<<1:1>>, fun lists:map/2], + Fallbacks = [{<<128>>,1}, {lists,map}], + Self = self(), - TermToSend= {call, Self, "Test"}, - F= fun() -> - case waitfornode("c42",20) of - true -> - {any, EINode} ! TermToSend, - Self ! sent_ok; - false -> - Self ! never_published - end, - ok - end, - - spawn(F), + Funny = fun() -> hello end, + TermToSend = {call, Self, "Test", Funny, RealTerms}, + TermToGet = {call, Self, "Test", Funny, Fallbacks}, Port = 6543, {ok, ListenFd} = ei_publish(P, Port), + {any, EINode} ! TermToSend, {ok, Fd, _Node} = ei_accept(P, ListenFd), - TermReceived= ei_receive(P, Fd), - io:format("Sent ~p received ~p ~n", [TermToSend, TermReceived]), - TermToSend= TermReceived, - receive - sent_ok -> - ok; - Unknown -> - io:format("~p ~n", [Unknown]) - after 1000 -> - io:format("timeout ~n") - end, + Got1 = ei_receive(P, Fd), + + %% Send again, now without auto-connect + {any, EINode} ! TermToSend, + Got2 = ei_receive(P, Fd), + + io:format("Sent ~p~nExp. ~p~nGot1 ~p~nGot2 ~p~n", [TermToSend, TermToGet, Got1, Got2]), + TermToGet = Got1, + TermToGet = Got2, + runner:finish(P), ok. |