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

« back to all changes in this revision

Viewing changes to lib/compiler/test/compilation_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
20
20
 
21
21
-module(compilation_SUITE).
22
22
 
23
 
-include("test_server.hrl").
 
23
-include_lib("test_server/include/test_server.hrl").
24
24
 
25
25
-compile(export_all).
26
26
 
27
 
all(suite) ->
28
 
    test_lib:recompile(?MODULE),
29
 
    [self_compile_old_inliner,self_compile,
30
 
     compiler_1,compiler_3,compiler_5,
31
 
     beam_compiler_1, beam_compiler_2, beam_compiler_3,
32
 
     beam_compiler_4, beam_compiler_5, beam_compiler_6,
33
 
     beam_compiler_7, beam_compiler_8, beam_compiler_9,
34
 
     beam_compiler_10, beam_compiler_11, beam_compiler_12,
35
 
     nested_tuples_in_case_expr,
36
 
     otp_2330, guards, vsn,
37
 
     otp_2380, otp_2141, otp_2173, otp_4790,
38
 
     const_list_256,
39
 
     bin_syntax_1, bin_syntax_2, bin_syntax_3,
40
 
     bin_syntax_4, bin_syntax_5, bin_syntax_6,
41
 
     live_var, convopts,
42
 
     bad_functional_value,
43
 
     catch_in_catch, redundant_case, long_string,
44
 
     otp_5076, complex_guard, otp_5092, otp_5151,
45
 
     otp_5235,otp_5244,
46
 
     trycatch_4, opt_crash,
47
 
     otp_5404,otp_5436,otp_5481,otp_5553,otp_5632,
48
 
     otp_5714,otp_5872,otp_6121,otp_6121a,otp_6121b,
49
 
     otp_7202,otp_7345,on_load
50
 
    ].
 
27
suite() -> [{ct_hooks,[ts_install_cth]}].
 
28
 
 
29
all() -> 
 
30
    test_lib:recompile(compilation_SUITE),
 
31
    [self_compile_old_inliner, self_compile, compiler_1,
 
32
     compiler_3, compiler_5, beam_compiler_1,
 
33
     beam_compiler_2, beam_compiler_3, beam_compiler_4,
 
34
     beam_compiler_5, beam_compiler_6, beam_compiler_7,
 
35
     beam_compiler_8, beam_compiler_9, beam_compiler_10,
 
36
     beam_compiler_11, beam_compiler_12,
 
37
     nested_tuples_in_case_expr, otp_2330, guards,
 
38
     {group, vsn}, otp_2380, otp_2141, otp_2173, otp_4790,
 
39
     const_list_256, bin_syntax_1, bin_syntax_2,
 
40
     bin_syntax_3, bin_syntax_4, bin_syntax_5, bin_syntax_6,
 
41
     live_var, convopts, bad_functional_value,
 
42
     catch_in_catch, redundant_case, long_string, otp_5076,
 
43
     complex_guard, otp_5092, otp_5151, otp_5235, otp_5244,
 
44
     trycatch_4, opt_crash, otp_5404, otp_5436, otp_5481,
 
45
     otp_5553, otp_5632, otp_5714, otp_5872, otp_6121,
 
46
     otp_6121a, otp_6121b, otp_7202, otp_7345, on_load,
 
47
     string_table,otp_8949_a,otp_8949_a].
 
48
 
 
49
groups() -> 
 
50
    [{vsn, [], [vsn_1, vsn_2, vsn_3]}].
 
51
 
 
52
init_per_suite(Config) ->
 
53
    Config.
 
54
 
 
55
end_per_suite(_Config) ->
 
56
    ok.
 
57
 
 
58
init_per_group(_GroupName, Config) ->
 
59
    Config.
 
60
 
 
61
end_per_group(_GroupName, Config) ->
 
62
    Config.
51
63
 
52
64
-define(comp(N),
53
65
        N(Config) when is_list(Config) -> try_it(N, Config)).
151
163
beam_compiler_7(doc) ->
152
164
    "Code snippet submitted from Ulf Wiger which fails in R3 Beam.";
153
165
beam_compiler_7(suite) -> [];
154
 
beam_compiler_7(Config) when list(Config) ->
 
166
beam_compiler_7(Config) when is_list(Config) ->
155
167
    ?line done = empty(2, false).
156
168
 
157
169
empty(N, Toggle) when N > 0 ->
311
323
from(H, [_ | T]) -> from(H, T);
312
324
from(_, []) -> [].
313
325
 
314
 
vsn(suite) -> [vsn_1, vsn_2, vsn_3].
315
326
 
316
327
vsn_1(doc) ->
317
328
    "Test generation of 'vsn' attribute";
318
329
vsn_1(suite) -> [];
319
 
vsn_1(Conf) when list(Conf) ->
 
330
vsn_1(Conf) when is_list(Conf) ->
320
331
    ?line M = vsn_1,
321
332
 
322
333
    ?line compile_load(M, ?config(data_dir, Conf), Conf),
340
351
vsn_2(doc) ->
341
352
    "Test overriding of generation of 'vsn' attribute";
342
353
vsn_2(suite) -> [];
343
 
vsn_2(Conf) when list(Conf) ->
 
354
vsn_2(Conf) when is_list(Conf) ->
344
355
    ?line M = vsn_2,
345
356
 
346
357
    ?line compile_load(M, ?config(data_dir, Conf), Conf),
356
367
vsn_3(doc) ->
357
368
    "Test that different code yields different generated 'vsn'";
358
369
vsn_3(suite) -> [];
359
 
vsn_3(Conf) when list(Conf) ->
 
370
vsn_3(Conf) when is_list(Conf) ->
360
371
    ?line M = vsn_3,
361
372
 
362
373
    ?line compile_load(M, ?config(data_dir, Conf), Conf),
596
607
                       10},
597
608
    id(LlUnitdataReq).
598
609
 
 
610
%% Check the generation of the string table.
 
611
 
 
612
string_table(Config) when is_list(Config) ->
 
613
    ?line DataDir = ?config(data_dir, Config),
 
614
    ?line File = filename:join(DataDir, "string_table.erl"),
 
615
    ?line {ok,string_table,Beam,[]} = compile:file(File, [return, binary]),
 
616
    ?line {ok,{string_table,[StringTableChunk]}} = beam_lib:chunks(Beam, ["StrT"]),
 
617
    ?line {"StrT", <<"stringabletringtable">>} = StringTableChunk,
 
618
    ok.
 
619
 
 
620
otp_8949_a(Config) when is_list(Config) ->
 
621
    value = otp_8949_a(),
 
622
    ok.
 
623
 
 
624
-record(cs, {exs,keys = [],flags = 1}).
 
625
-record(exs, {children = []}).
 
626
 
 
627
otp_8949_a() ->
 
628
    case id([#cs{}]) of
 
629
        [#cs{}=Cs] ->
 
630
            SomeVar = id(value),
 
631
            if
 
632
                Cs#cs.flags band 1 =/= 0 ->
 
633
                    id(SomeVar);
 
634
                (((Cs#cs.exs)#exs.children /= [])
 
635
                 and
 
636
                   (Cs#cs.flags band (1 bsl 0 bor (1 bsl 22)) == 0));
 
637
                Cs#cs.flags band (1 bsl 22) =/= 0 ->
 
638
                    ok
 
639
            end
 
640
    end.
 
641
    
 
642
otp_8949_b(Config) when is_list(Config) ->
 
643
    self() ! something,
 
644
    ?line value = otp_8949_b([], false),
 
645
    ?line {'EXIT',_} = (catch otp_8949_b([], true)),
 
646
    ok.
 
647
 
 
648
%% Would cause an endless loop in beam_utils.
 
649
otp_8949_b(A, B) ->
 
650
    Var = id(value),
 
651
    if
 
652
        A == [], B == false ->
 
653
            ok
 
654
    end,
 
655
    receive
 
656
        something ->
 
657
            id(Var)
 
658
    end.
 
659
    
 
660
 
599
661
id(I) -> I.