diff options
author | Peter Andersson <[email protected]> | 2011-04-19 23:25:12 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2011-04-28 22:45:58 +0200 |
commit | 0197acace48c17dcb500b7bdb10d2cc1cbaa848e (patch) | |
tree | db8cbd8253a578c70eacb1001964b449cc2e9e53 /lib/common_test/test/ct_error_SUITE_data | |
parent | 0634077b636eb0c879e1f71ba78ea1565b6617b2 (diff) | |
download | otp-0197acace48c17dcb500b7bdb10d2cc1cbaa848e.tar.gz otp-0197acace48c17dcb500b7bdb10d2cc1cbaa848e.tar.bz2 otp-0197acace48c17dcb500b7bdb10d2cc1cbaa848e.zip |
Fix problems with timetrap handling in common_test:
1. ct:timetrap(infinity) not supported.
2. Previous set timetrap for a test case is not cancelled by new one.
Diffstat (limited to 'lib/common_test/test/ct_error_SUITE_data')
-rw-r--r-- | lib/common_test/test/ct_error_SUITE_data/error/test/timetrap_2_SUITE.erl | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/timetrap_2_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/timetrap_2_SUITE.erl index 99bb400137..7fcb631d06 100644 --- a/lib/common_test/test/ct_error_SUITE_data/error/test/timetrap_2_SUITE.erl +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/timetrap_2_SUITE.erl @@ -77,8 +77,8 @@ init_per_testcase(tc1, Config) -> ct:timetrap({seconds,1}), Config; -init_per_testcase(tc3, Config) -> - ct:timetrap({seconds,1}), +init_per_testcase(tc2, Config) -> + ct:timetrap(250), Config; init_per_testcase(_TestCase, Config) -> @@ -90,7 +90,7 @@ init_per_testcase(_TestCase, Config) -> %% TestCase = atom() %% Config0 = Config1 = [tuple()] %%-------------------------------------------------------------------- -end_per_testcase(_, Config) -> +end_per_testcase(_, _Config) -> ok. %%-------------------------------------------------------------------- @@ -116,7 +116,7 @@ groups() -> %% Reason = term() %%-------------------------------------------------------------------- all() -> - [tc0,tc1,tc2]. + [tc0,tc1,tc2,tc3]. tc0(_) -> N = list_to_integer(ct:get_config(multiply)), @@ -131,8 +131,24 @@ tc1(_) -> ok. tc2(_) -> + ct:timetrap(500), N = list_to_integer(ct:get_config(multiply)), ct:comment(io_lib:format("TO after ~w sec", [0.5*N])), - ct:timetrap(500), ct:sleep(2000), ok. + +tc3() -> + [{timetrap,{seconds,2}}]. + +tc3(_) -> + T0 = now(), + ct:timetrap(infinity), + N = list_to_integer(ct:get_config(multiply)), + ct:comment(io_lib:format("Sleeping for ~w sec...", [4*N])), + ct:sleep(4000), + Diff = timer:now_diff(now(), T0), + if ((Diff < (N*4000000)) or (Diff > (N*4500000))) -> + exit(not_expected); + true -> + ok + end. |