diff options
author | Björn Gustavsson <[email protected]> | 2017-06-13 07:10:39 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-06-13 12:21:48 +0200 |
commit | 0725fe8296204a61f3dbc57142bfd458a45dd547 (patch) | |
tree | 851226493801170f3d75dc5e40cdca02f30a89cf /erts/emulator/test/z_SUITE.erl | |
parent | c75bc0ef433caa42cebcd8e3c8dd7a5f0c4fd408 (diff) | |
download | otp-0725fe8296204a61f3dbc57142bfd458a45dd547.tar.gz otp-0725fe8296204a61f3dbc57142bfd458a45dd547.tar.bz2 otp-0725fe8296204a61f3dbc57142bfd458a45dd547.zip |
Add informational test case z_SUITE:leaked_processes/1
Add z_SUITE:leaked_processes/1 to print the process information for
all new processes created during execution of the emulator test
suite. Test cases are not supposed leak processes, because that
could disturb later test cases.
Diffstat (limited to 'erts/emulator/test/z_SUITE.erl')
-rw-r--r-- | erts/emulator/test/z_SUITE.erl | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/erts/emulator/test/z_SUITE.erl b/erts/emulator/test/z_SUITE.erl index a2b267543f..feea7432a9 100644 --- a/erts/emulator/test/z_SUITE.erl +++ b/erts/emulator/test/z_SUITE.erl @@ -36,7 +36,8 @@ -export([schedulers_alive/1, node_container_refc_check/1, long_timers/1, pollset_size/1, - check_io_debug/1, get_check_io_info/0]). + check_io_debug/1, get_check_io_info/0, + leaked_processes/1]). suite() -> [{ct_hooks,[ts_install_cth]}, @@ -44,7 +45,10 @@ suite() -> all() -> [schedulers_alive, node_container_refc_check, - long_timers, pollset_size, check_io_debug]. + long_timers, pollset_size, check_io_debug, + %% Make sure that the leaked_processes/1 is always + %% run last. + leaked_processes]. %%% %%% The test cases ------------------------------------------------------------- @@ -285,6 +289,31 @@ has_gethost([P|T]) -> has_gethost([]) -> false. +leaked_processes(Config) when is_list(Config) -> + %% Replace the defualt timetrap with a timetrap with + %% known pid. + test_server:timetrap_cancel(), + Dog = test_server:timetrap(test_server:minutes(5)), + + Name = leaked_processes__process_holder, + Name ! {get_initial_processes, self()}, + receive + {initial_processes, Initial0} -> ok + end, + Initial = ordsets:from_list(Initial0), + + KnownPids = ordsets:from_list([self(),Dog]), + Now0 = ordsets:from_list(processes()), + Now = ordsets:subtract(Now0, KnownPids), + Leaked = ordsets:subtract(Now, Initial), + + _ = [begin + Info = process_info(P) ++ process_info(P, [current_stacktrace]), + io:format("~p: ~p\n", [P,Info]) + end || P <- Leaked], + Comment = lists:flatten(io_lib:format("~p process(es)", + [length(Leaked)])), + {comment, Comment}. %% %% Internal functions... |