diff options
author | Björn Gustavsson <[email protected]> | 2016-02-28 07:42:35 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-03-09 12:08:36 +0100 |
commit | d1fa4cb61880930ee19f81fbbfc59c8edb472a0f (patch) | |
tree | 5cedb9e19f75be39e6d86cdcdad1e42d5b4406cd | |
parent | 511ff3279897028cabace38388d475eb4e4c56ec (diff) | |
download | otp-d1fa4cb61880930ee19f81fbbfc59c8edb472a0f.tar.gz otp-d1fa4cb61880930ee19f81fbbfc59c8edb472a0f.tar.bz2 otp-d1fa4cb61880930ee19f81fbbfc59c8edb472a0f.zip |
Eliminate use of test_server:do_times()
-rw-r--r-- | lib/stdlib/test/ets_SUITE.erl | 21 | ||||
-rw-r--r-- | lib/stdlib/test/gen_fsm_SUITE.erl | 5 | ||||
-rw-r--r-- | lib/stdlib/test/gen_server_SUITE.erl | 12 |
3 files changed, 24 insertions, 14 deletions
diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl index 81bc87bd12..886f9049ed 100644 --- a/lib/stdlib/test/ets_SUITE.erl +++ b/lib/stdlib/test/ets_SUITE.erl @@ -43,8 +43,6 @@ t_delete_all_objects/1, t_insert_list/1, t_test_ms/1, t_select_delete/1,t_ets_dets/1]). --export([do_lookup/2, do_lookup_element/3]). - -export([ordered/1, ordered_match/1, interface_equality/1, fixtable_next/1, fixtable_insert/1, rename/1, rename_unnamed/1, evil_rename/1, update_element/1, update_counter/1, evil_update_counter/1, partly_bound/1, match_heavy/1]). @@ -3040,10 +3038,17 @@ time_lookup_do(Opts) -> Tab = ets_new(foo,Opts), fill_tab(Tab,foo), ets:insert(Tab,{{a,key},foo}), - {Time,_} = ?t:timecall(test_server,do_times, - [100000,ets,lookup,[Tab,{a,key}]]), + N = 100000, + {Time,_} = timer:tc(fun() -> time_lookup_many(N, Tab) end), + Seconds = Time / 1000000, true = ets:delete(Tab), - round(100000 / Time). % lookups/s + round(N / Seconds). % lookups/s + +time_lookup_many(0, _Tab) -> + ok; +time_lookup_many(N, Tab) -> + ets:lookup(Tab, {a,key}), + time_lookup_many(N-1, Tab). badlookup(doc) -> ["Check proper return values from bad lookups in existing/non existing " @@ -4401,7 +4406,7 @@ heavy_lookup_do(Opts) -> ?line EtsMem = etsmem(), ?line Tab = ets_new(foobar_table, [set, protected, {keypos, 2} | Opts]), ?line ok = fill_tab2(Tab, 0, 7000), - ?line ?t:do_times(50, ?MODULE, do_lookup, [Tab, 6999]), + _ = [do_lookup(Tab, 6999) || _ <- lists:seq(1, 50)], ?line true = ets:delete(Tab), ?line verify_etsmem(EtsMem). @@ -4426,8 +4431,8 @@ heavy_lookup_element_do(Opts) -> EtsMem = etsmem(), Tab = ets_new(foobar_table, [set, protected, {keypos, 2} | Opts]), ok = fill_tab2(Tab, 0, 7000), - % lookup ALL elements 50 times - ?t:do_times(50, ?MODULE, do_lookup_element, [Tab, 6999, 1]), + %% lookup ALL elements 50 times + _ = [do_lookup_element(Tab, 6999, 1) || _ <- lists:seq(1, 50)], true = ets:delete(Tab), verify_etsmem(EtsMem). diff --git a/lib/stdlib/test/gen_fsm_SUITE.erl b/lib/stdlib/test/gen_fsm_SUITE.erl index 4a772c2169..c097f3b645 100644 --- a/lib/stdlib/test/gen_fsm_SUITE.erl +++ b/lib/stdlib/test/gen_fsm_SUITE.erl @@ -44,7 +44,6 @@ -export([enter_loop/1]). %% Exports for apply --export([do_msg/1, do_sync_msg/1]). -export([enter_loop/2]). % The gen_fsm behaviour @@ -894,7 +893,7 @@ do_func_test(FSM) -> ok = do_connect(FSM), ok = gen_fsm:send_all_state_event(FSM, {'alive?', self()}), wfor(yes), - test_server:do_times(3, ?MODULE, do_msg, [FSM]), + _ = [do_msg(FSM) || _ <- lists:seq(1, 3)], ok = gen_fsm:send_all_state_event(FSM, {'alive?', self()}), wfor(yes), ok = do_disconnect(FSM), @@ -932,7 +931,7 @@ do_sync_func_test(FSM) -> yes = gen_fsm:sync_send_all_state_event(FSM, 'alive?'), ok = do_sync_connect(FSM), yes = gen_fsm:sync_send_all_state_event(FSM, 'alive?'), - test_server:do_times(3, ?MODULE, do_sync_msg, [FSM]), + _ = [do_sync_msg(FSM) || _ <- lists:seq(1, 3)], yes = gen_fsm:sync_send_all_state_event(FSM, 'alive?'), ok = do_sync_disconnect(FSM), yes = gen_fsm:sync_send_all_state_event(FSM, 'alive?'), diff --git a/lib/stdlib/test/gen_server_SUITE.erl b/lib/stdlib/test/gen_server_SUITE.erl index 5f29fc911d..1ada226215 100644 --- a/lib/stdlib/test/gen_server_SUITE.erl +++ b/lib/stdlib/test/gen_server_SUITE.erl @@ -1050,11 +1050,17 @@ otp_5854(Config) when is_list(Config) -> %% returns. otp_7669(Config) when is_list(Config) -> - ?line ?t:do_times(100, fun do_otp_7669_local_ignore/0), - ?line ?t:do_times(100, fun do_otp_7669_global_ignore/0), - ?line ?t:do_times(10, fun do_otp_7669_stop/0), + do_times(100, fun do_otp_7669_local_ignore/0), + do_times(100, fun do_otp_7669_global_ignore/0), + do_times(10, fun do_otp_7669_stop/0), ok. +do_times(0, _) -> + ok; +do_times(N, Fun) -> + Fun(), + do_times(N-1, Fun). + do_otp_7669_local_ignore() -> %% The name should never be registered after the return %% from gen_server:start/3. |