Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'sverk/test-cuddling' into maint

* sverk/test-cuddling:
  stdlib: Remove race in ets_SUITE:delete_large_tab
  stdlib: Remove race in ets_SUITE:delete_large_named_table
  • Loading branch information...
commit 2e658b94a047d3333284159ac74fde74b51c5182 2 parents bec7094 + 3fcaed8
@sverker sverker authored
Showing with 12 additions and 8 deletions.
  1. +12 −8 lib/stdlib/test/ets_SUITE.erl
View
20 lib/stdlib/test/ets_SUITE.erl
@@ -3218,6 +3218,7 @@ delete_large_tab_1(Name, Flags, Data, Fix) ->
end
end,
0),
+ SchedTracerMon = monitor(process, SchedTracer),
?line Loopers = start_loopers(erlang:system_info(schedulers),
Prio,
fun (_) -> erlang:yield() end,
@@ -3237,12 +3238,14 @@ delete_large_tab_1(Name, Flags, Data, Fix) ->
N >= 5 -> ?line ok;
true -> ?line ?t:fail()
end
- end.
+ end,
+ receive {'DOWN',SchedTracerMon,process,SchedTracer,_} -> ok end,
+ ok.
delete_large_named_table(doc) ->
"Delete a large name table and try to create a new table with the same name in another process.";
delete_large_named_table(Config) when is_list(Config) ->
- ?line Data = [{erlang:phash2(I, 16#ffffff),I} || I <- lists:seq(1, 500000)],
+ ?line Data = [{erlang:phash2(I, 16#ffffff),I} || I <- lists:seq(1, 200000)],
?line EtsMem = etsmem(),
repeat_for_opts(fun(Opts) -> delete_large_named_table_do(Opts,Data) end),
?line verify_etsmem(EtsMem),
@@ -3264,16 +3267,17 @@ delete_large_named_table_1(Name, Flags, Data, Fix) ->
?line lists:foreach(fun({K,_}) -> ets:delete(Tab, K) end, Data)
end,
Parent = self(),
- Pid = my_spawn_link(fun() ->
- receive
- {trace,Parent,call,_} ->
- ets_new(Name, [named_table])
- end
- end),
+ {Pid, MRef} = my_spawn_opt(fun() ->
+ receive
+ {trace,Parent,call,_} ->
+ ets_new(Name, [named_table])
+ end
+ end, [link, monitor]),
?line erlang:trace(self(), true, [call,{tracer,Pid}]),
?line erlang:trace_pattern({ets,delete,1}, true, [global]),
?line erlang:yield(), true = ets:delete(Tab),
?line erlang:trace_pattern({ets,delete,1}, false, [global]),
+ receive {'DOWN',MRef,process,Pid,_} -> ok end,
ok.
evil_delete(doc) ->
Please sign in to comment.
Something went wrong with that request. Please try again.