diff options
author | Adam Lindberg <[email protected]> | 2012-02-16 15:51:37 +0100 |
---|---|---|
committer | Adam Lindberg <[email protected]> | 2012-02-29 14:42:22 +0100 |
commit | 9ec0a0babace0932d78accf7c10b237a32dc801c (patch) | |
tree | 2d4a8e515a13497611631b0ed6cd787341ace27b /lib | |
parent | 79d2f2878c950584e56258a3c34724d42a91c631 (diff) | |
download | otp-9ec0a0babace0932d78accf7c10b237a32dc801c.tar.gz otp-9ec0a0babace0932d78accf7c10b237a32dc801c.tar.bz2 otp-9ec0a0babace0932d78accf7c10b237a32dc801c.zip |
[asn1] Refactor test cases and remove extra suites
Diffstat (limited to 'lib')
41 files changed, 1684 insertions, 3354 deletions
diff --git a/lib/asn1/c_src/asn1_erl_nif.c b/lib/asn1/c_src/asn1_erl_nif.c index accd368af1..dbff14f9b3 100644 --- a/lib/asn1/c_src/asn1_erl_nif.c +++ b/lib/asn1/c_src/asn1_erl_nif.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2002-2011. All Rights Reserved. + * Copyright Ericsson AB 2002-2012. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -1197,7 +1197,7 @@ static ERL_NIF_TERM encode_per_complete(ErlNifEnv* env, int argc, ErlNifBinary out_binary; int complete_len; if (!enif_inspect_iolist_as_binary(env, argv[0], &in_binary)) - return enif_make_atom(env, "badarg"); + return enif_make_badarg(env); if (!enif_alloc_binary(in_binary.size, &out_binary)) return enif_make_atom(env, "alloc_binary_failed"); diff --git a/lib/asn1/test/Makefile b/lib/asn1/test/Makefile index fa46bbb346..1621abbec9 100644 --- a/lib/asn1/test/Makefile +++ b/lib/asn1/test/Makefile @@ -29,9 +29,9 @@ MODULES= \ choice_extension \ ber_decode_error \ testPrim \ - testPrimStrings \ + testPrimStrings \ testCompactBitString \ - testPrimExternal \ + testPrimExternal \ testChoPrim \ testChoExtension \ testChoExternal \ @@ -85,7 +85,6 @@ MODULES= \ testMergeCompile \ testDeepTConstr \ testTimer \ - testRANAP \ testMegaco \ testSeqSetDefaultVal \ testParamBasic \ @@ -105,7 +104,6 @@ MODULES= \ test_inline \ testTcapsystem \ testNBAPsystem \ - test_bad_values \ test_compile_options \ testDoubleEllipses \ test_modified_x420 \ @@ -115,16 +113,9 @@ MODULES= \ asn1_app_test \ asn1_appup_test \ asn1_wrapper \ - asn1_SUITE \ - asn1_bin_SUITE \ - asn1_bin_v2_SUITE + asn1_SUITE SUITE= asn1_SUITE.erl -SUITE_BIN= asn1_bin_SUITE.erl -SUITE_BIN_V2= asn1_bin_v2_SUITE.erl -SUITE_SRC= asn1_SUITE.erl.src -SUITE_BIN_SRC= asn1_bin_SUITE.erl.src -SUITE_BIN_V2_SRC= asn1_bin_SUITE.erl.src ERL_FILES= $(MODULES:%=%.erl) @@ -153,30 +144,10 @@ $(EMAKEFILE): $(ERL_FILES) $(HRL_FILES) tests debug opt: $(SUITE) $(SUITE_BIN) $(SUITE_BIN_V2) $(EMAKEFILE) clean: - rm -f $(SUITE) $(SUITE_BIN) $(SUITE_BIN_V2) rm -f core docs: -#----------------------------------------------------- -# Special Targets -#----------------------------------------------------- -$(SUITE): $(SUITE_SRC) asn1_common_SUITE.erl.src asn1_particular_SUITE.erl.src - sed -e 's;%BIN%;;' -e 's;%PER%;per;' -e 's;%BER%;ber;' $< > $@ - cat asn1_common_SUITE.erl.src >> $@ - cat asn1_particular_SUITE.erl.src >> $@ - - -$(SUITE_BIN): $(SUITE_SRC) asn1_bin_particular_SUITE.erl.src - sed -e 's;%BIN%;bin_;' -e 's;%PER%;per_bin;' -e 's;%BER%;ber_bin;' $< > $@ - echo "common() -> []." >> $@ - cat asn1_bin_particular_SUITE.erl.src >> $@ - -$(SUITE_BIN_V2): $(SUITE_SRC) asn1_bin_v2_particular_SUITE.erl.src - sed -e 's;%BIN%;bin_v2_;' -e 's;%PER%;per_bin;' -e 's;%BER%;ber_bin_v2;' $< > $@ - echo "common() -> []." >> $@ - cat asn1_bin_v2_particular_SUITE.erl.src >> $@ - # ---------------------------------------------------- # Release Target # ---------------------------------------------------- @@ -187,15 +158,11 @@ release_spec: opt release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DIR) $(RELSYSDIR)/asn1_SUITE_data - $(INSTALL_DIR) $(RELSYSDIR)/asn1_bin_SUITE_data - $(INSTALL_DIR) $(RELSYSDIR)/asn1_bin_v2_SUITE_data $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) $(INSTALL_DATA) asn1.spec asn1.cover $(INSTALL_PROGS) $(RELSYSDIR) chmod -R u+w $(RELSYSDIR) cd asn1_SUITE_data; tar cfh $(RELSYSDIR)/asn1_SUITE_data.tar * cd $(RELSYSDIR)/asn1_SUITE_data; tar xf $(RELSYSDIR)/asn1_SUITE_data.tar - cd $(RELSYSDIR)/asn1_bin_SUITE_data; tar xf $(RELSYSDIR)/asn1_SUITE_data.tar - cd $(RELSYSDIR)/asn1_bin_v2_SUITE_data; tar xf $(RELSYSDIR)/asn1_SUITE_data.tar rm $(RELSYSDIR)/asn1_SUITE_data.tar release_docs_spec: diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl new file mode 100644 index 0000000000..3b9a7532c0 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE.erl @@ -0,0 +1,1511 @@ +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% Purpose: Test suite for the ASN.1 application + +-module(asn1_SUITE). + +-define(only_per(Func), + if Rule == per orelse Rule == per_bin -> Func; + true -> ok + end). +-define(only_ber(Func), + if Rule == ber orelse Rule == ber_bin orelse Rule == ber_bin_v2 -> Func; + true -> ok + end). +-define(only_uper(Func), + case Rule of + uper_bin -> Func; + _ -> ok + end). +-define(only_per_nif(Func), + case {Rule, lists:member(optimize, Opts)} of + {per_bin, true} -> Func; + _ -> ok + end). +-define(only_ber_nif(Func), + case {Rule, lists:member(nif, Opts)} of + {ber_bin_v2, true} -> Func; + _ -> ok + end). + +-compile(export_all). + +-include_lib("test_server/include/test_server.hrl"). + +%%------------------------------------------------------------------------------ +%% Suite definition +%%------------------------------------------------------------------------------ + +suite() -> [{ct_hooks, [ts_install_cth]}]. + +all() -> + [{group, parallel}, + {group, app_test}, + {group, appup_test}, + + % TODO: Investigate parallel running of these: + testComment, + testName2Number, + ticket_7407, + ticket7904, + + {group, performance}]. + +groups() -> + [{compile, parallel([]), + [c_syntax, + c_string, + c_implicit_before_choice]}, + + {ber, parallel([]), + [ber_choiceinseq, + % Uses 'SOpttest' + {group, [], [ber_optional, + ber_optional_keyed_list]}]}, + + {app_test, [], [{asn1_app_test, all}]}, + + {appup_test, [], [{asn1_appup_test, all}]}, + + {parallel, parallel([]), + [{group, compile}, + {group, ber}, + % Uses 'P-Record', 'Constraints', 'MEDIA-GATEWAY-CONTROL'... + {group, [], [parse, + test_driver_load, + test_undecoded_rest, + test_inline, + specialized_decodes, + special_decode_performance, + testMegaco, + testConstraints, + testCompactBitString]}, + default, + % Uses 'Def', 'MULTIMEDIA-SYSTEM-CONTROL', 'H323-MESSAGES', 'Prim', + % 'Real' + {group, [], [testPrim, + rtUI, + testPrimStrings, + testInvokeMod, + per, + ber_other, + h323test, + per_GeneralString]}, + testChoPrim, + testChoExtension, + testChoOptional, + testChoOptionalImplicitTag, + testChoRecursive, + testChoTypeRefCho, + testChoTypeRefPrim, + testChoTypeRefSeq, + testChoTypeRefSet, + testDef, + testOpt, + testSeqDefault, + % Uses 'External' + {group, [], [testChoExternal, + testPrimExternal, + testSeqExtension, + testSeqExternal, + testSeqOfExternal, + testSeqOfTag, + testSeqTag, + testSetExtension, + testSetExternal, + testSetOfExternal, + testSetOfTag, + testSetTag]}, + testSeqOptional, + testSeqPrim, + testSeqTypeRefCho, + % Uses 'SeqTypeRefPrim' + {group, [], [testSeqTypeRefPrim, + testTypeValueNotation]}, + testSeqTypeRefSeq, + testSeqTypeRefSet, + % Uses 'SeqOf' + {group, [], [testSeqOf, + testSeqOfIndefinite]}, % Uses 'Mvrasn*' + testSeqOfCho, + testSetDefault, + testExtensionAdditionGroup, + testSetOptional, + testSetPrim, + testSetTypeRefCho, + testSetTypeRefPrim, + testSetTypeRefSeq, + testSetTypeRefSet, + testSetOf, + testSetOfCho, + testEnumExt, + value_test, + value_bad_enum_test, + testSeq2738, + % Uses 'Constructed' + {group, [], [constructed, + ber_decode_error]}, + % Uses 'SeqSetIndefinite' + {group, [], [testSeqIndefinite, + testSetIndefinite]}, + testChoiceIndefinite, + per_open_type, + testInfObjectClass, + testParameterizedInfObj, + testMergeCompile, + testobj, + testDeepTConstr, + testExport, + testImport, + % Uses 'ParamBasic' + {group, [], [testParamBasic, + testDER]}, + testMvrasn6, + testContextSwitchingTypes, + testOpenTypeImplicitTag, + duplicate_tags, + testROSE, + testINSTANCE_OF, + testTCAP, + test_ParamTypeInfObj, + test_WS_ParamClass, + test_Defed_ObjectIdentifier, + testSelectionType, + testSSLspecs, + testNortel, + % Uses 'PKCS7' + {group, [], [test_modified_x420, + testX420]}, + testTcapsystem, + testNBAPsystem, + test_compile_options, + testDoubleEllipses, + test_x691, + ticket_6143, + testExtensionAdditionGroup, + test_OTP_9688]}, + + {performance, [], + [testTimer_ber, + testTimer_ber_bin, + testTimer_ber_bin_opt, + testTimer_ber_bin_opt_driver, + testTimer_per, + testTimer_per_bin, + testTimer_per_bin_opt, + testTimer_uper_bin, + smp]}]. + +parallel(Options) -> + case erlang:system_info(smp_support) andalso + erlang:system_info(schedulers) > 1 of + true -> [parallel|Options]; + false -> Options + end. + +%%------------------------------------------------------------------------------ +%% Init/end +%%------------------------------------------------------------------------------ + +init_per_suite(Config) -> + PrivDir = ?config(priv_dir, Config), + true = code:add_patha(PrivDir), + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +init_per_testcase(Func, Config) -> + CaseDir = filename:join([?config(priv_dir, Config), ?MODULE, Func]), + ok = filelib:ensure_dir(filename:join([CaseDir, dummy_file])), + true = code:add_patha(CaseDir), + + Dog = case Func of + testX420 -> test_server:timetrap({minutes, 90}); + _ -> test_server:timetrap({minutes, 60}) + end, + [{case_dir, CaseDir}, {watchdog, Dog}|Config]. + +end_per_testcase(_Func, Config) -> + true = code:del_path(?config(case_dir, Config)), + test_server:timetrap_cancel(?config(watchdog, Config)). + +%%------------------------------------------------------------------------------ +%% Test runners +%%------------------------------------------------------------------------------ + +test(Config, TestF) -> + test(Config, TestF, [per, + per_bin, + {per_bin, [optimize]}, + uper_bin, + ber, + ber_bin, + ber_bin_v2, + % TODO: {ber_bin_v2, [optimize, nif]} ? + {ber_bin_v2, [nif]}]). + +test(Config, TestF, Rules) -> + Fun = fun(C, R, O) -> + M = element(2, erlang:fun_info(TestF, module)), + F = element(2, erlang:fun_info(TestF, name)), + io:format("Running ~p:~p with ~p...~n", [M, F, {R, O}]), + try + TestF(C, R, O) + catch + Class:Reason -> + NewReason = {Reason, [{rule, R}, {options, O}]}, + erlang:raise(Class, NewReason, + erlang:get_stacktrace()) + end + end, + Result = [run_case(Config, Fun, rule(Rule), opts(Rule)) || Rule <- Rules], + case lists:usort(Result) of + [true|_Skips] -> true; % At least one test ran + Skips -> {skip, [R || {skip, R} <- Skips]} % All skipped + end. + +rule(A) when is_atom(A) -> A; +rule({A, _Opts} ) -> A. + +opts(Rule) when is_atom(Rule) -> []; +opts({_Rule, Opts}) -> Opts. + +run_case(Config, Fun, Rule, Opts) -> + CaseDir = ?config(case_dir, Config), + Dir = filename:join([CaseDir, join(Rule, Opts)]), + ok = filelib:ensure_dir(filename:join([Dir, dummy_file])), + replace_path(CaseDir, Dir), + NewConfig = lists:keyreplace(case_dir, 1, Config, {case_dir, Dir}), + + % Run the actual test function + Result = Fun(NewConfig, Rule, Opts), + + replace_path(Dir, CaseDir), + case Result of + {skip, _Reason} -> Result; + _ -> true + end. + +replace_path(PathA, PathB) -> + true = code:del_path(PathA), + true = code:add_patha(PathB). + +join(Rule, Opts) -> + string:join([atom_to_list(Rule)|lists:map(fun atom_to_list/1, Opts)], "_"). + +case_dir([], _Dir) -> + exit(no_case_dir); +case_dir([{case_dir, _}|Config], Dir) -> + [{case_dir, Dir}|Config]; +case_dir([C|Config], Opt) -> + [C|case_dir(Config, Opt)]. + +%%------------------------------------------------------------------------------ +%% Test cases +%%------------------------------------------------------------------------------ + +testPrim(Config) -> test(Config, fun testPrim/3). +testPrim(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["Prim", "Real"], Config, [Rule|Opts]), + testPrim:bool(Rule), + testPrim:int(Rule), + testPrim:enum(Rule), + testPrim:obj_id(Rule), + testPrim:rel_oid(Rule), + testPrim:null(Rule), + testPrim:real(Rule). + +testCompactBitString(Config) -> test(Config, fun testCompactBitString/3). +testCompactBitString(Config, Rule, Opts) -> + asn1_test_lib:compile("PrimStrings", Config, + [Rule, compact_bit_string|Opts]), + testCompactBitString:compact_bit_string(Rule), + ?only_uper(testCompactBitString:bit_string_unnamed(Rule)), + ?only_per(testCompactBitString:bit_string_unnamed(Rule)), + ?only_per_nif(testCompactBitString:ticket_7734(Rule)), + ?only_per_nif(asn1_test_lib:compile("Constraints", Config, + [Rule, compact_bit_string|Opts])), + ?only_per_nif(testCompactBitString:otp_4869(Rule)). + +testPrimStrings(Config) -> test(Config, fun testPrimStrings/3). +testPrimStrings(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["PrimStrings", "BitStr"], Config, [Rule|Opts]), + testPrimStrings_cases(Rule), + ?only_ber(testPrimStrings:more_strings(Rule)). + +testPrimStrings_cases(Rule) -> + testPrimStrings:bit_string(Rule), + testPrimStrings:bit_string_unnamed(Rule), + testPrimStrings:octet_string(Rule), + testPrimStrings:numeric_string(Rule), + testPrimStrings:other_strings(Rule), + testPrimStrings:universal_string(Rule), + testPrimStrings:bmp_string(Rule), + testPrimStrings:times(Rule), + testPrimStrings:utf8_string(Rule). + +testPrimExternal(Config) -> test(Config, fun testPrimExternal/3). +testPrimExternal(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "PrimExternal"], Config, + [Rule|Opts]), + testPrimExternal:external(Rule), + ?only_ber_nif(asn1_test_lib:compile_all(["PrimStrings", "BitStr"], Config, + [Rule|Opts])), + ?only_ber_nif(testPrimStrings_cases(Rule)), + ?only_ber_nif(testPrimStrings:more_strings(Rule)). + +testChoPrim(Config) -> test(Config, fun testChoPrim/3). +testChoPrim(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoPrim", Config, [Rule|Opts]), + testChoPrim:bool(Rule), + testChoPrim:int(Rule). + +testChoExtension(Config) -> test(Config, fun testChoExtension/3). +testChoExtension(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoExtension", Config, [Rule|Opts]), + testChoExtension:extension(Rule). + +testChoExternal(Config) -> test(Config, fun testChoExternal/3). +testChoExternal(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "ChoExternal"], Config, [Rule|Opts]), + testChoExternal:external(Rule). + +testChoOptional(Config) -> test(Config, fun testChoOptional/3). +testChoOptional(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoOptional", Config, [Rule|Opts]), + testChoOptional:optional(Rule). + +testChoOptionalImplicitTag(Config) -> + test(Config, fun testChoOptionalImplicitTag/3, + [ber, ber_bin, ber_bin_v2]). +testChoOptionalImplicitTag(Config, Rule, Opts) -> + %% Only meaningful for ber & co + asn1_test_lib:compile("ChoOptionalImplicitTag", Config, [Rule|Opts]), + testChoOptionalImplicitTag:optional(Rule). + +testChoRecursive(Config) -> test(Config, fun testChoRecursive/3). +testChoRecursive(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoRecursive", Config, [Rule|Opts]), + testChoRecursive:recursive(Rule). + +testChoTypeRefCho(Config) -> test(Config, fun testChoTypeRefCho/3). +testChoTypeRefCho(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoTypeRefCho", Config, [Rule|Opts]), + testChoTypeRefCho:choice(Rule). + +testChoTypeRefPrim(Config) -> test(Config, fun testChoTypeRefPrim/3). +testChoTypeRefPrim(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoTypeRefPrim", Config, [Rule|Opts]), + testChoTypeRefPrim:prim(Rule). + +testChoTypeRefSeq(Config) -> test(Config, fun testChoTypeRefSeq/3). +testChoTypeRefSeq(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoTypeRefSeq", Config, [Rule|Opts]), + testChoTypeRefSeq:seq(Rule). + +testChoTypeRefSet(Config) -> test(Config, fun testChoTypeRefSet/3). +testChoTypeRefSet(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoTypeRefSet", Config, [Rule|Opts]), + testChoTypeRefSet:set(Rule). + +testDef(Config) -> test(Config, fun testDef/3). +testDef(Config, Rule, Opts) -> + asn1_test_lib:compile("Def", Config, [Rule|Opts]), + testDef:main(Rule). + +testOpt(Config) -> test(Config, fun testOpt/3). +testOpt(Config, Rule, Opts) -> + asn1_test_lib:compile("Opt", Config, [Rule|Opts]), + testOpt:main(Rule). + +testEnumExt(Config) -> test(Config, fun testEnumExt/3). +testEnumExt(Config, Rule, Opts) -> + asn1_test_lib:compile("EnumExt", Config, [Rule|Opts]), + testEnumExt:main(Rule). + +%% Test of OTP-2523 ENUMERATED with extensionmark. +testSeqDefault(Config) -> test(Config, fun testSeqDefault/3). +testSeqDefault(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqDefault", Config, [Rule|Opts]), + testSeqDefault:main(Rule). + +testSeqExtension(Config) -> test(Config, fun testSeqExtension/3). +testSeqExtension(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SeqExtension"], Config, + [Rule|Opts]), + testSeqExtension:main(Rule). + +testSeqExternal(Config) -> test(Config, fun testSeqExternal/3). +testSeqExternal(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SeqExternal"], Config, [Rule|Opts]), + testSeqExternal:main(Rule). + +testSeqOptional(Config) -> test(Config, fun testSeqOptional/3). +testSeqOptional(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqOptional", Config, [Rule|Opts]), + testSeqOptional:main(Rule). + +testSeqPrim(Config) -> test(Config, fun testSeqPrim/3). +testSeqPrim(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqPrim", Config, [Rule|Opts]), + testSeqPrim:main(Rule). + +%% Test of OTP-2738 Detect corrupt optional component. +testSeq2738(Config) -> test(Config, fun testSeq2738/3). +testSeq2738(Config, Rule, Opts) -> + asn1_test_lib:compile("Seq2738", Config, [Rule|Opts]), + testSeq2738:main(Rule). + +testSeqTag(Config) -> test(Config, fun testSeqTag/3). +testSeqTag(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SeqTag"], Config, [Rule|Opts]), + testSeqTag:main(Rule). + +testSeqTypeRefCho(Config) -> test(Config, fun testSeqTypeRefCho/3). +testSeqTypeRefCho(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqTypeRefCho", Config, [Rule|Opts]), + testSeqTypeRefCho:main(Rule). + +testSeqTypeRefPrim(Config) -> test(Config, fun testSeqTypeRefPrim/3). +testSeqTypeRefPrim(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqTypeRefPrim", Config, [Rule|Opts]), + testSeqTypeRefPrim:main(Rule). + +testSeqTypeRefSeq(Config) -> test(Config, fun testSeqTypeRefSeq/3). +testSeqTypeRefSeq(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqTypeRefSeq", Config, [Rule|Opts]), + testSeqTypeRefSeq:main(Rule). + +testSeqTypeRefSet(Config) -> test(Config, fun testSeqTypeRefSet/3). +testSeqTypeRefSet(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqTypeRefSet", Config, [Rule|Opts]), + testSeqTypeRefSet:main(Rule). + +testSeqOf(Config) -> test(Config, fun testSeqOf/3). +testSeqOf(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["SeqOf", "SeqOfEnum", "XSeqOf"], Config, + [Rule|Opts]), + testSeqOf:main(Rule). + +testSeqOfCho(Config) -> test(Config, fun testSeqOfCho/3). +testSeqOfCho(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqOfCho", Config, [Rule|Opts]), + testSeqOfCho:main(Rule). + +testSeqOfIndefinite(Config) -> + test(Config, fun testSeqOfIndefinite/3, + [ber, ber_bin, ber_bin_v2, {ber_bin_v2, [nif]}]). +testSeqOfIndefinite(Config, Rule, Opts) -> + Files = ["Mvrasn-Constants-1", "Mvrasn-DataTypes-1", "Mvrasn-21-4", + "Mvrasn-20-4", "Mvrasn-19-4", "Mvrasn-18-4", "Mvrasn-17-4", + "Mvrasn-15-4", "Mvrasn-14-4", "Mvrasn-11-4", "SeqOf"], + asn1_test_lib:compile_all(Files, Config, [Rule|Opts]), + testSeqOfIndefinite:main(). + +testSeqOfExternal(Config) -> test(Config, fun testSeqOfExternal/3). +testSeqOfExternal(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SeqOfExternal"], Config, + [Rule|Opts]), + testSeqOfExternal:main(Rule). + +testSeqOfTag(Config) -> test(Config, fun testSeqOfTag/3). +testSeqOfTag(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SeqOfTag"], Config, [Rule|Opts]), + testSeqOfTag:main(Rule). + +testSetDefault(Config) -> test(Config, fun testSetDefault/3). +testSetDefault(Config, Rule, Opts) -> + asn1_test_lib:compile("SetDefault", Config, [Rule|Opts]), + testSetDefault:main(Rule). + +testParamBasic(Config) -> test(Config, fun testParamBasic/3). +testParamBasic(Config, Rule, Opts) -> + asn1_test_lib:compile("ParamBasic", Config, [Rule|Opts]), + testParamBasic:main(Rule). + +testSetExtension(Config) -> test(Config, fun testSetExtension/3). +testSetExtension(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SetExtension"], Config, + [Rule|Opts]), + testSetExtension:main(Rule). + +testSetExternal(Config) -> test(Config, fun testSetExternal/3). +testSetExternal(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SetExternal"], Config, [Rule|Opts]), + testSetExternal:main(Rule). + +testSetOptional(Config) -> test(Config, fun testSetOptional/3). +testSetOptional(Config, Rule, Opts) -> + asn1_test_lib:compile("SetOptional", Config, [Rule|Opts]), + testSetOptional:ticket_7533(Rule), + testSetOptional:main(Rule). + +testSetPrim(Config) -> test(Config, fun testSetPrim/3). +testSetPrim(Config, Rule, Opts) -> + asn1_test_lib:compile("SetPrim", Config, [Rule|Opts]), + testSetPrim:main(Rule). + +testSetTag(Config) -> test(Config, fun testSetTag/3). +testSetTag(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SetTag"], Config, [Rule|Opts]), + testSetTag:main(Rule). + +testSetTypeRefCho(Config) -> test(Config, fun testSetTypeRefCho/3). +testSetTypeRefCho(Config, Rule, Opts) -> + asn1_test_lib:compile("SetTypeRefCho", Config, [Rule|Opts]), + testSetTypeRefCho:main(Rule). + +testSetTypeRefPrim(Config) -> test(Config, fun testSetTypeRefPrim/3). +testSetTypeRefPrim(Config, Rule, Opts) -> + asn1_test_lib:compile("SetTypeRefPrim", Config, [Rule|Opts]), + testSetTypeRefPrim:main(Rule). + +testSetTypeRefSeq(Config) -> test(Config, fun testSetTypeRefSeq/3). +testSetTypeRefSeq(Config, Rule, Opts) -> + asn1_test_lib:compile("SetTypeRefSeq", Config, [Rule|Opts]), + testSetTypeRefSeq:main(Rule). + +testSetTypeRefSet(Config) -> test(Config, fun testSetTypeRefSet/3). +testSetTypeRefSet(Config, Rule, Opts) -> + asn1_test_lib:compile("SetTypeRefSet", Config, [Rule|Opts]), + testSetTypeRefSet:main(Rule). + +testSetOf(Config) -> test(Config, fun testSetOf/3). +testSetOf(Config, Rule, Opts) -> + asn1_test_lib:compile("SetOf", Config, [Rule|Opts]), + testSetOf:main(Rule). + +testSetOfCho(Config) -> test(Config, fun testSetOfCho/3). +testSetOfCho(Config, Rule, Opts) -> + asn1_test_lib:compile("SetOfCho", Config, [Rule|Opts]), + testSetOfCho:main(Rule). + +testSetOfExternal(Config) -> test(Config, fun testSetOfExternal/3). +testSetOfExternal(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SetOfExternal"], Config, + [Rule|Opts]), + testSetOfExternal:main(Rule). + +testSetOfTag(Config) -> test(Config, fun testSetOfTag/3). +testSetOfTag(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["External", "SetOfTag"], Config, [Rule|Opts]), + testSetOfTag:main(Rule). + +c_syntax(Config) -> + DataDir = ?config(data_dir, Config), + [{error, _} = asn1ct:compile(filename:join(DataDir, F)) + || F <-["Syntax", + "BadTypeEnding", + "BadValueAssignment1", + "BadValueAssignment2", + "BadValueSet", + "ChoiceBadExtension", + "EnumerationBadExtension", + "Example", + "Export1", + "MissingEnd", + "SequenceBadComma", + "SequenceBadComponentName", + "SequenceBadComponentType", + "SeqBadComma"]]. + +c_string(Config) -> + test(Config, fun c_string/3, [per, per_bin, ber, ber_bin, ber_bin_v2]). +c_string(Config, Rule, Opts) -> + asn1_test_lib:compile("String", Config, [Rule|Opts]). + +c_implicit_before_choice(Config) -> + test(Config, fun c_implicit_before_choice/3, + [ber, ber_bin, ber_bin_v2]). +c_implicit_before_choice(Config, Rule, Opts) -> + DataDir = ?config(data_dir, Config), + CaseDir = ?config(case_dir, Config), + {error, _R2} = asn1ct:compile(filename:join(DataDir, "CCSNARG3"), + [Rule, {outdir, CaseDir}|Opts]). + +parse(Config) -> + [asn1_test_lib:compile(M, Config, [abs]) || M <- test_modules()]. + +per(Config) -> + test(Config, fun per/3, [per, per_bin, {per_bin, [optimize]}]). +per(Config, Rule, Opts) -> + [module_test(M, Config, Rule, Opts) || M <- per_modules()]. + +ber_other(Config) -> + test(Config, fun ber_other/3, [ber, ber_bin, ber_bin_v2]). +ber_other(Config, Rule, Opts) -> + [module_test(M, Config, Rule, Opts) || M <- ber_modules()]. + + +module_test(M, Config, Rule, Opts) -> + asn1_test_lib:compile(M, Config, [Rule|Opts]), + case asn1ct:test(list_to_atom(M), [{i, ?config(case_dir, Config)}]) of + ok -> ok; + Error -> + erlang:error({test_failed, M, Opts, Error}) + end. + + +ber_choiceinseq(Config) -> + test(Config, fun ber_choiceinseq/3, [ber, ber_bin, ber_bin_v2]). +ber_choiceinseq(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoiceInSeq", Config, [Rule|Opts]). + +ber_optional(Config) -> + test(Config, fun ber_optional/3, [ber, ber_bin, ber_bin_v2]). +ber_optional(Config, Rule, Opts) -> + asn1_test_lib:compile("SOpttest", Config, [Rule|Opts]), + V = {'S', {'A', 10, asn1_NOVALUE, asn1_NOVALUE}, + {'B', asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE}, + {'C', asn1_NOVALUE, 111, asn1_NOVALUE}}, + {ok, B} = asn1_wrapper:encode('SOpttest', 'S', V), + Bytes = lists:flatten(B), + V2 = asn1_wrapper:decode('SOpttest', 'S', Bytes), + V = element(2, V2). + +ber_optional_keyed_list(Config) -> + test(Config, fun ber_optional_keyed_list/3, [ber, ber_bin]). +ber_optional_keyed_list(Config, Rule, Opts) -> + asn1_test_lib:compile("SOpttest", Config, [Rule, keyed_list|Opts]), + Vrecord = {'S', {'A', 10, asn1_NOVALUE, asn1_NOVALUE}, + {'B', asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE}, + {'C', asn1_NOVALUE, 111, asn1_NOVALUE}}, + V = [{a, [{scriptKey, 10}]}, + {b, []}, + {c, [{callingPartysCategory, 111}]}], + {ok, B} = asn1_wrapper:encode('SOpttest', 'S', V), + Bytes = lists:flatten(B), + V2 = asn1_wrapper:decode('SOpttest', 'S', Bytes), + Vrecord = element(2, V2). + +%% records used by test-case default +-record('Def1', {bool0, + bool1 = asn1_DEFAULT, + bool2 = asn1_DEFAULT, + bool3 = asn1_DEFAULT}). + +default(Config) -> test(Config, fun default/3). +default(Config, Rule, Opts) -> + asn1_test_lib:compile("Def", Config, [Rule|Opts]), + {ok, Bytes1} = asn1_wrapper:encode('Def', 'Def1', #'Def1'{bool0 = true}), + {ok, {'Def1', true, false, false, false}} = + asn1_wrapper:decode('Def', 'Def1', lists:flatten(Bytes1)), + + {ok, Bytes2} = asn1_wrapper:encode('Def', 'Def1', #'Def1'{bool0 = true, + bool2 = false}), + {ok, {'Def1', true, false, false, false}} = + asn1_wrapper:decode('Def', 'Def1', lists:flatten(Bytes2)). + +value_test(Config) -> test(Config, fun value_test/3). +value_test(Config, Rule, Opts) -> + asn1_test_lib:compile("ObjIdValues", Config, [Rule|Opts]), + {ok, _} = asn1ct:test('ObjIdValues', 'ObjIdType', + 'ObjIdValues':'mobileDomainId'()). + +value_bad_enum_test(Config) -> + case ?MODULE of + asn1_SUITE -> + {error, _} = asn1ct:compile(?config(data_dir, Config) + ++ "BadEnumValue1", + [{outdir, ?config(case_dir, Config)}]); + _ -> {skip, "Runs in asn1_SUITE only"} + end. + +constructed(Config) -> + test(Config, fun constructed/3, [ber, ber_bin, ber_bin_v2]). +constructed(Config, Rule, Opts) -> + asn1_test_lib:compile("Constructed", Config, [Rule|Opts]), + {ok, B} = asn1_wrapper:encode('Constructed', 'S', {'S', false}), + [40, 3, 1, 1, 0] = lists:flatten(B), + {ok, B1} = asn1_wrapper:encode('Constructed', 'S2', {'S2', false}), + [40, 5, 48, 3, 1, 1, 0] = lists:flatten(B1), + {ok, B2} = asn1_wrapper:encode('Constructed', 'I', 10), + [136, 1, 10] = lists:flatten(B2). + +ber_decode_error(Config) -> + test(Config, fun ber_decode_error/3, [ber, ber_bin, ber_bin_v2]). +ber_decode_error(Config, Rule, Opts) -> + asn1_test_lib:compile("Constructed", Config, [Rule|Opts]), + ber_decode_error:run(Opts). + +h323test(Config) -> test(Config, fun h323test/3). +h323test(Config, Rule, Opts) -> + Files = ["H235-SECURITY-MESSAGES", "H323-MESSAGES", + "MULTIMEDIA-SYSTEM-CONTROL"], + asn1_test_lib:compile_all(Files, Config, [Rule|Opts]), + h323test:run(Rule). + +per_GeneralString(Config) -> + test(Config, fun per_GeneralString/3, [per, per_bin]). +per_GeneralString(Config, Rule, Opts) -> + asn1_test_lib:compile("MULTIMEDIA-SYSTEM-CONTROL", Config, [Rule|Opts]), + UI = [109, 64, 1, 57], + {ok, _V} = asn1_wrapper:decode('MULTIMEDIA-SYSTEM-CONTROL', + 'MultimediaSystemControlMessage', UI). + +per_open_type(Config) -> test(Config, fun per_open_type/3, [per, per_bin]). +per_open_type(Config, Rule, Opts) -> + asn1_test_lib:compile("OpenType", Config, [Rule|Opts]), + {ok, _} = asn1ct:test('OpenType', 'Ot', {'Stype', 10, true}). + +testConstraints(Config) -> test(Config, fun testConstraints/3). +testConstraints(Config, Rule, Opts) -> + asn1_test_lib:compile("Constraints", Config, [Rule|Opts]), + testConstraints:int_constraints(Rule). + + +testSeqIndefinite(Config) -> + test(Config, fun testSeqIndefinite/3, [ber, ber_bin, ber_bin_v2, + {ber_bin_v2, [nif]}]). +testSeqIndefinite(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqSetIndefinite", Config, [Rule|Opts]), + testSeqIndefinite:main(Rule). + + +testSetIndefinite(Config) -> + test(Config, fun testSetIndefinite/3, [ber, ber_bin, ber_bin_v2, + {ber_bin_v2, [nif]}]). +testSetIndefinite(Config, Rule, Opts) -> + asn1_test_lib:compile("SeqSetIndefinite", Config, [Rule|Opts]), + testSetIndefinite:main(Rule). + + +testChoiceIndefinite(Config) -> + test(Config, fun testChoiceIndefinite/3, [ber, ber_bin, ber_bin_v2, + {ber_bin_v2, [nif]}]). +testChoiceIndefinite(Config, Rule, Opts) -> + asn1_test_lib:compile("ChoiceIndef", Config, [Rule|Opts]), + testChoiceIndefinite:main(Rule). + +testInfObjectClass(Config) -> test(Config, fun testInfObjectClass/3). +testInfObjectClass(Config, Rule, Opts) -> + Files = ["ErrorClass", "InfClass"], + InfObjFiles = ["RANAPextract1", "InfObj", "MAP-ExtensionDataTypes", + "Objects", "INAPv2extract"], + RANAPFiles = ["RANAP-CommonDataTypes", "RANAP-Constants", + "RANAP-Containers", "RANAP-IEs", "RANAP-PDU-Contents", + "RANAP-PDU-Descriptions"], + asn1_test_lib:compile_all(Files ++ InfObjFiles ++ RANAPFiles, Config, + [Rule|Opts]), + testInfObjectClass:main(Rule), + testInfObj:main(Rule). + +testParameterizedInfObj(Config) -> + test(Config, fun testParameterizedInfObj/3). +testParameterizedInfObj(Config, Rule, Opts) -> + asn1_test_lib:compile("Param", Config, [Rule|Opts]), + testParameterizedInfObj:main(Rule). + +testMergeCompile(Config) -> test(Config, fun testMergeCompile/3). +testMergeCompile(Config, Rule, Opts) -> + Files = ["MS.set.asn", "RANAPSET.set.asn1", "Mvrasn4.set.asn", + "Mvrasn6.set.asn"], + asn1_test_lib:compile_all(Files, Config, [Rule|Opts]), + testMergeCompile:main(Rule), + testMergeCompile:mvrasn(Rule). + +testobj(Config) -> test(Config, fun testobj/3). +testobj(Config, Rule, Opts) -> + asn1_test_lib:compile("RANAP", Config, [Rule|Opts]), + asn1_test_lib:compile_erlang("testobj", Config, []), + ok = testobj:run(), + ok = testParameterizedInfObj:ranap(Rule). + +testDeepTConstr(Config) -> test(Config, fun testDeepTConstr/3). +testDeepTConstr(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["TConstrChoice", "TConstr"], Config, + [Rule|Opts]), + testDeepTConstr:main(Rule). + +testInvokeMod(Config) -> test(Config, fun testInvokeMod/3). +testInvokeMod(Config, Rule, Opts) -> + asn1_test_lib:compile("PrimStrings", Config, [Rule|Opts]), + {ok, _Result2} = 'PrimStrings':encode('Bs1', [1, 0, 1, 0]). + +testExport(Config) -> + case ?MODULE of + asn1_SUITE -> + {error, {asn1, _Reason}} = + asn1ct:compile(filename:join(?config(data_dir, Config), + "IllegalExport"), + [{outdir, ?config(case_dir, Config)}]); + _ -> + {skip, "Runs in asn1_SUITE only"} + end. + +testImport(Config) -> + test(Config, fun testImport/3, [ber, ber_bin, ber_bin_v2]). +testImport(Config, Rule, Opts) -> + {error, _} = asn1ct:compile(filename:join(?config(data_dir, Config), + "ImportsFrom"), + [Rule, {outdir, ?config(priv_dir, Config)} + |Opts]). + +testMegaco(Config) -> test(Config, fun testMegaco/3). +testMegaco(Config, Rule, Opts) -> + {ok, Module1, Module2} = testMegaco:compile(Config, Rule, Opts), + ok = testMegaco:main(Module1, Config), + ok = testMegaco:main(Module2, Config). + +testMvrasn6(Config) -> test(Config, fun testMvrasn6/3). +testMvrasn6(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["Mvrasn-21-4", "Mvrasn-20-6", "Mvrasn-19-6", + "Mvrasn-15-6", "Mvrasn-18-6", "Mvrasn-14-6", + "Mvrasn-11-6"], Config, [Rule|Opts]). + +testContextSwitchingTypes(Config) -> + test(Config, fun testContextSwitchingTypes/3). +testContextSwitchingTypes(Config, Rule, Opts) -> + asn1_test_lib:compile("ContextSwitchingTypes", Config, [Rule|Opts]), + testContextSwitchingTypes:test(Config). + +testTypeValueNotation(Config) -> test(Config, fun testTypeValueNotation/3). +testTypeValueNotation(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["SeqTypeRefPrim", "ValueTest"], Config, + [Rule|Opts]), + testTypeValueNotation:main(Rule, Opts). + +testOpenTypeImplicitTag(Config) -> + test(Config, fun testOpenTypeImplicitTag/3). +testOpenTypeImplicitTag(Config, Rule, Opts) -> + asn1_test_lib:compile("OpenTypeImplicitTag", Config, [Rule|Opts]), + testOpenTypeImplicitTag:main(Rule). + +duplicate_tags(Config) -> + case ?MODULE of + asn1_SUITE -> + DataDir = ?config(data_dir, Config), + CaseDir = ?config(case_dir, Config), + {error, {asn1, [{error, {type, _, _, 'SeqOpt1Imp', {asn1, {duplicates_of_the_tags, _}}}}]}} = + asn1ct:compile(filename:join(DataDir, "SeqOptional2"), + [abs, {outdir, CaseDir}]); + _ -> + {skip, "Runs in asn1_SUITE only"} + end. + +rtUI(Config) -> test(Config, fun rtUI/3, [per, per_bin, ber, + ber_bin, ber_bin_v2]). +rtUI(Config, Rule, Opts) -> + asn1_test_lib:compile("Prim", Config, [Rule|Opts]), + {ok, _} = asn1rt:info('Prim'). + +testROSE(Config) -> test(Config, fun testROSE/3). +testROSE(Config, Rule, Opts) -> + asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, + [Rule|Opts]). + +testINSTANCE_OF(Config) -> test(Config, fun testINSTANCE_OF/3). +testINSTANCE_OF(Config, Rule, Opts) -> + asn1_test_lib:compile("INSTANCEOF.asn1", Config, [Rule|Opts]), + testINSTANCE_OF:main(Rule). + +testTCAP(Config) -> + test(Config, fun testTCAP/3, + [ber, ber_bin, ber_bin_v2, {ber_bin_v2, [nif]}]). +testTCAP(Config, Rule, Opts) -> + testTCAP:compile(Config, [Rule|Opts]), + testTCAP:test(Rule, Config), + case Rule of + ber_bin_v2 -> testTCAP:compile_asn1config(Config, [Rule, asn1config]), + testTCAP:test_asn1config(); + _ -> ok + end. + +testDER(Config) -> + test(Config, fun testDER/3, [ber, ber_bin, ber_bin_v2]). +testDER(Config, Rule, Opts) -> + asn1_test_lib:compile("DERSpec", Config, [Rule, der|Opts]), + testDER:test(), + asn1_test_lib:compile("ParamBasic", Config, [Rule, der|Opts]), + testParamBasic:main(der), + asn1_test_lib:compile("Default", Config, [Rule, der|Opts]), + testSeqSetDefaultVal:main(Rule). + +specialized_decodes(Config) -> + test(Config, fun specialized_decodes/3, [ber_bin_v2]). +specialized_decodes(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["PartialDecSeq.asn", + "PartialDecSeq2.asn", + "PartialDecSeq3.asn", + "PartialDecMyHTTP.asn", + "MEDIA-GATEWAY-CONTROL.asn", + "P-Record"], + Config, [Rule, optimize, asn1config|Opts]), + test_partial_incomplete_decode:test(Config), + test_selective_decode:test(). + +special_decode_performance(Config) -> + test(Config, fun special_decode_performance/3, + [{ber_bin, [optimize]}, {ber_bin_v2, [optimize, nif]}]). +special_decode_performance(Config, Rule, Opts) -> + Files = ["MEDIA-GATEWAY-CONTROL", "PartialDecSeq"], + asn1_test_lib:compile_all(Files, Config, [Rule, asn1config|Opts]), + test_special_decode_performance:go(all). + + +test_driver_load(Config) -> + test(Config, fun test_driver_load/3, [{per_bin, [optimize]}]). +test_driver_load(Config, Rule, Opts) -> + asn1_test_lib:compile("P-Record", Config, [Rule|Opts]), + test_driver_load:test(5). + +test_ParamTypeInfObj(Config) -> + asn1_test_lib:compile("IN-CS-1-Datatypes", Config, [ber_bin]). + +test_WS_ParamClass(Config) -> + asn1_test_lib:compile("InformationFramework", Config, [ber_bin]). + +test_Defed_ObjectIdentifier(Config) -> + asn1_test_lib:compile("UsefulDefinitions", Config, [ber_bin]). + +testSelectionType(Config) -> test(Config, fun testSelectionType/3). +testSelectionType(Config, Rule, Opts) -> + asn1_test_lib:compile("SelectionType", Config, [Rule|Opts]), + {ok, _} = testSelectionTypes:test(). + +testSSLspecs(Config) -> + test(Config, fun testSSLspecs/3, [ber, ber_bin, ber_bin_v2, {ber_bin_v2, [optimize]}]). +testSSLspecs(Config, Rule, Opts) -> + ok = testSSLspecs:compile(Config, + [Rule, compact_bit_string, der|Opts]), + testSSLspecs:run(Rule), + + case code:which(asn1ct) of + cover_compiled -> + ok; + _ -> + ok = testSSLspecs:compile_inline(Config, Rule), + ok = testSSLspecs:run_inline(Rule) + end. + +testNortel(Config) -> test(Config, fun testNortel/3). +testNortel(Config, Rule, Opts) -> + asn1_test_lib:compile("Nortel", Config, [Rule|Opts]). + +test_undecoded_rest(Config) -> test(Config, fun test_undecoded_rest/3). +test_undecoded_rest(Config, Rule, Opts) -> + asn1_test_lib:compile("P-Record", Config, [Rule|Opts]), + ok = test_undecoded_rest:test([], Config), + asn1_test_lib:compile("P-Record", Config, [Rule,undec_rest|Opts]), + case Rule of + ber_bin_v2 -> ok; + _ -> test_undecoded_rest:test(undec_rest, Config) + end. + +test_inline(Config) -> + test(Config, fun test_inline/3, [ber, ber_bin, ber_bin_v2]). +test_inline(Config, Rule, Opts) -> + case code:which(asn1ct) of + cover_compiled -> + {skip, "Not runnable when cover compiled"}; + _ -> + test_inline:compile(Config, Opts), + test_inline:main(Config, Rule), + test_inline:inline1(Config, Rule, Opts), + test_inline:performance2() + end. + +testTcapsystem(Config) -> + test(Config, fun testTcapsystem/3, [ber, ber_bin, ber_bin_v2]). +testTcapsystem(Config, Rule, Opts) -> + testTcapsystem:compile(Config, [Rule|Opts]). + +testNBAPsystem(Config) -> test(Config, fun testNBAPsystem/3, + [per, per_bin, {per_bin, [optimize]}]). +testNBAPsystem(Config, Rule, Opts) -> + testNBAPsystem:compile(Config, [Rule|Opts]), + testNBAPsystem:test(Rule, Config). + +test_compile_options(Config) -> + case code:which(asn1ct) of + cover_compiled -> + {skip, "Not runnable when cover compiled"}; + _ -> + ok = test_compile_options:wrong_path(Config), + ok = test_compile_options:path(Config), + ok = test_compile_options:noobj(Config), + ok = test_compile_options:record_name_prefix(Config), + ok = test_compile_options:verbose(Config), + ok = test_compile_options:warnings_as_errors(Config) + end. + +testDoubleEllipses(Config) -> test(Config, fun testDoubleEllipses/3). +testDoubleEllipses(Config, Rule, Opts) -> + asn1_test_lib:compile("DoubleEllipses", Config, [Rule|Opts]), + testDoubleEllipses:main(Rule). + +test_modified_x420(Config) -> + Files = [filename:join(modified_x420, F) || F <- ["PKCS7", + "InformationFramework", + "AuthenticationFramework"]], + asn1_test_lib:compile_all(Files, Config, [der]), + test_modified_x420:test_io(Config). + +testX420(Config) -> + test(Config, fun testX420/3, [ber, ber_bin, ber_bin_v2]). +testX420(Config, Rule, Opts) -> + testX420:compile(Rule, [der|Opts], Config), + ok = testX420:ticket7759(Rule, Config), + testX420:compile(Rule, Opts, Config). + +test_x691(Config) -> + test(Config, fun test_x691/3, + [per, per_bin, uper_bin, {per_bin, [optimize]}]). +test_x691(Config, Rule, Opts) -> + Files = ["P-RecordA1", "P-RecordA2", "P-RecordA3"], + asn1_test_lib:compile_all(Files, Config, [Rule|Opts]), + test_x691:cases(Rule, case Rule of + uper_bin -> unaligned; + _ -> aligned + end), + asn1_test_lib:ticket_7708(Config, []), + asn1_test_lib:ticket_7763(Config). + +ticket_6143(Config) -> + ok = test_compile_options:ticket_6143(Config). + +testExtensionAdditionGroup(Config) -> + %% FIXME problems with automatic tags [ber_bin], [ber_bin, optimize] + test(Config, fun testExtensionAdditionGroup/3, + [per_bin, {per_bin, [optimize]}, uper_bin]). +testExtensionAdditionGroup(Config, Rule, Opts) -> + asn1_test_lib:compile("Extension-Addition-Group", Config, [Rule|Opts]), + asn1_test_lib:compile_erlang("extensionAdditionGroup", Config, + [debug_info]), + extensionAdditionGroup:run([Rule|Opts]), + extensionAdditionGroup:run2([Rule|Opts]), + asn1_test_lib:compile("EUTRA-RRC-Definitions", Config, [Rule, {record_name_prefix, "RRC-"}|Opts]), + extensionAdditionGroup:run3([Rule|Opts]). + +% parse_modules() -> +% ["ImportsFrom"]. + +per_modules() -> + [X || X <- test_modules()]. + +ber_modules() -> + [X || X <- test_modules(), + X =/= "CommonDataTypes", + X =/= "DS-EquipmentUser-CommonFunctionOrig-TransmissionPath", + X =/= "H323-MESSAGES", + X =/= "H235-SECURITY-MESSAGES", + X =/= "MULTIMEDIA-SYSTEM-CONTROL"]. + +test_modules() -> + ["BitStr", + "CAP", + "CommonDataTypes", + "Constraints", + "ContextSwitchingTypes", + "DS-EquipmentUser-CommonFunctionOrig-TransmissionPath", + "Enum", + "From", + "H235-SECURITY-MESSAGES", + "H323-MESSAGES", + "Import", + "Int", + "MAP-commonDataTypes", + "Null", + "Octetstr", + "One", + "P-Record", + "P", + "Person", + "PrimStrings", + "Real", + "XSeq", + "XSeqOf", + "XSet", + "XSetOf", + "String", + "SwCDR", + "Time", + "SeqSetLib", % must be compiled before Seq and Set + "Seq", + "Set", + "SetOf", + "SeqOf", + "Prim", + "Cho", + "Def", + "Opt", + "ELDAPv3", + "LDAP"]. + +test_OTP_9688(Config) -> + PrivDir = ?config(case_dir, Config), + Data = " +OTP-9688 DEFINITIONS ::= BEGIN + + foo INTEGER ::= 1 + bar INTEGER ::= 42 + + Baz ::= INTEGER {x-y-z1(foo), x-y-z2(bar)} + Qux ::= SEQUENCE {flerpInfo SEQUENCE {x INTEGER (-10 | -9 | (0..4))} OPTIONAL} + +END +", + File = filename:join(PrivDir, "OTP-9688.asn1"), + ok = file:write_file(File, Data), + %% Does it compile with changes to asn1ct_check and asn1ct_gen_per_rt2ct? + %% (see ticket) + ok = asn1ct:compile(File, [{outdir, PrivDir}]). + + +timer_compile(Config, Rule, Opts) -> + asn1_test_lib:compile_all(["H235-SECURITY-MESSAGES", "H323-MESSAGES"], + Config, [Rule|Opts]). + +testTimer_ber(suite) -> []; +testTimer_ber(Config) -> + timer_compile(Config,ber,[]), + testTimer:go(Config,ber). + +testTimer_ber_bin(suite) -> []; +testTimer_ber_bin(Config) -> + timer_compile(Config,ber_bin,[]), + testTimer:go(Config,ber_bin). + +testTimer_ber_bin_opt(suite) -> []; +testTimer_ber_bin_opt(Config) -> + timer_compile(Config,ber_bin,[optimize]), + testTimer:go(Config,ber_bin). + +testTimer_ber_bin_opt_driver(suite) -> []; +testTimer_ber_bin_opt_driver(Config) -> + timer_compile(Config,ber_bin,[optimize,driver]), + testTimer:go(Config,ber_bin). + +testTimer_per(suite) -> []; +testTimer_per(Config) -> + timer_compile(Config,per,[]), + testTimer:go(Config,per). + +testTimer_per_bin(suite) -> []; +testTimer_per_bin(Config) -> + timer_compile(Config,per_bin,[]), + testTimer:go(Config,per_bin). + +testTimer_per_bin_opt(suite) -> []; +testTimer_per_bin_opt(Config) -> + timer_compile(Config,per_bin,[optimize]), + testTimer:go(Config,per_bin). + + +testTimer_uper_bin(suite) -> []; +testTimer_uper_bin(Config) -> + timer_compile(Config,uper_bin,[]), + {comment,_} = testTimer:go(Config,uper_bin). + +%% Test of multiple-line comment, OTP-8043 +testComment(suite) -> []; +testComment(Config) -> + asn1_test_lib:compile("Comment", Config, []), + {ok,Enc} = asn1_wrapper:encode('Comment','Seq',{'Seq',12,true}), + {ok,{'Seq',12,true}} = asn1_wrapper:decode('Comment','Seq',Enc), + ok. + +testName2Number(suite) -> []; +testName2Number(Config) -> + N2NOptions = [{n2n,Type} || Type <- ['CauseMisc', 'CauseProtocol', + 'CauseRadioNetwork', + 'CauseTransport','CauseNas']], + asn1_test_lib:compile("S1AP-IEs", Config, N2NOptions), + + 0 = 'S1AP-IEs':name2num_CauseMisc('control-processing-overload'), + 'unknown-PLMN' = 'S1AP-IEs':num2name_CauseMisc(5), + ok. + +ticket_7407(Config) -> + asn1_test_lib:compile("EUTRA-extract-7407", Config, [uper_bin]), + asn1_test_lib:ticket_7407_code(true), + + asn1_test_lib:compile("EUTRA-extract-7407", Config, + [uper_bin, no_final_padding]), + asn1_test_lib:ticket_7407_code(false). + +smp(suite) -> []; +smp(Config) -> + case erlang:system_info(smp_support) of + true -> + NumOfProcs = erlang:system_info(schedulers), + io:format("smp starting ~p workers\n",[NumOfProcs]), + + Msg = {initiatingMessage, testNBAPsystem:cell_setup_req_msg()}, + ok = testNBAPsystem:compile(Config, [per_bin, optimize]), + + enc_dec(NumOfProcs,Msg,2), + + N = 10000, + + {Time1,ok} = timer:tc(?MODULE,enc_dec,[NumOfProcs,Msg, N]), + {Time1S,ok} = timer:tc(?MODULE,enc_dec,[1, Msg, NumOfProcs * N]), + + ok = testNBAPsystem:compile(Config, [ber_bin, optimize, nif]), + {Time3,ok} = timer:tc(?MODULE,enc_dec,[NumOfProcs,Msg, N]), + + {Time3S,ok} = timer:tc(?MODULE,enc_dec,[1, Msg, NumOfProcs * N]), + + {comment,lists:flatten( + io_lib:format( + "Encode/decode time parallell with ~p cores: ~p [microsecs]~n" + "Encode/decode time sequential: ~p [microsecs]", + [NumOfProcs,Time1+Time3,Time1S+Time3S]))}; + false -> + {skipped,"No smp support"} + end. + +per_performance(Config) -> + PrivDir = proplists:get_value(priv_dir, Config), + NifDir = filename:join(PrivDir,"nif"), + ErlDir = filename:join(PrivDir,"erl"), + file:make_dir(NifDir),file:make_dir(ErlDir), + + Msg = {initiatingMessage, testNBAPsystem:cell_setup_req_msg()}, + ok = testNBAPsystem:compile([{priv_dir,NifDir}|Config], + [per_bin, optimize]), + ok = testNBAPsystem:compile([{priv_dir,ErlDir}|Config], + [per_bin]), + + Modules = ['NBAP-CommonDataTypes', + 'NBAP-Constants', + 'NBAP-Containers', + 'NBAP-IEs', + 'NBAP-PDU-Contents', + 'NBAP-PDU-Discriptions'], + + + PreNif = fun() -> + code:add_patha(NifDir), + lists:foreach(fun(M) -> + code:purge(M), + code:load_file(M) + end,Modules) + end, + + PreErl = fun() -> + code:add_patha(ErlDir), + lists:foreach(fun(M) -> + code:purge(M), + code:load_file(M) + end,Modules) + end, + + Func = fun() -> + element(1,timer:tc( + asn1_wrapper,encode,['NBAP-PDU-Discriptions', + 'NBAP-PDU', + Msg])) + end, + + nif_vs_erlang_performance({{{PreNif,Func},{PreErl,Func}},100000,32}). + +ber_performance(Config) -> + + Msg = {initiatingMessage, testNBAPsystem:cell_setup_req_msg()}, + ok = testNBAPsystem:compile(Config, [ber_bin, optimize, nif]), + + + BerFun = fun() -> + {ok,B} = asn1_wrapper:encode('NBAP-PDU-Discriptions', + 'NBAP-PDU', Msg), + asn1_wrapper:decode( + 'NBAP-PDU-Discriptions', + 'NBAP-PDU', + B) + end, + nif_vs_erlang_performance({BerFun,100000,32}). + +cert_pem_performance(Config) when is_list(Config) -> + cert_pem_performance({100000, 32}); +cert_pem_performance({N,S}) -> + nif_vs_erlang_performance({fun pem_performance:cert_pem/0,N,S}). + +dsa_pem_performance(Config) when is_list(Config) -> + dsa_pem_performance({100000, 32}); +dsa_pem_performance({N,S}) -> + nif_vs_erlang_performance({fun pem_performance:dsa_pem/0,N,S}). + + +nif_vs_erlang_performance({{TC1,TC2},N,Sched}) -> + random:seed({123,456,789}), + io:format("Running a ~p sample with ~p max procs...~n~n",[N,Sched]), + + {True,False} = exec(TC1,TC2,Sched,N+1), + + io:format("~ndone!~n"), + + io:format("~n"),TStats = print_stats(strip(True,N div 20)), + io:format("~n"),FStats = print_stats(strip(False,N div 20)), + Str = io_lib:format("~nNifs are ~.3f% faster than erlang!~n", + [(element(2,FStats) - element(2,TStats)) / + element(2,FStats) * 100]), + io:format(Str), + {comment, lists:flatten(Str)}; +nif_vs_erlang_performance({T,N,Sched}) -> + PTC1 = fun() -> + application:set_env(asn1, nif_loadable, true) + end, + PTC2 = fun() -> + application:set_env(asn1, nif_loadable, false) + end, + TC = fun() -> + element(1,timer:tc(T)) + end, + nif_vs_erlang_performance({{{PTC1,TC},{PTC2,TC}},N,Sched}). + + +print_stats(Data) -> + Length = length(Data), + Mean = lists:sum(Data) / Length, + Variance = lists:foldl(fun(N,Acc) -> math:pow(N - Mean, 2)+Acc end, 0, Data), + StdDev = math:sqrt(Variance / Length), + Median = lists:nth(round(Length/2),Data), + Min = lists:min(Data), + Max = lists:max(Data), + if Length < 20 -> + io:format("Data: ~w~n",[Data]); + true -> + ok + end, + io:format("Length: ~p~nMean: ~p~nStdDev: ~p~nMedian: ~p~nMin: ~p~nMax: ~p~n", + [Length,Mean,StdDev,Median,Min,Max]), + {Length,Mean,StdDev,Median,Min,Max}. + +collect(Acc) -> + receive + {Tag,Val} -> + Prev = proplists:get_value(Tag,Acc,[]), + collect(lists:keystore(Tag,1,Acc,{Tag,[Val|Prev]})) + after 100 -> + Acc + end. + +exec(One,Two,Max,N) -> + exec(One,Two,Max,N,{[],[]}). +exec(_,_,_,1,{D1,D2}) -> + {lists:flatten(D1),lists:flatten(D2)}; +exec({PreOne,One} = O,{PreTwo,Two} = T,MaxProcs, N, {D1,D2}) -> + Num = random:uniform(round(N/2)), + if Num rem 3 == 0 -> + timer:sleep(Num rem 1000); + true -> + ok + end, + Procs = random:uniform(MaxProcs), + io:format("\tBatch: ~p items in ~p processes, ~p left~n",[Num,Procs,N-Num]), + if Num rem 2 == 1 -> + erlang:garbage_collect(), + PreOne(), + MoreOne = pexec(One, Num, Procs, []), + erlang:garbage_collect(), + PreTwo(), + MoreTwo = pexec(Two, Num, Procs, []); + true -> + erlang:garbage_collect(), + PreTwo(), + MoreTwo = pexec(Two, Num, Procs, []), + erlang:garbage_collect(), + PreOne(), + MoreOne = pexec(One, Num, Procs, []) + end, + exec(O,T,MaxProcs,N-Num,{[MoreOne|D1], + [MoreTwo|D2]}). + +pexec(_Fun, _, 0, []) -> + []; +pexec(Fun, _, 0, [{Ref,Pid}|Rest]) -> + receive + {data,D} -> + [D|pexec(Fun,0,0,[{Ref,Pid}|Rest])]; + {'DOWN', Ref, process, Pid, normal} -> + pexec(Fun, 0,0,Rest) + end; +pexec(Fun, 0, 1, AccProcs) -> + pexec(Fun, 0, 0, AccProcs); +pexec(Fun, N, 1, AccProcs) -> + [Fun()|pexec(Fun, N - 1, 1, AccProcs)]; +pexec(Fun, N, Procs, AccProcs) -> + S = self(), + Pid = spawn(fun() -> + S ! {data,pexec(Fun,N,1,[])} + end), + Ref = erlang:monitor(process, Pid), + pexec(Fun, N, Procs - 1, [{Ref,Pid}|AccProcs]). + +strip(Data,Num) -> + {_,R} = lists:split(Num,lists:sort(Data)), + element(2,lists:split(Num,lists:reverse(R))). + +faster(A,B) -> + (B - A)/B * 100. + +enc_dec(1, Msg, N) -> + worker_loop(N, Msg); +enc_dec(NumOfProcs,Msg, N) -> + pforeach(fun(_) -> + worker_loop(N, Msg) + end, [I || I <- lists:seq(1,NumOfProcs)]). + +worker_loop(0, _Msg) -> + ok; +worker_loop(N, Msg) -> + {ok,B}=asn1_wrapper:encode('NBAP-PDU-Discriptions', + 'NBAP-PDU', + Msg), + {ok,_Msg}=asn1_wrapper:decode('NBAP-PDU-Discriptions', + 'NBAP-PDU', + B), + worker_loop(N - 1, Msg). + + +pforeach(Fun, List) -> + pforeach(Fun, List, []). +pforeach(Fun, [], [{Pid,Ref}|Pids]) -> + receive + {'DOWN', Ref, process, Pid, normal} -> + pforeach(Fun, [], Pids) + end; +pforeach(Fun, [H|T], Pids) -> + Pid = spawn(fun() -> Fun(H) end), + Ref = erlang:monitor(process, Pid), + pforeach(Fun, T, [{Pid, Ref}|Pids]); +pforeach(_Fun,[],[]) -> + ok. + +-record('InitiatingMessage',{procedureCode,criticality,value}). +-record('Iu-ReleaseCommand',{first,second}). + +ticket7904(Config) -> + asn1_test_lib:compile("RANAPextract1", Config, [per_bin, optimize]), + + Val1 = #'InitiatingMessage'{procedureCode=1, + criticality=ignore, + value=#'Iu-ReleaseCommand'{ + first=13, + second=true}}, + + {ok,_} = 'RANAPextract1':encode('InitiatingMessage', Val1), + {ok,_} = 'RANAPextract1':encode('InitiatingMessage', Val1). diff --git a/lib/asn1/test/asn1_SUITE.erl.src b/lib/asn1/test/asn1_SUITE.erl.src deleted file mode 100644 index d05b7cac90..0000000000 --- a/lib/asn1/test/asn1_SUITE.erl.src +++ /dev/null @@ -1,2347 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2012. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% -%% -%%% Purpose : Test suite for the ASN.1 application - --module(asn1_%BIN%SUITE). --define(PER, '%PER%'). --define(BER, '%BER%'). --define(ber_nif(Erule, Func), - case Erule of - ber_bin_v2 -> Func; - _ -> ok - end). --define(per_optimize(Erule), - case Erule of - ber_bin_v2 -> [optimize]; - _ -> [] - end). --define(per_bit_opt(FuncCall), - case ?BER of - ber_bin_v2 -> FuncCall; - _ -> ok - end). --define(uper_bin(FuncCall), - case ?PER of - per -> FuncCall; - _ -> ok - end). - --compile(export_all). -%%-export([Function/Arity, ...]). - --include_lib("test_server/include/test_server.hrl"). - -%% records used by test-case default --record('Def1', {bool0, - bool1 = asn1_DEFAULT, - bool2 = asn1_DEFAULT, - bool3 = asn1_DEFAULT}). - -suite() -> [{ct_hooks, [ts_install_cth]}]. - -all() -> [{group, parallel}] ++ common() ++ particular(). - -groups() -> - [{compile, parallel([]), - [c_syntax, - % Uses 'String' - {group, [], [c_string_per, - c_string_ber]}, - c_implicit_before_choice]}, - - {ber, parallel([]), - [ber_choiceinseq, - % Uses 'SOpttest' - {group, [], [ber_optional, - ber_optional_keyed_list]}, - ber_other]}, - - {app_test, [], - [{asn1_app_test, all}]}, - - {appup_test, [], - [{asn1_appup_test, all}]}, - - {parallel, parallel([]), - [{group, compile}, - {group, ber}, - % Uses 'Prim' - {group, [], [testPrim, - rtUI]}, - % Uses 'P-Record', 'Constraints', 'MEDIA-GATEWAY-CONTROL'... - {group, [], [parse, - test_driver_load, - test_undecoded_rest, - test_inline, - specialized_decodes, - special_decode_performance, - testMegaco, - testConstraints, - testCompactBitString]}, - % Uses 'Def' - {group, [], [default_ber, - default_per, - default_per_opt]}, - per, - {group, [], [testPrimStrings, - testInvokeMod]}, - testChoPrim, - testChoExtension, - testChoOptional, - testChoOptionalImplicitTag, - testChoRecursive, - testChoTypeRefCho, - testChoTypeRefPrim, - testChoTypeRefSeq, - testChoTypeRefSet, - testDef, - testOpt, - testSeqDefault, - % Uses 'External' - {group, [], [testChoExternal, - testPrimExternal, - testSeqExtension, - testSeqExternal, - testSeqOfExternal, - testSeqTag, - testSetExternal, - testSetOfExternal, - testSetOfTag, - testSetTag]}, - testSeqOptional, - testSeqPrim, - testSeqTypeRefCho, - % Uses 'SeqTypeRefPrim' - {group, [], [testSeqTypeRefPrim, - testTypeValueNotation]}, - testSeqTypeRefSeq, - testSeqTypeRefSet, - % Uses 'SeqOf' - {group, [], [testSeqOf, - testSeqOfIndefinite]}, % Uses 'Mvrasn*' - testSeqOfCho, - testSetDefault, - testSetExtension, - testExtensionAdditionGroup, - testSeqOfTag, - testSetOptional, - testSetPrim, - testSetTypeRefCho, - testSetTypeRefPrim, - testSetTypeRefSeq, - testSetTypeRefSet, - testSetOf, - testSetOfCho, - testEnumExt, - value_test, - testSeq2738, - % Uses 'Constructed' - {group, [], [constructed, - ber_decode_error]}, - % Uses 'MULTIMEDIA-SYSTEM-CONTROL' - {group, [], [h323test, - per_GeneralString]}, - % Uses 'SeqSetIndefinite' - {group, [], [testSeqIndefinite, - testSetIndefinite]}, - testChoiceIndefinite, - per_open_type, - testInfObjectClass, - testParameterizedInfObj, - testMergeCompile, - testobj, - testDeepTConstr, - testExport, - testImport, - % Uses 'ParamBasic' - {group, [], [testParamBasic, - testDER]}, - testMvrasn6, - testContextSwitchingTypes, - testOpenTypeImplicitTag, - duplicate_tags, - testROSE, - testINSTANCE_OF, - testTCAP, - test_ParamTypeInfObj, - test_WS_ParamClass, - test_Defed_ObjectIdentifier, - testSelectionType, - testSSLspecs, - testNortel, - % Uses 'PKCS7' - {group, [], [test_modified_x420, - testX420]}, - testTcapsystem, - testNBAPsystem, - test_compile_options, - testDoubleEllipses, - test_x691, - ticket_6143, - testExtensionAdditionGroup, - test_OTP_9688]} - ]. - -parallel(Options) -> - case erlang:system_info(smp_support) andalso - erlang:system_info(schedulers) > 1 of - true -> [parallel|Options]; - false -> Options - end. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -init_per_testcase(Func, Config) -> - PrivDir = ?config(priv_dir, Config), - true = code:add_patha(PrivDir), - - CaseDir = filename:join([PrivDir, ?MODULE, Func]), - ok = filelib:ensure_dir(filename:join([CaseDir, dummy_file])), - true = code:add_patha(CaseDir), - - Dog = case Func of - testX420 -> test_server:timetrap({minutes, 60}); - _ -> test_server:timetrap({minutes, 30}) - end, - [{case_dir, CaseDir}, {watchdog, Dog}|Config]. - -end_per_testcase(_Func, Config) -> - Dog = ?config(watchdog, Config), - % TODO: Clean up code path? - test_server:timetrap_cancel(Dog). - - -testPrim(suite) -> []; -testPrim(Config) -> - Files = ["Prim", "Real"], - - asn1_test_lib:compile_all(Files, Config, [?BER]), - testPrim_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile_all(Files, Config, [?BER, nif])), - ?ber_nif(?BER, testPrim_cases(?BER)), - - asn1_test_lib:compile_all(Files, Config, [?PER]), - testPrim_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile_all(Files, Config, [?PER, optimize])), - ?per_bit_opt(testPrim_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])), - ?uper_bin(testPrim_cases(uper_bin)), - - asn1_test_lib:compile_all(Files, Config, [?PER, optimize]), - testPrim_cases(?PER). - -testPrim_cases(Rules) -> - testPrim:bool(Rules), - testPrim:int(Rules), - testPrim:enum(Rules), - testPrim:obj_id(Rules), - testPrim:rel_oid(Rules), - testPrim:null(Rules), - testPrim:real(Rules). - - -testCompactBitString(suite) -> []; -testCompactBitString(Config) -> - testCompactBitString:compile(Config, [?BER, compact_bit_string]), - testCompactBitString:compact_bit_string(?BER), - - ?ber_nif(?BER, testCompactBitString:compile(Config, [?BER, compact_bit_string, nif])), - ?ber_nif(?BER, testCompactBitString:compact_bit_string(?BER)), - - testCompactBitString:compile(Config, [?PER, compact_bit_string]), - testCompactBitString:compact_bit_string(?PER), - testCompactBitString:bit_string_unnamed(?PER), - - ?per_bit_opt(testCompactBitString:compile(Config, [?PER, compact_bit_string, optimize])), - ?per_bit_opt(testCompactBitString:compact_bit_string(?PER)), - ?per_bit_opt(testCompactBitString:bit_string_unnamed(?PER)), - ?per_bit_opt(testCompactBitString:ticket_7734(?PER)), - - ?uper_bin(testCompactBitString:compile(Config, [uper_bin, compact_bit_string])), - ?uper_bin(testCompactBitString:compact_bit_string(uper_bin)), - ?uper_bin(testCompactBitString:bit_string_unnamed(uper_bin)), - - testCompactBitString:compile(Config, [?PER, optimize, compact_bit_string]), - testCompactBitString:compact_bit_string(?PER), - testCompactBitString:bit_string_unnamed(?PER), - - testCompactBitString:otp_4869(?PER). - - -testPrimStrings(suite) -> []; -testPrimStrings(Config) -> - - testPrimStrings:compile(Config, ?BER, []), - testPrimStrings_cases(?BER), - testPrimStrings:more_strings(?BER), %% these are not implemented in per yet - ?ber_nif(?BER, testPrimStrings:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testPrimStrings_cases(?BER)), - ?ber_nif(?BER, testPrimStrings:more_strings(?BER)), - - testPrimStrings:compile(Config, ?PER, []), - testPrimStrings_cases(?PER), - - ?per_bit_opt(testPrimStrings:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testPrimStrings_cases(?PER)), - - ?uper_bin(testPrimStrings:compile(Config, uper_bin, [])), - ?uper_bin(testPrimStrings_cases(uper_bin)), - - testPrimStrings:compile(Config, ?PER, [optimize]), - testPrimStrings_cases(?PER). - -testPrimStrings_cases(Rules) -> - testPrimStrings:bit_string(Rules), - testPrimStrings:bit_string_unnamed(Rules), - testPrimStrings:octet_string(Rules), - testPrimStrings:numeric_string(Rules), - testPrimStrings:other_strings(Rules), - testPrimStrings:universal_string(Rules), - testPrimStrings:bmp_string(Rules), - testPrimStrings:times(Rules), - testPrimStrings:utf8_string(Rules). - - - -testPrimExternal(suite) -> []; -testPrimExternal(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - asn1_test_lib:compile("PrimExternal", Config, [?BER]), - testPrimExternal:external(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, asn1_test_lib:compile("PrimExternal", Config, [?BER, nif])), - ?ber_nif(?BER, testPrimExternal:external(?BER)), - - asn1_test_lib:compile("External", Config, [?PER]), - asn1_test_lib:compile("PrimExternal", Config, [?PER]), - testPrimExternal:external(?PER), - - ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])), - ?per_bit_opt(asn1_test_lib:compile("PrimExternal", Config, [?PER, optimize])), - ?per_bit_opt(testPrimExternal:external(?PER)), - - ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])), - ?uper_bin(asn1_test_lib:compile("PrimExternal", Config, [uper_bin])), - ?uper_bin(testPrimExternal:external(uper_bin)), - - asn1_test_lib:compile("External", Config, [?PER, optimize]), - asn1_test_lib:compile("PrimExternal", Config, [?PER, optimize]), - testPrimExternal:external(?PER). - - -testChoPrim(suite) -> []; -testChoPrim(Config) -> - asn1_test_lib:compile("ChoPrim", Config, [?BER]), - testChoPrim_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("ChoPrim", Config, [?BER, nif])), - ?ber_nif(?BER, testChoPrim_cases(?BER)), - - asn1_test_lib:compile("ChoPrim", Config, [?PER]), - testChoPrim_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("ChoPrim", Config, [?PER, optimize])), - ?per_bit_opt(testChoPrim_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("ChoPrim", Config, [uper_bin])), - ?uper_bin(testChoPrim_cases(uper_bin)), - - asn1_test_lib:compile("ChoPrim", Config, [?PER, optimize]), - testChoPrim_cases(?PER). - -testChoPrim_cases(Rules) -> - testChoPrim:bool(Rules), - testChoPrim:int(Rules). - - - -testChoExtension(suite) -> []; -testChoExtension(Config) -> - asn1_test_lib:compile("ChoExtension", Config, [?BER]), - testChoExtension_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("ChoExtension", Config, [?BER, nif])), - ?ber_nif(?BER, testChoExtension_cases(?BER)), - - asn1_test_lib:compile("ChoExtension", Config, [?PER]), - testChoExtension_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("ChoExtension", Config, [?PER, optimize])), - ?per_bit_opt(testChoExtension_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("ChoExtension", Config, [uper_bin])), - ?uper_bin(testChoExtension_cases(uper_bin)), - - asn1_test_lib:compile("ChoExtension", Config, [?PER, optimize]), - testChoExtension_cases(?PER). - -testChoExtension_cases(Rules) -> - testChoExtension:extension(Rules). - - - -testChoExternal(suite) -> []; -testChoExternal(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - asn1_test_lib:compile("ChoExternal", Config, [?BER]), - testChoExternal:external(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, asn1_test_lib:compile("ChoExternal", Config, [?BER, nif])), - ?ber_nif(?BER, testChoExternal:external(?BER)), - - asn1_test_lib:compile("External", Config, [?PER]), - asn1_test_lib:compile("ChoExternal", Config, [?PER]), - testChoExternal:external(?PER), - - ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])), - ?per_bit_opt(asn1_test_lib:compile("ChoExternal", Config, [?PER, optimize])), - ?per_bit_opt(testChoExternal:external(?PER)), - - ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])), - ?uper_bin(asn1_test_lib:compile("ChoExternal", Config, [uper_bin])), - ?uper_bin(testChoExternal:external(uper_bin)), - - asn1_test_lib:compile("External", Config, [?PER, optimize]), - asn1_test_lib:compile("ChoExternal", Config, [?PER, optimize]), - testChoExternal:external(?PER). - - -testChoOptional(suite) -> []; -testChoOptional(Config) -> - - testChoOptional:compile(Config, ?BER, []), - testChoOptional_cases(?BER), - - ?ber_nif(?BER, testChoOptional:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testChoOptional_cases(?BER)), - - testChoOptional:compile(Config, ?PER, []), - testChoOptional_cases(?PER), - - ?per_bit_opt(testChoOptional:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testChoOptional_cases(?PER)), - - ?uper_bin(testChoOptional:compile(Config, uper_bin, [])), - ?uper_bin(testChoOptional_cases(uper_bin)), - - testChoOptional:compile(Config, ?PER, [optimize]), - testChoOptional_cases(?PER). - -testChoOptional_cases(Rules) -> - testChoOptional:optional(Rules). - -testChoOptionalImplicitTag(suite) -> []; -testChoOptionalImplicitTag(Config) -> - %% Only meaningful for ?BER - testChoOptionalImplicitTag:compile(Config, ?BER), - testChoOptionalImplicitTag:optional(?BER). - - -testChoRecursive(suite) -> []; -testChoRecursive(Config) -> - - testChoRecursive:compile(Config, ?BER, []), - testChoRecursive_cases(?BER), - - ?ber_nif(?BER, testChoRecursive:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testChoRecursive_cases(?BER)), - - testChoRecursive:compile(Config, ?PER, []), - testChoRecursive_cases(?PER), - - ?per_bit_opt(testChoRecursive:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testChoRecursive_cases(?PER)), - - ?uper_bin(testChoRecursive:compile(Config, uper_bin, [])), - ?uper_bin(testChoRecursive_cases(uper_bin)), - - testChoRecursive:compile(Config, ?PER, [optimize]), - testChoRecursive_cases(?PER). - -testChoRecursive_cases(Rules) -> - testChoRecursive:recursive(Rules). - - - -testChoTypeRefCho(suite) -> []; -testChoTypeRefCho(Config) -> - - testChoTypeRefCho:compile(Config, ?BER, []), - testChoTypeRefCho_cases(?BER), - - ?ber_nif(?BER, testChoTypeRefCho:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testChoTypeRefCho_cases(?BER)), - - testChoTypeRefCho:compile(Config, ?PER, []), - testChoTypeRefCho_cases(?PER), - - ?per_bit_opt(testChoTypeRefCho:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testChoTypeRefCho_cases(?PER)), - - ?uper_bin(testChoTypeRefCho:compile(Config, uper_bin, [])), - ?uper_bin(testChoTypeRefCho_cases(uper_bin)), - - testChoTypeRefCho:compile(Config, ?PER, [optimize]), - testChoTypeRefCho_cases(?PER). - -testChoTypeRefCho_cases(Rules) -> - testChoTypeRefCho:choice(Rules). - - - -testChoTypeRefPrim(suite) -> []; -testChoTypeRefPrim(Config) -> - - testChoTypeRefPrim:compile(Config, ?BER, []), - testChoTypeRefPrim_cases(?BER), - - ?ber_nif(?BER, testChoTypeRefPrim:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testChoTypeRefPrim_cases(?BER)), - - testChoTypeRefPrim:compile(Config, ?PER, []), - testChoTypeRefPrim_cases(?PER), - - ?per_bit_opt(testChoTypeRefPrim:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testChoTypeRefPrim_cases(?PER)), - - ?uper_bin(testChoTypeRefPrim:compile(Config, uper_bin, [])), - ?uper_bin(testChoTypeRefPrim_cases(uper_bin)), - - testChoTypeRefPrim:compile(Config, ?PER, [optimize]), - testChoTypeRefPrim_cases(?PER). - -testChoTypeRefPrim_cases(Rules) -> - testChoTypeRefPrim:prim(Rules). - - - -testChoTypeRefSeq(suite) -> []; -testChoTypeRefSeq(Config) -> - - testChoTypeRefSeq:compile(Config, ?BER, []), - testChoTypeRefSeq_cases(?BER), - - ?ber_nif(?BER, testChoTypeRefSeq:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testChoTypeRefSeq_cases(?BER)), - - testChoTypeRefSeq:compile(Config, ?PER, []), - testChoTypeRefSeq_cases(?PER), - - ?per_bit_opt(testChoTypeRefSeq:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testChoTypeRefSeq_cases(?PER)), - - ?uper_bin(testChoTypeRefSeq:compile(Config, uper_bin, [])), - ?uper_bin(testChoTypeRefSeq_cases(uper_bin)), - - testChoTypeRefSeq:compile(Config, ?PER, [optimize]), - testChoTypeRefSeq_cases(?PER). - -testChoTypeRefSeq_cases(Rules) -> - testChoTypeRefSeq:seq(Rules). - - - -testChoTypeRefSet(suite) -> []; -testChoTypeRefSet(Config) -> - - testChoTypeRefSet:compile(Config, ?BER, []), - testChoTypeRefSet_cases(?BER), - - ?ber_nif(?BER, testChoTypeRefSet:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testChoTypeRefSet_cases(?BER)), - - testChoTypeRefSet:compile(Config, ?PER, []), - testChoTypeRefSet_cases(?PER), - - ?per_bit_opt(testChoTypeRefSet:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testChoTypeRefSet_cases(?PER)), - - ?uper_bin(testChoTypeRefSet:compile(Config, uper_bin, [])), - ?uper_bin(testChoTypeRefSet_cases(uper_bin)), - - testChoTypeRefSet:compile(Config, ?PER, [optimize]), - testChoTypeRefSet_cases(?PER). - -testChoTypeRefSet_cases(Rules) -> - testChoTypeRefSet:set(Rules). - - - -testDef(suite) -> []; -testDef(Config) -> - - testDef:compile(Config, ?BER, []), - testDef_cases(?BER), - - ?ber_nif(?BER, testDef:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testDef_cases(?BER)), - - testDef:compile(Config, ?PER, []), - testDef_cases(?PER), - - ?per_bit_opt(testDef:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testDef_cases(?PER)), - - ?uper_bin(testDef:compile(Config, uper_bin, [])), - ?uper_bin(testDef_cases(uper_bin)), - - testDef:compile(Config, ?PER, [optimize]), - testDef_cases(?PER). - -testDef_cases(Rules) -> - testDef:main(Rules). - - - -testOpt(suite) -> []; -testOpt(Config) -> - - testOpt:compile(Config, ?BER), - testOpt_cases(?BER), - - testOpt:compile(Config, ?PER), - testOpt_cases(?PER). - -testOpt_cases(Rules) -> - testOpt:main(Rules). - - -testEnumExt(suite) -> []; -testEnumExt(Config) -> - - asn1_test_lib:compile("EnumExt", Config, [?BER]), - testEnumExt:main(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("EnumExt", Config, [?BER, nif])), - ?ber_nif(?BER, testEnumExt:main(?BER)), - - asn1_test_lib:compile("EnumExt", Config, [?PER]), - testEnumExt:main(?PER), - - ?per_bit_opt(asn1_test_lib:compile("EnumExt", Config, [?PER, optimize])), - ?per_bit_opt(testEnumExt:main(?PER)), - - ?uper_bin(asn1_test_lib:compile("EnumExt", Config, [uper_bin])), - ?uper_bin(testEnumExt:main(uper_bin)), - - asn1_test_lib:compile("EnumExt", Config, [?PER, optimize]), - testEnumExt:main(?PER). - -testSeqDefault(doc) -> ["Test of OTP-2523 ENUMERATED with extensionmark."]; -testSeqDefault(suite) -> []; -testSeqDefault(Config) -> - asn1_test_lib:compile("SeqDefault", Config, [?BER]), - testSeqDefault_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SeqDefault", Config, [?BER, nif])), - ?ber_nif(?BER, testSeqDefault_cases(?BER)), - - asn1_test_lib:compile("SeqDefault", Config, [?PER]), - testSeqDefault_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SeqDefault", Config, [?PER, optimize])), - ?per_bit_opt(testSeqDefault_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SeqDefault", Config, [uper_bin])), - ?uper_bin(testSeqDefault_cases(uper_bin)), - - asn1_test_lib:compile("SeqDefault", Config, [?PER, optimize]), - testSeqDefault_cases(?PER). - -testSeqDefault_cases(Rules) -> - testSeqDefault:main(Rules). - - - -testSeqExtension(suite) -> []; -testSeqExtension(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - asn1_test_lib:compile("SeqExtension", Config, [?BER]), - testSeqExtension_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, asn1_test_lib:compile("SeqExtension", Config, [?BER, nif])), - ?ber_nif(?BER, testSeqExtension_cases(?BER)). - -testSeqExtension_cases(Rules) -> - testSeqExtension:main(Rules). - - - -testSeqExternal(suite) -> []; -testSeqExternal(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - asn1_test_lib:compile("SeqExternal", Config, [?BER]), - testSeqExternal_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, asn1_test_lib:compile("SeqExternal", Config, [?BER, nif])), - ?ber_nif(?BER, testSeqExternal_cases(?BER)). - -testSeqExternal_cases(Rules) -> - testSeqExternal:main(Rules). - - -testSeqOptional(suite) -> []; -testSeqOptional(Config) -> - - testSeqOptional:compile(Config, ?BER, []), - testSeqOptional_cases(?BER), - - ?ber_nif(?BER, testSeqOptional:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSeqOptional_cases(?BER)), - - testSeqOptional:compile(Config, ?PER, []), - testSeqOptional_cases(?PER), - - ?per_bit_opt(testSeqOptional:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSeqOptional_cases(?PER)), - - ?uper_bin(testSeqOptional:compile(Config, uper_bin, [])), - ?uper_bin(testSeqOptional_cases(uper_bin)), - - testSeqOptional:compile(Config, ?PER, [optimize]), - testSeqOptional_cases(?PER). - -testSeqOptional_cases(Rules) -> - testSeqOptional:main(Rules). - - - -testSeqPrim(suite) -> []; -testSeqPrim(Config) -> - - testSeqPrim:compile(Config, ?BER, []), - testSeqPrim_cases(?BER), - - ?ber_nif(?BER, testSeqPrim:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSeqPrim_cases(?BER)), - - testSeqPrim:compile(Config, ?PER, []), - testSeqPrim_cases(?PER), - - ?per_bit_opt(testSeqPrim:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSeqPrim_cases(?PER)), - - ?uper_bin(testSeqPrim:compile(Config, uper_bin, [])), - ?uper_bin(testSeqPrim_cases(uper_bin)), - - testSeqPrim:compile(Config, ?PER, [optimize]), - testSeqPrim_cases(?PER). - -testSeqPrim_cases(Rules) -> - testSeqPrim:main(Rules). - - -testSeq2738(doc) -> ["Test of OTP-2738 Detect corrupt optional component."]; -testSeq2738(suite) -> []; -testSeq2738(Config) -> - asn1_test_lib:compile("Seq2738", Config, [?BER]), - testSeq2738_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("Seq2738", Config, [?BER, nif])), - ?ber_nif(?BER, testSeq2738_cases(?BER)), - - asn1_test_lib:compile("Seq2738", Config, [?PER]), - testSeq2738_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("Seq2738", Config, [?PER, optimize])), - ?per_bit_opt(testSeq2738_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("Seq2738", Config, [uper_bin])), - ?uper_bin(testSeq2738_cases(uper_bin)), - - asn1_test_lib:compile("Seq2738", Config, [?PER, optimize]), - testSeq2738_cases(?PER). - -testSeq2738_cases(Rules) -> - testSeq2738:main(Rules). - - -testSeqTag(suite) -> []; -testSeqTag(Config) -> - asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?BER]), - testSeqTag_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?BER, nif])), - ?ber_nif(?BER, testSeqTag_cases(?BER)), - - asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?PER]), - testSeqTag_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?PER, optimize])), - ?per_bit_opt(testSeqTag_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile_all(["External", "SeqTag"], Config, [uper_bin])), - ?uper_bin(testSeqTag_cases(uper_bin)), - - asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?PER, optimize]), - testSeqTag_cases(?PER). - -testSeqTag_cases(Rules) -> - testSeqTag:main(Rules). - - - - -testSeqTypeRefCho(suite) -> []; -testSeqTypeRefCho(Config) -> - - testSeqTypeRefCho:compile(Config, ?BER, []), - testSeqTypeRefCho_cases(?BER), - - ?ber_nif(?BER, testSeqTypeRefCho:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSeqTypeRefCho_cases(?BER)), - - testSeqTypeRefCho:compile(Config, ?PER, []), - testSeqTypeRefCho_cases(?PER), - - ?per_bit_opt(testSeqTypeRefCho:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSeqTypeRefCho_cases(?PER)), - - ?uper_bin(testSeqTypeRefCho:compile(Config, uper_bin, [])), - ?uper_bin(testSeqTypeRefCho_cases(uper_bin)), - - testSeqTypeRefCho:compile(Config, ?PER, [optimize]), - testSeqTypeRefCho_cases(?PER). - -testSeqTypeRefCho_cases(Rules) -> - testSeqTypeRefCho:main(Rules). - - - -testSeqTypeRefPrim(suite) -> []; -testSeqTypeRefPrim(Config) -> - asn1_test_lib:compile("SeqTypeRefPrim", Config, [?BER]), - testSeqTypeRefPrim_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SeqTypeRefPrim", Config, [?BER, nif])), - ?ber_nif(?BER, testSeqTypeRefPrim_cases(?BER)), - - asn1_test_lib:compile("SeqTypeRefPrim", Config, [?PER]), - testSeqTypeRefPrim_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SeqTypeRefPrim", Config, [?PER, optimize])), - ?per_bit_opt(testSeqTypeRefPrim_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SeqTypeRefPrim", Config, [uper_bin])), - ?uper_bin(testSeqTypeRefPrim_cases(uper_bin)), - - asn1_test_lib:compile("SeqTypeRefPrim", Config, [?PER, optimize]), - testSeqTypeRefPrim_cases(?PER). - -testSeqTypeRefPrim_cases(Rules) -> - testSeqTypeRefPrim:main(Rules). - - - -testSeqTypeRefSeq(suite) -> []; -testSeqTypeRefSeq(Config) -> - asn1_test_lib:compile("SeqTypeRefSeq", Config, [?BER]), - testSeqTypeRefSeq_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SeqTypeRefSeq", Config, [?BER, nif])), - ?ber_nif(?BER, testSeqTypeRefSeq_cases(?BER)), - - asn1_test_lib:compile("SeqTypeRefSeq", Config, [?PER]), - testSeqTypeRefSeq_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SeqTypeRefSeq", Config, [?PER, optimize])), - ?per_bit_opt(testSeqTypeRefSeq_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SeqTypeRefSeq", Config, [uper_bin])), - ?uper_bin(testSeqTypeRefSeq_cases(uper_bin)), - - asn1_test_lib:compile("SeqTypeRefSeq", Config, [?PER, optimize]), - testSeqTypeRefSeq_cases(?PER). - -testSeqTypeRefSeq_cases(Rules) -> - testSeqTypeRefSeq:main(Rules). - - - -testSeqTypeRefSet(suite) -> []; -testSeqTypeRefSet(Config) -> - asn1_test_lib:compile("SeqTypeRefSet", Config, [?BER]), - testSeqTypeRefSet_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SeqTypeRefSet", Config, [?BER, nif])), - ?ber_nif(?BER, testSeqTypeRefSet_cases(?BER)), - - asn1_test_lib:compile("SeqTypeRefSet", Config, [?PER]), - testSeqTypeRefSet_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SeqTypeRefSet", Config, [?PER, optimize])), - ?per_bit_opt(testSeqTypeRefSet_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SeqTypeRefSet", Config, [uper_bin])), - ?uper_bin(testSeqTypeRefSet_cases(uper_bin)), - - asn1_test_lib:compile("SeqTypeRefSet", Config, [?PER, optimize]), - testSeqTypeRefSet_cases(?PER). - -testSeqTypeRefSet_cases(Rules) -> - testSeqTypeRefSet:main(Rules). - - - - -testSeqOf(suite) -> []; -testSeqOf(Config) -> - testSeqOf:compile(Config, ?BER, []), - testSeqOf_cases(?BER), - - ?ber_nif(?BER, testSeqOf:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSeqOf_cases(?BER)), - - testSeqOf:compile(Config, ?PER, []), - testSeqOf_cases(?PER), - - ?per_bit_opt(testSeqOf:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSeqOf_cases(?PER)), - - ?uper_bin(testSeqOf:compile(Config, uper_bin, [])), - ?uper_bin(testSeqOf_cases(uper_bin)), - - testSeqOf:compile(Config, ?PER, [optimize]), - testSeqOf_cases(?PER). - -testSeqOf_cases(Rules) -> - testSeqOf:main(Rules). - - - - -testSeqOfCho(suite) -> []; -testSeqOfCho(Config) -> - testSeqOfCho:compile(Config, ?BER, []), - testSeqOfCho_cases(?BER), - - ?ber_nif(?BER, testSeqOfCho:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSeqOfCho_cases(?BER)), - - testSeqOfCho:compile(Config, ?PER, []), - testSeqOfCho_cases(?PER), - - ?per_bit_opt(testSeqOfCho:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSeqOfCho_cases(?PER)), - - ?uper_bin(testSeqOfCho:compile(Config, uper_bin, [])), - ?uper_bin(testSeqOfCho_cases(uper_bin)), - - testSeqOfCho:compile(Config, ?PER, [optimize]), - testSeqOfCho_cases(?PER). - -testSeqOfIndefinite(suite) -> []; -testSeqOfIndefinite(Config) -> - %% Mvrasn (11-21)-4 - testSeqOfIndefinite:compile(Config, ?BER, []), - testSeqOfIndefinite:main(), - - ?ber_nif(?BER, testSeqOfIndefinite:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSeqOfIndefinite:main()). - -testSeqOfCho_cases(Rules) -> - testSeqOfCho:main(Rules). - - -testSeqOfExternal(suite) -> []; -testSeqOfExternal(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - testSeqOfExternal:compile(Config, ?BER, []), - testSeqOfExternal_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, testSeqOfExternal:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSeqOfExternal_cases(?BER)), - - asn1_test_lib:compile("External", Config, [?PER]), - testSeqOfExternal:compile(Config, ?PER, []), - testSeqOfExternal_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])), - ?per_bit_opt(testSeqOfExternal:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSeqOfExternal_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])), - ?uper_bin(testSeqOfExternal:compile(Config, uper_bin, [])), - ?uper_bin(testSeqOfExternal_cases(uper_bin)), - - asn1_test_lib:compile("External", Config, [?PER, optimize]), - testSeqOfExternal:compile(Config, ?PER, [optimize]), - testSeqOfExternal_cases(?PER). - -testSeqOfExternal_cases(Rules) -> - testSeqOfExternal:main(Rules). - - - -testSeqOfTag(suite) -> []; -testSeqOfTag(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - testSeqOfTag:compile(Config, ?BER, []), - testSeqOfTag_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, testSeqOfTag:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSeqOfTag_cases(?BER)), - - asn1_test_lib:compile("External", Config, [?PER]), - testSeqOfTag:compile(Config, ?PER, []), - testSeqOfTag_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])), - ?per_bit_opt(testSeqOfTag:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSeqOfTag_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])), - ?uper_bin(testSeqOfTag:compile(Config, uper_bin, [])), - ?uper_bin(testSeqOfTag_cases(uper_bin)), - - asn1_test_lib:compile("External", Config, [?PER, optimize]), - testSeqOfTag:compile(Config, ?PER, [optimize]), - testSeqOfTag_cases(?PER). - -testSeqOfTag_cases(Rules) -> - testSeqOfTag:main(Rules). - - - - -testSetDefault(suite) -> []; -testSetDefault(Config) -> - asn1_test_lib:compile("SetDefault", Config, [?BER]), - testSetDefault_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SetDefault", Config, [?BER, nif])), - ?ber_nif(?BER, testSetDefault_cases(?BER)), - - asn1_test_lib:compile("SetDefault", Config, [?PER]), - testSetDefault_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SetDefault", Config, [?PER, optimize])), - ?per_bit_opt(testSetDefault_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SetDefault", Config, [uper_bin])), - ?uper_bin(testSetDefault_cases(uper_bin)), - - asn1_test_lib:compile("SetDefault", Config, [?PER, optimize]), - testSetDefault_cases(?PER). - -testSetDefault_cases(Rules) -> - testSetDefault:main(Rules). - - -testParamBasic(suite) -> []; -testParamBasic(Config) -> - testParamBasic:compile(Config, ?BER, []), - testParamBasic_cases(?BER), - - ?ber_nif(?BER, testParamBasic:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testParamBasic_cases(?BER)), - - testParamBasic:compile(Config, ?PER, []), - testParamBasic_cases(?PER), - - ?per_bit_opt(testParamBasic:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testParamBasic_cases(?PER)), - - ?uper_bin(testParamBasic:compile(Config, uper_bin, [])), - ?uper_bin(testParamBasic_cases(uper_bin)), - - testParamBasic:compile(Config, ?PER, [optimize]), - testParamBasic_cases(?PER). - - -testParamBasic_cases(Rules) -> - testParamBasic:main(Rules). - -testSetExtension(suite) -> []; -testSetExtension(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - asn1_test_lib:compile("SetExtension", Config, [?BER]), - testSetExtension_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, asn1_test_lib:compile("SetExtension", Config, [?BER, nif])), - ?ber_nif(?BER, testSetExtension_cases(?BER)). - -testSetExtension_cases(Rules) -> - testSetExtension:main(Rules). - - -testSetExternal(suite) -> []; -testSetExternal(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - testSetExternal:compile(Config, ?BER, []), - testSetExternal_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, testSetExternal:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSetExternal_cases(?BER)). - -testSetExternal_cases(Rules) -> - testSetExternal:main(Rules). - - -testSetOptional(suite) -> []; -testSetOptional(Config) -> - testSetOptional:compile(Config, ?BER, []), - testSetOptional_cases(?BER), - - ?ber_nif(?BER, testSetOptional:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSetOptional_cases(?BER)), - - testSetOptional:compile(Config, ?PER, []), - testSetOptional_cases(?PER), - - ?per_bit_opt(testSetOptional:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSetOptional_cases(?PER)), - - ?uper_bin(testSetOptional:compile(Config, uper_bin, [])), - ?uper_bin(testSetOptional_cases(uper_bin)), - - testSetOptional:compile(Config, ?PER, [optimize]), - testSetOptional_cases(?PER). - -testSetOptional_cases(Rules) -> - ok = testSetOptional:ticket_7533(Rules), - ok = testSetOptional:main(Rules). - - - - -testSetPrim(suite) -> []; -testSetPrim(Config) -> - testSetPrim:compile(Config, ?BER, []), - testSetPrim_cases(?BER), - - ?ber_nif(?BER, testSetPrim:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSetPrim_cases(?BER)), - - testSetPrim:compile(Config, ?PER, []), - testSetPrim_cases(?PER), - - ?per_bit_opt(testSetPrim:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSetPrim_cases(?PER)), - - ?uper_bin(testSetPrim:compile(Config, uper_bin, [])), - ?uper_bin(testSetPrim_cases(uper_bin)), - - testSetPrim:compile(Config, ?PER, [optimize]), - testSetPrim_cases(?PER). - -testSetPrim_cases(Rules) -> - testSetPrim:main(Rules). - - - -testSetTag(suite) -> []; -testSetTag(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - testSetTag:compile(Config, ?BER, []), - testSetTag_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, testSetTag:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testSetTag_cases(?BER)), - - asn1_test_lib:compile("External", Config, [?PER]), - testSetTag:compile(Config, ?PER, []), - testSetTag_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])), - ?per_bit_opt(testSetTag:compile(Config, ?PER, [optimize])), - ?per_bit_opt(testSetTag_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])), - ?uper_bin(testSetTag:compile(Config, uper_bin, [])), - ?uper_bin(testSetTag_cases(uper_bin)), - - asn1_test_lib:compile("External", Config, [?PER, optimize]), - testSetTag:compile(Config, ?PER, [optimize]), - testSetTag_cases(?PER). - -testSetTag_cases(Rules) -> - testSetTag:main(Rules). - - - -testSetTypeRefCho(suite) -> []; -testSetTypeRefCho(Config) -> - asn1_test_lib:compile("SetTypeRefCho", Config, [?BER]), - testSetTypeRefCho_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SetTypeRefCho", Config, [?BER, nif])), - ?ber_nif(?BER, testSetTypeRefCho_cases(?BER)), - - asn1_test_lib:compile("SetTypeRefCho", Config, [?PER]), - testSetTypeRefCho_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SetTypeRefCho", Config, [?PER, optimize])), - ?per_bit_opt(testSetTypeRefCho_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SetTypeRefCho", Config, [uper_bin])), - ?uper_bin(testSetTypeRefCho_cases(uper_bin)), - - asn1_test_lib:compile("SetTypeRefCho", Config, [?PER, optimize]), - testSetTypeRefCho_cases(?PER). - -testSetTypeRefCho_cases(Rules) -> - testSetTypeRefCho:main(Rules). - - - -testSetTypeRefPrim(suite) -> []; -testSetTypeRefPrim(Config) -> - asn1_test_lib:compile("SetTypeRefPrim", Config, [?BER]), - testSetTypeRefPrim_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SetTypeRefPrim", Config, [?BER, nif])), - ?ber_nif(?BER, testSetTypeRefPrim_cases(?BER)), - - asn1_test_lib:compile("SetTypeRefPrim", Config, [?PER]), - testSetTypeRefPrim_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SetTypeRefPrim", Config, [?PER, optimize])), - ?per_bit_opt(testSetTypeRefPrim_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SetTypeRefPrim", Config, [uper_bin])), - ?uper_bin(testSetTypeRefPrim_cases(uper_bin)), - - asn1_test_lib:compile("SetTypeRefPrim", Config, [?PER, optimize]), - testSetTypeRefPrim_cases(?PER). - -testSetTypeRefPrim_cases(Rules) -> - testSetTypeRefPrim:main(Rules). - - - -testSetTypeRefSeq(suite) -> []; -testSetTypeRefSeq(Config) -> - asn1_test_lib:compile("SetTypeRefSeq", Config, [?BER]), - testSetTypeRefSeq_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SetTypeRefSeq", Config, [?BER, nif])), - ?ber_nif(?BER, testSetTypeRefSeq_cases(?BER)), - - asn1_test_lib:compile("SetTypeRefSeq", Config, [?PER]), - testSetTypeRefSeq_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SetTypeRefSeq", Config, [?PER, optimize])), - ?per_bit_opt(testSetTypeRefSeq_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SetTypeRefSeq", Config, [uper_bin])), - ?uper_bin(testSetTypeRefSeq_cases(uper_bin)), - - asn1_test_lib:compile("SetTypeRefSeq", Config, [?PER, optimize]), - testSetTypeRefSeq_cases(?PER). - -testSetTypeRefSeq_cases(Rules) -> - testSetTypeRefSeq:main(Rules). - - - -testSetTypeRefSet(suite) -> []; -testSetTypeRefSet(Config) -> - asn1_test_lib:compile("SetTypeRefSet", Config, [?BER]), - testSetTypeRefSet_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SetTypeRefSet", Config, [?BER, nif])), - ?ber_nif(?BER, testSetTypeRefSet_cases(?BER)), - - asn1_test_lib:compile("SetTypeRefSet", Config, [?PER]), - testSetTypeRefSet_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SetTypeRefSet", Config, [?PER, optimize])), - ?per_bit_opt(testSetTypeRefSet_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SetTypeRefSet", Config, [uper_bin])), - ?uper_bin(testSetTypeRefSet_cases(uper_bin)), - - asn1_test_lib:compile("SetTypeRefSet", Config, [?PER, optimize]), - testSetTypeRefSet_cases(?PER). - -testSetTypeRefSet_cases(Rules) -> - testSetTypeRefSet:main(Rules). - - - -testSetOf(suite) -> []; -testSetOf(Config) -> - asn1_test_lib:compile("SetOf", Config, [?BER]), - testSetOf_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SetOf", Config, [?BER, nif])), - ?ber_nif(?BER, testSetOf_cases(?BER)), - - asn1_test_lib:compile("SetOf", Config, [?PER]), - testSetOf_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SetOf", Config, [?PER, optimize])), - ?per_bit_opt(testSetOf_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SetOf", Config, [uper_bin])), - ?uper_bin(testSetOf_cases(uper_bin)), - - asn1_test_lib:compile("SetOf", Config, [?PER, optimize]), - testSetOf_cases(?PER). - -testSetOf_cases(Rules) -> - testSetOf:main(Rules). - - - -testSetOfCho(suite) -> []; -testSetOfCho(Config) -> - asn1_test_lib:compile("SetOfCho", Config, [?BER]), - testSetOfCho_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SetOfCho", Config, [?BER, nif])), - ?ber_nif(?BER, testSetOfCho_cases(?BER)), - - asn1_test_lib:compile("SetOfCho", Config, [?PER]), - testSetOfCho_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("SetOfCho", Config, [?PER, optimize])), - ?per_bit_opt(testSetOfCho_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("SetOfCho", Config, [uper_bin])), - ?uper_bin(testSetOfCho_cases(uper_bin)), - - asn1_test_lib:compile("SetOfCho", Config, [?PER, optimize]), - testSetOfCho_cases(?PER). - -testSetOfCho_cases(Rules) -> - testSetOfCho:main(Rules). - - -testSetOfExternal(suite) -> []; -testSetOfExternal(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - asn1_test_lib:compile("SetOfExternal", Config, [?BER]), - testSetOfExternal_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, asn1_test_lib:compile("SetOfExternal", Config, [?BER, nif])), - ?ber_nif(?BER, testSetOfExternal_cases(?BER)), - - asn1_test_lib:compile("External", Config, [?PER]), - asn1_test_lib:compile("SetOfExternal", Config, [?PER]), - testSetOfExternal_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])), - ?per_bit_opt(asn1_test_lib:compile("SetOfExternal", Config, [?PER, optimize])), - ?per_bit_opt(testSetOfExternal_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])), - ?uper_bin(asn1_test_lib:compile("SetOfExternal", Config, [uper_bin])), - ?uper_bin(testSetOfExternal_cases(uper_bin)), - - asn1_test_lib:compile("External", Config, [?PER, optimize]), - asn1_test_lib:compile("SetOfExternal", Config, [?PER, optimize]), - testSetOfExternal_cases(?PER). - -testSetOfExternal_cases(Rules) -> - testSetOfExternal:main(Rules). - - - - -testSetOfTag(suite) -> []; -testSetOfTag(Config) -> - asn1_test_lib:compile("External", Config, [?BER]), - asn1_test_lib:compile("SetOfTag", Config, [?BER]), - testSetOfTag_cases(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("External", Config, [?BER, nif])), - ?ber_nif(?BER, asn1_test_lib:compile("SetOfTag", Config, [?BER, nif])), - ?ber_nif(?BER, testSetOfTag_cases(?BER)), - - asn1_test_lib:compile("External", Config, [?PER]), - asn1_test_lib:compile("SetOfTag", Config, [?PER]), - testSetOfTag_cases(?PER), - - ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])), - ?per_bit_opt(asn1_test_lib:compile("SetOfTag", Config, [?PER, optimize])), - ?per_bit_opt(testSetOfTag_cases(?PER)), - - ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])), - ?uper_bin(asn1_test_lib:compile("SetOfTag", Config, [uper_bin])), - ?uper_bin(testSetOfTag_cases(uper_bin)), - - asn1_test_lib:compile("External", Config, [?PER, optimize]), - asn1_test_lib:compile("SetOfTag", Config, [?PER, optimize]), - testSetOfTag_cases(?PER). - -testSetOfTag_cases(Rules) -> - testSetOfTag:main(Rules). - - -sequence(suite) -> [{sequence, all}]. - -c_syntax(suite) -> []; -c_syntax(Config) -> - DataDir% asn1_test_lib:compile("External", Config, ?PER), -% testPrimExternal:compile(Config, ?PER), -% testPrimExternal_cases(?PER). - = ?config(data_dir, Config), - _TempDir = ?config(priv_dir, Config), - {error, _R1} = asn1ct:compile(filename:join(DataDir, "Syntax")), - {error, _R2} = asn1ct:compile(filename:join(DataDir, "BadTypeEnding")), - {error, _R3} = asn1ct:compile(filename:join(DataDir, - "BadValueAssignment1")), - {error, _R4} = asn1ct:compile(filename:join(DataDir, - "BadValueAssignment2")), - {error, _R5} = asn1ct:compile(filename:join(DataDir, - "BadValueSet")), - {error, _R6} = asn1ct:compile(filename:join(DataDir, - "ChoiceBadExtension")), - {error, _R7} = asn1ct:compile(filename:join(DataDir, - "EnumerationBadExtension")), - {error, _R8} = asn1ct:compile(filename:join(DataDir, - "Example")), - {error, _R9} = asn1ct:compile(filename:join(DataDir, - "Export1")), - {error, _R10} = asn1ct:compile(filename:join(DataDir, - "MissingEnd")), - {error, _R11} = asn1ct:compile(filename:join(DataDir, - "SequenceBadComma")), - {error, _R12} = asn1ct:compile(filename:join(DataDir, - "SequenceBadComponentName")), - {error, _R13} = asn1ct:compile(filename:join(DataDir, - "SequenceBadComponentType")), - {error, _R14} = asn1ct:compile(filename:join(DataDir, - "SeqBadComma")). - - -c_string_per(suite) -> []; -c_string_per(Config) -> - asn1_test_lib:compile("String", Config, [?PER]). - -c_string_ber(suite) -> []; -c_string_ber(Config) -> - asn1_test_lib:compile("String", Config, [?BER]). - - -c_implicit_before_choice(suite) -> []; -c_implicit_before_choice(Config) -> - DataDir = ?config(data_dir, Config), - TempDir = ?config(priv_dir, Config), - {error, _R2} = asn1ct:compile(filename:join(DataDir, "CCSNARG3"), - [?BER, {outdir, TempDir}]). - -parse(suite) -> []; -parse(Config) -> - M1 = test_modules(), - ok = parse1(M1, Config). - -parse1([M|T], Config) -> - asn1_test_lib:compile(M, Config, [abs]), - parse1(T, Config); -parse1([], _) -> - ok. - -per(suite) -> []; -per(Config) -> - CaseDir = ?config(case_dir, Config), - ok = per1(per_modules(), Config, CaseDir), - ?per_bit_opt(per1_bit_opt(per_modules(), Config, CaseDir)). - - -per1([M|T], Config, CaseDir) -> - asn1_test_lib:compile(M, Config, [?PER]), - ok = asn1ct:test(list_to_atom(M), [{i, CaseDir}]), - per1(T, Config, CaseDir); -per1([], _, _) -> - ok. - -per1_bit_opt([M|T], Config, CaseDir) -> - asn1_test_lib:compile(M, Config, [?PER, optimize]), - ok = asn1ct:test(list_to_atom(M), [{i, CaseDir}]), - per1_bit_opt(T, Config, CaseDir); -per1_bit_opt([], _, _) -> - ok. - -ber_choiceinseq(suite) ->[]; -ber_choiceinseq(Config) -> - asn1_test_lib:compile("ChoiceInSeq", Config, [?BER]). - -ber_optional(suite) ->[]; -ber_optional(Config) -> - asn1_test_lib:compile("SOpttest", Config, [?BER]), - - V = {'S', {'A', 10, asn1_NOVALUE, asn1_NOVALUE}, - {'B', asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE}, - {'C', asn1_NOVALUE, 111, asn1_NOVALUE}}, - {ok, B} = asn1_wrapper:encode('SOpttest', 'S', V), - Bytes = lists:flatten(B), - V2 = asn1_wrapper:decode('SOpttest', 'S', Bytes), - V = element(2, V2). - -ber_optional_keyed_list(suite) ->[]; -ber_optional_keyed_list(Config) -> - case ?BER of - ber_bin_v2 -> - ok; - _ -> - asn1_test_lib:compile("SOpttest", Config, [?BER, keyed_list]), - Vrecord = {'S', {'A', 10, asn1_NOVALUE, asn1_NOVALUE}, - {'B', asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE}, - {'C', asn1_NOVALUE, 111, asn1_NOVALUE}}, - V = [{a, [{scriptKey, 10}]}, - {b, []}, - {c, [{callingPartysCategory, 111}]}], - {ok, B} = asn1_wrapper:encode('SOpttest', 'S', V), - Bytes = lists:flatten(B), - V2 = asn1_wrapper:decode('SOpttest', 'S', Bytes), - Vrecord = element(2, V2) - end. - -ber_other(suite) ->[]; -ber_other(Config) -> - CaseDir = ?config(case_dir, Config), - ok = ber1(ber_modules(), Config, CaseDir). - - -ber1([M|T], Config, CaseDir) -> - asn1_test_lib:compile(M, Config, [?BER]), - ok = asn1ct:test(list_to_atom(M), [{i, CaseDir}]), - ber1(T, Config, CaseDir); -ber1([], _, _) -> - ok. - -default_per(suite) ->[]; -default_per(Config) -> - default1(Config, [?PER]). - -default_per_opt(suite) -> []; -default_per_opt(Config) -> - ?per_bit_opt(default1(Config, [?PER, optimize])), - default1(Config, [?PER, optimize]). - -default_ber(suite) ->[]; -default_ber(Config) -> - default1(Config, [?BER]). - -default1(Config, Options) -> - asn1_test_lib:compile("Def", Config, Options), - - {ok, Bytes1} = asn1_wrapper:encode('Def', 'Def1', #'Def1'{bool0 = true, - bool1 = true, - bool2 = true, - bool3 = true}), - {ok, {'Def1', true, true, true, true}} = - asn1_wrapper:decode('Def', 'Def1', lists:flatten(Bytes1)), - - {ok, Bytes2} = asn1_wrapper:encode('Def', 'Def1', #'Def1'{bool0 = true}), - {ok, {'Def1', true, false, false, false}} = - asn1_wrapper:decode('Def', 'Def1', lists:flatten(Bytes2)), - - {ok, Bytes3} = asn1_wrapper:encode('Def', 'Def1', #'Def1'{bool0 = true, - bool2 = false}), - {ok, {'Def1', true, false, false, false}} = - asn1_wrapper:decode('Def', 'Def1', lists:flatten(Bytes3)). - - -value_test(suite) ->[]; -value_test(Config) -> - asn1_test_lib:compile("ObjIdValues", Config, [?BER]), - {ok, _} = asn1_wrapper:encode('ObjIdValues', 'ObjIdType', 'ObjIdValues':'mobileDomainId'()), - asn1_test_lib:compile("ObjIdValues", Config, [?PER]), - {ok, _} = asn1_wrapper:encode('ObjIdValues', 'ObjIdType', 'ObjIdValues':'mobileDomainId'()), - ok = test_bad_values:tests(Config), - ok. - - -constructed(suite) -> - []; -constructed(Config) -> - asn1_test_lib:compile("Constructed", Config, [?BER]), - {ok, B} = asn1_wrapper:encode('Constructed', 'S', {'S', false}), - [40, 3, 1, 1, 0] = lists:flatten(B), - {ok, B1} = asn1_wrapper:encode('Constructed', 'S2', {'S2', false}), - [40, 5, 48, 3, 1, 1, 0] = lists:flatten(B1), - {ok, B2} = asn1_wrapper:encode('Constructed', 'I', 10), - [136, 1, 10] = lists:flatten(B2), - ok. - -ber_decode_error(suite) -> []; -ber_decode_error(Config) -> - asn1_test_lib:compile("Constructed", Config, [?BER]), - ok = ber_decode_error:run([]), - - ?ber_nif(?BER, asn1_test_lib:compile("Constructed", Config, [?BER, nif])), - ok = ?ber_nif(?BER, ber_decode_error:run([nif])), - ok. - -h323test(suite) -> - []; -h323test(Config) -> - Files = ["H235-SECURITY-MESSAGES", - "H323-MESSAGES", - "MULTIMEDIA-SYSTEM-CONTROL"], - asn1_test_lib:compile_all(Files, Config, [?PER]), - ok = h323test:run(?PER), - ?per_bit_opt(asn1_test_lib:compile_all(Files, Config, [?PER, optimize])), - ?per_bit_opt(h323test:run(?PER)), - ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])), - ?uper_bin(h323test:run(uper_bin)), - ok = asn1_test_lib:compile_all(Files, Config, [?PER, optimize]), - ok = h323test:run(?PER), - ok. - -per_GeneralString(suite) -> - []; -per_GeneralString(Config) -> - asn1_test_lib:compile("MULTIMEDIA-SYSTEM-CONTROL", Config, [?PER]), - UI = [109, 64, 1, 57], - {ok, _V} = asn1_wrapper:decode('MULTIMEDIA-SYSTEM-CONTROL', - 'MultimediaSystemControlMessage', UI). - -per_open_type(suite) -> - []; -per_open_type(Config) -> - asn1_test_lib:compile("OpenType", Config, [?PER]), - - Stype = {'Stype', 10, true}, - {ok, Bytes} = asn1_wrapper:encode('OpenType', 'Ot', Stype), - {ok, Stype} = asn1_wrapper:decode('OpenType', 'Ot', Bytes), - - ?per_bit_opt(asn1_test_lib:compile("OpenType", Config, [?PER, optimize])), - ?per_bit_opt({ok, Bytes}=asn1_wrapper:encode('OpenType', 'Ot', Stype)), - ?per_bit_opt({ok, Stype}=asn1_wrapper:decode('OpenType', 'Ot', Bytes)), - - ?uper_bin(asn1_test_lib:compile("OpenType", Config, [uper_bin])), - ?uper_bin({ok, Bytes}=asn1_wrapper:encode('OpenType', 'Ot', Stype)), - ?uper_bin({ok, Stype}=asn1_wrapper:decode('OpenType', 'Ot', Bytes)), - - asn1_test_lib:compile("OpenType", Config, [?PER, optimize]), - {ok, Bytes} = asn1_wrapper:encode('OpenType', 'Ot', Stype), - {ok, Stype} = asn1_wrapper:decode('OpenType', 'Ot', Bytes). - -testConstraints(suite) -> - []; -testConstraints(Config) -> - asn1_test_lib:compile("Constraints", Config, [?BER]), - testConstraints:int_constraints(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("Constraints", Config, [?BER, nif])), - ?ber_nif(?BER, testConstraints:int_constraints(?BER)), - - asn1_test_lib:compile("Constraints", Config, [?PER]), - testConstraints:int_constraints(?PER), - testConstraints:refed_NNL_name(?PER), - - ?per_bit_opt(asn1_test_lib:compile("Constraints", Config, [?PER, optimize])), - ?per_bit_opt(testConstraints:int_constraints(?PER)), - ?per_bit_opt(testConstraints:refed_NNL_name(?PER)), - - ?uper_bin(asn1_test_lib:compile("Constraints", Config, [uper_bin])), - ?uper_bin(testConstraints:int_constraints(uper_bin)), - ?uper_bin(testConstraints:refed_NNL_name(uper_bin)), - - asn1_test_lib:compile("Constraints", Config, [?PER, optimize]), - testConstraints:int_constraints(?PER), - testConstraints:refed_NNL_name(?PER). - -testSeqIndefinite(suite) -> []; -testSeqIndefinite(Config) -> - asn1_test_lib:compile("SeqSetIndefinite", Config, [?BER]), - testSeqIndefinite:main(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SeqSetIndefinite", Config, [?BER, nif])), - ?ber_nif(?BER, testSeqIndefinite:main(?BER)). - -testSetIndefinite(suite) -> []; -testSetIndefinite(Config) -> - asn1_test_lib:compile("SeqSetIndefinite", Config, [?BER]), - testSetIndefinite:main(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("SeqSetIndefinite", Config, [?BER, nif])), - ?ber_nif(?BER, testSetIndefinite:main(?BER)). - -testChoiceIndefinite(suite) -> []; -testChoiceIndefinite(Config) -> - testChoiceIndefinite:compile(Config, ?BER, []), - testChoiceIndefinite:main(?BER), - - ?ber_nif(?BER, testChoiceIndefinite:compile(Config, ?BER, [nif])), - ?ber_nif(?BER, testChoiceIndefinite:main(?BER)). - -testInfObjectClass(suite) -> - []; -testInfObjectClass(Config) -> - Files = ["ErrorClass", "InfClass"], - InfObjFiles = ["RANAPextract1", "InfObj", "MAP-ExtensionDataTypes", - "Objects", "INAPv2extract"], - RANAPFiles = ["RANAP-CommonDataTypes", "RANAP-Constants", - "RANAP-Containers", "RANAP-IEs", "RANAP-PDU-Contents", - "RANAP-PDU-Descriptions"], - asn1_test_lib:compile_all(Files, Config, [?PER]), - testInfObjectClass:main(?PER), - asn1_test_lib:compile_all(InfObjFiles, Config, [?PER]), - testInfObj:main(?PER), - - ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])), - ?uper_bin(testInfObjectClass:main(uper_bin)), - ?uper_bin(asn1_test_lib:compile_all(InfObjFiles, Config, [uper_bin])), - ?uper_bin(testInfObj:main(uper_bin)), - - asn1_test_lib:compile_all(Files, Config, [?PER, optimize]), - testInfObjectClass:main(?PER), - asn1_test_lib:compile_all(InfObjFiles, Config, [?PER, optimize]), - testInfObj:main(?PER), - - asn1_test_lib:compile_all(Files, Config, [?BER]), - testInfObjectClass:main(?BER), - asn1_test_lib:compile_all(InfObjFiles, Config, [?BER]), - testInfObj:main(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile_all(Files, Config, [?BER, nif])), - ?ber_nif(?BER, testInfObjectClass:main(?BER)), - ?ber_nif(?BER, asn1_test_lib:compile_all(InfObjFiles, Config, [?BER, nif])), - ?ber_nif(?BER, testInfObj:main(?BER)), - - asn1_test_lib:compile_all(RANAPFiles, Config, [?PER]), - - ?uper_bin(asn1_test_lib:compile_all(RANAPFiles, Config, [uper_bin])), - - asn1_test_lib:compile_all(RANAPFiles, Config, [?PER, optimize]), - - asn1_test_lib:compile_all(RANAPFiles, Config, [?BER]). - -testParameterizedInfObj(suite) -> - []; -testParameterizedInfObj(Config) -> - asn1_test_lib:compile("Param", Config, [?PER]), - testParameterizedInfObj:main(?PER), - - % TODO: Remove all ?per_bit_opt(...) which has an equiv without macro - ?per_bit_opt(asn1_test_lib:compile("Param", Config, [?PER, optimize])), - ?per_bit_opt(testParameterizedInfObj:main(?PER)), - - ?uper_bin(asn1_test_lib:compile("Param", Config, [uper_bin])), - ?uper_bin(testParameterizedInfObj:main(uper_bin)), - - asn1_test_lib:compile("Param", Config, [?PER, optimize]), - testParameterizedInfObj:main(?PER), - - asn1_test_lib:compile("Param", Config, [?BER]), - testParameterizedInfObj:main(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("Param", Config, [?BER, nif])), - ?ber_nif(?BER, testParameterizedInfObj:main(?BER)). - -testMergeCompile(suite) -> - []; -testMergeCompile(Config) -> - Files = ["MS.set.asn", "RANAPSET.set.asn1", "Mvrasn4.set.asn", - "Mvrasn6.set.asn"], - asn1_test_lib:compile_all(Files, Config, [?PER]), - testMergeCompile:main(?PER), - testMergeCompile:mvrasn(?PER), - - ?per_bit_opt(asn1_test_lib:compile_all(Files, Config, [?PER, optimize])), - ?per_bit_opt(testMergeCompile:main(?PER)), - ?per_bit_opt(testMergeCompile:mvrasn(?PER)), - - ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])), - ?uper_bin(testMergeCompile:main(uper_bin)), - ?uper_bin(testMergeCompile:mvrasn(uper_bin)), - - asn1_test_lib:compile_all(Files, Config, [?BER]), - testMergeCompile:main(?BER), - testMergeCompile:mvrasn(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile_all(Files, Config, [?BER, nif])), - ?ber_nif(?BER, testMergeCompile:main(?BER)), - ?ber_nif(?BER, testMergeCompile:mvrasn(?BER)). - -testobj(suite) -> - []; -testobj(Config) -> - ok = testRANAP:compile(Config, [?PER]), - ok = testRANAP:testobj(?PER), - ok = testParameterizedInfObj:ranap(?PER), - - ?per_bit_opt(ok = testRANAP:compile(Config, [?PER, optimize])), - ?per_bit_opt(ok = testRANAP:testobj(?PER)), - ?per_bit_opt(ok = testParameterizedInfObj:ranap(?PER)), - - ?uper_bin(ok = testRANAP:compile(Config, [uper_bin])), - ?uper_bin(ok = testRANAP:testobj(uper_bin)), - ?uper_bin(ok = testParameterizedInfObj:ranap(uper_bin)), - - ok = testRANAP:compile(Config, [?PER, optimize]), - ok = testRANAP:testobj(?PER), - ok = testParameterizedInfObj:ranap(?PER), - - ok = testRANAP:compile(Config, [?BER]), - ok = testRANAP:testobj(?BER), - ok = testParameterizedInfObj:ranap(?BER), - - ?ber_nif(?BER, testRANAP:compile(Config, [?BER, nif])), - ?ber_nif(?BER, testRANAP:testobj(?BER)), - ?ber_nif(?BER, testParameterizedInfObj:ranap(?BER)). - - -testDeepTConstr(suite) -> - []; -testDeepTConstr(Config) -> - asn1_test_lib:compile("TConstrChoice", Config, [?PER]), - asn1_test_lib:compile("TConstr", Config, [?PER]), - testDeepTConstr:main(?PER), - - ?per_bit_opt(asn1_test_lib:compile("TConstrChoice", Config, [?PER, optimize])), - ?per_bit_opt(asn1_test_lib:compile("TConstr", Config, [?PER, optimize])), - ?per_bit_opt(testDeepTConstr:main(?PER)), - - ?uper_bin(asn1_test_lib:compile("TConstrChoice", Config, [uper_bin])), - ?uper_bin(asn1_test_lib:compile("TConstr", Config, [uper_bin])), - ?uper_bin(testDeepTConstr:main(uper_bin)), - - asn1_test_lib:compile("TConstrChoice", Config, [?PER, optimize]), - asn1_test_lib:compile("TConstr", Config, [?PER, optimize]), - testDeepTConstr:main(?PER), - - asn1_test_lib:compile("TConstrChoice", Config, [?BER]), - asn1_test_lib:compile("TConstr", Config, [?BER]), - testDeepTConstr:main(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("TConstrChoice", Config, [?BER, nif])), - ?ber_nif(?BER, asn1_test_lib:compile("TConstr", Config, [?BER, nif])), - ?ber_nif(?BER, testDeepTConstr:main(?BER)). - -testInvokeMod(suite) -> - []; -testInvokeMod(Config) -> - asn1_test_lib:compile("PrimStrings", Config, []), - {ok, _Result1} = 'PrimStrings':encode('Bs1', [1, 0, 1, 0]), - asn1_test_lib:compile("PrimStrings", Config, [?PER]), - {ok, _Result2} = 'PrimStrings':encode('Bs1', [1, 0, 1, 0]). - -testExport(suite) -> - []; -testExport(Config) -> - DataDir = ?config(data_dir, Config), - CaseDir = ?config(case_dir, Config), - {error, {asn1, _Reason}} = - asn1ct:compile(filename:join(DataDir, "IllegalExport"), - [{outdir, CaseDir}]). - -testImport(suite) -> - []; -testImport(Config) -> - DataDir = ?config(data_dir, Config), - CaseDir = ?config(priv_dir, Config), - {error, _} = asn1ct:compile(filename:join(DataDir, "ImportsFrom"), - [?BER, {outdir, CaseDir}]). - -testMegaco(suite) -> - []; -testMegaco(Config) -> - {ok, ModuleName1, ModuleName2} = testMegaco:compile(Config, ?BER, []), - ok = testMegaco:main(ModuleName1, Config), - ok = testMegaco:main(ModuleName2, Config), - - case ?BER of - ber_bin_v2 -> - {ok, ModuleName3, ModuleName4} = testMegaco:compile(Config, ?BER, [nif]), - ok = testMegaco:main(ModuleName3, Config), - ok = testMegaco:main(ModuleName4, Config); - _-> - ok - end, - - {ok, ModuleName5, ModuleName6} = testMegaco:compile(Config, ?PER, []), - ok = testMegaco:main(ModuleName5, Config), - ok = testMegaco:main(ModuleName6, Config), - - ?per_bit_opt({ok, ModuleName5, ModuleName6} = testMegaco:compile(Config, ?PER, [optimize])), - ?per_bit_opt(ok = testMegaco:main(ModuleName5, Config)), - ?per_bit_opt(ok = testMegaco:main(ModuleName6, Config)), - - ?uper_bin({ok, ModuleName5, ModuleName6} = testMegaco:compile(Config, uper_bin, [])), - ?uper_bin(ok = testMegaco:main(ModuleName5, Config)), - ?uper_bin(ok = testMegaco:main(ModuleName6, Config)), - - {ok, ModuleName7, ModuleName8} = testMegaco:compile(Config, ?PER, [optimize]), - ok = testMegaco:main(ModuleName7, Config), - ok = testMegaco:main(ModuleName8, Config). - - -testMvrasn6(suite) -> []; -testMvrasn6(Config) -> - asn1_test_lib:compile("Mvrasn-21-4", Config, [?BER]), - asn1_test_lib:compile("Mvrasn-20-6", Config, [?BER]), - asn1_test_lib:compile("Mvrasn-19-6", Config, [?BER]), - asn1_test_lib:compile("Mvrasn-15-6", Config, [?BER]), - asn1_test_lib:compile("Mvrasn-18-6", Config, [?BER]), - asn1_test_lib:compile("Mvrasn-14-6", Config, [?BER]), - asn1_test_lib:compile("Mvrasn-11-6", Config, [?BER]). - -testContextSwitchingTypes(suite) -> []; -testContextSwitchingTypes(Config) -> - asn1_test_lib:compile("ContextSwitchingTypes", Config, [?BER]), - testContextSwitchingTypes:test(Config), - - ?ber_nif(?BER, asn1_test_lib:compile("ContextSwitchingTypes", Config, [?BER, nif])), - ?ber_nif(?BER, testContextSwitchingTypes:test(Config)), - - asn1_test_lib:compile("ContextSwitchingTypes", Config, [?PER]), - testContextSwitchingTypes:test(Config), - - ?per_bit_opt(asn1_test_lib:compile("ContextSwitchingTypes", Config, [?PER, optimize])), - ?per_bit_opt(testContextSwitchingTypes:test(Config)), - - ?uper_bin(asn1_test_lib:compile("ContextSwitchingTypes", Config, [uper_bin])), - ?uper_bin(testContextSwitchingTypes:test(Config)), - - asn1_test_lib:compile("ContextSwitchingTypes", Config, [?PER, optimize]), - testContextSwitchingTypes:test(Config). - -testTypeValueNotation(suite) -> []; -testTypeValueNotation(Config) -> - Files = ["SeqTypeRefPrim", - "ValueTest"], % OTP-6695 - case ?BER of - Ber when Ber == ber; Ber == ber_bin -> - asn1_test_lib:compile_all(Files, Config, [?BER]), - testTypeValueNotation:main(?BER, dummy); - _ -> - ok - end, - - ?ber_nif(?BER, asn1_test_lib:compile_all(Files, Config, [?BER, nif])), - ?ber_nif(?BER, testTypeValueNotation:main(?BER, optimize)), - - case ?BER of - Ber2 when Ber2 == ber; Ber2 == ber_bin -> - asn1_test_lib:compile_all(Files, Config, [?PER]), - testTypeValueNotation:main(?PER, dummy); - _ -> - ok - end, - - ?per_bit_opt(asn1_test_lib:compile_all(Files, Config, [?PER, optimize])), - ?per_bit_opt(testTypeValueNotation:main(?PER, optimize)), - - ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])), - ?uper_bin(testTypeValueNotation:main(uper_bin, optimize)), - case ?BER of - Ber3 when Ber3 == ber; Ber3 == ber_bin -> - asn1_test_lib:compile_all(Files, Config, [?PER, optimize]), - testTypeValueNotation:main(?PER, optimize); - _ -> - ok - end. - -testOpenTypeImplicitTag(suite) -> []; -testOpenTypeImplicitTag(Config) -> - asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?BER]), - testOpenTypeImplicitTag:main(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?BER, nif])), - ?ber_nif(?BER, testOpenTypeImplicitTag:main(?BER)), - - asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?PER]), - testOpenTypeImplicitTag:main(?PER), - - ?per_bit_opt(asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?PER, optimize])), - ?per_bit_opt(testOpenTypeImplicitTag:main(?PER)), - - ?uper_bin(asn1_test_lib:compile("OpenTypeImplicitTag", Config, [uper_bin])), - ?uper_bin(testOpenTypeImplicitTag:main(uper_bin)), - - asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?PER, optimize]), - testOpenTypeImplicitTag:main(?PER). - -duplicate_tags(suite) -> []; -duplicate_tags(Config) -> - DataDir = ?config(data_dir, Config), - CaseDir = ?config(case_dir, Config), - {error, {asn1, [{error, {type, _, _, 'SeqOpt1Imp', {asn1, {duplicates_of_the_tags, _}}}}]}} = - asn1ct:compile(filename:join(DataDir, "SeqOptional2"), - [abs, {outdir, CaseDir}]). - -rtUI(suite) -> []; -rtUI(Config) -> - asn1_test_lib:compile("Prim", Config, [?BER]), - {ok, _} = asn1rt:info('Prim'), - asn1_test_lib:compile("Prim", Config, [?PER]), - {ok, _} = asn1rt:info('Prim'). - -testROSE(suite) -> []; -testROSE(Config) -> - asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [?BER]), - asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [?PER]), - ?per_bit_opt(asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [?PER, optimize])), - ?uper_bin(asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [uper_bin])), - asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [?PER, optimize]). - -testINSTANCE_OF(suite) -> []; -testINSTANCE_OF(Config) -> - asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?BER]), - testINSTANCE_OF:main(?BER), - - ?ber_nif(?BER, asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?BER, nif])), - ?ber_nif(?BER, testINSTANCE_OF:main(?BER)), - - asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?PER]), - testINSTANCE_OF:main(?PER), - - ?per_bit_opt(asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?PER, optimize])), - ?per_bit_opt(testINSTANCE_OF:main(?PER)), - - ?uper_bin(asn1_test_lib:compile("INSTANCEOF.asn1", Config, [uper_bin])), - ?uper_bin(testINSTANCE_OF:main(uper_bin)), - - asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?PER, optimize]), - testINSTANCE_OF:main(?PER). - -testTCAP(suite) -> []; -testTCAP(Config) -> - testTCAP:compile(Config, [?BER]), - testTCAP:test(?BER, Config), - - ?ber_nif(?BER, testTCAP:compile(Config, [?BER, nif])), - ?ber_nif(?BER, testTCAP:test(?BER, Config)), - - ?ber_nif(?BER, testTCAP:compile_asn1config(Config, [?BER, asn1config])), - ?ber_nif(?BER, testTCAP:test_asn1config()). - -testDER(suite) ->[]; -testDER(Config) -> - asn1_test_lib:compile("DERSpec", Config, [?BER, der]), - testDER:test(), - - ?ber_nif(?BER, asn1_test_lib:compile("DERSpec", Config, [?BER, der, nif])), - ?ber_nif(?BER, testDER:test()), - - asn1_test_lib:compile("ParamBasic", Config, [?BER, der]), - testParamBasic_cases(der), - - asn1_test_lib:compile("Default", Config, [?BER, der]), - testSeqSetDefaultVal_cases(?BER). - -testSeqSetDefaultVal_cases(?BER) -> - testSeqSetDefaultVal:main(?BER). - - -specialized_decodes(suite) -> []; -specialized_decodes(Config) -> - case ?BER of - ber_bin_v2 -> - asn1_test_lib:compile_all(["PartialDecSeq.asn", - "PartialDecSeq2.asn", - "PartialDecSeq3.asn", - "PartialDecMyHTTP.asn", - "MEDIA-GATEWAY-CONTROL.asn", - "P-Record"], - Config, [?BER, optimize, asn1config]), - test_partial_incomplete_decode:test(Config), - test_selective_decode:test(); - Rule -> - {skip, lists:concat(["not implemented yet for version: ", Rule])} - end. - -special_decode_performance(suite) ->[]; -special_decode_performance(Config) -> - Files = ["MEDIA-GATEWAY-CONTROL", "PartialDecSeq"], - ?ber_nif(?BER, asn1_test_lib:compile_all(Files, Config, - [?BER, optimize, asn1config])), - ?ber_nif(?BER, test_special_decode_performance:go(all)). - - -test_driver_load(suite) -> []; -test_driver_load(Config) -> - case ?PER of - per_bin -> - asn1_test_lib:compile("P-Record", Config, [?PER, optimize]), - test_driver_load:test(5); - _ -> - ok - end. - -test_ParamTypeInfObj(suite) -> []; -test_ParamTypeInfObj(Config) -> - asn1_test_lib:compile("IN-CS-1-Datatypes", Config, [ber_bin]). - -test_WS_ParamClass(suite) -> []; -test_WS_ParamClass(Config) -> - asn1_test_lib:compile("InformationFramework", Config, [ber_bin]). - -test_Defed_ObjectIdentifier(suite) -> []; -test_Defed_ObjectIdentifier(Config) -> - asn1_test_lib:compile("UsefulDefinitions", Config, [ber_bin]). - -testSelectionType(suite) -> []; -testSelectionType(Config) -> - asn1_test_lib:compile("SelectionType", Config, [?BER]), - {ok, _} = testSelectionTypes:test(), - asn1_test_lib:compile("SelectionType", Config, [?PER]), - {ok, _} = testSelectionTypes:test(). - -testSSLspecs(suite) -> []; -testSSLspecs(Config) -> - ok = testSSLspecs:compile(Config, - [?BER, optimize, compact_bit_string, der]), - testSSLspecs:run(?BER), - - case code:which(asn1ct) of - cover_compiled -> - ok; - _ -> - ok = testSSLspecs:compile_inline(Config, ?BER), - ok = testSSLspecs:run_inline(?BER) - end. - -testNortel(suite) -> []; -testNortel(Config) -> - asn1_test_lib:compile("Nortel", Config, [?BER]), - asn1_test_lib:compile("Nortel", Config, [?BER, optimize]), - asn1_test_lib:compile("Nortel", Config, [?BER, optimize, nif]), - asn1_test_lib:compile("Nortel", Config, [?PER]), - ?per_bit_opt(asn1_test_lib:compile("Nortel", Config, [?PER, optimize])), - ?uper_bin(asn1_test_lib:compile("Nortel", Config, [uper_bin])), - asn1_test_lib:compile("Nortel", Config, [?PER, optimize]). - -test_undecoded_rest(suite) -> []; -test_undecoded_rest(Config) -> - - asn1_test_lib:compile("P-Record", Config, [?BER]), - ok = test_undecoded_rest:test([], Config), - - asn1_test_lib:compile("P-Record", Config, [?BER, undec_rest]), - ok = test_undecoded_rest:test(undec_rest, Config), - - asn1_test_lib:compile("P-Record", Config, [?PER]), - ok = test_undecoded_rest:test([], Config), - - ?per_bit_opt(asn1_test_lib:compile("P-Record", Config, [?PER, optimize, undec_rest])), - ?per_bit_opt(ok = test_undecoded_rest:test(undec_rest, Config)), - - ?uper_bin(asn1_test_lib:compile("P-Record", Config, [uper_bin, undec_rest])), - ?uper_bin(ok = test_undecoded_rest:test(undec_rest, Config)), - - asn1_test_lib:compile("P-Record", Config, [?PER, undec_rest]), - ok = test_undecoded_rest:test(undec_rest, Config). - -test_inline(suite) -> []; -test_inline(Config) -> - case code:which(asn1ct) of - cover_compiled -> - {skip, "Not runnable when cover compiled"}; - _ -> - ok=test_inline:compile(Config, []), - test_inline:main(Config, ?BER), - test_inline:inline1(Config, ?BER, []), - test_inline:performance2() - end. - -%test_inline_prf(suite) -> []; -%test_inline_prf(Config) -> -% test_inline:performance(Config). - -testTcapsystem(suite) -> []; -testTcapsystem(Config) -> - testTcapsystem:compile(Config, [?BER]). - -testNBAPsystem(suite) -> []; -testNBAPsystem(Config) -> - ok=testNBAPsystem:compile(Config, [?PER|?per_optimize(?BER)]), - ok=testNBAPsystem:test(?PER, Config). - -test_compile_options(suite) -> []; -test_compile_options(Config) -> - case code:which(asn1ct) of - cover_compiled -> - {skip, "Not runnable when cover compiled"}; - _ -> - ok = test_compile_options:wrong_path(Config), - ok = test_compile_options:path(Config), - ok = test_compile_options:noobj(Config), - ok = test_compile_options:record_name_prefix(Config), - ok = test_compile_options:verbose(Config), - ok = test_compile_options:warnings_as_errors(Config) - end. - -testDoubleEllipses(suite) -> []; -testDoubleEllipses(Config) -> - asn1_test_lib:compile("DoubleEllipses", Config, [?BER]), - testDoubleEllipses:main(?BER), - ?ber_nif(?BER, asn1_test_lib:compile("DoubleEllipses", Config, [?BER, nif])), - ?ber_nif(?BER, testDoubleEllipses:main(?BER)), - ?per_bit_opt(asn1_test_lib:compile("DoubleEllipses", Config, [?PER, optimize])), - ?per_bit_opt(testDoubleEllipses:main(?PER)), - ?uper_bin(asn1_test_lib:compile("DoubleEllipses", Config, [uper_bin])), - ?uper_bin(testDoubleEllipses:main(uper_bin)), - asn1_test_lib:compile("DoubleEllipses", Config, [?PER|?per_optimize(?BER)]), - testDoubleEllipses:main(?PER). - -test_modified_x420(suite) -> []; -test_modified_x420(Config) -> - test_modified_x420:compile(Config), - test_modified_x420:test_io(Config). - -testX420(suite) -> []; -testX420(Config) -> - testX420:compile(?BER, [der], Config), - ok = testX420:ticket7759(?BER, Config), - testX420:compile(?PER, [], Config). - -test_x691(suite) -> []; -test_x691(Config) -> - case ?PER of - per -> - ok = test_x691:compile(Config, [uper_bin]), - true = test_x691:cases(uper_bin, unaligned), - ok = test_x691:compile(Config, [?PER]), - true = test_x691:cases(?PER, aligned), - ok = asn1_test_lib:ticket_7708(Config, []), - ok = asn1_test_lib:ticket_7763(Config); - _ -> - ok = test_x691:compile(Config, [?PER|?per_optimize(?BER)]), - true = test_x691:cases(?PER, aligned) - end. - -ticket_6143(suite) -> []; -ticket_6143(Config) -> - ok = test_compile_options:ticket_6143(Config). - -testExtensionAdditionGroup(suite) -> []; -testExtensionAdditionGroup(Config) -> - DataDir = ?config(data_dir, Config), - PrivDir = ?config(priv_dir, Config), - Path = code:get_path(), - DoIt = fun(Erule) -> - ok = asn1ct:compile(filename:join(DataDir, "Extension-Addition-Group"), Erule ++ [{outdir, PrivDir}]), - {ok, _M} = compile:file(filename:join(DataDir, "extensionAdditionGroup"), [{i, PrivDir}, {outdir, PrivDir}, debug_info]), - ok = extensionAdditionGroup:run(Erule), - ok = extensionAdditionGroup:run2(Erule), - ok = asn1ct:compile(filename:join(DataDir, "EUTRA-RRC-Definitions"), Erule ++ [{record_name_prefix, "RRC-"}, {outdir, PrivDir}]), - ok = extensionAdditionGroup:run3(Erule) - end, - [DoIt(Rule)|| Rule <- [[per_bin], [per_bin, optimize], [uper_bin]]], - %% FIXME problems with automatic tags [ber_bin], [ber_bin, optimize] - code:set_path(Path). - - - -% parse_modules() -> -% ["ImportsFrom"]. - -per_modules() -> - [X || X <- test_modules()]. -ber_modules() -> - [X || X <- test_modules(), - X =/= "CommonDataTypes", - X =/= "DS-EquipmentUser-CommonFunctionOrig-TransmissionPath", - X =/= "H323-MESSAGES", - X =/= "H235-SECURITY-MESSAGES", - X =/= "MULTIMEDIA-SYSTEM-CONTROL"]. -test_modules() -> - _Modules = [ - "BitStr", - "CAP", - "CommonDataTypes", - "Constraints", - "ContextSwitchingTypes", - "DS-EquipmentUser-CommonFunctionOrig-TransmissionPath", - "Enum", - "From", - "H235-SECURITY-MESSAGES", - "H323-MESSAGES", - %%"MULTIMEDIA-SYSTEM-CONTROL", recursive type , problem for asn1ct:value - "Import", - "Int", - "MAP-commonDataTypes", -% ambigous tags "MAP-insertSubscriberData-def", - "Null", - "Octetstr", - "One", - "P-Record", - "P", -% "PDUs", - "Person", - "PrimStrings", - "Real", - "XSeq", - "XSeqOf", - "XSet", - "XSetOf", - "String", - "SwCDR", -% "Syntax", - "Time" -% ANY "Tst", -% "Two", -% errors that should be detected "UndefType" -] ++ - [ - "SeqSetLib", % must be compiled before Seq and Set - "Seq", - "Set", - "SetOf", - "SeqOf", - "Prim", - "Cho", - "Def", - "Opt", - "ELDAPv3", - "LDAP" - ]. - -test_OTP_9688(Config) -> - Asn1Mod = "OTP-9688.asn1", - %%DataDir = ?config(data_dir,Config), - PrivDir = ?config(priv_dir,Config), - Data = " -OTP-9688 DEFINITIONS ::= BEGIN - - foo INTEGER ::= 1 - bar INTEGER ::= 42 - - Baz ::= INTEGER {x-y-z1(foo), x-y-z2(bar)} - Qux ::= SEQUENCE {flerpInfo SEQUENCE {x INTEGER (-10 | -9 | (0..4))} OPTIONAL} - -END -", - File = filename:join(PrivDir,Asn1Mod), - ok = file:write_file(File, Data), - %% Does it compile with changes to asn1ct_check and asn1ct_gen_per_rt2ct? - %% (see ticket) - ok = asn1ct:compile(File, [{outdir, PrivDir}]). diff --git a/lib/asn1/test/asn1_bin_particular_SUITE.erl.src b/lib/asn1/test/asn1_bin_particular_SUITE.erl.src deleted file mode 100644 index 0e153238ad..0000000000 --- a/lib/asn1/test/asn1_bin_particular_SUITE.erl.src +++ /dev/null @@ -1,2 +0,0 @@ - -particular() -> []. diff --git a/lib/asn1/test/asn1_common_SUITE.erl.src b/lib/asn1/test/asn1_common_SUITE.erl.src deleted file mode 100644 index 12512606d8..0000000000 --- a/lib/asn1/test/asn1_common_SUITE.erl.src +++ /dev/null @@ -1,95 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2011. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% -%% - -common() -> [{group,app_test}, {group,appup_test},testTimer_ber,testTimer_ber_bin, - testTimer_ber_bin_opt, testTimer_ber_bin_opt_driver, testTimer_per, - testTimer_per_bin, testTimer_per_bin_opt, testTimer_uper_bin, - testComment,testName2Number]. - - -testTimer_ber(suite) -> []; -testTimer_ber(Config) -> - ?line testTimer:compile(Config,ber,[]), - ?line testTimer:go(Config,ber). - -testTimer_ber_bin(suite) -> []; -testTimer_ber_bin(Config) -> - ?line testTimer:compile(Config,ber_bin,[]), - ?line testTimer:go(Config,ber_bin). - -testTimer_ber_bin_opt(suite) -> []; -testTimer_ber_bin_opt(Config) -> - ?line testTimer:compile(Config,ber_bin,[optimize]), - ?line testTimer:go(Config,ber_bin). - -testTimer_ber_bin_opt_driver(suite) -> []; -testTimer_ber_bin_opt_driver(Config) -> - ?line testTimer:compile(Config,ber_bin,[optimize,driver]), - ?line testTimer:go(Config,ber_bin). - -testTimer_per(suite) -> []; -testTimer_per(Config) -> - ?line testTimer:compile(Config,per,[]), - ?line testTimer:go(Config,per). - -testTimer_per_bin(suite) -> []; -testTimer_per_bin(Config) -> - ?line testTimer:compile(Config,per_bin,[]), - ?line testTimer:go(Config,per_bin). - -testTimer_per_bin_opt(suite) -> []; -testTimer_per_bin_opt(Config) -> - ?line testTimer:compile(Config,per_bin,[optimize]), - ?line testTimer:go(Config,per_bin). - - -testTimer_uper_bin(suite) -> []; -testTimer_uper_bin(Config) -> - ?line ok=testTimer:compile(Config,uper_bin,[]), - ?line {comment,_} = testTimer:go(Config,uper_bin). - -%% Test of multiple-line comment, OTP-8043 -testComment(suite) -> []; -testComment(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - - ?line ok = asn1ct:compile(DataDir ++ "Comment",[{outdir,OutDir}]), - - ?line {ok,Enc} = asn1_wrapper:encode('Comment','Seq',{'Seq',12,true}), - ?line {ok,{'Seq',12,true}} = asn1_wrapper:decode('Comment','Seq',Enc), - ok. - -testName2Number(suite) -> []; -testName2Number(Config) -> - DataDir = ?config(data_dir,Config), - OutDir = ?config(priv_dir,Config), - N2NOptions = [{n2n,Type}|| Type <- - ['CauseMisc','CauseProtocol', - %% 'CauseNetwork', - 'CauseRadioNetwork', - 'CauseTransport','CauseNas']], - ?line ok = asn1ct:compile(DataDir ++ "S1AP-IEs",[{outdir,OutDir}]++N2NOptions), - ?line true = code:add_patha(OutDir), - - ?line 0 = 'S1AP-IEs':name2num_CauseMisc('control-processing-overload'), - ?line 'unknown-PLMN' = 'S1AP-IEs':num2name_CauseMisc(5), - ok. - diff --git a/lib/asn1/test/asn1_particular_SUITE.erl.src b/lib/asn1/test/asn1_particular_SUITE.erl.src deleted file mode 100644 index df76de914d..0000000000 --- a/lib/asn1/test/asn1_particular_SUITE.erl.src +++ /dev/null @@ -1,10 +0,0 @@ - -particular() -> [ticket_7407]. - -ticket_7407(suite) -> []; -ticket_7407(Config) -> - ?line ok = asn1_test_lib:ticket_7407_compile(Config,[]), - ?line ok = asn1_test_lib:ticket_7407_code(true), - - ?line ok = asn1_test_lib:ticket_7407_compile(Config,[no_final_padding]), - ?line ok = asn1_test_lib:ticket_7407_code(false).
\ No newline at end of file diff --git a/lib/asn1/test/asn1_test_lib.erl b/lib/asn1/test/asn1_test_lib.erl index 70e78c5197..96c04a9436 100644 --- a/lib/asn1/test/asn1_test_lib.erl +++ b/lib/asn1/test/asn1_test_lib.erl @@ -21,6 +21,7 @@ -export([compile/3]). -export([compile_all/3]). +-export([compile_erlang/3]). -export([ticket_7407_compile/2,ticket_7407_code/1, ticket_7678/2, ticket_7708/2, ticket_7763/1, ticket_7876/3]). @@ -32,11 +33,54 @@ compile(File, Config, Options) -> compile_all([File], Config, Options). compile_all(Files, Config, Options) -> DataDir = ?config(data_dir, Config), CaseDir = ?config(case_dir, Config), - % TODO: Purge and load as well? - [ok = asn1ct:compile(filename:join(DataDir, F), - [{outdir, CaseDir}|Options]) || F <- Files], + [compile_file(filename:join(DataDir, F), [{outdir, CaseDir}|Options]) + || F <- Files], ok. +compile_file(File, Options) -> + try + ok = asn1ct:compile(File, Options), + case should_load(File, Options) of + false -> + ok; + {module, Module} -> + code:purge(Module), + true = code:soft_purge(Module), + {module, Module} = code:load_file(Module) + end + catch + Class:Reason -> + erlang:error({compile_failed, {File, Options}, {Class, Reason}}) + end. + +compile_erlang(Mod, Config, Options) -> + DataDir = ?config(data_dir, Config), + CaseDir = ?config(case_dir, Config), + M = list_to_atom(Mod), + {ok, M} = compile:file(filename:join(DataDir, Mod), + [{i, CaseDir}, {outdir, CaseDir}|Options]). + +should_load(File, Options) -> + should_load(File, lists:member(abs, Options), + proplists:lookup(inline, Options)). + +should_load(_File, true, _Inline) -> + false; +should_load(_File, _Abs, {inline, Module}) when Module /= true -> + {module, Module}; +should_load(File, _Abs, _Inline) -> + {module, list_to_atom(strip_extension(filename:basename(File)))}. + +strip_extension(File) -> + strip_extension(File, filename:extension(File)). + +strip_extension(File, "") -> + File; +strip_extension(File, Ext) when Ext == ".asn"; Ext == ".set"; Ext == ".asn1"-> + strip_extension(filename:rootname(File)); +strip_extension(File, _Ext) -> + File. + ticket_7407_compile(Config,Option) -> ?line DataDir = ?config(data_dir,Config), diff --git a/lib/asn1/test/h323test.erl b/lib/asn1/test/h323test.erl index c23ea27003..b7a7d6e4df 100644 --- a/lib/asn1/test/h323test.erl +++ b/lib/asn1/test/h323test.erl @@ -19,50 +19,20 @@ %% -module(h323test). --compile(export_all). -export([run/1]). -include_lib("test_server/include/test_server.hrl"). -run(per_bin) -> - run(); -run(per) -> - run(); -run(_Rules) -> - ok. +run(per_bin) -> run(); +run(per) -> run(); +run(_Rules) -> ok. run() -> - ?line alerting(), - ?line connect(), + alerting(), + connect(), ok. -arq() -> - _AdmissionRequest = "27900007086000340036003300320038003700370101805337010180533600AC1F38C60693000D000445367AE75C5740120300AC1F38C6415004E0200100110000D7D22EA88D511C0200AC1F38C6C0580100". - - -t0() -> - Setup = "00B8060008914A0001010180533622C000000000074572696373736F6E0356302E3100010180533700AC1F38C206B80045367AE75C5740120300AC1F38C6415000411C110000D7D22EA88D511C0200AC1F3806C0583802150000080E1403001E80800A04000100AC1F38C661A820400000060401004E1403001E80801114000100AC1F38C72EE000AC1F38C72EE00100010063AA34AB" -, - ByteList = hexstr2bytes(Setup), - asn1_wrapper:decode('H323-MESSAGES','H323-UU-PDU',ByteList). - -t1() -> - AdmissionRequest = "27900007086000340036003300320038003700370101805337010180533600AC1F38C60693000D000445367AE75C5740120300AC1F38C6415004E0200100110000D7D22EA88D511C0200AC1F38C6C0580100", - ByteList = hexstr2bytes(AdmissionRequest), - asn1_wrapper:decode('H323-MESSAGES','RasMessage',ByteList). - -t2() -> - Cs = "080200040504038090A56C059132303033700591323030347E00930500B8060008914A0001010180533622C000000000074572696373736F6E0356302E3100010180533700AC1F38C206B80045367AE75C5740120300AC1F38C6415000411C110000D7D22EA88D511C0200AC1F3806C0583802150000080E1403001E80800A04000100AC1F38C661A820400000060401004E1403001E80801114000100AC1F38C72EE000AC1F38C72EE00100010063AA34AB", - ByteList = hexstr2bytes(Cs), - asn1_wrapper:decode('H323-MESSAGES','H323-UU-PDU',ByteList). - -t3() -> - Cs = "10b8060008914a0002044003004d0067006f006e018085cc22c0b500534c164d6963726f736f6674ae204e65744d656574696e67ae0003332e3000000101808c990088e1293a06b8001689edc5bf23d3118c2d00c04f4b1cd0000c07000a00000204dc40b500534c3c0200000028000000000000001b0000008138427484ccd211b4e300a0c90d0660100000001289edc5bf23d3118c2d00c04f4b1cd00000000000000000a615d9ee", - ByteList = hexstr2bytes(Cs), - asn1_wrapper:decode('H323-MESSAGES','H323-UU-PDU',ByteList). - dec_alerting() -> Cs = "0380060008914a0002020120110000000000000000000000000000000000", - _Slask="E83AE983", ByteList = hexstr2bytes(Cs), asn1_wrapper:decode('H323-MESSAGES','H323-UserInformation',ByteList). @@ -70,95 +40,31 @@ enc_alerting(V) -> asn1_wrapper:encode('H323-MESSAGES','H323-UserInformation',V). alerting() -> - ?line {ok,V} = dec_alerting(), - ?line {ok,B} = enc_alerting(V), - ?line ByteList = lists:flatten(B), - ?line {ok,V} = asn1_wrapper:decode('H323-MESSAGES','H323-UserInformation',ByteList). + {ok,V} = dec_alerting(), + {ok,B} = enc_alerting(V), + ByteList = lists:flatten(B), + {ok,V} = asn1_wrapper:decode('H323-MESSAGES','H323-UserInformation',ByteList). dec_connect() -> Cs = "02c0060008914a00020088e1293a04a322c0b500534c164d6963726f736f6674ae204e65744d656474696e67ae0003332e3000001689edc5bf23d3118c2d00c04f4b1cd00900110000000000000000000000000000000000", - _Slask="2f530a3f", ByteList = hexstr2bytes(Cs), asn1_wrapper:decode('H323-MESSAGES','H323-UserInformation',ByteList). - + enc_connect(V) -> asn1_wrapper:encode('H323-MESSAGES','H323-UserInformation',V). connect() -> - ?line {ok,V} = dec_connect(), - ?line {ok,B} = enc_connect(V), - ?line ByteList = lists:flatten(B), - ?line {ok,V} = asn1_wrapper:decode('H323-MESSAGES','H323-UserInformation',ByteList). + {ok,V} = dec_connect(), + {ok,B} = enc_connect(V), + ByteList = lists:flatten(B), + {ok,V} = asn1_wrapper:decode('H323-MESSAGES','H323-UserInformation',ByteList). -dec_h245_TCS() -> - Cs ="02700106000881750003" - "800d00003c000100000100000100000e" - "807fff04b5428080010180000e483060" - "0100800c96a88000002020b500534c48" - "020000000000f4010000f40101000400" - "0000000002000100401f000000100000" - "000104002000f4010700000100000002" - "00ff00000000c0004000f0000000cc01" - "30ff880118ff00008000012040b38000" - "0220c0b38000032020b500534c280200" - "00000000a0000000a000040010000000" - "000070000100401f0000580200000c00" - "1000000000008000042020b500534c28" - "020000000000a0000000a00004001000" - "0000000071000100401f00003a070000" - "25001000000000008000052020b50053" - "4c280200000000008000000080000500" - "14000000000072000100401f00000809" - "000025001000000000008000062020b5" - "00534c28020000000000800000008000" - "050014000000000073000100401f0000" - "7f0a00002b0010000000000080000722" - "000b40000909a00120390c000a099001" - "20390c000b09880120390c000c08a220" - "3940000d089220390004800602070007" - "00060004000500020001000000030000" - "0a00000e800702070007000600040005" - "000200010000000300000900000e8008" - "02070007000600040005000200010000" - "000300000c00000e8009020700070006" - "00040005000200010000000300000b00" - "000e800a020700070006000400050002" - "00010000000300000d00000e0300000b" - "01003280299d93369631bc", - ByteList = hexstr2bytes(Cs), - asn1_wrapper:decode('MULTIMEDIA-SYSTEM-CONTROL', - 'MultimediaSystemControlMessage',ByteList). - - hexstr2bytes([D1,D2|T]) -> +hexstr2bytes([D1,D2|T]) -> [dig2num(D1)*16+dig2num(D2)|hexstr2bytes(T)]; hexstr2bytes([]) -> []. -dig2num(D) when D >= $0, D =< $9 -> - D - $0; -dig2num(D) when D >= $a, D =< $f -> - 10 + D - $a; -dig2num(D) when D >= $A, D =< $F -> - 10 + D - $A. - -bytes2hexstr(Bytes) -> - bytes2hexstr(Bytes,[]). - -bytes2hexstr([B|Bytes],Acc) -> - D1 = num2dig(B bsr 4), - D2 = num2dig(B band 15), - bytes2hexstr(Bytes,[D2,D1|Acc]); -bytes2hexstr([],Acc) -> - lists:reverse(Acc). - -num2dig(Num) when Num =< 9 -> - $0 + Num; -num2dig(Num) -> - $a + Num - 10. - - - - - - +dig2num(D) when D >= $0, D =< $9 -> D - $0; +dig2num(D) when D >= $a, D =< $f -> 10 + D - $a; +dig2num(D) when D >= $A, D =< $F -> 10 + D - $A. diff --git a/lib/asn1/test/asn1_bin_v2_particular_SUITE.erl.src b/lib/asn1/test/pem_performance.erl index 6386feae17..87b8cbd61d 100644 --- a/lib/asn1/test/asn1_bin_v2_particular_SUITE.erl.src +++ b/lib/asn1/test/pem_performance.erl @@ -1,276 +1,22 @@ - -particular() -> [smp, ticket7904]. - - -smp(suite) -> []; -smp(Config) -> - case erlang:system_info(smp_support) of - true -> - NumOfProcs = erlang:system_info(schedulers), - io:format("smp starting ~p workers\n",[NumOfProcs]), - - ?line Msg = {initiatingMessage, testNBAPsystem:cell_setup_req_msg()}, - ?line ok = testNBAPsystem:compile(Config, [per_bin, optimize]), - - enc_dec(NumOfProcs,Msg,2), - - N = 10000, - - ?line {Time1,ok} = timer:tc(?MODULE,enc_dec,[NumOfProcs,Msg, N]), - ?line {Time1S,ok} = timer:tc(?MODULE,enc_dec,[1, Msg, NumOfProcs * N]), - - ?line ok = testNBAPsystem:compile(Config, [ber_bin, optimize, nif]), - ?line {Time3,ok} = timer:tc(?MODULE,enc_dec,[NumOfProcs,Msg, N]), - - ?line {Time3S,ok} = timer:tc(?MODULE,enc_dec,[1, Msg, NumOfProcs * N]), - - {comment,lists:flatten( - io_lib:format( - "Encode/decode time parallell with ~p cores: ~p [microsecs]~n" - "Encode/decode time sequential: ~p [microsecs]", - [NumOfProcs,Time1+Time3,Time1S+Time3S]))}; - false -> - {skipped,"No smp support"} - end. - -per_performance(Config) -> - PrivDir = proplists:get_value(priv_dir, Config), - NifDir = filename:join(PrivDir,"nif"), - ErlDir = filename:join(PrivDir,"erl"), - file:make_dir(NifDir),file:make_dir(ErlDir), - - ?line Msg = {initiatingMessage, testNBAPsystem:cell_setup_req_msg()}, - ?line ok = testNBAPsystem:compile([{priv_dir,NifDir}|Config], - [per_bin, optimize]), - ?line ok = testNBAPsystem:compile([{priv_dir,ErlDir}|Config], - [per_bin]), - - Modules = ['NBAP-CommonDataTypes', - 'NBAP-Constants', - 'NBAP-Containers', - 'NBAP-IEs', - 'NBAP-PDU-Contents', - 'NBAP-PDU-Discriptions'], - - - PreNif = fun() -> - code:add_patha(NifDir), - lists:foreach(fun(M) -> - code:purge(M), - code:load_file(M) - end,Modules) - end, - - PreErl = fun() -> - code:add_patha(ErlDir), - lists:foreach(fun(M) -> - code:purge(M), - code:load_file(M) - end,Modules) - end, - - Func = fun() -> - element(1,timer:tc( - asn1_wrapper,encode,['NBAP-PDU-Discriptions', - 'NBAP-PDU', - Msg])) - end, - - nif_vs_erlang_performance({{{PreNif,Func},{PreErl,Func}},100000,32}). - -ber_performance(Config) -> - - ?line Msg = {initiatingMessage, testNBAPsystem:cell_setup_req_msg()}, - ?line ok = testNBAPsystem:compile(Config, [ber_bin, optimize, nif]), - - - BerFun = fun() -> - {ok,B} = asn1_wrapper:encode('NBAP-PDU-Discriptions', - 'NBAP-PDU', Msg), - asn1_wrapper:decode( - 'NBAP-PDU-Discriptions', - 'NBAP-PDU', - B) - end, - nif_vs_erlang_performance({BerFun,100000,32}). - -cert_pem_performance(Config) when is_list(Config) -> - cert_pem_performance({100000, 32}); -cert_pem_performance({N,S}) -> - nif_vs_erlang_performance({fun cert_pem/0,N,S}). - -dsa_pem_performance(Config) when is_list(Config) -> - cert_pem_performance({100000, 32}); -dsa_pem_performance({N,S}) -> - nif_vs_erlang_performance({fun dsa_pem/0,N,S}). - - -nif_vs_erlang_performance({{TC1,TC2},N,Sched}) -> - random:seed({123,456,789}), - io:format("Running a ~p sample with ~p max procs...~n~n",[N,Sched]), - - {True,False} = exec(TC1,TC2,Sched,N+1), - - io:format("~ndone!~n"), - - io:format("~n"),TStats = print_stats(strip(True,N div 20)), - io:format("~n"),FStats = print_stats(strip(False,N div 20)), - Str = io_lib:format("~nNifs are ~.3f% faster than erlang!~n", - [(element(2,FStats) - element(2,TStats)) / - element(2,FStats) * 100]), - io:format(Str), - {comment, lists:flatten(Str)}; -nif_vs_erlang_performance({T,N,Sched}) -> - PTC1 = fun() -> - application:set_env(asn1, nif_loadable, true) - end, - PTC2 = fun() -> - application:set_env(asn1, nif_loadable, false) - end, - TC = fun() -> - element(1,timer:tc(T)) - end, - nif_vs_erlang_performance({{{PTC1,TC},{PTC2,TC}},N,Sched}). - - -print_stats(Data) -> - Length = length(Data), - Mean = lists:sum(Data) / Length, - Variance = lists:foldl(fun(N,Acc) -> math:pow(N - Mean, 2)+Acc end, 0, Data), - StdDev = math:sqrt(Variance / Length), - Median = lists:nth(round(Length/2),Data), - Min = lists:min(Data), - Max = lists:max(Data), - if Length < 20 -> - io:format("Data: ~w~n",[Data]); - true -> - ok - end, - io:format("Length: ~p~nMean: ~p~nStdDev: ~p~nMedian: ~p~nMin: ~p~nMax: ~p~n", - [Length,Mean,StdDev,Median,Min,Max]), - {Length,Mean,StdDev,Median,Min,Max}. - -collect(Acc) -> - receive - {Tag,Val} -> - Prev = proplists:get_value(Tag,Acc,[]), - collect(lists:keystore(Tag,1,Acc,{Tag,[Val|Prev]})) - after 100 -> - Acc - end. - -exec(One,Two,Max,N) -> - exec(One,Two,Max,N,{[],[]}). -exec(_,_,_,1,{D1,D2}) -> - {lists:flatten(D1),lists:flatten(D2)}; -exec({PreOne,One} = O,{PreTwo,Two} = T,MaxProcs, N, {D1,D2}) -> - Num = random:uniform(round(N/2)), - if Num rem 3 == 0 -> - timer:sleep(Num rem 1000); - true -> - ok - end, - Procs = random:uniform(MaxProcs), - io:format("\tBatch: ~p items in ~p processes, ~p left~n",[Num,Procs,N-Num]), - if Num rem 2 == 1 -> - erlang:garbage_collect(), - PreOne(), - MoreOne = pexec(One, Num, Procs, []), - erlang:garbage_collect(), - PreTwo(), - MoreTwo = pexec(Two, Num, Procs, []); - true -> - erlang:garbage_collect(), - PreTwo(), - MoreTwo = pexec(Two, Num, Procs, []), - erlang:garbage_collect(), - PreOne(), - MoreOne = pexec(One, Num, Procs, []) - end, - exec(O,T,MaxProcs,N-Num,{[MoreOne|D1], - [MoreTwo|D2]}). - -pexec(_Fun, _, 0, []) -> - []; -pexec(Fun, _, 0, [{Ref,Pid}|Rest]) -> - receive - {data,D} -> - [D|pexec(Fun,0,0,[{Ref,Pid}|Rest])]; - {'DOWN', Ref, process, Pid, normal} -> - pexec(Fun, 0,0,Rest) - end; -pexec(Fun, 0, 1, AccProcs) -> - pexec(Fun, 0, 0, AccProcs); -pexec(Fun, N, 1, AccProcs) -> - [Fun()|pexec(Fun, N - 1, 1, AccProcs)]; -pexec(Fun, N, Procs, AccProcs) -> - S = self(), - Pid = spawn(fun() -> - S ! {data,pexec(Fun,N,1,[])} - end), - Ref = erlang:monitor(process, Pid), - pexec(Fun, N, Procs - 1, [{Ref,Pid}|AccProcs]). - -strip(Data,Num) -> - {_,R} = lists:split(Num,lists:sort(Data)), - element(2,lists:split(Num,lists:reverse(R))). - -faster(A,B) -> - (B - A)/B * 100. - -enc_dec(1, Msg, N) -> - worker_loop(N, Msg); -enc_dec(NumOfProcs,Msg, N) -> - pforeach(fun(_) -> - worker_loop(N, Msg) - end, [I || I <- lists:seq(1,NumOfProcs)]). - -worker_loop(0, _Msg) -> - ok; -worker_loop(N, Msg) -> - ?line {ok,B}=asn1_wrapper:encode('NBAP-PDU-Discriptions', - 'NBAP-PDU', - Msg), - ?line {ok,_Msg}=asn1_wrapper:decode('NBAP-PDU-Discriptions', - 'NBAP-PDU', - B), - worker_loop(N - 1, Msg). - - -pforeach(Fun, List) -> - pforeach(Fun, List, []). -pforeach(Fun, [], [{Pid,Ref}|Pids]) -> - receive - {'DOWN', Ref, process, Pid, normal} -> - pforeach(Fun, [], Pids) - end; -pforeach(Fun, [H|T], Pids) -> - Pid = spawn(fun() -> Fun(H) end), - Ref = erlang:monitor(process, Pid), - pforeach(Fun, T, [{Pid, Ref}|Pids]); -pforeach(_Fun,[],[]) -> - ok. - --record('InitiatingMessage',{procedureCode,criticality,value}). --record('Iu-ReleaseCommand',{first,second}). - -ticket7904(suite) -> []; -ticket7904(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - - ?line ok = asn1ct:compile(DataDir ++ - "RANAPextract1",[per_bin,optimize,{outdir,OutDir}]), - - Val1 = #'InitiatingMessage'{procedureCode=1, - criticality=ignore, - value=#'Iu-ReleaseCommand'{ - first=13, - second=true}}, - - ?line {ok,_} = 'RANAPextract1':encode('InitiatingMessage', Val1), - asn1rt:unload_driver(), - ?line {ok,_} = 'RANAPextract1':encode('InitiatingMessage', Val1). +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% + +-module([cert_pem/0]). +-module([dsa_pem/0]). cert_pem() -> 'OTP-PUB-KEY':decode('Certificate',<<48,130,3,184,48,130,3,33,160,3,2,1,2,2,1,1,48,13,6,9,42,134,72,134,247,13,1,1,5,5,0,48,129,131,49,14,48,12,6,3,85,4,3,19,5,111,116,112,67,65,49,19,48,17,6,3,85,4,11,19,10,69,114,108,97,110,103,32,79,84,80,49,20,48,18,6,3,85,4,10,19,11,69,114,105,99,115,115,111,110,32,65,66,49,11,48,9,6,3,85,4,6,19,2,83,69,49,18,48,16,6,3,85,4,7,19,9,83,116,111,99,107,104,111,108,109,49,37,48,35,6,9,42,134,72,134,247,13,1,9,1,22,22,112,101,116,101,114,64,101,114,105,120,46,101,114,105,99,115,115,111,110,46,115,101,48,30,23,13,48,56,48,49,48,57,48,56,50,57,51,48,90,23,13,49,55,49,49,49,55,48,56,50,57,51,48,90,48,129,132,49,15,48,13,6,3,85,4,3,19,6,99,108,105,101,110,116,49,19,48,17,6,3,85,4,11,19,10,69,114,108,97,110,103,32,79,84,80,49,20,48,18,6,3,85,4,10,19,11,69,114,105,99,115,115,111,110,32,65,66,49,11,48,9,6,3,85,4,6,19,2,83,69,49,18,48,16,6,3,85,4,7,19,9,83,116,111,99,107,104,111,108,109,49,37,48,35,6,9,42,134,72,134,247,13,1,9,1,22,22,112,101,116,101,114,64,101,114,105,120,46,101,114,105,99,115,115,111,110,46,115,101,48,129,159,48,13,6,9,42,134,72,134,247,13,1,1,1,5,0,3,129,141,0,48,129,137,2,129,129,0,245,56,68,254,220,239,193,190,63,221,182,60,67,77,121,163,214,136,137,183,139,8,166,30,100,27,45,17,126,58,15,173,151,218,75,224,148,14,22,164,10,100,186,183,104,175,197,97,96,182,146,150,106,129,140,100,194,106,90,62,133,233,155,46,155,33,101,220,83,193,182,232,240,99,253,249,114,8,159,172,143,77,179,132,229,205,29,110,185,233,224,52,25,149,249,100,80,229,199,125,23,106,146,233,159,26,13,8,161,206,221,43,240,149,42,45,194,190,85,6,235,152,220,219,160,32,144,67,2,3,1,0,1,163,130,1,55,48,130,1,51,48,9,6,3,85,29,19,4,2,48,0,48,11,6,3,85,29,15,4,4,3,2,5,224,48,29,6,3,85,29,14,4,22,4,20,26,59,44,5,72,211,158,214,23,34,30,241,125,27,123,115,93,163,231,120,48,129,179,6,3,85,29,35,4,129,171,48,129,168,128,20,6,171,128,52,58,164,184,118,178,189,157,46,40,229,109,145,222,125,1,155,161,129,140,164,129,137,48,129,134,49,17,48,15,6,3,85,4,3,19,8,101,114,108,97,110,103,67,65,49,19,48,17,6,3,85,4,11,19,10,69,114,108,97,110,103,32,79,84,80,49,20,48,18,6,3,85,4,10,19,11,69,114,105,99,115,115,111,110,32,65,66,49,18,48,16,6,3,85,4,7,19,9,83,116,111,99,107,104,111,108,109,49,11,48,9,6,3,85,4,6,19,2,83,69,49,37,48,35,6,9,42,134,72,134,247,13,1,9,1,22,22,112,101,116,101,114,64,101,114,105,120,46,101,114,105,99,115,115,111,110,46,115,101,130,1,1,48,33,6,3,85,29,17,4,26,48,24,129,22,112,101,116,101,114,64,101,114,105,120,46,101,114,105,99,115,115,111,110,46,115,101,48,33,6,3,85,29,18,4,26,48,24,129,22,112,101,116,101,114,64,101,114,105,120,46,101,114,105,99,115,115,111,110,46,115,101,48,13,6,9,42,134,72,134,247,13,1,1,5,5,0,3,129,129,0,93,11,112,227,121,15,121,179,247,135,110,216,17,197,84,18,149,166,147,142,190,178,0,209,190,0,142,233,144,100,194,205,220,182,73,204,108,42,95,23,48,63,4,120,239,42,194,25,184,35,117,107,96,229,18,45,76,122,125,40,171,210,132,50,146,178,160,55,17,35,255,208,114,30,47,55,185,154,155,165,204,180,14,143,20,234,6,234,201,225,72,235,5,87,61,255,250,23,217,1,144,246,98,221,223,102,49,168,177,13,70,241,26,27,254,251,217,14,244,18,242,197,151,50,186,214,15,42>>). @@ -288,4 +34,4 @@ dsa_pem() -> {1,2,840,10040,4,1}, <<48,130,1,31,2,129,129,0,183,179,230,217,37,99,144,157,21,228,204,162,207,61,246,144,58,139,139,184,184,43,108,206,0,115,173,208,100,233,201,121,21,90,179,119,53,140,25,52,34,202,121,211,164,107,43,56,68,162,159,51,244,232,138,126,164,109,121,89,237,142,57,28,32,188,44,67,253,111,121,104,40,141,211,255,140,118,37,234,150,201,155,160,16,17,51,59,26,249,41,129,16,211,119,128,95,254,182,235,132,0,92,206,93,77,106,217,201,132,203,4,75,201,246,204,216,162,1,84,79,211,10,21,152,195,103,145,2,21,0,213,30,184,86,247,16,247,69,192,241,35,138,84,57,140,3,71,65,206,233,2,129,129,0,148,179,24,63,74,91,128,25,96,29,5,78,223,246,175,0,121,86,54,178,42,231,98,241,147,180,157,60,149,160,50,243,227,76,175,89,234,203,252,242,76,108,9,204,157,182,59,206,227,127,99,215,42,156,194,78,116,25,7,62,243,169,45,5,101,179,247,127,199,144,135,103,23,42,154,125,231,248,154,101,175,155,101,42,232,41,80,41,47,128,208,11,31,106,63,12,202,207,135,80,200,136,250,171,31,118,52,91,200,138,112,111,179,23,214,123,21,118,194,179,0,185,217,52,197,182,236,13>>}, {0, - <<2,129,128,124,66,0,111,121,139,142,209,95,136,95,237,177,150,248,252,49,135,117,100,155,232,138,244,132,89,40,5,70,125,202,96,78,239,76,37,125,149,82,64,107,54,227,73,25,180,227,41,0,234,73,47,80,242,242,129,250,61,68,62,39,38,156,193,146,40,241,247,106,215,223,202,194,110,130,62,186,90,18,28,196,174,99,47,193,61,130,100,150,25,248,115,164,231,153,99,46,69,66,139,33,187,51,49,35,219,234,29,44,172,166,247,42,16,177,187,9,162,81,243,33,26,100,46,78,57,203,135>>}}). + <<2,129,128,124,66,0,111,121,139,142,209,95,136,95,237,177,150,248,252,49,135,117,100,155,232,138,244,132,89,40,5,70,125,202,96,78,239,76,37,125,149,82,64,107,54,227,73,25,180,227,41,0,234,73,47,80,242,242,129,250,61,68,62,39,38,156,193,146,40,241,247,106,215,223,202,194,110,130,62,186,90,18,28,196,174,99,47,193,61,130,100,150,25,248,115,164,231,153,99,46,69,66,139,33,187,51,49,35,219,234,29,44,172,166,247,42,16,177,187,9,162,81,243,33,26,100,46,78,57,203,135>>}}). diff --git a/lib/asn1/test/testChoOptional.erl b/lib/asn1/test/testChoOptional.erl index 61a1955d28..cbb8134e51 100644 --- a/lib/asn1/test/testChoOptional.erl +++ b/lib/asn1/test/testChoOptional.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,29 +19,16 @@ %% -module(testChoOptional). - --export([compile/3]). -export([optional/1]). %-include("ChoOptional.hrl"). -include_lib("test_server/include/test_server.hrl"). -include("External.hrl"). - -record('Seq1',{bool, int = asn1_NOVALUE, cho = asn1_NOVALUE}). -record('Seq2',{int = asn1_NOVALUE, cho = asn1_NOVALUE, bool}). -record('Seq3',{cho = asn1_NOVALUE, int = asn1_NOVALUE, bool}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "ChoOptional",[Rules,{outdir,OutDir}]++Options). - - - optional(_Rules) -> ?line {ok,Bytes11} = asn1_wrapper:encode('ChoOptional','Seq1',#'Seq1'{bool = true}), diff --git a/lib/asn1/test/testChoOptionalImplicitTag.erl b/lib/asn1/test/testChoOptionalImplicitTag.erl index e28353cb5a..efe335cabd 100644 --- a/lib/asn1/test/testChoOptionalImplicitTag.erl +++ b/lib/asn1/test/testChoOptionalImplicitTag.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,28 +20,16 @@ -module(testChoOptionalImplicitTag). --export([compile/2]). -export([optional/1]). %-include("ChoOptional.hrl"). -include_lib("test_server/include/test_server.hrl"). -include("External.hrl"). - -record('Seq1',{bool, int = asn1_NOVALUE, cho = asn1_NOVALUE}). -record('Seq2',{int = asn1_NOVALUE, cho = asn1_NOVALUE, bool}). -record('Seq3',{cho = asn1_NOVALUE, int = asn1_NOVALUE, bool}). - -compile(Config,Rules) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "ChoOptionalImplicitTag",[Rules,{outdir,OutDir}]). - - - optional(_Rules) -> ?line {ok,Bytes11} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq1',#'Seq1'{bool = true}), diff --git a/lib/asn1/test/testChoRecursive.erl b/lib/asn1/test/testChoRecursive.erl index 36e23e2e03..22be26cbce 100644 --- a/lib/asn1/test/testChoRecursive.erl +++ b/lib/asn1/test/testChoRecursive.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,7 +20,6 @@ -module(testChoRecursive). --export([compile/3]). -export([recursive/1]). -include_lib("test_server/include/test_server.hrl"). @@ -28,16 +27,6 @@ -record('ChoRec_something',{a, b, c}). -record('ChoRec2_something',{a, b, c}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "ChoRecursive",[Rules,{outdir,OutDir}]++Options). - - - recursive(_Rules) -> ?line {ok,Bytes11} = asn1_wrapper:encode('ChoRecursive','ChoRec',{'ChoRec',{something, diff --git a/lib/asn1/test/testChoTypeRefCho.erl b/lib/asn1/test/testChoTypeRefCho.erl index f381d9078d..9bd732f462 100644 --- a/lib/asn1/test/testChoTypeRefCho.erl +++ b/lib/asn1/test/testChoTypeRefCho.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,22 +19,10 @@ %% -module(testChoTypeRefCho). --export([compile/3]). -export([choice/1]). -include_lib("test_server/include/test_server.hrl"). - - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "ChoTypeRefCho",[Rules,{outdir,OutDir}]++Options). - - - choice(_Rules) -> ?line {ok,Bytes11} = asn1_wrapper:encode('ChoTypeRefCho','ChoTRcho',{choCho,{choInt,88}}), diff --git a/lib/asn1/test/testChoTypeRefPrim.erl b/lib/asn1/test/testChoTypeRefPrim.erl index 8fb9ed9f02..edef6192fe 100644 --- a/lib/asn1/test/testChoTypeRefPrim.erl +++ b/lib/asn1/test/testChoTypeRefPrim.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,22 +19,10 @@ %% -module(testChoTypeRefPrim). --export([compile/3]). -export([prim/1]). -include_lib("test_server/include/test_server.hrl"). - - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "ChoTypeRefPrim",[Rules,{outdir,OutDir}]++Options). - - - prim(_Rules) -> ?line {ok,Bytes11} = asn1_wrapper:encode('ChoTypeRefPrim','ChoTR',{bool,true}), diff --git a/lib/asn1/test/testChoTypeRefSeq.erl b/lib/asn1/test/testChoTypeRefSeq.erl index 45d6209e79..bf2b66c73e 100644 --- a/lib/asn1/test/testChoTypeRefSeq.erl +++ b/lib/asn1/test/testChoTypeRefSeq.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testChoTypeRefSeq). --export([compile/3]). -export([seq/1]). -include_lib("test_server/include/test_server.hrl"). @@ -28,16 +27,6 @@ -record('ChoSeqImp',{seqInt, seqOs}). -record('ChoSeqExp',{seqInt, seqOs}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "ChoTypeRefSeq",[Rules,{outdir,OutDir}]++Options). - - - seq(_Rules) -> ?line {ok,Bytes1} = diff --git a/lib/asn1/test/testChoTypeRefSet.erl b/lib/asn1/test/testChoTypeRefSet.erl index 9869549d7a..8a3e8bdbb0 100644 --- a/lib/asn1/test/testChoTypeRefSet.erl +++ b/lib/asn1/test/testChoTypeRefSet.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testChoTypeRefSet). --export([compile/3]). -export([set/1]). -include_lib("test_server/include/test_server.hrl"). @@ -28,16 +27,6 @@ -record('ChoSetImp',{setInt, setOs}). -record('ChoSetExp',{setInt, setOs}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "ChoTypeRefSet",[Rules,{outdir,OutDir}]++Options). - - - set(_Rules) -> ?line {ok,Bytes1} = diff --git a/lib/asn1/test/testChoiceIndefinite.erl b/lib/asn1/test/testChoiceIndefinite.erl index e5f3ee51c8..630efcf27a 100644 --- a/lib/asn1/test/testChoiceIndefinite.erl +++ b/lib/asn1/test/testChoiceIndefinite.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% Copyright Ericsson AB 2002-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,20 +19,10 @@ %% -module(testChoiceIndefinite). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "ChoiceIndef", - [Rules,{outdir,OutDir}]++Options). - main(per_bin) -> ok; main(per) -> ok; main(ber_bin_v2) -> @@ -50,6 +40,3 @@ main(ber) -> ?line {ok,V} = asn1_wrapper:decode('ChoiceIndef','Seq',B), ?line {ok,V} = asn1_wrapper:decode('ChoiceIndef','Seq',Bi), ok. - - - diff --git a/lib/asn1/test/testCompactBitString.erl b/lib/asn1/test/testCompactBitString.erl index 15818eaf5c..9563a31bf3 100644 --- a/lib/asn1/test/testCompactBitString.erl +++ b/lib/asn1/test/testCompactBitString.erl @@ -19,19 +19,11 @@ %% -module(testCompactBitString). --export([compile/2]). -export([compact_bit_string/1, bit_string_unnamed/1,otp_4869/1, ticket_7734/1]). -include_lib("test_server/include/test_server.hrl"). -compile(Config, Options) -> - asn1_test_lib:compile("PrimStrings", Config, Options), - case lists:member(per_bin, Options) of - true -> asn1_test_lib:compile("Constraints", Config, Options); - _ -> ok - end. - compact_bit_string(Rules) -> %%========================================================== diff --git a/lib/asn1/test/testDef.erl b/lib/asn1/test/testDef.erl index 7942a358be..48f0015008 100644 --- a/lib/asn1/test/testDef.erl +++ b/lib/asn1/test/testDef.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testDef). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -37,16 +36,6 @@ bool32 = asn1_DEFAULT, bool33 = asn1_DEFAULT}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "Def",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = asn1_wrapper:encode('Def','Def1',#'Def1'{bool0 = true, diff --git a/lib/asn1/test/testParamBasic.erl b/lib/asn1/test/testParamBasic.erl index 507aa07112..b5780195b8 100644 --- a/lib/asn1/test/testParamBasic.erl +++ b/lib/asn1/test/testParamBasic.erl @@ -19,7 +19,6 @@ %% -module(testParamBasic). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -29,15 +28,6 @@ -record('T21',{number, string}). -record('T22',{number, string}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "ParamBasic", - [Rules,{outdir,OutDir}]++Options). - main(Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testPrimStrings.erl b/lib/asn1/test/testPrimStrings.erl index 33652d6554..b1c5172b95 100644 --- a/lib/asn1/test/testPrimStrings.erl +++ b/lib/asn1/test/testPrimStrings.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testPrimStrings). --export([compile/3]). -export([bit_string/1]). -export([bit_string_unnamed/1]). -export([octet_string/1]). @@ -33,22 +32,6 @@ -include_lib("test_server/include/test_server.hrl"). - -compile(Config,Rules,Option) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "PrimStrings", - [Rules,{outdir,OutDir}]++Option), - ?line {ok,IO} = file:open(test_config,write), - io:format(IO,"~p.~n",[Config]), - file:close(IO), - ?line ok = asn1ct:compile(DataDir ++ "BitStr", - [Rules, {outdir,OutDir}]++Option). - - - bit_string(Rules) -> %%========================================================== diff --git a/lib/asn1/test/testRANAP.erl b/lib/asn1/test/testRANAP.erl deleted file mode 100644 index 7c1a02adf1..0000000000 --- a/lib/asn1/test/testRANAP.erl +++ /dev/null @@ -1,50 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2012. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(testRANAP). - --export([compile/2,testobj/1]). - --include_lib("test_server/include/test_server.hrl"). - - -compile(Config, Options) -> - asn1_test_lib:compile("RANAP", Config, Options), - DataDir = ?config(data_dir,Config), - CaseDir = ?config(case_dir,Config), - {ok,testobj} = compile:file(filename:join(DataDir,"testobj"),[{i,CaseDir},{outdir,CaseDir}]++Options), - ok. - -testobj(_Erule) -> - ?line ok = testobj:run_com_id(), - ?line ok = testobj:run_dir_tsf_2cn(), - ?line ok = testobj:run_dir_tsf_2rnc(), - ?line ok = testobj:run_init_ue(), - ?line ok = testobj:run_iu_rel_cmd(), - ?line ok = testobj:run_iu_rel_cmp(), - ?line ok = testobj:run_rab_ass_rsp_delete(), - ?line ok = testobj:run_rab_ass_rsp_setup(), - ?line ok = testobj:run_rab_create(), - ?line ok = testobj:run_rab_rel(), - ?line ok = testobj:run_reset(), - ?line ok = testobj:run_reset_res(), - ?line ok = testobj:run_sm_cmd(), - ?line ok = testobj:run_sm_cmp(), - ?line ok = testobj:run_sm_rej(). diff --git a/lib/asn1/test/testSeqOf.erl b/lib/asn1/test/testSeqOf.erl index 961e2d89d9..0c0bbc3e66 100644 --- a/lib/asn1/test/testSeqOf.erl +++ b/lib/asn1/test/testSeqOf.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testSeqOf). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -35,18 +34,6 @@ -record('SeqEmp',{seq1}). -record('Empty',{}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SeqOf",[Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "SeqOfEnum",[Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "XSeqOf",[Rules,{outdir,OutDir}]++Options). - - - main(Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSeqOfCho.erl b/lib/asn1/test/testSeqOfCho.erl index 05bd45580f..5b83c8bf21 100644 --- a/lib/asn1/test/testSeqOfCho.erl +++ b/lib/asn1/test/testSeqOfCho.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testSeqOfCho). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -31,17 +30,6 @@ -record('SeqOfChoEmbDef_SEQOF',{bool1, int1, seq1 = asn1_DEFAULT}). -record('SeqOfChoEmbOpt_SEQOF',{bool1, int1, seq1 = asn1_NOVALUE}). - - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SeqOfCho",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSeqOfIndefinite.erl b/lib/asn1/test/testSeqOfIndefinite.erl index 0221581cf1..01ef36e0b4 100644 --- a/lib/asn1/test/testSeqOfIndefinite.erl +++ b/lib/asn1/test/testSeqOfIndefinite.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,42 +19,10 @@ %% -module(testSeqOfIndefinite). --export([compile/3]). -export([main/0]). -include_lib("test_server/include/test_server.hrl"). -%-record('Seq1',{bool1, int1, seq1 = asn1_DEFAULT}). -%-record('Seq2',{seq2 = asn1_DEFAULT, bool2, int2}). -%-record('Seq3',{bool3, seq3 = asn1_DEFAULT, int3}). -%-record('Seq4',{seq41 = asn1_DEFAULT, seq42 = asn1_DEFAULT, seq43 = asn1_DEFAULT}). -%-record('SeqIn',{boolIn, intIn}). -%-record('SeqCho',{bool1, int1, seq1 = asn1_DEFAULT}). -%-record('SeqChoInline',{bool1, int1, seq1 = asn1_DEFAULT}). -%-record('SeqChoOfInline_SEQOF',{bool1, int1, seq1 = asn1_DEFAULT}). -%-record('SeqEmp',{seq1}). -%-record('Empty',{}). - - - -compile(Config,Rules,Opts) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line Options = [Rules,{outdir,OutDir}]++Opts, - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-Constants-1",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-DataTypes-1",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-21-4",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-20-4",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-19-4",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-18-4",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-17-4",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-15-4",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-14-4",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-11-4",Options), - ?line ok = asn1ct:compile(DataDir ++ "SeqOf",Options). - main() -> ?line ok = test(isd), ?line ok = test(isd2), diff --git a/lib/asn1/test/testSeqOfTag.erl b/lib/asn1/test/testSeqOfTag.erl index 4f56ab717b..2359df0c59 100644 --- a/lib/asn1/test/testSeqOfTag.erl +++ b/lib/asn1/test/testSeqOfTag.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,8 +19,6 @@ %% -module(testSeqOfTag). - --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -45,17 +43,6 @@ -record('Imp',{os, bool}). -record('Exp',{os, bool}). - - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SeqOfTag",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSeqOptional.erl b/lib/asn1/test/testSeqOptional.erl index 0125c9fb3e..8013f3c685 100644 --- a/lib/asn1/test/testSeqOptional.erl +++ b/lib/asn1/test/testSeqOptional.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,7 +20,6 @@ -module(testSeqOptional). -include("External.hrl"). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -37,16 +36,6 @@ -record('SeqIn',{boolIn, intIn}). -record('SeqChoOpt',{int, cho = asn1_NOVALUE}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SeqOptional",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSeqPrim.erl b/lib/asn1/test/testSeqPrim.erl index ec48d1b779..c2451a7cd1 100644 --- a/lib/asn1/test/testSeqPrim.erl +++ b/lib/asn1/test/testSeqPrim.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testSeqPrim). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -27,15 +26,6 @@ -record('Seq',{bool, boolCon, boolPri, boolApp, boolExpCon, boolExpPri, boolExpApp}). -record('Empty',{}). -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SeqPrim",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> diff --git a/lib/asn1/test/testSeqTypeRefCho.erl b/lib/asn1/test/testSeqTypeRefCho.erl index 9262fd1bfd..4b9eac7034 100644 --- a/lib/asn1/test/testSeqTypeRefCho.erl +++ b/lib/asn1/test/testSeqTypeRefCho.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testSeqTypeRefCho). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -27,16 +26,6 @@ -record('SeqTRcho',{seqCho, seqChoE, 'seqCho-E', 'seqChoE-E'}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SeqTypeRefCho",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> diff --git a/lib/asn1/test/testSetExternal.erl b/lib/asn1/test/testSetExternal.erl index 41f32dcd90..30cddcacfb 100644 --- a/lib/asn1/test/testSetExternal.erl +++ b/lib/asn1/test/testSetExternal.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,7 +20,6 @@ -module(testSetExternal). -include("External.hrl"). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -33,17 +32,6 @@ %-record('Imp',{os, bool}). %-record('Exp',{os, bool}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SetExternal", - [Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSetOptional.erl b/lib/asn1/test/testSetOptional.erl index 035fa70424..4692941524 100644 --- a/lib/asn1/test/testSetOptional.erl +++ b/lib/asn1/test/testSetOptional.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,7 +20,6 @@ -module(testSetOptional). -include("External.hrl"). --export([compile/3]). -export([main/1]). -export([ticket_7533/1,decoder/4]). -include_lib("test_server/include/test_server.hrl"). @@ -36,16 +35,6 @@ -record('SetOpt3Exp',{bool3 = asn1_NOVALUE, set3 = asn1_NOVALUE, int3 = asn1_NOVALUE}). -record('SetIn',{boolIn, intIn}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SetOptional",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = @@ -204,9 +193,8 @@ ticket_7533(Ber) when Ber == ber; Ber == ber_bin -> io:format("Decode result: ~p~n",[Result]), ok after 10000 -> - exit(Pid,normal), io:format("Decode timeout~n",[]), - error + exit(Pid,normal) end; ticket_7533(_) -> ok. diff --git a/lib/asn1/test/testSetPrim.erl b/lib/asn1/test/testSetPrim.erl index e093c918e3..3234b65135 100644 --- a/lib/asn1/test/testSetPrim.erl +++ b/lib/asn1/test/testSetPrim.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testSetPrim). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -27,15 +26,6 @@ -record('Set',{bool, boolCon, boolPri, boolApp, boolExpCon, boolExpPri, boolExpApp}). -record('Empty',{}). -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SetPrim",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> diff --git a/lib/asn1/test/testSetTag.erl b/lib/asn1/test/testSetTag.erl index 8df3e36815..8b9364d603 100644 --- a/lib/asn1/test/testSetTag.erl +++ b/lib/asn1/test/testSetTag.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,6 @@ %% -module(testSetTag). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -35,16 +34,6 @@ -record('Imp',{os, bool}). -record('Exp',{os, bool}). - -compile(Config,Rules,Options) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(DataDir ++ "SetTag",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> diff --git a/lib/asn1/test/testTCAP.erl b/lib/asn1/test/testTCAP.erl index f4e80ecd3b..878ce7c070 100644 --- a/lib/asn1/test/testTCAP.erl +++ b/lib/asn1/test/testTCAP.erl @@ -29,12 +29,13 @@ compile(Config, Options) -> "TCAPMessages-simple", "TCAPPackage"], asn1_test_lib:compile_all(Files, Config, Options), - DataDir = ?config(data_dir,Config), - CaseDir = ?config(case_dir,Config), - compile:file(filename:join([DataDir,"TCAPPackage_msg"]),[{i,CaseDir},{outdir,CaseDir}]). + asn1_test_lib:compile_erlang("TCAPPackage_msg", Config, []). compile_asn1config(Config, Options) -> - asn1_test_lib:compile("TCAPPackage", Config, Options). + Files = ["Remote-Operations-Information-Objects", + "TCAPPackage"], + asn1_test_lib:compile_all(Files, Config, Options), + asn1_test_lib:compile_erlang("TCAPPackage_msg", Config, []). test(Erule,_Config) when Erule==ber;Erule==ber_bin;Erule==ber_bin_v2 -> % ?line OutDir = ?config(priv_dir,Config), diff --git a/lib/asn1/test/testTimer.erl b/lib/asn1/test/testTimer.erl index 74002e16e9..2d3b777558 100644 --- a/lib/asn1/test/testTimer.erl +++ b/lib/asn1/test/testTimer.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% Copyright Ericsson AB 2001-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -26,12 +26,6 @@ -define(times, 5000). -compile(Config,Enc,Options) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ok = asn1ct:compile(DataDir++"H235-SECURITY-MESSAGES",[Enc,{outdir,OutDir}]++Options), - ok = asn1ct:compile(DataDir++"H323-MESSAGES",[Enc,{outdir,OutDir}]++Options). - val() -> _Value = {'H323-UserInformation',{'H323-UU-PDU', {callProceeding, diff --git a/lib/asn1/test/testTypeValueNotation.erl b/lib/asn1/test/testTypeValueNotation.erl index d2ef1216e2..cd5223ef23 100644 --- a/lib/asn1/test/testTypeValueNotation.erl +++ b/lib/asn1/test/testTypeValueNotation.erl @@ -23,42 +23,39 @@ -include_lib("test_server/include/test_server.hrl"). --record('Seq',{octstr, int, bool, enum, bitstr, null, oid, vstr}). +-record('Seq', {octstr, int, bool, enum, bitstr, null, oid, vstr}). -main(Rules,Option) -> +main(Rule, Option) -> + Value1 = #'Seq'{octstr = [1, 2, 3, 4], + int = 12, + bool = true, + enum = a, + bitstr = [1, 0, 1, 0], + null = 'NULL', + oid = {1, 2, 55}, + vstr = "Hello World"}, + Value2 = #'Seq'{octstr = {'OctStr', [1, 2, 3, 4]}, + int = {'Int', 12}, + bool = {'Bool', true}, + enum = {'Enum', a}, + bitstr = {'BitStr', [1, 0, 1, 0]}, + null = {'Null', 'NULL'}, + oid = {'OId', {1, 2, 55}}, + vstr = {'VStr', "Hello World"}}, + main(Rule, Option, Value1, Value2). - io:format("testTypeValueNotation:main/2 with arguments:~nRules: ~w, Option: ~w~n",[Rules,Option]), - Value1 = #'Seq'{octstr = [1,2,3,4], - int = 12, - bool = true, - enum = a, - bitstr = [1,0,1,0], - null = 'NULL', - oid = {1,2,55}, - vstr = "Hello World"}, - Value2 = #'Seq'{octstr = {'OctStr',[1,2,3,4]}, - int = {'Int',12}, - bool = {'Bool',true}, - enum = {'Enum',a}, - bitstr = {'BitStr',[1,0,1,0]}, - null = {'Null','NULL'}, - oid = {'OId',{1,2,55}}, - vstr = {'VStr',"Hello World"}}, - case Option of - optimize when Rules == per_bin; Rules == ber_bin ; Rules == uper_bin; Rules == ber_bin_v2 -> - ?line {ok,Bytes} = - asn1_wrapper:encode('SeqTypeRefPrim','Seq',Value1), - ?line {error,_Reason} = - asn1_wrapper:encode('SeqTypeRefPrim','Seq',Value2), - ?line {ok,Value1} = - asn1_wrapper:decode('SeqTypeRefPrim','Seq',Bytes); - _ -> - ?line {ok,Bytes} = - asn1_wrapper:encode('SeqTypeRefPrim','Seq',Value1), - ?line {ok,Bytes} = - asn1_wrapper:encode('SeqTypeRefPrim','Seq',Value2), - ?line {ok,Value1} = - asn1_wrapper:decode('SeqTypeRefPrim','Seq',Bytes) - end, +%% Value2 will fail for ber_bin_v2, per_bin with nifs (optimize) and uper_bin +main(ber_bin_v2, _, Value1, Value2) -> encode_fail(Value1, Value2); +main(per_bin, [optimize], Value1, Value2) -> encode_fail(Value1, Value2); +main(uper_bin, [], Value1, Value2) -> encode_fail(Value1, Value2); +main(_, _, Value1, Value2) -> encode_normal(Value1, Value2). - ok. +encode_normal(Value1, Value2) -> + {ok, Bytes} = asn1_wrapper:encode('SeqTypeRefPrim', 'Seq', Value1), + {ok, Bytes} = asn1_wrapper:encode('SeqTypeRefPrim', 'Seq', Value2), + {ok, Value1} = asn1_wrapper:decode('SeqTypeRefPrim', 'Seq', Bytes). + +encode_fail(Value1, Value2) -> + {ok, Bytes} = asn1_wrapper:encode('SeqTypeRefPrim', 'Seq', Value1), + {error, _Reason} = asn1_wrapper:encode('SeqTypeRefPrim', 'Seq', Value2), + {ok, Value1} = asn1_wrapper:decode('SeqTypeRefPrim', 'Seq', Bytes). diff --git a/lib/asn1/test/test_bad_values.erl b/lib/asn1/test/test_bad_values.erl deleted file mode 100644 index d379a509ab..0000000000 --- a/lib/asn1/test/test_bad_values.erl +++ /dev/null @@ -1,29 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2010. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% -%% --module(test_bad_values). - --export([tests/1]). --include_lib("test_server/include/test_server.hrl"). - -tests(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line {error,_R} = asn1ct:compile(DataDir ++ "BadEnumValue1",[{outdir,OutDir}]), - ok. diff --git a/lib/asn1/test/test_modified_x420.erl b/lib/asn1/test/test_modified_x420.erl index 5a4b529375..2e9dfeee87 100644 --- a/lib/asn1/test/test_modified_x420.erl +++ b/lib/asn1/test/test_modified_x420.erl @@ -20,15 +20,10 @@ -module(test_modified_x420). %-compile(export_all). --export([compile/1, test_io/1]). +-export([test_io/1]). -include_lib("test_server/include/test_server.hrl"). -compile(Config) -> - [asn1_test_lib:compile(filename:join([modified_x420,M]), Config, [der]) - || M <- ["PKCS7", "InformationFramework", "AuthenticationFramework"]], - ok. - test_io(Config) -> io:format("~p~n~n", [catch test(Config)]). diff --git a/lib/asn1/test/test_undecoded_rest.erl b/lib/asn1/test/test_undecoded_rest.erl index 0c248a840a..36fd26ed59 100644 --- a/lib/asn1/test/test_undecoded_rest.erl +++ b/lib/asn1/test/test_undecoded_rest.erl @@ -27,31 +27,27 @@ %% testing OTP-5104 test(Opt, Config) -> - ?line {ok,Msg} = asn1ct:value('P-Record','PersonnelRecord', - [{i, ?config(case_dir, Config)}]), - ?line {ok,Bytes} = asn1_wrapper:encode('P-Record','PersonnelRecord',Msg), - Bytes2 = - fun(B) when is_list(B) -> - B ++ [55,55,55]; - (B) when is_binary(B) -> - iolist_to_binary([B,<<55,55,55>>]) - end (Bytes), - + {ok, Msg} = asn1ct:value('P-Record', 'PersonnelRecord', + [{i, ?config(case_dir, Config)}]), + {ok, Bytes} = asn1_wrapper:encode('P-Record', 'PersonnelRecord', Msg), + Bytes2 = if is_list(Bytes) -> + Bytes ++ [55, 55, 55]; + is_binary(Bytes) -> + iolist_to_binary([Bytes, <<55, 55, 55>>]) + end, case Opt of - undec_rest -> - ?line {ok,Msg,R}=asn1_wrapper:decode('P-Record','PersonnelRecord', - Bytes2), - ?line case R of - <<55,55,55>> ->ok; - [55,55,55] -> ok; - BStr when is_bitstring(BStr) -> - PadLen = (8 - (bit_size(BStr) rem 8)) rem 8, - case <<0:PadLen,BStr/bitstring>> of - <<0,55,55,55>> -> ok - end - end; - _ -> - ?line {ok,Msg} = asn1_wrapper:decode('P-Record','PersonnelRecord', - Bytes2) + undec_rest -> + {ok, Msg, R} = asn1_wrapper:decode('P-Record', 'PersonnelRecord', + Bytes2), + case R of + <<55, 55, 55>> -> ok; + [55, 55, 55] -> ok; + BStr when is_bitstring(BStr) -> + PadLen = (8 - (bit_size(BStr) rem 8)) rem 8, + <<0, 55, 55, 55>> = <<0:PadLen, BStr/bitstring>> + end; + _ -> + {ok, Msg} = asn1_wrapper:decode('P-Record', 'PersonnelRecord', + Bytes2) end, ok. diff --git a/lib/asn1/test/test_x691.erl b/lib/asn1/test/test_x691.erl index 6355c30cc2..dcfa211d80 100644 --- a/lib/asn1/test/test_x691.erl +++ b/lib/asn1/test/test_x691.erl @@ -19,16 +19,10 @@ %% -module(test_x691). --export([compile/2]). -export([cases/2]). -include_lib("test_server/include/test_server.hrl"). -compile(Config, Options) -> - asn1_test_lib:compile_all(["P-RecordA1", "P-RecordA2", "P-RecordA3"], - Config, Options). - - cases(Erule,Variant) -> MsgA1 = a1(), ?line {ok,B1} = asn1_wrapper:encode('P-RecordA1','PersonnelRecord',MsgA1), |