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

« back to all changes in this revision

Viewing changes to lib/debugger/test/debugger_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
%%
 
2
%% %CopyrightBegin%
 
3
%%
 
4
%% Copyright Ericsson AB 2001-2011. All Rights Reserved.
 
5
%%
 
6
%% The contents of this file are subject to the Erlang Public License,
 
7
%% Version 1.1, (the "License"); you may not use this file except in
 
8
%% compliance with the License. You should have received a copy of the
 
9
%% Erlang Public License along with this software. If not, it can be
 
10
%% retrieved online at http://www.erlang.org/.
 
11
%%
 
12
%% Software distributed under the License is distributed on an "AS IS"
 
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
14
%% the License for the specific language governing rights and limitations
 
15
%% under the License.
 
16
%%
 
17
%% %CopyrightEnd%
 
18
%%
 
19
 
 
20
%%
 
21
-module(debugger_SUITE).
 
22
 
 
23
%% Test break points.
 
24
 
 
25
-include_lib("test_server/include/test_server.hrl").
 
26
 
 
27
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, 
 
28
         init_per_group/2,end_per_group/2,
 
29
         init_per_testcase/2,end_per_testcase/2,
 
30
         app_test/1,erts_debug/1,encrypted_debug_info/1,
 
31
         no_abstract_code/1]).
 
32
 
 
33
suite() -> [{ct_hooks,[ts_install_cth]}].
 
34
 
 
35
all() -> 
 
36
    [app_test, erts_debug, no_abstract_code,
 
37
     encrypted_debug_info].
 
38
 
 
39
groups() -> 
 
40
    [].
 
41
 
 
42
init_per_suite(Config) ->
 
43
    Config.
 
44
 
 
45
end_per_suite(_Config) ->
 
46
    ok.
 
47
 
 
48
init_per_group(_GroupName, Config) ->
 
49
    Config.
 
50
 
 
51
end_per_group(_GroupName, Config) ->
 
52
    Config.
 
53
 
 
54
 
 
55
init_per_testcase(_Case, Config) ->
 
56
    Dog=test_server:timetrap(?t:minutes(0.5)),
 
57
    [{watchdog, Dog}|Config].
 
58
end_per_testcase(_Case, Config) ->
 
59
    Dog=?config(watchdog, Config),
 
60
    test_server:timetrap_cancel(Dog),
 
61
    ok.
 
62
 
 
63
app_test(Config) when is_list(Config) ->
 
64
    ?line ?t:app_test(debugger),
 
65
    ok.
 
66
 
 
67
erts_debug(Config) when is_list(Config) ->
 
68
    c:l(erts_debug),
 
69
    ok.
 
70
 
 
71
no_abstract_code(Config) when is_list(Config) ->
 
72
    ?line PrivDir = ?config(priv_dir, Config),
 
73
    ?line Simple = filename:join(PrivDir, "simple"),
 
74
    ?line Source = Simple ++ ".erl",
 
75
    ?line BeamFile = Simple ++ ".beam",
 
76
    ?line simple_file(Source),
 
77
 
 
78
    %% Compile module without abstract code.
 
79
    CompileFlags = [{outdir,PrivDir}],
 
80
    ?line {ok,_} = compile:file(Source, CompileFlags),
 
81
    ?line error = int:i(Simple),
 
82
 
 
83
    %% Cleanup.
 
84
    ?line ok = file:delete(Source),
 
85
    ?line ok = file:delete(BeamFile),
 
86
 
 
87
    ok.
 
88
 
 
89
encrypted_debug_info(Config) when is_list(Config) ->
 
90
    try begin crypto:start(), crypto:info(), crypto:stop(), ok end of
 
91
        ok ->
 
92
            encrypted_debug_info_1(Config)
 
93
    catch
 
94
        error:_ ->
 
95
            {skip,"The crypto application is missing or broken"}
 
96
    end.
 
97
 
 
98
encrypted_debug_info_1(Config) ->
 
99
    ?line PrivDir = ?config(priv_dir, Config),
 
100
    ?line Simple = filename:join(PrivDir, "simple"),
 
101
    ?line Source = Simple ++ ".erl",
 
102
    ?line BeamFile = Simple ++ ".beam",
 
103
    ?line simple_file(Source),
 
104
 
 
105
    %% Compile module.
 
106
    Key = "_This a Crypto Key_",
 
107
    CompileFlags = [{outdir,PrivDir},debug_info,{debug_info_key,Key}],
 
108
    ?line {ok,_} = compile:file(Source, CompileFlags),
 
109
 
 
110
    %% Interpret module
 
111
    ?line ok = beam_lib:crypto_key_fun(simple_crypto_fun(Key)),
 
112
    ?line {module,simple} = int:i(Simple),
 
113
 
 
114
    %% Remove key.
 
115
    ?line {ok,_} = beam_lib:clear_crypto_key_fun(),
 
116
    ?line error = int:i(Simple),
 
117
 
 
118
    %% Cleanup.
 
119
    ?line ok = file:delete(Source),
 
120
    ?line ok = file:delete(BeamFile),
 
121
 
 
122
    ok.
 
123
 
 
124
simple_crypto_fun(Key) ->
 
125
    fun(init) -> ok;
 
126
       ({debug_info, des3_cbc, simple, _}) -> Key
 
127
    end.
 
128
 
 
129
 
 
130
simple_file(File) ->
 
131
    simple_file(File, simple).
 
132
 
 
133
simple_file(File, Module) ->
 
134
    simple_file(File, Module, member).
 
135
 
 
136
simple_file(File, Module, F) ->
 
137
    B = list_to_binary(["-module(", atom_to_list(Module), "). "
 
138
                        "-export([t/0]). "
 
139
                        "t() -> "
 
140
                        "    t([]). "
 
141
                        "t(L) -> "
 
142
                        "    lists:",
 
143
                        atom_to_list(F), "(a, L). "]),
 
144
    ok = file:write_file(File, B).