diff options
Diffstat (limited to 'erts/emulator/test/send_term_SUITE.erl')
-rw-r--r-- | erts/emulator/test/send_term_SUITE.erl | 139 |
1 files changed, 69 insertions, 70 deletions
diff --git a/erts/emulator/test/send_term_SUITE.erl b/erts/emulator/test/send_term_SUITE.erl index ed70d14a1b..6f14963e9d 100644 --- a/erts/emulator/test/send_term_SUITE.erl +++ b/erts/emulator/test/send_term_SUITE.erl @@ -35,10 +35,10 @@ all() -> basic(Config) when is_list(Config) -> Drv = "send_term_drv", - ?line P = start_driver(Config, Drv), + P = start_driver(Config, Drv), - ?line [] = term(P, 0), - ?line Self = self(), + [] = term(P, 0), + Self = self(), {blurf,42,[],[-42,{}|"abc"++P],"kalle",3.1416,Self,#{}} = term(P, 1), Map41 = maps:from_list([{blurf, 42}, @@ -52,36 +52,36 @@ basic(Config) when is_list(Config) -> {3.1416, Self}, {#{}, blurf}]), Map42 = term(P, 42), - ?line Deep = lists:seq(0, 199), - ?line Deep = term(P, 2), - ?line {B1,B2} = term(P, 3), - ?line B1 = list_to_binary(lists:seq(0, 255)), - ?line B2 = list_to_binary(lists:seq(23, 255-17)), + Deep = lists:seq(0, 199), + Deep = term(P, 2), + {B1,B2} = term(P, 3), + B1 = list_to_binary(lists:seq(0, 255)), + B2 = list_to_binary(lists:seq(23, 255-17)), %% Pid sending. We need another process. - ?line Child = spawn_link(fun() -> + Child = spawn_link(fun() -> erlang:port_command(P, [4]) end), - ?line {Self,Child} = receive_any(), + {Self,Child} = receive_any(), %% ERL_DRV_EXT2TERM - ?line ExpectExt2Term = expected_ext2term_drv(proplists:get_value(data_dir, Config)), - ?line ExpectExt2Term = term(P, 5), + ExpectExt2Term = expected_ext2term_drv(proplists:get_value(data_dir, Config)), + ExpectExt2Term = term(P, 5), %% ERL_DRV_INT, ERL_DRV_UINT - ?line case erlang:system_info({wordsize, external}) of + case erlang:system_info({wordsize, external}) of 4 -> - ?line {-1, 4294967295} = term(P, 6); + {-1, 4294967295} = term(P, 6); 8 -> - ?line {-1, 18446744073709551615} = term(P, 6) + {-1, 18446744073709551615} = term(P, 6) end, %% ERL_DRV_BUF2BINARY - ?line ExpectedBinTup = {<<>>, + ExpectedBinTup = {<<>>, <<>>, list_to_binary(lists:duplicate(17,17)), list_to_binary(lists:duplicate(1024,17))}, - ?line ExpectedBinTup = term(P, 7), + ExpectedBinTup = term(P, 7), %% single terms Singles = [{[], 8}, % ERL_DRV_NIL @@ -116,34 +116,34 @@ basic(Config) when is_list(Config) -> {-20233590931456, 38}, % ERL_DRV_INT64 {-9223372036854775808, 39}, {#{}, 40}], % ERL_DRV_MAP - ?line {Terms, Ops} = lists:unzip(Singles), - ?line Terms = term(P,Ops), + {Terms, Ops} = lists:unzip(Singles), + Terms = term(P,Ops), AFloat = term(P, 26), % ERL_DRV_FLOAT - ?line true = AFloat < 0.001, - ?line true = AFloat > -0.001, + true = AFloat < 0.001, + true = AFloat > -0.001, %% Failure cases. - ?line [] = term(P, 127), - ?line receive + [] = term(P, 127), + receive Any -> ct:fail("Unexpected: ~p\n", [Any]) after 0 -> ok end, - ?line ok = chk_temp_alloc(), + ok = chk_temp_alloc(), %% In a private heap system, verify that there are no binaries %% left for the process. - ?line erlang:garbage_collect(), %Get rid of binaries. + erlang:garbage_collect(), %Get rid of binaries. case erlang:system_info(heap_type) of private -> - ?line {binary,[]} = process_info(self(), binary); + {binary,[]} = process_info(self(), binary); _ -> ok end, - ?line stop_driver(P, Drv), + stop_driver(P, Drv), ok. term(P, Op) -> @@ -159,22 +159,22 @@ chk_temp_alloc() -> case erlang:system_info({allocator,temp_alloc}) of false -> %% Temp alloc is not enabled - ?line ok; + ok; TIL -> %% Verify that we havn't got anything allocated by temp_alloc lists:foreach( fun ({instance, _, TI}) -> - ?line {value, {mbcs, MBCInfo}} + {value, {mbcs, MBCInfo}} = lists:keysearch(mbcs, 1, TI), - ?line {value, {blocks, 0, _, _}} + {value, {blocks, 0, _, _}} = lists:keysearch(blocks, 1, MBCInfo), - ?line {value, {sbcs, SBCInfo}} + {value, {sbcs, SBCInfo}} = lists:keysearch(sbcs, 1, TI), - ?line {value, {blocks, 0, _, _}} + {value, {blocks, 0, _, _}} = lists:keysearch(blocks, 1, SBCInfo) end, TIL), - ?line ok + ok end. @@ -194,7 +194,7 @@ load_driver(Dir, Driver) -> end. stop_driver(Port, Name) -> - ?line true = erlang:port_close(Port), + true = erlang:port_close(Port), receive {Port,Message} -> ct:fail({strange_message_from_port,Message}) @@ -204,7 +204,7 @@ stop_driver(Port, Name) -> %% Unload the driver. ok = erl_ddll:unload_driver(Name), - ?line ok = erl_ddll:stop(). + ok = erl_ddll:stop(). get_external_terms(DataDir) -> {ok, Bin} = file:read_file([DataDir, "ext_terms.bin"]), @@ -236,37 +236,36 @@ generate_external_terms_files(BaseDir) -> RPort = hd(rpc:call(Node, erlang, ports, [])), true = is_port(RPort), slave:stop(Node), - Terms = - [{4711, -4711, [an_atom, "a list"]}, - [1000000000000000000000,-1111111111111111, "blupp!", blipp], - {RPid, {RRef, RPort}, self(), hd(erlang:ports()), make_ref()}, - {{}, [], [], fun () -> ok end, <<"hej hopp trallalaaaaaaaaaaaaaaa">>}, - [44444444444444444444444,-44444444444, "b!", blippppppp], - {4711, RPid, {RRef, RPort}, -4711, [an_atom, "a list"]}, - {RPid, {RRef, RPort}, hd(processes()), hd(erlang:ports())}, - {4711, -4711, [an_atom, "a list"]}, - {4711, -4711, [atom, "list"]}, - {RPid, {RRef, RPort}, hd(processes()), hd(erlang:ports())}, - {4444444444444444444,-44444, {{{{{{{{{{{{}}}}}}}}}}}}, make_ref()}, - {444444444444444444444,-44444, [[[[[[[[[[[1]]]]]]]]]]], make_ref()}, - {444444444444444444,-44444, {{{{{{{{{{{{2}}}}}}}}}}}}, make_ref()}, - {4444444444444444444444,-44444, {{{{{{{{{{{{3}}}}}}}}}}}}, make_ref()}, - {44444444444444444444,-44444, {{{{{{{{{{{{4}}}}}}}}}}}}, make_ref()}, - {4444444444444444,-44444, [[[[[[[[[[[5]]]]]]]]]]], make_ref()}, - {444444444444444444444,-44444, {{{{{{{{{{{{6}}}}}}}}}}}}, make_ref()}, - {444444444444444,-44444, {{{{{{{{{{{{7}}}}}}}}}}}}, make_ref()}, - {4444444444444444444,-44444, {{{{{{{{{{{{8}}}}}}}}}}}}, make_ref()}, - #{}, - #{1 => 11, 2 => 22, 3 => 33}, - maps:from_list([{K,K*11} || K <- lists:seq(1,100)])], + Terms = [{4711, -4711, [an_atom, "a list"]}, + [1000000000000000000000,-1111111111111111, "blupp!", blipp], + {RPid, {RRef, RPort}, self(), hd(erlang:ports()), make_ref()}, + {{}, [], [], fun () -> ok end, <<"hej hopp trallalaaaaaaaaaaaaaaa">>}, + [44444444444444444444444,-44444444444, "b!", blippppppp], + {4711, RPid, {RRef, RPort}, -4711, [an_atom, "a list"]}, + {RPid, {RRef, RPort}, hd(processes()), hd(erlang:ports())}, + {4711, -4711, [an_atom, "a list"]}, + {4711, -4711, [atom, "list"]}, + {RPid, {RRef, RPort}, hd(processes()), hd(erlang:ports())}, + {4444444444444444444,-44444, {{{{{{{{{{{{}}}}}}}}}}}}, make_ref()}, + {444444444444444444444,-44444, [[[[[[[[[[[1]]]]]]]]]]], make_ref()}, + {444444444444444444,-44444, {{{{{{{{{{{{2}}}}}}}}}}}}, make_ref()}, + {4444444444444444444444,-44444, {{{{{{{{{{{{3}}}}}}}}}}}}, make_ref()}, + {44444444444444444444,-44444, {{{{{{{{{{{{4}}}}}}}}}}}}, make_ref()}, + {4444444444444444,-44444, [[[[[[[[[[[5]]]]]]]]]]], make_ref()}, + {444444444444444444444,-44444, {{{{{{{{{{{{6}}}}}}}}}}}}, make_ref()}, + {444444444444444,-44444, {{{{{{{{{{{{7}}}}}}}}}}}}, make_ref()}, + {4444444444444444444,-44444, {{{{{{{{{{{{8}}}}}}}}}}}}, make_ref()}, + #{}, + #{1 => 11, 2 => 22, 3 => 33}, + maps:from_list([{K,K*11} || K <- lists:seq(1,100)])], ok = file:write_file(filename:join([BaseDir, - "send_term_SUITE_data", - "ext_terms.bin"]), - term_to_binary(Terms, [compressed])), + "send_term_SUITE_data", + "ext_terms.bin"]), + term_to_binary(Terms, [compressed])), {ok, IoDev} = file:open(filename:join([BaseDir, - "send_term_SUITE_data", - "ext_terms.h"]), - [write]), + "send_term_SUITE_data", + "ext_terms.h"]), + [write]), write_ext_terms_h(IoDev, Terms), file:close(IoDev). @@ -276,12 +275,12 @@ write_ext_terms_h(IoDev, Terms) -> io:format(IoDev, "#define EXT_TERMS_H__~n",[]), {ExtTerms, MaxSize} = make_ext_terms(Terms), io:format(IoDev, - "static struct {~n" - " unsigned char ext[~p];~n" - " int ext_size;~n" - " unsigned char cext[~p];~n" - " int cext_size;~n" - "} ext_terms[] = {~n",[MaxSize, MaxSize]), + "static struct {~n" + " unsigned char ext[~p];~n" + " int ext_size;~n" + " unsigned char cext[~p];~n" + " int cext_size;~n" + "} ext_terms[] = {~n",[MaxSize, MaxSize]), E = write_ext_terms_h(IoDev, ExtTerms, 0), io:format(IoDev, "};~n",[]), io:format(IoDev, "#define NO_OF_EXT_TERMS ~p~n", [E]), |