aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/asn1/test/asn1_SUITE.erl16
-rw-r--r--lib/asn1/test/testTimer.erl242
2 files changed, 118 insertions, 140 deletions
diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl
index 83bd66a631..2809c8020b 100644
--- a/lib/asn1/test/asn1_SUITE.erl
+++ b/lib/asn1/test/asn1_SUITE.erl
@@ -1128,21 +1128,21 @@ END
ok = asn1ct:compile(File, [{outdir, PrivDir}]).
-timer_compile(Config, Rule, Opts) ->
+timer_compile(Config, Rule) ->
asn1_test_lib:compile_all(["H235-SECURITY-MESSAGES", "H323-MESSAGES"],
- Config, [Rule|Opts]).
+ Config, [no_ok_wrapper,Rule]).
testTimer_ber(Config) ->
- timer_compile(Config,ber,[]),
- testTimer:go(Config,ber).
+ timer_compile(Config, ber),
+ testTimer:go().
testTimer_per(Config) ->
- timer_compile(Config,per,[]),
- testTimer:go(Config,per).
+ timer_compile(Config, per),
+ testTimer:go().
testTimer_uper(Config) ->
- timer_compile(Config,uper,[]),
- {comment,_} = testTimer:go(Config,uper).
+ timer_compile(Config, uper),
+ testTimer:go().
%% Test of multiple-line comment, OTP-8043
testComment(suite) -> [];
diff --git a/lib/asn1/test/testTimer.erl b/lib/asn1/test/testTimer.erl
index 0f02bab6e0..9f1b775226 100644
--- a/lib/asn1/test/testTimer.erl
+++ b/lib/asn1/test/testTimer.erl
@@ -18,163 +18,141 @@
%%
%%
-module(testTimer).
--export([go/2]).
+-export([go/0]).
-include_lib("test_server/include/test_server.hrl").
-define(times, 5000).
val() ->
- _Value = {'H323-UserInformation',{'H323-UU-PDU',
- {callProceeding,
- {'CallProceeding-UUIE',
- {0,8,222},
- {'EndpointType',
- {'NonStandardParameter',
- {object,{0,9,237}},
- "O"},
- {'VendorIdentifier',
- {'H221NonStandard',62,63,16282},
- "OC",
- "OC"},
- {'GatekeeperInfo',
- {'NonStandardParameter',
- {object,{0,10,260}},
- "O"}},
- {'GatewayInfo',
- [{h320,
- {'H320Caps',
- {'NonStandardParameter',
- {object,{0,11,282}},
- "O"},
- [{'DataRate',
- {'NonStandardParameter',
- {object,
- {0,11,295}},
- "O"},
- 1290470518,
- 78}],
- [{'SupportedPrefix',
- {'NonStandardParameter',
- {object,
- {0,12,312}},
- "O"},
- {'h323-ID',"BM"}}]}}],
- {'NonStandardParameter',
- {object,{0,13,326}},
- "O"}},
- {'McuInfo',
- {'NonStandardParameter',
- {object,{1,13,340,340}},
- "OC"}},
- {'TerminalInfo',
- {'NonStandardParameter',
- {object,{1,14,353,354}},
- "OC"}},
- true,
- true},
- {ipxAddress,
- {'TransportAddress_ipxAddress',
- "OCTET ",
- "OCTE",
- "OC"}},
- {'CallIdentifier',"OCTET STRINGOCTE"},
- {noSecurity,'NULL'},
- [{'ClearToken',
- 1667517741,
- "BM",
- {'DHset',[1],[1],[1]},
- "OCTET STR",
- -26430296,
- {'TypedCertificate',
- {1,16,405,406},
- "OC"},
- "BMP",
- {'NonStandardParameter',
- {1,16,414,415},
- "OC"}},
- {'ClearToken',
- 1817656756,
- "BMP",
- {'DHset',[1],[1],[1]},
- "OCTET STRI",
- -16356110,
- {'TypedCertificate',
- {1,17,442,443},
- "OC"},
- "BMP",
- {'NonStandardParameter',
- {1,18,452,452},
- "OC"}}],
- [{cryptoGKPwdEncr,
- {'CryptoH323Token_cryptoGKPwdEncr',
- {1,18,467,467},
- {'Params',-7477016,"OCTET ST"},
- "OC"}},
- {cryptoGKPwdEncr,
- {'CryptoH323Token_cryptoGKPwdEncr',
- {1,19,486,486},
- {'Params',-2404513,"OCTET ST"},
- []}}],
- []}},
- {'NonStandardParameter',{object,{0,3,84}},[]},
- [],
- true,
- [],
- []},
- {'H323-UserInformation_user-data',24,"O"}}.
+ {'H323-UserInformation',{'H323-UU-PDU',
+ {callProceeding,
+ {'CallProceeding-UUIE',
+ {0,8,222},
+ {'EndpointType',
+ {'NonStandardParameter',
+ {object,{0,9,237}},
+ "O"},
+ {'VendorIdentifier',
+ {'H221NonStandard',62,63,16282},
+ "OC",
+ "OC"},
+ {'GatekeeperInfo',
+ {'NonStandardParameter',
+ {object,{0,10,260}},
+ "O"}},
+ {'GatewayInfo',
+ [{h320,
+ {'H320Caps',
+ {'NonStandardParameter',
+ {object,{0,11,282}},
+ "O"},
+ [{'DataRate',
+ {'NonStandardParameter',
+ {object,
+ {0,11,295}},
+ "O"},
+ 1290470518,
+ 78}],
+ [{'SupportedPrefix',
+ {'NonStandardParameter',
+ {object,
+ {0,12,312}},
+ "O"},
+ {'h323-ID',"BM"}}]}}],
+ {'NonStandardParameter',
+ {object,{0,13,326}},
+ "O"}},
+ {'McuInfo',
+ {'NonStandardParameter',
+ {object,{1,13,340,340}},
+ "OC"}},
+ {'TerminalInfo',
+ {'NonStandardParameter',
+ {object,{1,14,353,354}},
+ "OC"}},
+ true,
+ true},
+ {ipxAddress,
+ {'TransportAddress_ipxAddress',
+ "OCTET ",
+ "OCTE",
+ "OC"}},
+ {'CallIdentifier',"OCTET STRINGOCTE"},
+ {noSecurity,'NULL'},
+ [{'ClearToken',
+ 1667517741,
+ "BM",
+ {'DHset',<<1:1>>,<<1:1>>,<<1:1>>},
+ "OCTET STR",
+ -26430296,
+ {'TypedCertificate',
+ {1,16,405,406},
+ "OC"},
+ "BMP",
+ {'NonStandardParameter',
+ {1,16,414,415},
+ "OC"}},
+ {'ClearToken',
+ 1817656756,
+ "BMP",
+ {'DHset',<<1:1>>,<<1:1>>,<<1:1>>},
+ "OCTET STRI",
+ -16356110,
+ {'TypedCertificate',
+ {1,17,442,443},
+ "OC"},
+ "BMP",
+ {'NonStandardParameter',
+ {1,18,452,452},
+ "OC"}}],
+ [{cryptoGKPwdEncr,
+ {'CryptoH323Token_cryptoGKPwdEncr',
+ {1,18,467,467},
+ {'Params',-7477016,"OCTET ST"},
+ "OC"}},
+ {cryptoGKPwdEncr,
+ {'CryptoH323Token_cryptoGKPwdEncr',
+ {1,19,486,486},
+ {'Params',-2404513,"OCTET ST"},
+ []}}],
+ []}},
+ {'NonStandardParameter',{object,{0,3,84}},[]},
+ [],
+ true,
+ [],
+ []},
+ {'H323-UserInformation_user-data',24,"O"}}.
-go(Config, _Enc) ->
- ?line true = code:add_patha(?config(priv_dir,Config)),
-
+go() ->
Module = 'H323-MESSAGES',
Type = 'H323-UserInformation',
Value = val(),
- {ok,Bytes} = asn1rt:encode(Module,Type,Value),
+ Bytes = Module:encode(Type, Value),
+ Value = Module:decode(Type, Bytes),
- CompileOptions = compile_options(),
-
{ValWr,done} = timer:tc(fun() -> encode(?times, Module, Type, Value) end),
- ?line io:format("ASN1 encode ~p: ~p micro~n", [CompileOptions, ValWr / ?times]),
+ io:format("ASN.1 encoding: ~p micro~n", [ValWr / ?times]),
done = decode(2, Module, Type, Bytes),
{ValRead,done} = timer:tc(fun() -> decode(?times, Module, Type, Bytes) end),
- ?line io:format("ASN1 decode ~p: ~p micro~n", [CompileOptions, ValRead /?times]),
-
+ io:format("ASN.1 decoding: ~p micro~n", [ValRead /?times]),
- ?line Comment = "encode: "++integer_to_list(round(ValWr/?times))++
- " micro, decode: "++integer_to_list(round(ValRead /?times))++
- " micro. " ++ CompileOptions,
+ Comment = "encode: "++integer_to_list(round(ValWr/?times)) ++
+ " micro, decode: "++integer_to_list(round(ValRead /?times)) ++
+ " micro. [" ++ atom_to_list(Module:encoding_rule()) ++ "]",
{comment,Comment}.
encode(0, _Module,_Type,_Value) ->
done;
encode(N, Module,Type,Value) ->
- ?line {ok,B} = asn1rt:encode(Module,Type,Value),
- _B2 = if
- is_list(B) -> list_to_binary(B);
- true -> B
- end,
- encode(N-1, Module,Type,Value).
+ Module:encode(Type, Value),
+ encode(N-1, Module, Type, Value).
decode(0, _Module, _Type, _Value) ->
done;
decode(N, Module, Type, Value) ->
- {ok,_B} = asn1rt:decode(Module, Type, Value),
+ Module:decode(Type, Value),
decode(N-1, Module, Type, Value).
-
-compile_options() ->
- {ok,Info} = asn1rt:info('H323-MESSAGES'),
- case lists:keyfind(options, 1, Info) of
- {_,Opts0} ->
- Opts1 = [X || X <- Opts0,
- (X =:= ber orelse
- X =:= per orelse
- X =:= uper)],
- lists:flatten(io_lib:format("~p", [Opts1]));
- _ ->
- "[]"
- end.
-