aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/ets_tough_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdlib/test/ets_tough_SUITE.erl')
-rw-r--r--lib/stdlib/test/ets_tough_SUITE.erl57
1 files changed, 28 insertions, 29 deletions
diff --git a/lib/stdlib/test/ets_tough_SUITE.erl b/lib/stdlib/test/ets_tough_SUITE.erl
index 5c2ab4747c..c83c17217b 100644
--- a/lib/stdlib/test/ets_tough_SUITE.erl
+++ b/lib/stdlib/test/ets_tough_SUITE.erl
@@ -25,7 +25,9 @@
-compile([export_all]).
-include_lib("common_test/include/ct.hrl").
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap,{minutes,5}}].
all() ->
[ex1].
@@ -52,34 +54,31 @@ end_per_group(_GroupName, Config) ->
-define(GLOBAL_PARAMS,ets_tough_SUITE_global_params).
init_per_testcase(_Func, Config) ->
- Dog=test_server:timetrap(test_server:seconds(300)),
- [{watchdog, Dog}|Config].
+ Config.
-end_per_testcase(_Func, Config) ->
- Dog=?config(watchdog, Config),
- test_server:timetrap_cancel(Dog),
+end_per_testcase(_Func, _Config) ->
ets:delete(?GLOBAL_PARAMS).
ex1(Config) when is_list(Config) ->
- ?line ets:new(?GLOBAL_PARAMS,[named_table,public]),
- ?line ets:insert(?GLOBAL_PARAMS,{a,set}),
- ?line ets:insert(?GLOBAL_PARAMS,{b,set}),
- ?line ex1_sub(Config),
- ?line ets:insert(?GLOBAL_PARAMS,{a,ordered_set}),
- ?line ets:insert(?GLOBAL_PARAMS,{b,set}),
- ?line ex1_sub(Config),
- ?line ets:insert(?GLOBAL_PARAMS,{a,ordered_set}),
- ?line ets:insert(?GLOBAL_PARAMS,{b,ordered_set}),
- ?line ex1_sub(Config).
-
-
+ ets:new(?GLOBAL_PARAMS,[named_table,public]),
+ ets:insert(?GLOBAL_PARAMS,{a,set}),
+ ets:insert(?GLOBAL_PARAMS,{b,set}),
+ ex1_sub(Config),
+ ets:insert(?GLOBAL_PARAMS,{a,ordered_set}),
+ ets:insert(?GLOBAL_PARAMS,{b,set}),
+ ex1_sub(Config),
+ ets:insert(?GLOBAL_PARAMS,{a,ordered_set}),
+ ets:insert(?GLOBAL_PARAMS,{b,ordered_set}),
+ ex1_sub(Config).
+
+
ex1_sub(Config) ->
{A,B} = prep(Config),
N =
- case ?config(ets_tough_SUITE_iters,Config) of
+ case proplists:get_value(ets_tough_SUITE_iters,Config) of
undefined ->
5000;
Other ->
@@ -94,7 +93,7 @@ ex1_sub(Config) ->
prep(Config) ->
rand:seed(exsplus),
put(dump_ticket,none),
- DumpDir = filename:join(?config(priv_dir,Config), "ets_tough"),
+ DumpDir = filename:join(proplists:get_value(priv_dir,Config), "ets_tough"),
file:make_dir(DumpDir),
put(dump_dir,DumpDir),
process_flag(trap_exit,true),
@@ -188,9 +187,9 @@ operate(dump,A,_B) ->
NewTicket = ddump_next(A,Units,Ticket),
put(dump_ticket,NewTicket),
_Result = case NewTicket of
- done -> done;
- _ -> dump_more
- end,
+ done -> done;
+ _ -> dump_more
+ end,
?DEBUG(io:format("dump ~w (~w)\n",[Units,_Result]));
_ ->
DumpDir = get(dump_dir),
@@ -211,7 +210,7 @@ operate(dump,A,_B) ->
ok
end
end.
-
+
random_operation() ->
Ops = {get,put,erase,dirty_get,dump},
random_element(Ops).
@@ -246,7 +245,7 @@ show_table(N) ->
_ ->
error
end.
-
+
show_entries(Fd) ->
case phys_read_len(Fd) of
{ok,Len} ->
@@ -370,7 +369,7 @@ derase(ServerPid,Class,Key) ->
dget_class(ServerPid,Class,Condition) ->
gen_server:call(ServerPid,
- {handle_get_class,Class,Condition},infinity).
+ {handle_get_class,Class,Condition},infinity).
%%% derase_class(ServerPid,Class) -> ok
%%%
@@ -828,7 +827,7 @@ table_lookup_batch([],_Class,_Cond) ->
[];
table_lookup_batch([Table|Tables],Class,Cond) ->
table_lookup_batch([],Tables,Table,ets:first(Table),Class,Cond,[]).
-
+
table_lookup_batch(_Passed,[],_,'$end_of_table',_Class,_Cond,Ack) ->
Ack;
table_lookup_batch(Passed,[NewTable|Tables],Table,'$end_of_table',
@@ -838,7 +837,7 @@ table_lookup_batch(Passed,[NewTable|Tables],Table,'$end_of_table',
table_lookup_batch(Passed,Tables,Table,?ERASE_MARK(Key),Class,Cond,Ack) ->
table_lookup_batch(Passed,Tables,Table,?ets_next(Table,?ERASE_MARK(Key)),
Class,Cond,Ack);
-
+
table_lookup_batch(Passed,Tables,Table,Key,Class,Cond,Ack) ->
NewAck =
case table_lookup(Passed,Key) of
@@ -1069,7 +1068,7 @@ phys_load_table(DumpDir,N,Tab) ->
Other ->
{error,{open_error,Other}}
end.
-
+
phys_load_entries(Fd,Tab) ->
case phys_read_len(Fd) of
{ok,Len} ->