diff options
author | Rickard Green <[email protected]> | 2019-07-11 19:44:38 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2019-07-22 11:08:40 +0200 |
commit | dda4dc0da4b89431a202b58427431de50c269861 (patch) | |
tree | 260097c10c04d3758312cde5acb17e3bcf42f500 /erts/emulator/test | |
parent | 158c7475c1d4251ed2eed0d425e887bcd06a6ad6 (diff) | |
download | otp-dda4dc0da4b89431a202b58427431de50c269861.tar.gz otp-dda4dc0da4b89431a202b58427431de50c269861.tar.bz2 otp-dda4dc0da4b89431a202b58427431de50c269861.zip |
Node container refc test for persistent terms
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/node_container_SUITE.erl | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/erts/emulator/test/node_container_SUITE.erl b/erts/emulator/test/node_container_SUITE.erl index 300b4ed036..0a90ae8e93 100644 --- a/erts/emulator/test/node_container_SUITE.erl +++ b/erts/emulator/test/node_container_SUITE.erl @@ -51,7 +51,8 @@ unique_pid/1, iter_max_procs/1, magic_ref/1, - dist_entry_gc/1]). + dist_entry_gc/1, + persistent_term/1]). suite() -> [{ct_hooks,[ts_install_cth]}, @@ -63,7 +64,8 @@ all() -> node_table_gc, dist_link_refc, dist_monitor_refc, node_controller_refc, ets_refc, match_spec_refc, timer_refc, pid_wrap, port_wrap, bad_nc, - unique_pid, iter_max_procs, magic_ref]. + unique_pid, iter_max_procs, + magic_ref, persistent_term]. init_per_suite(Config) -> Config. @@ -896,6 +898,44 @@ magic_ref(Config) when is_list(Config) -> true = erts_debug:get_internal_state({magic_ref,MRef2}), ok. +persistent_term(Config) when is_list(Config) -> + {ok, Node} = start_node(get_nodefirstname()), + Self = self(), + NcData = make_ref(), + RPid = spawn_link(Node, + fun () -> + Self ! {NcData, self(), hd(erlang:ports()), erlang:make_ref()} + end), + Data = receive + {NcData, RPid, RPort, RRef} -> + {RPid, RPort, RRef} + end, + unlink(RPid), + stop_node(Node), + Stuff = lists:foldl(fun (N, Acc) -> + persistent_term:put({?MODULE, N}, Data), + persistent_term:erase({?MODULE, N-1}), + node_container_refc_check(node()), + Data = persistent_term:get({?MODULE, N}), + try + persistent_term:get({?MODULE, N-1}) + catch + error:badarg -> + ok + end, + case N rem 4 of + 0 -> [persistent_term:get({?MODULE, N})|Acc]; + _ -> Acc + end + end, + [], + lists:seq(1, 100)), + persistent_term:erase({?MODULE, 100}), + receive after 2000 -> ok end, %% give literal gc some time to run... + node_container_refc_check(node()), + id(Stuff), + ok. + lost_pending_connection(Node) -> _ = (catch erts_internal:new_connection(Node)), |