diff options
Diffstat (limited to 'lib/stdlib')
47 files changed, 250 insertions, 423 deletions
diff --git a/lib/stdlib/test/array_SUITE.erl b/lib/stdlib/test/array_SUITE.erl index 6fec03a2f7..0807bb2051 100644 --- a/lib/stdlib/test/array_SUITE.erl +++ b/lib/stdlib/test/array_SUITE.erl @@ -22,11 +22,6 @@ -include_lib("common_test/include/ct.hrl"). -%% Default timetrap timeout (set in init_per_testcase). -%% This should be set relatively high (10-15 times the expected -%% max testcasetime). --define(default_timeout, ?t:seconds(60)). - %% Test server specific exports -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). @@ -66,7 +61,9 @@ %% %% all/1 %% -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [new_test, fix_test, relax_test, resize_test, @@ -93,12 +90,9 @@ end_per_group(_GroupName, Config) -> init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. -define(LEAFSIZE,10). diff --git a/lib/stdlib/test/base64_SUITE.erl b/lib/stdlib/test/base64_SUITE.erl index f750145ef0..6c8eb9ca5b 100644 --- a/lib/stdlib/test/base64_SUITE.erl +++ b/lib/stdlib/test/base64_SUITE.erl @@ -34,19 +34,17 @@ roundtrip_1/1, roundtrip_2/1, roundtrip_3/1, roundtrip_4/1]). init_per_testcase(_, Config) -> - Dog = test_server:timetrap(?t:minutes(4)), - NewConfig = lists:keydelete(watchdog, 1, Config), - [{watchdog, Dog} | NewConfig]. + Config. -end_per_testcase(_, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_, _Config) -> ok. %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,4}}]. all() -> [base64_encode, base64_decode, base64_otp_5635, diff --git a/lib/stdlib/test/beam_lib_SUITE.erl b/lib/stdlib/test/beam_lib_SUITE.erl index 5de7b661e5..fc7e2ac231 100644 --- a/lib/stdlib/test/beam_lib_SUITE.erl +++ b/lib/stdlib/test/beam_lib_SUITE.erl @@ -40,7 +40,9 @@ -export([init_per_testcase/2, end_per_testcase/2]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,2}}]. all() -> [error, normal, cmp, cmp_literals, strip, otp_6711, @@ -63,12 +65,9 @@ end_per_group(_GroupName, Config) -> init_per_testcase(_Case, Config) -> - Dog=?t:timetrap(?t:minutes(2)), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. normal(suite) -> []; diff --git a/lib/stdlib/test/binary_module_SUITE.erl b/lib/stdlib/test/binary_module_SUITE.erl index 8bb29b6a26..8fd9d1e0a4 100644 --- a/lib/stdlib/test/binary_module_SUITE.erl +++ b/lib/stdlib/test/binary_module_SUITE.erl @@ -20,6 +20,7 @@ -module(binary_module_SUITE). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, init_per_group/2,end_per_group/2, interesting/1,scope_return/1,random_ref_comp/1,random_ref_sr_comp/1, random_ref_fla_comp/1,parts/1, bin_to_list/1, list_to_bin/1, @@ -27,45 +28,17 @@ -export([random_number/1, make_unaligned/1]). - - -%%-define(STANDALONE,1). - --ifdef(STANDALONE). - --define(line,erlang:display({?MODULE,?LINE}),). - --else. - -include_lib("common_test/include/ct.hrl"). --export([init_per_testcase/2, end_per_testcase/2]). -% Default timetrap timeout (set in init_per_testcase). -% Some of these testcases are really heavy... --define(default_timeout, ?t:minutes(30)). - --endif. - - - --ifdef(STANDALONE). --export([run/0]). - -run() -> - [ apply(?MODULE,X,[[]]) || X <- all(suite) ]. - --else. init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. + Config. -end_per_testcase(_Case, Config) -> - ?line Dog = ?config(watchdog, Config), - ?line test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. --endif. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,30}}]. all() -> [scope_return,interesting, random_ref_fla_comp, random_ref_sr_comp, diff --git a/lib/stdlib/test/dets_SUITE.erl b/lib/stdlib/test/dets_SUITE.erl index ee3a812e24..34e85ab198 100644 --- a/lib/stdlib/test/dets_SUITE.erl +++ b/lib/stdlib/test/dets_SUITE.erl @@ -83,15 +83,14 @@ -define(CLOSED_PROPERLY,1). init_per_testcase(_Case, Config) -> - Dog=?t:timetrap(?t:minutes(15)), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Case, _Config) -> - Dog=?config(watchdog, _Config), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,15}}]. all() -> [ diff --git a/lib/stdlib/test/dict_SUITE.erl b/lib/stdlib/test/dict_SUITE.erl index 92d31bb748..d315e6f673 100644 --- a/lib/stdlib/test/dict_SUITE.erl +++ b/lib/stdlib/test/dict_SUITE.erl @@ -32,7 +32,9 @@ -import(lists, [foldl/3]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,5}}]. all() -> [create, store, iterate]. @@ -54,12 +56,9 @@ end_per_group(_GroupName, Config) -> init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?t:minutes(5)), - [{watchdog,Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. create(Config) when is_list(Config) -> diff --git a/lib/stdlib/test/edlin_expand_SUITE.erl b/lib/stdlib/test/edlin_expand_SUITE.erl index b0a07a95a3..fcf4db3696 100644 --- a/lib/stdlib/test/edlin_expand_SUITE.erl +++ b/lib/stdlib/test/edlin_expand_SUITE.erl @@ -19,26 +19,21 @@ %% -module(edlin_expand_SUITE). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, init_per_group/2,end_per_group/2]). - -export([normal/1, quoted_fun/1, quoted_module/1, quoted_both/1]). --export([init_per_testcase/2, end_per_testcase/2]). - -include_lib("common_test/include/ct.hrl"). -%% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). - init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), + Config. + +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [normal, quoted_fun, quoted_module, quoted_both]. diff --git a/lib/stdlib/test/epp_SUITE.erl b/lib/stdlib/test/epp_SUITE.erl index 0c00e104b7..a89e29a91b 100644 --- a/lib/stdlib/test/epp_SUITE.erl +++ b/lib/stdlib/test/epp_SUITE.erl @@ -50,19 +50,16 @@ config(data_dir, _) -> -include_lib("common_test/include/ct.hrl"). -export([init_per_testcase/2, end_per_testcase/2]). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). - init_per_testcase(_, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. -end_per_testcase(_, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), + Config. + +end_per_testcase(_, _Config) -> ok. -endif. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [rec_1, {group, upcase_mac}, include_local, predef_mac, diff --git a/lib/stdlib/test/erl_anno_SUITE.erl b/lib/stdlib/test/erl_anno_SUITE.erl index 79b27c6217..dff40a524f 100644 --- a/lib/stdlib/test/erl_anno_SUITE.erl +++ b/lib/stdlib/test/erl_anno_SUITE.erl @@ -46,7 +46,9 @@ groups() -> line, location, record, text, bad]}, {parse, [], [parse_abstract, mapfold_anno]}]. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. init_per_suite(Config) -> Config. @@ -61,12 +63,9 @@ end_per_group(_GroupName, Config) -> Config. init_per_testcase(_Case, Config) -> - Dog=?t:timetrap(?t:minutes(1)), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Case, _Config) -> - Dog=?config(watchdog, _Config), - test_server:timetrap_cancel(Dog), ok. -define(INFO(T, V), {T, V}). diff --git a/lib/stdlib/test/erl_eval_SUITE.erl b/lib/stdlib/test/erl_eval_SUITE.erl index 1874ee1a1d..c37a83ff49 100644 --- a/lib/stdlib/test/erl_eval_SUITE.erl +++ b/lib/stdlib/test/erl_eval_SUITE.erl @@ -19,6 +19,7 @@ -module(erl_eval_SUITE). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, init_per_group/2,end_per_group/2]). -export([guard_1/1, guard_2/1, @@ -65,19 +66,17 @@ config(priv_dir,_) -> ".". -else. -include_lib("common_test/include/ct.hrl"). --export([init_per_testcase/2, end_per_testcase/2]). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). +-endif. + init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), + Config. + +end_per_testcase(_Case, _Config) -> ok. --endif. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [guard_1, guard_2, match_pattern, string_plusplus, diff --git a/lib/stdlib/test/erl_expand_records_SUITE.erl b/lib/stdlib/test/erl_expand_records_SUITE.erl index 2cc4757c04..82c76512f2 100644 --- a/lib/stdlib/test/erl_expand_records_SUITE.erl +++ b/lib/stdlib/test/erl_expand_records_SUITE.erl @@ -41,19 +41,15 @@ otp_5915/1, otp_7931/1, otp_5990/1, otp_7078/1, otp_7101/1, maps/1]). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). - init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. + Config. end_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [attributes, expr, guard, init, diff --git a/lib/stdlib/test/erl_internal_SUITE.erl b/lib/stdlib/test/erl_internal_SUITE.erl index ad0b37aae3..057c955a25 100644 --- a/lib/stdlib/test/erl_internal_SUITE.erl +++ b/lib/stdlib/test/erl_internal_SUITE.erl @@ -28,7 +28,9 @@ -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,2}}]. all() -> [behav]. @@ -49,15 +51,10 @@ end_per_group(_GroupName, Config) -> Config. --define(default_timeout, ?t:minutes(2)). - init_per_testcase(_Case, Config) -> - Dog = test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. behav(suite) -> []; diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl index d946469625..21db9a5a38 100644 --- a/lib/stdlib/test/erl_lint_SUITE.erl +++ b/lib/stdlib/test/erl_lint_SUITE.erl @@ -69,19 +69,15 @@ record_errors/1 ]). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). - init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. + Config. end_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [{group, unused_vars_warn}, export_vars_warn, diff --git a/lib/stdlib/test/erl_pp_SUITE.erl b/lib/stdlib/test/erl_pp_SUITE.erl index f7418b1f5f..eded80d1ad 100644 --- a/lib/stdlib/test/erl_pp_SUITE.erl +++ b/lib/stdlib/test/erl_pp_SUITE.erl @@ -55,19 +55,15 @@ %% Internal export. -export([ehook/6]). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(2)). - init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. + Config. end_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,2}}]. all() -> [{group, expr}, {group, attributes}, hook, neg_indent, diff --git a/lib/stdlib/test/erl_scan_SUITE.erl b/lib/stdlib/test/erl_scan_SUITE.erl index 941703b5dd..004d013da5 100644 --- a/lib/stdlib/test/erl_scan_SUITE.erl +++ b/lib/stdlib/test/erl_scan_SUITE.erl @@ -18,11 +18,12 @@ %% %CopyrightEnd% -module(erl_scan_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, init_per_group/2,end_per_group/2]). --export([ error_1/1, error_2/1, iso88591/1, otp_7810/1, otp_10302/1, - otp_10990/1, otp_10992/1, otp_11807/1]). +-export([error_1/1, error_2/1, iso88591/1, otp_7810/1, otp_10302/1, + otp_10990/1, otp_10992/1, otp_11807/1]). -import(lists, [nth/2,flatten/1]). -import(io_lib, [print/1]). @@ -43,22 +44,17 @@ %% ".". -else. -include_lib("common_test/include/ct.hrl"). --export([init_per_testcase/2, end_per_testcase/2]). +-endif. -init_per_testcase(_Case, Config) when is_list(Config) -> - ?line Dog=test_server:timetrap(test_server:seconds(1200)), - [{watchdog, Dog}|Config]. +init_per_testcase(_Case, Config) -> + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. --endif. - -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,20}}]. all() -> [{group, error}, iso88591, otp_7810, otp_10302, otp_10990, otp_10992, diff --git a/lib/stdlib/test/escript_SUITE.erl b/lib/stdlib/test/escript_SUITE.erl index a8d646c044..fc97d7ccfa 100644 --- a/lib/stdlib/test/escript_SUITE.erl +++ b/lib/stdlib/test/escript_SUITE.erl @@ -43,7 +43,9 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("kernel/include/file.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,5}}]. all() -> [basic, errors, strange_name, emulator_flags, @@ -68,12 +70,9 @@ end_per_group(_GroupName, Config) -> Config. init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?t:minutes(5)), - [{watchdog,Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl index 6f9be9b179..19e2acac93 100644 --- a/lib/stdlib/test/ets_SUITE.erl +++ b/lib/stdlib/test/ets_SUITE.erl @@ -116,19 +116,18 @@ init_per_testcase(Case, Config) -> io:format("*** SEED: ~p ***\n", [rand:export_seed()]), start_spawn_logger(), wait_for_test_procs(), %% Ensure previous case cleaned up - Dog=test_server:timetrap(test_server:minutes(20)), put('__ETS_TEST_CASE__', Case), - [{watchdog, Dog}, {test_case, Case} | Config]. + [{test_case, Case} | Config]. -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - wait_for_test_procs(true), - test_server:timetrap_cancel(Dog). +end_per_testcase(_Func, _Config) -> + wait_for_test_procs(true). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,20}}]. all() -> [{group, new}, {group, insert}, {group, lookup}, @@ -1308,13 +1307,9 @@ match_heavy(Config) when is_list(Config) -> %% running the test function. put(where_to_read,DataDir), put(where_to_write,PrivDir), - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), - NewDog=test_server:timetrap(test_server:seconds(1000)), - NewConfig = [{watchdog, NewDog} | lists:keydelete(watchdog,1,Config)], random_test(), drop_match(), - NewConfig. + ok. %%% Extra safety for the very low probability that this is not %%% caught by the random test (Statistically impossible???) diff --git a/lib/stdlib/test/ets_tough_SUITE.erl b/lib/stdlib/test/ets_tough_SUITE.erl index 5c2ab4747c..90911f86ef 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,12 +54,9 @@ 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). diff --git a/lib/stdlib/test/file_sorter_SUITE.erl b/lib/stdlib/test/file_sorter_SUITE.erl index 947dc2ad8d..eb8474fe24 100644 --- a/lib/stdlib/test/file_sorter_SUITE.erl +++ b/lib/stdlib/test/file_sorter_SUITE.erl @@ -49,15 +49,14 @@ -export([init_per_testcase/2, end_per_testcase/2]). init_per_testcase(_Case, Config) -> - Dog=?t:timetrap(?t:minutes(2)), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,2}}]. all() -> [basic, badarg, term_sort, term_keysort, diff --git a/lib/stdlib/test/filelib_SUITE.erl b/lib/stdlib/test/filelib_SUITE.erl index 5d5434c7b2..fed6f9250f 100644 --- a/lib/stdlib/test/filelib_SUITE.erl +++ b/lib/stdlib/test/filelib_SUITE.erl @@ -33,15 +33,14 @@ -include_lib("kernel/include/file.hrl"). init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?t:minutes(5)), - [{watchdog,Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,5}}]. all() -> [wildcard_one, wildcard_two, wildcard_errors, diff --git a/lib/stdlib/test/filename_SUITE.erl b/lib/stdlib/test/filename_SUITE.erl index 7f2e4771f3..9dc147bee9 100644 --- a/lib/stdlib/test/filename_SUITE.erl +++ b/lib/stdlib/test/filename_SUITE.erl @@ -32,7 +32,9 @@ -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [absname, absname_2, @@ -181,7 +183,6 @@ absname_2(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% basename_1(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), "." = filename:basename("."), "foo" = filename:basename("foo"), "foo" = filename:basename("/usr/foo"), @@ -202,11 +203,9 @@ basename_1(Config) when is_list(Config) -> "strange\\but\\true" = filename:basename("strange\\but\\true") end, - test_server:timetrap_cancel(Dog), ok. basename_2(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), "." = filename:basename(".", ".erl"), "foo" = filename:basename("foo.erl", ".erl"), "foo" = filename:basename('foo.erl', ".erl"), @@ -232,7 +231,6 @@ basename_2(Config) when is_list(Config) -> "strange\\but\\true" = filename:basename("strange\\but\\true", ".erl") end, - test_server:timetrap_cancel(Dog), ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -553,7 +551,6 @@ absname_bin_2(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% basename_bin_1(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), <<".">> = filename:basename(<<".">>), <<"foo">> = filename:basename(<<"foo">>), <<"foo">> = filename:basename(<<"/usr/foo">>), @@ -565,11 +562,9 @@ basename_bin_1(Config) when is_list(Config) -> _ -> <<"strange\\but\\true">> = filename:basename(<<"strange\\but\\true">>) end, - test_server:timetrap_cancel(Dog), ok. basename_bin_2(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), <<".">> = filename:basename(<<".">>, <<".erl">>), <<"foo">> = filename:basename(<<"foo.erl">>, <<".erl">>), <<"foo.erl">> = filename:basename(<<"/usr/foo.erl">>, <<".hrl">>), @@ -589,7 +584,6 @@ basename_bin_2(Config) when is_list(Config) -> <<"strange\\but\\true">> = filename:basename(<<"strange\\but\\true">>, <<".erl">>) end, - test_server:timetrap_cancel(Dog), ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/stdlib/test/fixtable_SUITE.erl b/lib/stdlib/test/fixtable_SUITE.erl index 66150e60c1..655002c611 100644 --- a/lib/stdlib/test/fixtable_SUITE.erl +++ b/lib/stdlib/test/fixtable_SUITE.erl @@ -33,7 +33,9 @@ %%% Internal exports -export([command_loop/0,start_commander/0]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [multiple_fixes, multiple_processes, @@ -70,12 +72,9 @@ end_per_group(_GroupName, Config) -> init_per_testcase(_Func, Config) -> PrivDir = ?config(priv_dir,Config), file:make_dir(PrivDir), - Dog=test_server:timetrap(test_server:seconds(60)), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), lists:foreach(fun(X) -> (catch dets:close(X)), (catch file:delete(dets_filename(X,Config))) diff --git a/lib/stdlib/test/format_SUITE.erl b/lib/stdlib/test/format_SUITE.erl index da28e085bb..b653623879 100644 --- a/lib/stdlib/test/format_SUITE.erl +++ b/lib/stdlib/test/format_SUITE.erl @@ -27,18 +27,15 @@ -include_lib("common_test/include/ct.hrl"). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). - init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), + Config. + +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [hang_1]. diff --git a/lib/stdlib/test/gen_server_SUITE.erl b/lib/stdlib/test/gen_server_SUITE.erl index 634d868ad4..2307d823bf 100644 --- a/lib/stdlib/test/gen_server_SUITE.erl +++ b/lib/stdlib/test/gen_server_SUITE.erl @@ -52,7 +52,9 @@ -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, format_status/2]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [start, {group,stop}, crash, call, cast, cast_fast, info, abcast, @@ -83,8 +85,6 @@ end_per_group(_GroupName, Config) -> Config. --define(default_timeout, ?t:minutes(1)). - init_per_testcase(Case, Config) when Case == call_remote1; Case == call_remote2; Case == call_remote3; @@ -92,11 +92,10 @@ init_per_testcase(Case, Config) when Case == call_remote1; Case == call_remote_n2; Case == call_remote_n3 -> {ok,N} = start_node(hubba), - ?line Dog = ?t:timetrap(?default_timeout), - [{node,N},{watchdog, Dog} | Config]; + [{node,N} | Config]; init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. + Config. + end_per_testcase(_Case, Config) -> case proplists:get_value(node, Config) of undefined -> @@ -104,8 +103,6 @@ end_per_testcase(_Case, Config) -> N -> test_server:stop_node(N) end, - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), ok. diff --git a/lib/stdlib/test/id_transform_SUITE.erl b/lib/stdlib/test/id_transform_SUITE.erl index a0c3c9317a..4e862053b1 100644 --- a/lib/stdlib/test/id_transform_SUITE.erl +++ b/lib/stdlib/test/id_transform_SUITE.erl @@ -33,7 +33,8 @@ -hej(hopp). -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}]. all() -> [id_transform]. @@ -62,10 +63,8 @@ id_transform(Config) when is_list(Config) -> {module,erl_id_trans} = code:load_binary(erl_id_trans, File, Bin), case test_server:purify_is_running() of false -> - Dog = ct:timetrap(?t:hours(1)), - Res = run_in_test_suite(), - ?t:timetrap_cancel(Dog), - Res; + ct:timetrap({hours,1}), + run_in_test_suite(); true -> {skip,"Valgrind (too slow)"} end. diff --git a/lib/stdlib/test/io_SUITE.erl b/lib/stdlib/test/io_SUITE.erl index 2d56f2d502..81fd3786ce 100644 --- a/lib/stdlib/test/io_SUITE.erl +++ b/lib/stdlib/test/io_SUITE.erl @@ -26,7 +26,7 @@ -export([error_1/1, float_g/1, otp_5403/1, otp_5813/1, otp_6230/1, otp_6282/1, otp_6354/1, otp_6495/1, otp_6517/1, otp_6502/1, - manpage/1, otp_6708/1, otp_7084/1, otp_7421/1, + manpage/1, otp_6708/1, otp_7084/0, otp_7084/1, otp_7421/1, io_lib_collect_line_3_wb/1, cr_whitespace_in_string/1, io_fread_newlines/1, otp_8989/1, io_lib_fread_literal/1, printable_range/1, bad_printable_range/1, @@ -51,19 +51,15 @@ -define(privdir(Conf), ?config(priv_dir, Conf)). -endif. - -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). - init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. + Config. + end_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [error_1, float_g, otp_5403, otp_5813, otp_6230, @@ -1239,15 +1235,15 @@ otp_6708(Config) when is_list(Config) -> -define(ONE(N), ((1 bsl N) - 1)). -define(ALL_ONES, ((1 bsl 52) - 1)). + +otp_7084() -> + [{timetrap,{minutes,3}}]. + otp_7084(doc) -> ["OTP-7084. Printing floating point numbers nicely."]; otp_7084(suite) -> []; otp_7084(Config) when is_list(Config) -> - OldDog=?config(watchdog, Config), - test_server:timetrap_cancel(OldDog), - Timeout = 180, - ?line Dog = test_server:timetrap({seconds,Timeout}), L = [{g_warm_up, fun g_warm_up/0}, {g_big_pos_float, fun g_big_pos_float/0}, {g_small_neg_float, fun g_small_neg_float/0}, @@ -1263,7 +1259,6 @@ otp_7084(Config) when is_list(Config) -> catch throw:Reason -> Reason end, - ?line test_server:timetrap_cancel(Dog), R. g_warm_up() -> diff --git a/lib/stdlib/test/io_proto_SUITE.erl b/lib/stdlib/test/io_proto_SUITE.erl index 97e6a90b76..82ef855cab 100644 --- a/lib/stdlib/test/io_proto_SUITE.erl +++ b/lib/stdlib/test/io_proto_SUITE.erl @@ -64,23 +64,18 @@ -define(RM_RF(Dir),rm_rf(Dir)). -endif. - -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(20)). - init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), Term = os:getenv("TERM", "dumb"), os:putenv("TERM","vt100"), - [{watchdog, Dog}, {term, Term} | Config]. + [{term, Term} | Config]. end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), Term = ?config(term,Config), os:putenv("TERM",Term), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,20}}]. all() -> [setopts_getopts, unicode_options, unicode_options_gen, diff --git a/lib/stdlib/test/lists_SUITE.erl b/lib/stdlib/test/lists_SUITE.erl index 257607f734..1f60ed50fe 100644 --- a/lib/stdlib/test/lists_SUITE.erl +++ b/lib/stdlib/test/lists_SUITE.erl @@ -24,12 +24,6 @@ -module(lists_SUITE). -include_lib("common_test/include/ct.hrl"). - -% Default timetrap timeout (set in init_per_testcase). -% This should be set relatively high (10-15 times the expected -% max testcasetime). --define(default_timeout, ?t:minutes(4)). - % Test server specific exports -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). @@ -78,7 +72,9 @@ %% %% all/1 %% -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,4}}]. all() -> [{group, append}, @@ -141,12 +137,9 @@ end_per_group(_GroupName, Config) -> init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. % diff --git a/lib/stdlib/test/maps_SUITE.erl b/lib/stdlib/test/maps_SUITE.erl index f1f476433b..807fe48835 100644 --- a/lib/stdlib/test/maps_SUITE.erl +++ b/lib/stdlib/test/maps_SUITE.erl @@ -25,8 +25,6 @@ -include_lib("common_test/include/ct.hrl"). --define(default_timeout, ?t:minutes(1)). - % Test server specific exports -export([all/0]). -export([suite/0]). @@ -46,7 +44,8 @@ -define(badarg(F,_Args), {'EXIT', {badarg, [{maps,F,_,_}|_]}}). suite() -> - [{ct_hooks, [ts_install_cth]}]. + [{ct_hooks, [ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [t_get_3,t_filter_2, @@ -60,12 +59,9 @@ end_per_suite(_Config) -> ok. init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. t_get_3(Config) when is_list(Config) -> diff --git a/lib/stdlib/test/ms_transform_SUITE.erl b/lib/stdlib/test/ms_transform_SUITE.erl index 6a9478d0d2..e8d16e9486 100644 --- a/lib/stdlib/test/ms_transform_SUITE.erl +++ b/lib/stdlib/test/ms_transform_SUITE.erl @@ -23,6 +23,7 @@ -include_lib("common_test/include/ct.hrl"). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, init_per_group/2,end_per_group/2]). -export([basic_ets/1]). -export([basic_dbg/1]). @@ -42,17 +43,16 @@ -export([warnings/1]). -export([no_warnings/1]). -export([eep37/1]). --export([init_per_testcase/2, end_per_testcase/2]). init_per_testcase(_Func, Config) -> - Dog=test_server:timetrap(test_server:seconds(360)), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Func, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog). +end_per_testcase(_Func, _Config) -> + ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,6}}]. all() -> [from_shell, basic_ets, basic_dbg, records, diff --git a/lib/stdlib/test/qlc_SUITE.erl b/lib/stdlib/test/qlc_SUITE.erl index 6f94e740eb..8beb6a9f3e 100644 --- a/lib/stdlib/test/qlc_SUITE.erl +++ b/lib/stdlib/test/qlc_SUITE.erl @@ -107,19 +107,15 @@ handle_event/2, handle_call/2, handle_info/2, terminate/2]). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(5)). - init_per_testcase(Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{?TESTCASE, Case}, {watchdog, Dog} | Config]. + [{?TESTCASE, Case} | Config]. end_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - test_server:timetrap_cancel(Dog), ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,5}}]. all() -> [{group, parse_transform}, {group, evaluation}, diff --git a/lib/stdlib/test/queue_SUITE.erl b/lib/stdlib/test/queue_SUITE.erl index 77fe6adb7c..f6331398a2 100644 --- a/lib/stdlib/test/queue_SUITE.erl +++ b/lib/stdlib/test/queue_SUITE.erl @@ -19,26 +19,23 @@ %% -module(queue_SUITE). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, init_per_group/2,end_per_group/2]). -export([do/1, to_list/1, io_test/1, op_test/1, error/1, oops/1]). --export([init_per_testcase/2, end_per_testcase/2]). -include_lib("common_test/include/ct.hrl"). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). - init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), + Config. + +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [do, to_list, io_test, op_test, error, oops]. diff --git a/lib/stdlib/test/rand_SUITE.erl b/lib/stdlib/test/rand_SUITE.erl index ab260da950..c694dbf8e2 100644 --- a/lib/stdlib/test/rand_SUITE.erl +++ b/lib/stdlib/test/rand_SUITE.erl @@ -35,19 +35,17 @@ -include_lib("common_test/include/ct.hrl"). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(3)). -define(LOOP, 1000000). init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), + Config. + +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,3}}]. all() -> [seed, interval_int, interval_float, diff --git a/lib/stdlib/test/random_SUITE.erl b/lib/stdlib/test/random_SUITE.erl index 701a3e3f33..fe7189d91a 100644 --- a/lib/stdlib/test/random_SUITE.erl +++ b/lib/stdlib/test/random_SUITE.erl @@ -19,26 +19,23 @@ -module(random_SUITE). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, init_per_group/2,end_per_group/2]). -export([interval_1/1, seed0/1, seed/1]). --export([init_per_testcase/2, end_per_testcase/2]). -include_lib("common_test/include/ct.hrl"). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). - init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{watchdog, Dog} | Config]. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), + Config. + +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [interval_1, seed0, seed]. diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl index bd495ce587..d1720bd4bc 100644 --- a/lib/stdlib/test/re_SUITE.erl +++ b/lib/stdlib/test/re_SUITE.erl @@ -33,7 +33,9 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("kernel/include/file.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,3}}]. all() -> [pcre, compile_options, run_options, combined_options, @@ -64,11 +66,9 @@ end_per_group(_GroupName, Config) -> pcre(doc) -> ["Run all applicable tests from the PCRE testsuites."]; pcre(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), RootDir = ?config(data_dir, Config), Res = run_pcre_tests:test(RootDir), 0 = lists:sum([ X || {X,_,_} <- Res ]), - ?t:timetrap_cancel(Dog), {comment,Res}. compile_options(doc) -> @@ -270,15 +270,12 @@ combined_options(Config) when is_list(Config) -> replace_autogen(doc) -> ["Test replace with autogenerated erlang module"]; replace_autogen(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), re_testoutput1_replacement_test:run(), - ?t:timetrap_cancel(Dog), ok. global_capture(doc) -> ["Tests capture options together with global searching"]; global_capture(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), ?line {match,[{3,4}]} = re:run("ABCabcdABC",".*(?<FOO>abcd).*",[{capture,[1]}]), ?line {match,[{10,4}]} = re:run("ABCabcdABCabcdA",".*(?<FOO>abcd).*",[{capture,[1]}]), ?line {match,[[{10,4}]]} = re:run("ABCabcdABCabcdA",".*(?<FOO>abcd).*",[global,{capture,[1]}]), @@ -302,23 +299,19 @@ global_capture(Config) when is_list(Config) -> ?line {match,[["Åbcd","bcd"],["abcd","bcd"]]} = re:run(<<"ABC",8#303,8#205,"bcdABCabcdA">>,".(?<FOO>bcd)",[global,{capture,all,list},unicode]), ?line {match,[["Åbcd","bcd"],["abcd","bcd"]]} = re:run("ABCÅbcdABCabcdA",".(?<FOO>bcd)",[global,{capture,all,list},unicode]), ?line {match,[[{3,5},{5,3}],[{11,4},{12,3}]]} = re:run("ABCÅbcdABCabcdA",".(?<FOO>bcd)",[global,{capture,all,index},unicode]), - ?t:timetrap_cancel(Dog), ok. replace_input_types(doc) -> ["Tests replace with different input types"]; replace_input_types(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), ?line <<"abcd">> = re:replace("abcd","Z","X",[{return,binary},unicode]), ?line <<"abcd">> = re:replace("abcd","\x{400}","X",[{return,binary},unicode]), ?line <<"a",208,128,"cd">> = re:replace(<<"abcd">>,"b","\x{400}",[{return,binary},unicode]), - ?t:timetrap_cancel(Dog), ok. replace_return(doc) -> ["Tests return options of replace together with global searching"]; replace_return(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), {'EXIT',{badarg,_}} = (catch re:replace("na","(a","")), ok = replacetest(<<"nisse">>,"i","a",[{return,binary}],<<"nasse">>), ok = replacetest("ABC\305abcdABCabcdA","a(?<FOO>bcd)","X",[global,{return,binary}],<<"ABCÅXABCXA">>), @@ -339,7 +332,6 @@ replace_return(Config) when is_list(Config) -> ok = replacetest("a\x{400}bcd","d","X",[global,{return,binary},unicode],<<"a",208,128,"bcX">>), ok = replacetest("a\x{400}bcd","Z","X",[global,{return,list},unicode],"a\x{400}bcd"), ok = replacetest("a\x{400}bcd","Z","X",[global,{return,binary},unicode],<<"a",208,128,"bcd">>), - ?t:timetrap_cancel(Dog), ok. rtest(Subj, RE, Copt, Ropt, true) -> @@ -415,15 +407,12 @@ copt(_) -> false. split_autogen(doc) -> ["Test split with autogenerated erlang module"]; split_autogen(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(3)), re_testoutput1_split_test:run(), - ?t:timetrap_cancel(Dog), ok. split_options(doc) -> ["Test special options to split."]; split_options(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(1)), ok = splittest("a b c ","( )",[group,trim],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]]), ok = splittest("a b c ","( )",[group,{parts,0}],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]]), ok = splittest("a b c ","( )",[{parts,infinity},group],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<>>]]), @@ -441,7 +430,6 @@ split_options(Config) when is_list(Config) -> {'EXIT',{badarg,_}} = (catch re:split("a b c d","( +)",[{capture,[],binary}])), % Parts 0 is equal to no parts specification (implicit strip) ok = splittest("a b c d","( *)",[{parts,0},{return,list}],["a"," ","b"," ","c"," ","d"]), - ?t:timetrap_cancel(Dog), ok. join([]) -> []; @@ -452,12 +440,10 @@ split_specials(doc) -> ["Some special cases of split that are easy to get wrong."]; split_specials(Config) when is_list(Config) -> %% More or less just to remember these icky cases - Dog = ?t:timetrap(?t:minutes(1)), ?line <<"::abd:f">> = iolist_to_binary(join(re:split("abdf","^(?!(ab)de|x)(abd)(f)",[trim]))), ?line <<":abc2xyzabc3">> = iolist_to_binary(join(re:split("abc1abc2xyzabc3","\\Aabc.",[trim]))), - ?t:timetrap_cancel(Dog), ok. @@ -474,7 +460,7 @@ error_handling(_Config) -> error_handling() -> % This test checks the exception tuples manufactured in the erlang % code to hide the trapping from the user at least when it comes to errors - Dog = ?t:timetrap(?t:minutes(1)), + % The malformed precomiled RE is detected after % the trap to re:grun from grun, in the grun function clause % that handles precompiled expressions @@ -625,7 +611,6 @@ error_handling() -> [banana]],_}, {?MODULE,error_handling,0,_} | _]}} = (catch re:split("apa","(p",[banana])), - ?t:timetrap_cancel(Dog), ok. pcre_cve_2008_2371(doc) -> @@ -645,7 +630,6 @@ pcre_compile_workspace_overflow(Config) when is_list(Config) -> re_infinite_loop(doc) -> "Make sure matches that really loop infinitely actually fail"; re_infinite_loop(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(1)), Str = "http:/www.flickr.com/slideShow/index.gne?group_id=&user_id=69845378@N0", EMail_regex = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+" @@ -657,17 +641,14 @@ re_infinite_loop(Config) when is_list(Config) -> nomatch = re:run(Str, EMail_regex, [global]), {error,match_limit} = re:run(Str, EMail_regex,[report_errors]), {error,match_limit} = re:run(Str, EMail_regex,[report_errors,global]), - ?t:timetrap_cancel(Dog), ok. re_backwards_accented(doc) -> "Check for nasty bug where accented graphemes can make PCRE back past " "beginning of subject"; re_backwards_accented(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(1)), ?line match = re:run(<<65,204,128,65,204,128,97,98,99>>, <<"\\X?abc">>, [unicode,{capture,none}]), - ?t:timetrap_cancel(Dog), ok. opt_dupnames(doc) -> "Check correct handling of dupnames option to re"; diff --git a/lib/stdlib/test/select_SUITE.erl b/lib/stdlib/test/select_SUITE.erl index f92971583a..1f3b72b280 100644 --- a/lib/stdlib/test/select_SUITE.erl +++ b/lib/stdlib/test/select_SUITE.erl @@ -64,16 +64,15 @@ config(priv_dir,_) -> init_per_testcase/2, end_per_testcase/2, return_values/1]). -init_per_testcase(_Case, Config) when is_list(Config) -> - ?line Dog=test_server:timetrap(test_server:seconds(1200)), - [{watchdog, Dog}|Config]. +init_per_testcase(_Case, Config) -> + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,20}}]. all() -> [return_values, select_test]. diff --git a/lib/stdlib/test/sets_SUITE.erl b/lib/stdlib/test/sets_SUITE.erl index 06da696700..b866cb62e0 100644 --- a/lib/stdlib/test/sets_SUITE.erl +++ b/lib/stdlib/test/sets_SUITE.erl @@ -36,15 +36,14 @@ -import(lists, [foldl/3,reverse/1]). init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?t:minutes(5)), - [{watchdog,Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,5}}]. all() -> [create, add_element, del_element, subtract, diff --git a/lib/stdlib/test/shell_SUITE.erl b/lib/stdlib/test/shell_SUITE.erl index 747b76abb6..e1733292f6 100644 --- a/lib/stdlib/test/shell_SUITE.erl +++ b/lib/stdlib/test/shell_SUITE.erl @@ -54,17 +54,12 @@ config(priv_dir,_) -> -else. -include_lib("common_test/include/ct.hrl"). -export([init_per_testcase/2, end_per_testcase/2]). -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(10)). init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), ?line OrigPath = code:get_path(), ?line code:add_patha(?config(priv_dir,Config)), - [{orig_path,OrigPath}, {watchdog, Dog} | Config]. + [{orig_path,OrigPath} | Config]. end_per_testcase(_Case, Config) -> - ?line Dog = ?config(watchdog, Config), - ?line test_server:timetrap_cancel(Dog), ?line OrigPath = ?config(orig_path,Config), ?line code:set_path(OrigPath), ?line application:unset_env(stdlib, restricted_shell), @@ -73,7 +68,9 @@ end_per_testcase(_Case, Config) -> ok. -endif. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,10}}]. all() -> [forget, records, known_bugs, otp_5226, otp_5327, diff --git a/lib/stdlib/test/slave_SUITE.erl b/lib/stdlib/test/slave_SUITE.erl index f01bf77550..6dbbd60d6f 100644 --- a/lib/stdlib/test/slave_SUITE.erl +++ b/lib/stdlib/test/slave_SUITE.erl @@ -29,7 +29,9 @@ -export([fun_init/1, test_errors/1]). -export([timeout_test/1, auth_test/1, rsh_test/1, start_a_slave/3]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [t_start_link, start_link_nodedown, t_start, errors]. @@ -52,8 +54,6 @@ end_per_group(_GroupName, Config) -> t_start_link(suite) -> []; t_start_link(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(20)), - %% Define useful variables. ?line Host = host(), @@ -95,15 +95,12 @@ t_start_link(Config) when is_list(Config) -> ?line is_dead(Slave1), ?line is_dead(Slave2), - ?line test_server:timetrap_cancel(Dog), ok. %% Test that slave:start_link() works when the master exits. start_link_nodedown(suite) -> []; start_link_nodedown(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(20)), - %% Define useful variables. ?line Host = host(), @@ -119,7 +116,6 @@ start_link_nodedown(Config) when is_list(Config) -> ?line receive after 200 -> ok end, ?line pang = net_adm:ping(Slave), - ?line test_server:timetrap_cancel(Dog), ok. start_a_slave(ReplyTo, Host, Name) -> @@ -130,8 +126,6 @@ start_a_slave(ReplyTo, Host, Name) -> t_start(suite) -> []; t_start(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(20)), - %% Define useful variables. ?line Host = host(), @@ -173,7 +167,6 @@ t_start(Config) when is_list(Config) -> ?line is_dead(Slave1), ?line is_dead(Slave2), - ?line test_server:timetrap_cancel(Dog), ok. %% Test the various error conditions in parallell (since the timeout @@ -181,8 +174,6 @@ t_start(Config) when is_list(Config) -> errors(suite) -> []; errors(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:seconds(50)), - ?line process_flag(trap_exit, true), ?line Pa = filename:dirname(code:which(?MODULE)), ?line {ok, Master} = slave_start_link(host(), master, @@ -191,7 +182,6 @@ errors(Config) when is_list(Config) -> ?line Pids = rpc:call(Master, ?MODULE, test_errors, [self()]), ?line wait_for_result(Pids), - ?line test_server:timetrap_cancel(Dog), ok. wait_for_result([]) -> diff --git a/lib/stdlib/test/sofs_SUITE.erl b/lib/stdlib/test/sofs_SUITE.erl index 9eed2893d4..c227575a50 100644 --- a/lib/stdlib/test/sofs_SUITE.erl +++ b/lib/stdlib/test/sofs_SUITE.erl @@ -87,7 +87,9 @@ -compile({inline,[{eval,2}]}). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,2}}]. all() -> [{group, sofs}, {group, sofs_family}]. @@ -129,12 +131,9 @@ end_per_group(_GroupName, Config) -> init_per_testcase(_Case, Config) -> - Dog=?t:timetrap(?t:minutes(2)), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. %% [{2,b},{1,a,b}] == lists:sort([{2,b},{1,a,b}]) diff --git a/lib/stdlib/test/string_SUITE.erl b/lib/stdlib/test/string_SUITE.erl index 6ac3950f44..8a5759279b 100644 --- a/lib/stdlib/test/string_SUITE.erl +++ b/lib/stdlib/test/string_SUITE.erl @@ -23,10 +23,6 @@ -module(string_SUITE). -include_lib("common_test/include/ct.hrl"). - -% Default timetrap timeout (set in init_per_testcase). --define(default_timeout, ?t:minutes(1)). - % Test server specific exports -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). @@ -39,10 +35,10 @@ -export([sub_string/1,centre/1, join/1]). -export([to_integer/1,to_float/1]). -export([to_upper_to_lower/1]). -%% -%% all/1 -%% -suite() -> [{ct_hooks,[ts_install_cth]}]. + +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [len, equal, concat, chr_rchr, str_rstr, span_cspan, @@ -67,11 +63,9 @@ end_per_group(_GroupName, Config) -> init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), + Config. + +end_per_testcase(_Case, _Config) -> ok. % diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl index 903ca76575..acfe6c9067 100644 --- a/lib/stdlib/test/supervisor_SUITE.erl +++ b/lib/stdlib/test/supervisor_SUITE.erl @@ -22,7 +22,6 @@ -module(supervisor_SUITE). -include_lib("common_test/include/ct.hrl"). --define(TIMEOUT, ?t:minutes(1)). %% Testserver specific export -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, @@ -78,7 +77,8 @@ %%------------------------------------------------------------------------- suite() -> - [{ct_hooks,[ts_install_cth]}]. + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [{group, sup_start}, {group, sup_start_map}, {group, sup_stop}, child_adm, @@ -144,11 +144,9 @@ end_per_group(_GroupName, Config) -> Config. init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?TIMEOUT), - [{watchdog,Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - ?t:timetrap_cancel(?config(watchdog,Config)), +end_per_testcase(_Case, _Config) -> ok. start_link(InitResult) -> diff --git a/lib/stdlib/test/supervisor_bridge_SUITE.erl b/lib/stdlib/test/supervisor_bridge_SUITE.erl index 94e719bea1..768ff77be5 100644 --- a/lib/stdlib/test/supervisor_bridge_SUITE.erl +++ b/lib/stdlib/test/supervisor_bridge_SUITE.erl @@ -30,7 +30,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [starting, mini_terminate, mini_die, badstart, simple_global_supervisor]. @@ -77,9 +79,9 @@ miniappl(N) -> process_flag(trap_exit,true), ?line {ok,Server} = start(3), ?line Client = spawn_link(?MODULE,client,[N]), - ?line Handle = test_server:timetrap(2000), - ?line miniappl_loop(Client,Server), - ?line test_server:timetrap_cancel(Handle). + ct:timetrap({seconds,2}), + miniappl_loop(Client, Server). + miniappl_loop([],[]) -> ok; @@ -173,8 +175,6 @@ terminate(_Reason, _State) -> badstart(suite) -> []; badstart(doc) -> "Test various bad ways of starting a supervisor bridge."; badstart(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(1)), - %% Various bad arguments. ?line {'EXIT',_} = @@ -199,7 +199,6 @@ badstart(Config) when is_list(Config) -> ?line receive {'EXIT', Pid, killed} -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -208,7 +207,6 @@ badstart(Config) when is_list(Config) -> simple_global_supervisor(suite) -> []; simple_global_supervisor(doc) -> "Globally registered supervisor."; simple_global_supervisor(Config) when is_list(Config) -> - ?line Dog = test_server:timetrap({seconds,10}), Child = {child, {?MODULE,server9212,[]}, permanent, 2000, worker, []}, InitResult = {ok, {{one_for_all,3,60}, [Child]}}, @@ -225,7 +223,6 @@ simple_global_supervisor(Config) when is_list(Config) -> ?line process_flag(trap_exit, true), exit(Sup, kill), ?line receive {'EXIT', Sup, killed} -> ok end, - ?line test_server:timetrap_cancel(Dog), ok. server9212() -> diff --git a/lib/stdlib/test/timer_SUITE.erl b/lib/stdlib/test/timer_SUITE.erl index e4d656c9bf..d43f78a481 100644 --- a/lib/stdlib/test/timer_SUITE.erl +++ b/lib/stdlib/test/timer_SUITE.erl @@ -41,7 +41,9 @@ %% reasonable on different machines; therefore the test can sometimes %% fail, even though the timer module is ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,20}}]. all() -> [do_big_test]. @@ -65,11 +67,9 @@ end_per_group(_GroupName, Config) -> %% ------------------------------------------------------- %% do_big_test(TConfig) when is_list(TConfig) -> - Dog = ?t:timetrap(?t:minutes(20)), Save = process_flag(trap_exit, true), Result = big_test(200), process_flag(trap_exit, Save), - ?t:timetrap_cancel(Dog), report_result(Result). report_result(ok) -> ok; diff --git a/lib/stdlib/test/timer_simple_SUITE.erl b/lib/stdlib/test/timer_simple_SUITE.erl index 42b96c4b1c..f3cf34843b 100644 --- a/lib/stdlib/test/timer_simple_SUITE.erl +++ b/lib/stdlib/test/timer_simple_SUITE.erl @@ -56,7 +56,9 @@ -define(MAXREF, (1 bsl 18)). -define(REFMARG, 30). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,10}}]. all() -> [apply_after, send_after1, send_after2, send_after3, @@ -356,12 +358,10 @@ forever() -> % Testing for performance (on different implementations) of timers % + timer_perf(suite) -> []; timer_perf(Config) when is_list(Config) -> - Dog = ?t:timetrap(?t:minutes(10)), - Res = performance(timer), - ?t:timetrap_cancel(Dog), - Res. + performance(timer). performance(Mod) -> process_flag(trap_exit, true), diff --git a/lib/stdlib/test/unicode_SUITE.erl b/lib/stdlib/test/unicode_SUITE.erl index f45e00928e..61e3bcd0be 100644 --- a/lib/stdlib/test/unicode_SUITE.erl +++ b/lib/stdlib/test/unicode_SUITE.erl @@ -38,15 +38,15 @@ ex_binaries_errors_utf32_little/1, ex_binaries_errors_utf32_big/1]). -init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> - Dog=?t:timetrap(?t:minutes(20)), - [{watchdog, Dog}|Config]. +init_per_testcase(_Case, Config) -> + Config. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog). +end_per_testcase(_Case, _Config) -> + ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,20}}]. all() -> [utf8_illegal_sequences_bif, diff --git a/lib/stdlib/test/win32reg_SUITE.erl b/lib/stdlib/test/win32reg_SUITE.erl index 88614c639d..c74f05637f 100644 --- a/lib/stdlib/test/win32reg_SUITE.erl +++ b/lib/stdlib/test/win32reg_SUITE.erl @@ -24,7 +24,9 @@ -include_lib("common_test/include/ct.hrl"). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{seconds,10}}]. all() -> [long, evil_write]. @@ -52,8 +54,6 @@ end_per_suite(Config) when is_list(Config) -> long(doc) -> "Test long keys and entries (OTP-3446)."; long(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), - LongKey = "software\\" ++ lists:flatten(lists:duplicate(10, "..\\software\\")) ++ "Ericsson\\Erlang", @@ -76,12 +76,9 @@ long(Config) when is_list(Config) -> %% Done. ok = win32reg:close(Reg), - test_server:timetrap_cancel(Dog), ok. evil_write(Config) when is_list(Config) -> - Dog = test_server:timetrap(test_server:seconds(10)), - Key = "Software\\Ericsson\\Erlang", {ok,Reg} = win32reg:open([read,write]), ok = win32reg:change_key(Reg, "\\hkcu"), @@ -95,7 +92,6 @@ evil_write(Config) when is_list(Config) -> %% Done. ok = win32reg:close(Reg), - test_server:timetrap_cancel(Dog), ok. evil_write_1(Reg, [_|[_|_]=Key]=Key0) -> |