~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/asn1/test/testMergeCompile.erl

  • Committer: Elliot Murphy
  • Date: 2010-06-08 03:55:44 UTC
  • mfrom: (3.5.6 squeeze)
  • Revision ID: elliot@elliotmurphy.com-20100608035544-dd8zh2swk7jr5rz2
* Merge with Debian unstable; remaining Ubuntu changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to. (LP #438365)
  - 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.
* Added missing symlinks to /usr/include for a few new header files.
* Fixed generation of ${erlang-base:Depends} and ${erlang-x11:Depends}
  substitution variables.
* Added a fix for a re:compile/2 crash on a long regular expression.
* Changed urgency to medium as the change fixes a security bug.
* Manpages in section 1 are needed even if only arch-dependent packages are
  built. So, re-enabled them.
* Fixed HiPE architecture recognition for powerpc Debian architecture.
* Moved xsltproc and fop to build-depends-indep and do not build
  documentation if only architecture-specific packages are built.
* Refreshed all patches.
* Made Emacs look in man5 and man7 for Erlang manpages and added code
  skeleton files to erlang-mode package.
* New upstream release.
* Moved manpages from incorrect sections 4 and 6 to correct 5 and 7
  (closes: #498492).
* Made manpages regexp in Emacs mode match only 3erl pages in section 3.
* Removed docb_gen script which is no longer needed to build manpages.
* Added erlang-doc package which contains documentation in HTML and PDF
  formats. This package replaces erlang-doc-html package and it's easier
  to synchronize it with the main Erlang packages as it's built from
  a single source package (closes: #558451).
* Removed RPATH from ssl and crypto application binaries as required by
  Debian policy.
* Added libwxgtk2.4-dev and libwxgtk2.6-dev to build conflicts.
* Added a few dpendencies for erlang-dialyzer, erlang-et, erlang-observer
  and erlang-examples packages which now call functions from more modules
  than in 1:13.b.3.
* Added a workaround which disables vfork() for hppa architecture
  (closes: #562218).
* Strictened check for JDK 1.5 adding a call to String(int[], int, int)
  because GCJ 4.4 doesn't implement it and OpenJDK isn't available for all
  architectures.
* Fixed erlang-manpages package section.
* Made erlang-depends add only substvars which are requested in
  debian/control file. This minimizes number of warnings from dh_gencontrol.
  Also, improved descriptions of the functions in erlang-depends escript.
* Added erlang-erl-docgen package to erlang-nox dependencies.
* Made dummy packages erlang-nox and erlang-x11 architecture all.
* Cleaned up working with custom substitution variables in debian/rules.
* Reorganized debian/rules to ensure that manpages arent built twice, and
  aren't built at all if only architecture-dependent packages are requested.
* Fixed project links in README.Debian.
* Added a new package erlang-jinterface which provides tools for
  communication of Java programs with Erlang processes. This adds build
  depandency on default-jdk and as a result enables Java module for IDL
  compiler.
* Bumped standards version to 3.8.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 2001-2009. 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(testMergeCompile).
 
22
 
 
23
-export([compile/3,main/1,mvrasn/1]).
 
24
 
 
25
-include("test_server.hrl").
 
26
 
 
27
-record('InitiatingMessage',{procedureCode,criticality,value}).
 
28
-record('Iu-ReleaseCommand',{protocolIEs,protocolExtensions}).
 
29
 
 
30
compile(Config,Erule,Options) ->
 
31
    ?line DataDir = ?config(data_dir,Config),
 
32
    ?line OutDir = ?config(priv_dir,Config),
 
33
    ?line true = code:add_patha(?config(priv_dir,Config)),
 
34
 
 
35
    ?line ok = asn1ct:compile(DataDir ++ 
 
36
                              "MS.set.asn",[Erule,{outdir,OutDir}]++Options),
 
37
 
 
38
    ?line ok = asn1ct:compile(DataDir ++ 
 
39
                              "RANAPSET.set.asn1",[Erule,{outdir,OutDir}]++Options),
 
40
    
 
41
    ?line ok = asn1ct:compile(filename:join([DataDir,"Mvrasn4.set.asn"]),
 
42
                              [Erule,{outdir,OutDir}]++Options),
 
43
 
 
44
    ?line ok = asn1ct:compile(filename:join([DataDir,"Mvrasn6.set.asn"]),
 
45
                              [Erule,{outdir,OutDir}]++Options).
 
46
 
 
47
 
 
48
main(Erule) ->
 
49
    %% test of module MS.set.asn that tests OTP-4492: different tagdefault in 
 
50
    %% modules and types  with same name in modules
 
51
    ?line MSVal = {'Type4M2',8,true,three,"OCTET STRING"},
 
52
    ?line {ok,MSBytes} = asn1_wrapper:encode('MS','Type4M2',MSVal),
 
53
    ?line {ok,MSVal} = asn1_wrapper:decode('MS','Type4M2',MSBytes),
 
54
    
 
55
 
 
56
    %% test of RANAP.set.asn1
 
57
    ?line _PIEVal = [{'ProtocolIE-Field',4,ignore,{'Cause',{radioNetwork,{'CauseRadioNetwork','rab-pre-empted'}}}}],
 
58
    ?line PIEVal2 = [{'ProtocolIE-Field',4,ignore,{'Cause',{radioNetwork,'rab-pre-empted'}}}],
 
59
    ?line _PEVal = [{'ProtocolExtensionField',[0]}],
 
60
%%    ?line EncVal = asn1rt_per_v1:encode_integer([],100),
 
61
    ?line EncVal = 
 
62
        case Erule of
 
63
            per -> 
 
64
                [1,100];
 
65
            per_bin -> 
 
66
                <<1,100>>;
 
67
            uper_bin ->
 
68
                <<1,100>>;
 
69
            ber ->
 
70
                [2,1,1];
 
71
            ber_bin ->
 
72
                <<2,1,1>>;
 
73
            ber_bin_v2 ->
 
74
                <<2,1,1>>
 
75
        end,
 
76
    ?line PEVal2 = [{dummy,1,ignore,EncVal},{dummy,2,reject,EncVal}],
 
77
    ?line Val2 = 
 
78
        #'InitiatingMessage'{procedureCode=1,
 
79
                             criticality=ignore,
 
80
                             value=#'Iu-ReleaseCommand'{protocolIEs=PIEVal2,
 
81
                                                        protocolExtensions=asn1_NOVALUE}},
 
82
    
 
83
    ?line {ok,Bytes2} = asn1_wrapper:encode('RANAPSET','InitiatingMessage',Val2),
 
84
    ?line {ok,_Ret2} = asn1_wrapper:decode('RANAPSET','InitiatingMessage',Bytes2),
 
85
    
 
86
    ?line Val3 = 
 
87
        #'InitiatingMessage'{procedureCode=1,
 
88
                             criticality=ignore,
 
89
                             value=#'Iu-ReleaseCommand'{protocolIEs=PIEVal2,
 
90
                                                        protocolExtensions=PEVal2}},
 
91
    ?line {ok,Bytes3} = asn1_wrapper:encode('RANAPSET','InitiatingMessage',Val3),
 
92
    ?line {ok,_Ret3} = asn1_wrapper:decode('RANAPSET','InitiatingMessage',Bytes3).
 
93
 
 
94
 
 
95
mvrasn(Erule) ->
 
96
    case Erule of
 
97
        Ber when Ber == ber;Ber == ber_bin ->
 
98
            ?line ok = test(isd),
 
99
            ?line ok = test(isd2),
 
100
            ?line ok = test(dsd),
 
101
            ?line ok = test(ul_res),
 
102
            ?line ok = test(seqofseq),
 
103
            ?line ok = test('InsertSubscriberDataArg');
 
104
        _ ->
 
105
            ok
 
106
    end,
 
107
    ?line ok = test(mvrasn6,'InsertSubscriberDataArg').
 
108
 
 
109
test(isd)->
 
110
    EncPdu = [48,128,129,7,145,148,113,50,1,0,241,131,1,0,176,128,5,0,161,128,48,22,2,1,1,144,2,241,33,145,4,0,1,2,3,146,3,36,131,16,148,2,1,42,48,35,2,1,2,144,2,241,33,145,4,255,255,255,255,146,3,37,147,18,147,0,148,13,7,67,79,77,80,65,78,89,4,67,79,77,53,48,28,2,1,3,144,2,241,33,146,3,26,98,31,148,14,9,67,79,77,80,65,78,89,49,50,3,67,79,77,0,0,0,0,152,1,2,0,0],
 
111
    
 
112
    ?line {ok,_} = asn1_wrapper:decode('Mvrasn4',
 
113
                                'InsertSubscriberDataArg',
 
114
                                EncPdu),
 
115
    ok;
 
116
 
 
117
 
118
% Problems with indefinite length encoding !!!
 
119
 
120
test(isd2)->
 
121
    EncPdu = [48, 128, 128, 8, 98, 2, 50, 1, 0, 0, 0, 241, 176, 128, 161, 128, 48, 128, 2, 1, 1, 144, 2, 241, 33, 145, 4, 255, 23, 12, 1, 146, 3, 9, 17, 1, 147, 0, 148, 13, 7, 67, 79, 77, 80, 65, 78, 89, 4, 67, 79, 77, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 
122
    
 
123
    ?line {ok,_DecPdu} = asn1_wrapper:decode('Mvrasn4',
 
124
                                'InsertSubscriberDataArg',
 
125
                                EncPdu),
 
126
 
 
127
    ok;
 
128
 
 
129
 
130
% Is doing fine, although there is indefinite encoding used... !!!
 
131
 
132
test(dsd)->
 
133
    EncPdu = [48, 128, 128, 8, 98, 2, 50, 1, 0, 0, 0, 241, 170, 2, 5, 0, 0, 0, 0, 0],
 
134
    
 
135
    ?line {ok,_DecPdu} = asn1_wrapper:decode('Mvrasn4',
 
136
                                'DeleteSubscriberDataArg',
 
137
                                EncPdu),
 
138
 
 
139
    ok;
 
140
 
 
141
%
 
142
% Is doing fine !!!
 
143
 
144
test(ul_res)->
 
145
    EncPdu = [48, 9, 4, 7, 145, 148, 113, 66, 16, 17, 241],
 
146
    
 
147
    ?line {ok,_DecPdu} = asn1_wrapper:decode('Mvrasn4',
 
148
                                'UpdateGprsLocationRes',
 
149
                                EncPdu),
 
150
 
 
151
    ok;
 
152
 
 
153
test(seqofseq) ->
 
154
    {ok,_V} = asn1_wrapper:decode('Mvrasn4',
 
155
                                 'SentParameters',
 
156
                                 [48,129,190,161,128,4,16,176,197,182,68,41,243,188,205,123,13,9,145,206,200,144,102,4,4,176,197,182,68,4,8,41,243,188,205,123,13,9,145,0,0,161,128,4,16,39,0,3,117,35,189,130,21,42,104,49,194,212,24,151,234,4,4,39,0,3,117,4,8,35,189,130,21,42,104,49,194,0,0,161,128,4,16,62,207,166,59,71,29,37,97,120,25,132,80,144,251,161,123,4,4,62,207,166,59,4,8,71,29,37,97,120,25,132,80,0,0,161,128,4,16,95,183,173,151,17,76,148,146,248,102,127,215,102,224,39,60,4,4,95,183,173,151,4,8,17,76,148,146,248,102,127,215,0,0,161,128,4,16,41,198,247,157,117,190,203,170,91,146,88,91,223,220,188,16,4,4,41,198,247,157,4,8,117,190,203,170,91,146,88,91,0,0]),
 
157
    ok;
 
158
 
 
159
test('InsertSubscriberDataArg') ->
 
160
    {ok,_V} =
 
161
        asn1_wrapper:decode('Mvrasn4','InsertSubscriberDataArg',
 
162
                            [16#30,16#80,16#81,16#07,16#91,16#94,
 
163
                             16#71,16#92,16#00,16#35,16#80,16#83,
 
164
                             16#01,16#00,16#A6,16#06,16#04,16#01,
 
165
                             16#21,16#04,16#01,16#22,16#B0,16#80,
 
166
                             16#05,16#00,16#A1,16#80,16#30,16#1A,
 
167
                             16#02,16#01,16#01,16#90,16#02,16#F1,
 
168
                             16#21,16#92,16#03,16#0D,16#92,16#1F,
 
169
                             16#94,16#0C,16#03,16#53,16#49,16#4D,
 
170
                             16#03,16#47,16#53,16#4E,16#03,16#4C,
 
171
                             16#4B,16#50,16#00,16#00,16#00,16#00,
 
172
                             16#98,16#01,16#00,16#00,16#00]),
 
173
    ok.
 
174
 
 
175
test(mvrasn6,'InsertSubscriberDataArg') ->
 
176
    Val = {'InsertSubscriberDataArg',"IMSI","Address","C",serviceGranted,["abc","cde"],["tele","serv","ice"],asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,{'NAEA-PreferredCI',"NCC",asn1_NOVALUE},{'GPRSSubscriptionData','NULL',[{'PDP-Context',49,"PT","PDP-Address","QoS",'NULL',"APN",asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}],asn1_NOVALUE},'NULL',onlyMSC,{'LSAInformation','NULL',accessOutsideLSAsAllowed,[{'LSAData',"LSA","L",'NULL',asn1_NOVALUE},{'LSAData',"LSA","L",'NULL',asn1_NOVALUE}],asn1_NOVALUE},'NULL',{'LCSInformation',["Addr","ess","string"],[{'LCS-PrivacyClass',"S","ExtSS",notifyLocationAllowed,[{'ExternalClient',{'LCSClientExternalID',"Addr",asn1_NOVALUE},asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}],[broadcastService,anonymousLocation,targetMSsubscribedService],asn1_NOVALUE}],asn1_NOVALUE},100,"age",{'MC-SS-Info',"S","ExtSS",5,4,asn1_NOVALUE},"C",{'SGSN-CAMEL-SubscriptionInfo',{'GPRS-CSI',[{'GPRS-CamelTDPData',attach,13,"Addr",continueTransaction,asn1_NOVALUE}],11,asn1_NOVALUE,'NULL','NULL'},{'SMS-CSI',[{'SMS-CAMEL-TDP-DataList','sms-CollectedInfo',13,"Addr",continueTransaction,asn1_NOVALUE}],11,asn1_NOVALUE,'NULL','NULL'},asn1_NOVALUE},"ON"},
 
177
 
 
178
    {ok,Bytes}=
 
179
        asn1_wrapper:encode('Mvrasn6','InsertSubscriberDataArg',Val),
 
180
    
 
181
    {ok,_Res} =
 
182
        asn1_wrapper:decode('Mvrasn6','InsertSubscriberDataArg',Bytes),
 
183
    
 
184
    ok.