~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/stdlib/test/timer_simple_SUITE.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
3
%% 
4
 
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
 
4
%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
5
5
%% 
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
21
21
-module(timer_simple_SUITE).
22
22
 
23
23
%% external
24
 
-export([all/1, 
 
24
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, 
 
25
         init_per_group/2,end_per_group/2, 
25
26
         init_per_testcase/2,
26
27
         apply_after/1,
27
28
         send_after1/1,
49
50
         timer/4,
50
51
         timer/5]).
51
52
 
52
 
-include("test_server.hrl").
 
53
-include_lib("test_server/include/test_server.hrl").
53
54
 
54
55
-define(MAXREF, (1 bsl 18)).
55
56
-define(REFMARG, 30).
56
57
 
57
 
all(doc) -> "Test of the timer module.";
58
 
all(suite) -> 
59
 
    [apply_after,
60
 
     send_after1,
61
 
     send_after2,
62
 
     send_after3,
63
 
     exit_after1,
64
 
     exit_after2,
65
 
     kill_after1,
66
 
     kill_after2,
67
 
     apply_interval,
68
 
     send_interval1,
69
 
     send_interval2,
70
 
     send_interval3,
71
 
     send_interval4,
72
 
     cancel1,
73
 
     cancel2,
74
 
     tc,
75
 
     unique_refs,
76
 
     timer_perf].
 
58
suite() -> [{ct_hooks,[ts_install_cth]}].
 
59
 
 
60
all() -> 
 
61
    [apply_after, send_after1, send_after2, send_after3,
 
62
     exit_after1, exit_after2, kill_after1, kill_after2,
 
63
     apply_interval, send_interval1, send_interval2,
 
64
     send_interval3, send_interval4, cancel1, cancel2, tc,
 
65
     unique_refs, timer_perf].
 
66
 
 
67
groups() -> 
 
68
    [].
 
69
 
 
70
init_per_suite(Config) ->
 
71
    Config.
 
72
 
 
73
end_per_suite(_Config) ->
 
74
    ok.
 
75
 
 
76
init_per_group(_GroupName, Config) ->
 
77
    Config.
 
78
 
 
79
end_per_group(_GroupName, Config) ->
 
80
    Config.
 
81
 
77
82
 
78
83
init_per_testcase(_, Config) when is_list(Config) ->
79
84
    timer:start(),
224
229
tc(doc) -> "Test sleep/1 and tc/3.";
225
230
tc(suite) -> [];
226
231
tc(Config) when is_list(Config) ->
227
 
    % This should both sleep and tc 
228
 
    ?line {Res, ok} = timer:tc(timer, sleep, [500]),  
229
 
    ?line ok =  if 
230
 
                    Res < 500*1000 -> {too_early, Res};  % Too early
231
 
                    Res > 800*1000 -> {too_late, Res};  % Too much time
 
232
    % This should both sleep and tc/3
 
233
    ?line {Res1, ok} = timer:tc(timer, sleep, [500]),
 
234
    ?line ok =  if
 
235
                    Res1 < 500*1000 -> {too_early, Res1}; % Too early
 
236
                    Res1 > 800*1000 -> {too_late, Res1};  % Too much time
 
237
                    true -> ok
 
238
                end,
 
239
 
 
240
    % This should both sleep and tc/2
 
241
    ?line {Res2, ok} = timer:tc(fun(T) -> timer:sleep(T) end, [500]),
 
242
    ?line ok =  if
 
243
                    Res2 < 500*1000 -> {too_early, Res2}; % Too early
 
244
                    Res2 > 800*1000 -> {too_late, Res2};  % Too much time
232
245
                    true -> ok
233
246
                end,
234
247