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

« back to all changes in this revision

Viewing changes to lib/debugger/test/bs_bincomp_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 2007-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
%% Originally based on Per Gustafsson's test suite.
 
22
%%
 
23
 
 
24
-module(bs_bincomp_SUITE).
 
25
 
 
26
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, 
 
27
         init_per_group/2,end_per_group/2,
 
28
         init_per_testcase/2,end_per_testcase/2,
 
29
         byte_aligned/1,bit_aligned/1,extended_byte_aligned/1,
 
30
         extended_bit_aligned/1,mixed/1]).
 
31
 
 
32
-include_lib("test_server/include/test_server.hrl").
 
33
 
 
34
init_per_testcase(_Case, Config) ->
 
35
    test_lib:interpret(?MODULE),
 
36
    Dog = test_server:timetrap(?t:minutes(1)),
 
37
    [{watchdog,Dog}|Config].
 
38
 
 
39
end_per_testcase(_Case, Config) ->
 
40
    Dog = ?config(watchdog, Config),
 
41
    ?t:timetrap_cancel(Dog),
 
42
    ok.
 
43
 
 
44
suite() -> [{ct_hooks,[ts_install_cth]}].
 
45
 
 
46
all() -> 
 
47
    [byte_aligned, bit_aligned, extended_byte_aligned,
 
48
     extended_bit_aligned, mixed].
 
49
 
 
50
groups() -> 
 
51
    [].
 
52
 
 
53
init_per_suite(Config) ->
 
54
    Config.
 
55
 
 
56
end_per_suite(_Config) ->
 
57
    ok.
 
58
 
 
59
init_per_group(_GroupName, Config) ->
 
60
    Config.
 
61
 
 
62
end_per_group(_GroupName, Config) ->
 
63
    Config.
 
64
 
 
65
 
 
66
 
 
67
byte_aligned(Config) when is_list(Config) ->
 
68
    ?line <<"abcdefg">> = << <<(X+32)>> || <<X>> <= <<"ABCDEFG">> >>,
 
69
    ?line <<1:32/little,2:32/little,3:32/little,4:32/little>> =
 
70
        << <<X:32/little>> || <<X:32>> <= <<1:32,2:32,3:32,4:32>> >>,
 
71
    ?line <<1:32/little,2:32/little,3:32/little,4:32/little>> =
 
72
        << <<X:32/little>> || <<X:16>> <= <<1:16,2:16,3:16,4:16>> >>,
 
73
  ok.
 
74
 
 
75
bit_aligned(Config) when is_list(Config) ->
 
76
    ?line <<$a:7,$b:7,$c:7,$d:7,$e:7,$f:7,$g:7>> =
 
77
        << <<(X+32):7>> || <<X>> <= <<"ABCDEFG">> >>,
 
78
    ?line <<"ABCDEFG">> =
 
79
        << <<(X-32)>> || <<X:7>> <= <<$a:7,$b:7,$c:7,$d:7,$e:7,$f:7,$g:7>> >>,
 
80
    ?line <<1:31/little,2:31/little,3:31/little,4:31/little>> =
 
81
        << <<X:31/little>> || <<X:31>> <= <<1:31,2:31,3:31,4:31>> >>,
 
82
    ?line <<1:31/little,2:31/little,3:31/little,4:31/little>> =
 
83
        << <<X:31/little>> || <<X:15>> <= <<1:15,2:15,3:15,4:15>> >>,
 
84
  ok.
 
85
 
 
86
extended_byte_aligned(Config) when is_list(Config) ->
 
87
    ?line <<"abcdefg">> = << <<(X+32)>> || X <- "ABCDEFG" >>,
 
88
    ?line "abcdefg" = [(X+32) || <<X>> <= <<"ABCDEFG">>],
 
89
    ?line <<1:32/little,2:32/little,3:32/little,4:32/little>> =
 
90
        << <<X:32/little>> || X <- [1,2,3,4] >>,
 
91
    ?line [256,512,768,1024] =
 
92
        [X || <<X:16/little>> <= <<1:16,2:16,3:16,4:16>>],
 
93
  ok.
 
94
 
 
95
extended_bit_aligned(Config) when is_list(Config) ->
 
96
    ?line <<$a:7,$b:7,$c:7,$d:7,$e:7,$f:7,$g:7>> =
 
97
        << <<(X+32):7>> || X <- "ABCDEFG" >>,
 
98
    ?line "ABCDEFG" = [(X-32) || <<X:7>> <= <<$a:7,$b:7,$c:7,$d:7,$e:7,$f:7,$g:7>>],
 
99
    ?line <<1:31/little,2:31/little,3:31/little,4:31/little>> =
 
100
        << <<X:31/little>> || X <- [1,2,3,4] >>,
 
101
    ?line [256,512,768,1024] =
 
102
        [X || <<X:15/little>> <= <<1:15,2:15,3:15,4:15>>],
 
103
    ok.
 
104
 
 
105
mixed(Config) when is_list(Config) ->
 
106
    ?line <<2,3,3,4,4,5,5,6>> =
 
107
        << <<(X+Y)>> || <<X>> <= <<1,2,3,4>>, <<Y>> <= <<1,2>> >>,
 
108
    ?line <<2,3,3,4,4,5,5,6>> =
 
109
        << <<(X+Y)>> || <<X>> <= <<1,2,3,4>>, Y <- [1,2] >>,
 
110
    ?line <<2,3,3,4,4,5,5,6>> =
 
111
        << <<(X+Y)>> || X <- [1,2,3,4], Y <- [1,2] >>,
 
112
    ?line [2,3,3,4,4,5,5,6] =
 
113
        [(X+Y) || <<X>> <= <<1,2,3,4>>, <<Y>> <= <<1,2>>],
 
114
    ?line [2,3,3,4,4,5,5,6] =
 
115
        [(X+Y) || <<X>> <= <<1,2,3,4>>, Y <- [1,2]],
 
116
    ?line <<2:3,3:3,3:3,4:3,4:3,5:3,5:3,6:3>> =
 
117
        << <<(X+Y):3>> || <<X:3>> <= <<1:3,2:3,3:3,4:3>>, <<Y:3>> <= <<1:3,2:3>> >>,
 
118
    ?line <<2:3,3:3,3:3,4:3,4:3,5:3,5:3,6:3>> =
 
119
        << <<(X+Y):3>> || <<X:3>> <= <<1:3,2:3,3:3,4:3>>, Y <- [1,2] >>,
 
120
    ?line <<2:3,3:3,3:3,4:3,4:3,5:3,5:3,6:3>> =
 
121
        << <<(X+Y):3>> || X <- [1,2,3,4], Y <- [1,2] >>,
 
122
    ?line [2,3,3,4,4,5,5,6] =
 
123
        [(X+Y) || <<X:3>> <= <<1:3,2:3,3:3,4:3>>, <<Y:3>> <= <<1:3,2:3>>],
 
124
    ?line [2,3,3,4,4,5,5,6] =
 
125
        [(X+Y) || <<X:3>> <= <<1:3,2:3,3:3,4:3>>, Y <- [1,2]],
 
126
    ok.