aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2011-05-11 14:52:38 +0200
committerRickard Green <[email protected]>2011-05-11 14:52:38 +0200
commit116deb98aa1309039d06530de3351feec1163c3f (patch)
tree34e98231f345dec4992d22fdb5068a943842a524 /erts/emulator/test
parent68fe6a14539b82250373ef114d6576e74e1b8f2e (diff)
parentaeda9e6b3b28849a27b0f4f5386d000e40a198d0 (diff)
downloadotp-116deb98aa1309039d06530de3351feec1163c3f.tar.gz
otp-116deb98aa1309039d06530de3351feec1163c3f.tar.bz2
otp-116deb98aa1309039d06530de3351feec1163c3f.zip
Merge branch 'rickard/gc-other/OTP-9211' into dev
* rickard/gc-other/OTP-9211: Fix bad assertions Avoid scheduling of processes being garbage collected by others
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/process_SUITE.erl40
1 files changed, 38 insertions, 2 deletions
diff --git a/erts/emulator/test/process_SUITE.erl b/erts/emulator/test/process_SUITE.erl
index 36bae908aa..f68e712268 100644
--- a/erts/emulator/test/process_SUITE.erl
+++ b/erts/emulator/test/process_SUITE.erl
@@ -50,7 +50,8 @@
processes_last_call_trap/1, processes_gc_trap/1,
processes_term_proc_list/1,
otp_7738_waiting/1, otp_7738_suspended/1,
- otp_7738_resume/1]).
+ otp_7738_resume/1,
+ garb_other_running/1]).
-export([prio_server/2, prio_client/2]).
-export([init_per_testcase/2, end_per_testcase/2]).
@@ -72,7 +73,7 @@ all() ->
bad_register, garbage_collect, process_info_messages,
process_flag_badarg, process_flag_heap_size,
spawn_opt_heap_size, otp_6237, {group, processes_bif},
- {group, otp_7738}].
+ {group, otp_7738}, garb_other_running].
groups() ->
[{t_exit_2, [],
@@ -2116,6 +2117,41 @@ otp_7738_test(Type) ->
end,
?line ok.
+gor(Reds, Stop) ->
+ receive
+ {From, reds} ->
+ From ! {reds, Reds, self()},
+ gor(Reds+1, Stop);
+ {From, Stop} ->
+ From ! {stopped, Stop, Reds, self()}
+ after 0 ->
+ gor(Reds+1, Stop)
+ end.
+
+garb_other_running(Config) when is_list(Config) ->
+ ?line Stop = make_ref(),
+ ?line {Pid, Mon} = spawn_monitor(fun () -> gor(0, Stop) end),
+ ?line Reds = lists:foldl(fun (_, OldReds) ->
+ ?line erlang:garbage_collect(Pid),
+ ?line receive after 1 -> ok end,
+ ?line Pid ! {self(), reds},
+ ?line receive
+ {reds, NewReds, Pid} ->
+ ?line true = (NewReds > OldReds),
+ ?line NewReds
+ end
+ end,
+ 0,
+ lists:seq(1, 10000)),
+ ?line receive after 1 -> ok end,
+ ?line Pid ! {self(), Stop},
+ ?line receive
+ {stopped, Stop, StopReds, Pid} ->
+ ?line true = (StopReds > Reds)
+ end,
+ ?line receive {'DOWN', Mon, process, Pid, normal} -> ok end,
+ ?line ok.
+
%% Internal functions
wait_until(Fun) ->