diff options
author | Sverker Eriksson <[email protected]> | 2015-12-03 15:32:38 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2015-12-07 18:02:52 +0100 |
commit | 75ef9b7cae7533fb9be7953ac72f743b055d2a7a (patch) | |
tree | baf6ad2b2fc883d1fbcf22ea82953db18e8db1bc /erts/emulator/test | |
parent | 6b912d7fdd5fca46dee840b0bfa6a92915c0a093 (diff) | |
download | otp-75ef9b7cae7533fb9be7953ac72f743b055d2a7a.tar.gz otp-75ef9b7cae7533fb9be7953ac72f743b055d2a7a.tar.bz2 otp-75ef9b7cae7533fb9be7953ac72f743b055d2a7a.zip |
erts: Add test for remote exit signal with fat map
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/map_SUITE.erl | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/erts/emulator/test/map_SUITE.erl b/erts/emulator/test/map_SUITE.erl index 6890c42b7a..a256cf4195 100644 --- a/erts/emulator/test/map_SUITE.erl +++ b/erts/emulator/test/map_SUITE.erl @@ -2999,21 +2999,38 @@ id(I) -> I. t_gc_rare_map_overflow(Config) -> Pa = filename:dirname(code:which(?MODULE)), {ok, Node} = test_server:start_node(gc_rare_map_overflow, slave, [{args, "-pa \""++Pa++"\""}]), - Echo = spawn_link(Node, fun Loop() -> receive {From,Msg} -> From ! Msg - end, - Loop() - end), - FatMap = fatmap(34), - false = (flatmap =:= erts_internal:map_type(FatMap)), - - t_gc_rare_map_overflow_do(Echo, FatMap, fun() -> erlang:garbage_collect() end), - - % Repeat test for minor gc: - minor_collect(), % need this to make the next gc really be a minor - t_gc_rare_map_overflow_do(Echo, FatMap, fun() -> true = minor_collect() end), - - unlink(Echo), - test_server:stop_node(Node). + erts_debug:set_internal_state(available_internal_state, true), + try + Echo = spawn_link(Node, fun Loop() -> receive {From,Msg} -> From ! Msg + end, + Loop() + end), + FatMap = fatmap(34), + false = (flatmap =:= erts_internal:map_type(FatMap)), + + t_gc_rare_map_overflow_do(Echo, FatMap, fun() -> erlang:garbage_collect() end), + + %% Repeat test for minor gc: + t_gc_rare_map_overflow_do(Echo, FatMap, fun() -> minor_collect() end), + + unlink(Echo), + + %% Test fatmap in exit signal + Exiter = spawn_link(Node, fun Loop() -> receive {From,Msg} -> + "not_a_map" = Msg % badmatch! + end, + Loop() + end), + process_flag(trap_exit, true), + Exiter ! {self(), FatMap}, + {'EXIT', Exiter, {{badmatch,FatMap}, _}} = receive M -> M end, + ok + + after + process_flag(trap_exit, false), + erts_debug:set_internal_state(available_internal_state, false), + test_server:stop_node(Node) + end. t_gc_rare_map_overflow_do(Echo, FatMap, GcFun) -> Master = self(), @@ -3033,15 +3050,11 @@ t_gc_rare_map_overflow_do(Echo, FatMap, GcFun) -> ok. minor_collect() -> - minor_collect(minor_gcs()). - -minor_collect(Before) -> + Before = minor_gcs(), + erts_debug:set_internal_state(force_gc, self()), + erlang:yield(), After = minor_gcs(), - case After of - _ when After > Before -> true; - _ when After =:= Before -> minor_collect(Before); - 0 -> false - end. + io:format("minor_gcs: ~p -> ~p\n", [Before, After]). minor_gcs() -> {garbage_collection, Info} = process_info(self(), garbage_collection), @@ -3051,7 +3064,7 @@ minor_gcs() -> %% Generate a map with N (or N+1) keys that has an abnormal heap demand. %% Done by finding keys that collide in the first 32-bit hash. fatmap(N) -> - erts_debug:set_internal_state(available_internal_state, true), + %%erts_debug:set_internal_state(available_internal_state, true), Table = ets:new(void, [bag, private]), Seed0 = rand:seed_s(exsplus, {4711, 3141592, 2718281}), |