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

« back to all changes in this revision

Viewing changes to lib/asn1/test/testTCAP.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 2003-2010. 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
-module(testTCAP).
 
21
 
 
22
-export([compile/3,test/2,compile_asn1config/3,test_asn1config/0]).
 
23
 
 
24
-include_lib("test_server/include/test_server.hrl").
 
25
 
 
26
 
 
27
 
 
28
compile(Config,Rules,Opt) ->
 
29
 
 
30
    ?line DataDir = ?config(data_dir,Config),
 
31
    ?line OutDir = ?config(priv_dir,Config),
 
32
    ?line true = code:add_patha(?config(priv_dir,Config)),
 
33
    
 
34
    ?line ok = asn1ct:compile(DataDir ++ "Remote-Operations-Information-Objects",[Rules,{outdir,OutDir}]++Opt),
 
35
%    ?line ok = asn1ct:compile(DataDir ++ "Remote-Operations-Generic-ROS-PDUs",[Rules,{outdir,OutDir}]++Opt),
 
36
%    ?line ok = asn1ct:compile(DataDir ++ "Remote-Operations-Useful-Definitions",[Rules,{outdir,OutDir}]++Opt),
 
37
    ?line ok = asn1ct:compile(DataDir ++ "TCAPMessages",[Rules,{outdir,OutDir}]++Opt),
 
38
    ?line ok = asn1ct:compile(DataDir ++ "TCAPMessages-simple",[Rules,{outdir,OutDir}]++Opt),
 
39
    ?line ok = asn1ct:compile(DataDir ++ "TCAPPackage",[Rules,{outdir,OutDir}]++Opt),
 
40
    ?line compile:file(filename:join([DataDir,"TCAPPackage_msg"]),[{i,OutDir},{outdir,OutDir}]).
 
41
 
 
42
compile_asn1config(Config,Rules,Opt) ->
 
43
    ?line DataDir = ?config(data_dir,Config),
 
44
    ?line OutDir = ?config(priv_dir,Config),
 
45
    ?line true = code:add_patha(?config(priv_dir,Config)),
 
46
    
 
47
    ?line ok = asn1ct:compile(DataDir ++ "TCAPPackage",
 
48
                              [Rules,{outdir,OutDir},{i,DataDir}]++Opt).
 
49
 
 
50
test(Erule,_Config) when Erule==ber;Erule==ber_bin;Erule==ber_bin_v2 ->
 
51
%    ?line OutDir = ?config(priv_dir,Config),
 
52
    %% testing OTP-4798, open type encoded with indefinite length
 
53
    ?line {ok,_Res} = asn1_wrapper:decode('TCAPMessages-simple','MessageType', val_OTP_4798(Erule)),
 
54
    %% testing OTP-4799, absent optional open type
 
55
    ?line {ok,_Res2} = asn1_wrapper:decode('TCAPMessages-simple','MessageType',val_OTP_4799(Erule)),
 
56
    %% testing vance shipley's problems. Parameterized object sets.
 
57
    ?line Val3 = 'TCAPPackage_msg':val('PackageType',unidirectional),
 
58
    ?line {ok,Bytes3} = asn1_wrapper:encode('TCAPPackage','PackageType',Val3),
 
59
    ?line {ok,Res3} = asn1_wrapper:decode('TCAPPackage','PackageType',Bytes3),
 
60
    ?line ok = 'TCAPPackage_msg':check_result('PackageType',unidirectional,Res3),
 
61
%%    ?line io:format("Res3:~n~p~n~n",[Res3]),
 
62
    
 
63
    ?line Val4 = 'TCAPPackage_msg':val('PackageType',abort),
 
64
    ?line {ok,Bytes4} = asn1_wrapper:encode('TCAPPackage','PackageType',Val4),
 
65
    ?line {ok,Res4} = asn1_wrapper:decode('TCAPPackage','PackageType',Bytes4),
 
66
    ?line ok = 'TCAPPackage_msg':check_result('PackageType',abort,Res4),
 
67
%%    ?line io:format("Res4:~n~p~n~n",[Res4]),
 
68
 
 
69
    ?line Val5 = 'TCAPPackage_msg':val('PackageType',response),
 
70
    ?line {ok,Bytes5} = asn1_wrapper:encode('TCAPPackage','PackageType',Val5),
 
71
    ?line {ok,Res5} = asn1_wrapper:decode('TCAPPackage','PackageType',Bytes5),
 
72
    ?line ok = 'TCAPPackage_msg':check_result('PackageType',response,Res5).
 
73
%%    ?line io:format("Res5:~n~p~n~n",[Res5]).
 
74
 
 
75
val_OTP_4798(ber) ->
 
76
    [100,129,176,73,4,57,3,17,80,107,42,40,40,6,7,0,17,134,5,1,1,1,160,29,97,27,128,2,7,128,161,9,6,7,4,0,0,1,0,14,2,162,3,2,1,0,163,5,161,3,2,1,0,108,128,162,120,2,1,0,48,115,2,1,56,48,128,48,34,4,16,203,87,215,196,217,93,235,90,64,131,106,145,39,26,25,236,4,4,197,241,81,112,4,8,78,225,34,196,215,212,200,0,48,34,4,16,145,125,27,67,42,144,6,161,207,112,55,75,200,191,191,28,4,4,226,219,242,123,4,8,72,46,130,28,206,178,168,0,48,34,4,16,1,8,20,29,70,160,218,160,125,188,244,174,113,115,253,245,4,4,26,5,90,160,4,8,252,75,149,98,153,224,140,0,0,0,0,0];
 
77
val_OTP_4798(_) ->
 
78
    <<100,129,176,73,4,57,3,17,80,107,42,40,40,6,7,0,17,134,5,1,1,1,160,29,97,27,128,2,7,128,161,9,6,7,4,0,0,1,0,14,2,162,3,2,1,0,163,5,161,3,2,1,0,108,128,162,120,2,1,0,48,115,2,1,56,48,128,48,34,4,16,203,87,215,196,217,93,235,90,64,131,106,145,39,26,25,236,4,4,197,241,81,112,4,8,78,225,34,196,215,212,200,0,48,34,4,16,145,125,27,67,42,144,6,161,207,112,55,75,200,191,191,28,4,4,226,219,242,123,4,8,72,46,130,28,206,178,168,0,48,34,4,16,1,8,20,29,70,160,218,160,125,188,244,174,113,115,253,245,4,4,26,5,90,160,4,8,252,75,149,98,153,224,140,0,0,0,0,0>>.
 
79
 
 
80
val_OTP_4799(ber) ->
 
81
    [100,16,73,4,41,182,36,0,108,8,163,6,2,1,29,2,1,27];
 
82
val_OTP_4799(_) ->
 
83
    <<100,16,73,4,41,182,36,0,108,8,163,6,2,1,29,2,1,27>>.
 
84
 
 
85
test_asn1config() ->
 
86
    ?line Val = 'TCAPPackage_msg':val('PackageType',queryWithPerm),
 
87
    ?line {ok,B} = asn1_wrapper:encode('TCAPPackage','PackageType',Val),
 
88
    ?line {ok,ExMsg}='TCAPPackage':decode_PackageType(list_to_binary(B)),
 
89
    ?line {_,{_,_,_,{Key,ExVal}}}=ExMsg,
 
90
    ?line {ok,_Parts}='TCAPPackage':decode_part(Key,ExVal),
 
91
    
 
92
    ?line Val2 = 'TCAPPackage_msg':val('TransactionPDU'),
 
93
    ?line {ok,B2} = 'TCAPPackage':encode('TransactionPDU',Val2),
 
94
    ?line {ok,ExMsg2}='TCAPPackage':decode_TransactionPDU(list_to_binary(B2)),
 
95
    ?line {_,_,_,{Key2,ExVal2}}=ExMsg2,
 
96
    ?line {ok,_Parts2}='TCAPPackage':decode_part(Key2,ExVal2),
 
97
 
 
98
    ?line Val3 = 'TCAPPackage_msg':val('PackageType',response),
 
99
    ?line {ok,B3} = asn1_wrapper:encode('TCAPPackage','PackageType',Val3),
 
100
    ?line {ok,ExMsg3}='TCAPPackage':decode_PackageType(list_to_binary(B3)),
 
101
    ?line {_,{_,_,_,{Key3,ExVal3}}}=ExMsg3,
 
102
    ?line {ok,_Parts3}='TCAPPackage':decode_part(Key3,ExVal3).
 
103