aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/system_profile_SUITE.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2016-04-15 12:26:47 +0200
committerBjörn-Egil Dahlberg <[email protected]>2016-04-15 12:26:47 +0200
commit8d2ea920456c5db3f123ebc19b8b8e398db2e2d5 (patch)
treee269654e6506c4c3c1d0a53fb261ee30caf3ec8c /erts/emulator/test/system_profile_SUITE.erl
parentf3c2071cc0bbe776f1d301d4fc346c1d261c1533 (diff)
parent0fc3412387a889663f55515f123f1168e8f66be2 (diff)
downloadotp-8d2ea920456c5db3f123ebc19b8b8e398db2e2d5.tar.gz
otp-8d2ea920456c5db3f123ebc19b8b8e398db2e2d5.tar.bz2
otp-8d2ea920456c5db3f123ebc19b8b8e398db2e2d5.zip
Merge branch 'egil/erts/fix-erlang-system_profile/ERL-126/OTP-13494'
* egil/erts/fix-erlang-system_profile/ERL-126/OTP-13494: erts: Enhance system_profile tests erts: Don't use function location when process is terminating
Diffstat (limited to 'erts/emulator/test/system_profile_SUITE.erl')
-rw-r--r--erts/emulator/test/system_profile_SUITE.erl32
1 files changed, 30 insertions, 2 deletions
diff --git a/erts/emulator/test/system_profile_SUITE.erl b/erts/emulator/test/system_profile_SUITE.erl
index a56b394765..2e359b11ce 100644
--- a/erts/emulator/test/system_profile_SUITE.erl
+++ b/erts/emulator/test/system_profile_SUITE.erl
@@ -27,7 +27,7 @@
system_profile_on_and_off/1,
runnable_procs/1, runnable_ports/1,
dont_profile_profiler/1,
- scheduler/1]).
+ scheduler/1, sane_location/1]).
-export([profiler_process/1, ring_loop/1, port_echo_start/0,
list_load/0, run_load/2]).
@@ -40,7 +40,8 @@ suite() ->
all() ->
[system_profile_on_and_off, runnable_procs,
- runnable_ports, scheduler, dont_profile_profiler].
+ runnable_ports, scheduler, dont_profile_profiler,
+ sane_location].
%% No specification clause needed for an init function in a conf case!!!
@@ -183,6 +184,33 @@ dont_profile_profiler(Config) when is_list(Config) ->
exit(Pid,kill),
ok.
+%% Check sane location (of exits)
+sane_location(Config) when is_list(Config) ->
+ Check = spawn_link(fun() -> flush_sane_location() end),
+ erlang:system_profile(Check, [runnable_procs]),
+ Me = self(),
+ Pids = [spawn_link(fun() -> wat(Me) end) || _ <- lists:seq(1,100)],
+ [receive {Pid,ok} -> ok end || Pid <- Pids],
+ Check ! {Me, done},
+ receive {Check,ok} -> ok end,
+ ok.
+
+wat(Pid) ->
+ Pid ! {self(), ok}.
+
+flush_sane_location() ->
+ receive
+ {profile,_,_,{M,F,A},_} when is_atom(M), is_atom(F),
+ is_integer(A) ->
+ flush_sane_location();
+ {profile,_,_,0,_} ->
+ flush_sane_location();
+ {Pid,done} when is_pid(Pid) ->
+ Pid ! {self(), ok};
+ M ->
+ ct:fail({badness,M})
+ end.
+
%%% Check scheduler profiling