diff options
Diffstat (limited to 'lib/asn1/test')
111 files changed, 2182 insertions, 4259 deletions
diff --git a/lib/asn1/test/Makefile b/lib/asn1/test/Makefile index 7ecd544d4b..6e6374baf1 100644 --- a/lib/asn1/test/Makefile +++ b/lib/asn1/test/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2011. 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 @@ -28,11 +28,10 @@ MODULES= \ h323test \ choice_extension \ ber_decode_error \ - testExternal \ testPrim \ - testPrimStrings \ + testPrimStrings \ testCompactBitString \ - testPrimExternal \ + testPrimExternal \ testChoPrim \ testChoExtension \ testChoExternal \ @@ -86,15 +85,12 @@ MODULES= \ testMergeCompile \ testDeepTConstr \ testTimer \ - testRANAP \ testMegaco \ - testMvrasn6 \ testSeqSetDefaultVal \ testParamBasic \ testContextSwitchingTypes \ testTypeValueNotation \ testOpenTypeImplicitTag \ - testROSE \ testINSTANCE_OF \ test_partial_incomplete_decode \ testDER \ @@ -108,7 +104,6 @@ MODULES= \ test_inline \ testTcapsystem \ testNBAPsystem \ - test_bad_values \ test_compile_options \ testDoubleEllipses \ test_modified_x420 \ @@ -118,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) @@ -156,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) - 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) - 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) - 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 # ---------------------------------------------------- @@ -188,17 +156,13 @@ include $(ERL_TOP)/make/otp_release_targets.mk 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 + $(INSTALL_DIR) "$(RELSYSDIR)" + $(INSTALL_DIR) "$(RELSYSDIR)/asn1_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" + rm "$(RELSYSDIR)/asn1_SUITE_data.tar" release_docs_spec: diff --git a/lib/asn1/test/asn1.cover b/lib/asn1/test/asn1.cover index 589a8b7e3d..ad3a0f3db9 100644 --- a/lib/asn1/test/asn1.cover +++ b/lib/asn1/test/asn1.cover @@ -1,2 +1,3 @@ {incl_app,asn1,details}. +{excl_mods, asn1, [asn1rt_nif]}.
\ No newline at end of file diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl new file mode 100644 index 0000000000..12569273bd --- /dev/null +++ b/lib/asn1/test/asn1_SUITE.erl @@ -0,0 +1,1541 @@ +%% %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]}, + {timetrap,{minutes,60}}]. + +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), + + [{case_dir, CaseDir}|Config]. + +end_per_testcase(_Func, Config) -> + code:del_path(?config(case_dir, 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]), + asn1_test_lib:compile("LargeConstraints", 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) -> + test(Config, fun test_modified_x420/3, + [ber,ber_bin,ber_bin_v2,{ber_bin_v2,[nif]}]). +test_modified_x420(Config, Rule, Opts) -> + Files = [filename:join(modified_x420, F) || F <- ["PKCS7", + "InformationFramework", + "AuthenticationFramework"]], + asn1_test_lib:compile_all(Files, Config, [Rule,der|Opts]), + test_modified_x420:test(Config). + + +testX420() -> + [{timetrap,{minutes,90}}]. +testX420(Config) -> + case erlang:system_info(system_architecture) of + "sparc-sun-solaris2.10" -> + {skip,"Too slow for an old Sparc"}; + _ -> + test(Config, fun testX420/3, [ber, ber_bin, ber_bin_v2]) + end. +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]), + extensionAdditionGroup:run3(), + 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), + + %% OTP-10144 + %% Test that n2n option generates name2num and num2name functions supporting + %% values not within the extension root if the enumeration type has an + %% extension marker. + N2NOptionsExt = [{n2n, 'NoExt'}, {n2n, 'Ext'}, {n2n, 'Ext2'}], + asn1_test_lib:compile("EnumN2N", Config, N2NOptionsExt), + %% Previously, name2num and num2name was not generated if the type didn't + %% have an extension marker: + 0 = 'EnumN2N':name2num_NoExt('blue'), + 2 = 'EnumN2N':name2num_NoExt('green'), + blue = 'EnumN2N':num2name_NoExt(0), + green = 'EnumN2N':num2name_NoExt(2), + + %% Test enumeration extension: + 7 = 'EnumN2N':name2num_Ext2('orange'), + orange = 'EnumN2N':num2name_Ext2(7), + %% 7 is not defined in Ext, only in Ext2. + {asn1_enum, 7} = 'EnumN2N':num2name_Ext(7), + 7 = 'EnumN2N':name2num_Ext({asn1_enum, 7}), + 42 = 'EnumN2N':name2num_Ext2({asn1_enum, 42}), + 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 e7f93a4053..0000000000 --- a/lib/asn1/test/asn1_SUITE.erl.src +++ /dev/null @@ -1,2376 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-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% -%% -%% -%%% Purpose : Test suite for the ASN.1 application - --module(asn1_%BIN%SUITE). --define(PER,'%PER%'). --define(BER,'%BER%'). --define(ber_driver(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; -% _ -> {skip,"only for bit optimized per_bin"} - _ -> 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}). - -%-record('Def2',{ -%bool10, bool11 = asn1_DEFAULT, bool12 = asn1_DEFAULT, bool13}). - -%-record('Def3',{ -%bool30 = asn1_DEFAULT, bool31 = asn1_DEFAULT, bool32 = asn1_DEFAULT, bool33 = asn1_DEFAULT}). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> [{group,compile},parse,default_per,default_ber,default_per_opt,per, - {group,ber},testPrim, - testPrimStrings, testPrimExternal, testChoPrim, - testChoExtension, testChoExternal, testChoOptional, - testChoOptionalImplicitTag, testChoRecursive, - testChoTypeRefCho, testChoTypeRefPrim, testChoTypeRefSeq, - testChoTypeRefSet, testDef, testOpt, testSeqDefault, - testSeqExtension, testSeqExternal, testSeqOptional, - testSeqPrim, testSeqTag, testSeqTypeRefCho, - testSeqTypeRefPrim, testSeqTypeRefSeq, testSeqTypeRefSet, - testSeqOf, testSeqOfIndefinite, testSeqOfCho, - testSeqOfExternal, testSetDefault, testSetExtension, - testExtensionAdditionGroup, - testSetExternal, testSeqOfTag, testSetOptional, testSetPrim, - testSetTag, testSetTypeRefCho, testSetTypeRefPrim, - testSetTypeRefSeq, testSetTypeRefSet, testSetOf, testSetOfCho, - testSetOfExternal, testSetOfTag, testEnumExt, value_test, - testSeq2738, constructed, ber_decode_error, - h323test, testSeqIndefinite, testSetIndefinite, - testChoiceIndefinite, - per_GeneralString, per_open_type, testInfObjectClass, - testParameterizedInfObj, testMergeCompile, testobj, - testDeepTConstr, testConstraints, - testInvokeMod, testExport, testImport, testCompactBitString, - testMegaco, testParamBasic, testMvrasn6, - testContextSwitchingTypes, testTypeValueNotation, - testOpenTypeImplicitTag,duplicate_tags,rtUI,testROSE, - testINSTANCE_OF,testTCAP,testDER,specialized_decodes, - special_decode_performance,test_driver_load, - test_ParamTypeInfObj, test_WS_ParamClass, - test_Defed_ObjectIdentifier, testSelectionType, - testSSLspecs, testNortel,test_undecoded_rest, - test_inline, testTcapsystem, testNBAPsystem, - test_compile_options,testDoubleEllipses, test_modified_x420, - testX420, test_x691,ticket_6143, testExtensionAdditionGroup - ] ++ common() ++ particular(). - -groups() -> - [ - {compile, [], - [c_syntax, c_string_per, c_string_ber, - c_implicit_before_choice]}, - {ber, [], - [ber_choiceinseq, ber_optional, ber_optional_keyed_list, - ber_other]}, - {app_test, [], [{asn1_app_test, all}]}, - {appup_test, [], [{asn1_appup_test, all}]} - ]. - -init_per_suite(Config) -> - io:format("code:lib_dir(asn1) = ~p~n",[code:lib_dir(asn1)]), - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%all(suite) -> [test_inline,testNBAPsystem,test_compile_options,ticket_6143]. - - -init_per_testcase(Func,Config) -> - %%?line test_server:format("Func: ~p~n",[Func]), - ?line {ok, _} = file:read_file_info(filename:join([?config(priv_dir,Config)])), - ?line code:add_patha(?config(priv_dir,Config)), - Dog= - case Func of - testX420 -> - test_server:timetrap({minutes,60}); % 60 minutes - _ -> - test_server:timetrap({minutes,30}) % 60 minutes - end, -%% Dog=test_server:timetrap(1800000), % 30 minutes - [{watchdog, Dog}|Config]. - -end_per_testcase(_Func,Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog). - - -testPrim(suite) -> []; -testPrim(Config) -> - ?line testPrim:compile(Config,?BER,[]), - ?line testPrim_cases(?BER), - ?line ?ber_driver(?BER,testPrim:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testPrim_cases(?BER)), - ?line testPrim:compile(Config,?PER,[]), - ?line testPrim_cases(?PER), - ?line ?per_bit_opt(testPrim:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testPrim_cases(?PER)), - ?line ?uper_bin(testPrim:compile(Config,uper_bin,[])), - ?line ?uper_bin(testPrim_cases(uper_bin)), - ?line testPrim:compile(Config,?PER,[optimize]), - ?line testPrim_cases(?PER). - -testPrim_cases(Rules) -> - ?line testPrim:bool(Rules), - ?line testPrim:int(Rules), - ?line testPrim:enum(Rules), - ?line testPrim:obj_id(Rules), - ?line testPrim:rel_oid(Rules), - ?line testPrim:null(Rules), - ?line testPrim:real(Rules). - - -testCompactBitString(suite) -> []; -testCompactBitString(Config) -> - - ?line testCompactBitString:compile(Config,?BER,[compact_bit_string]), - ?line testCompactBitString:compact_bit_string(?BER), - - ?line ?ber_driver(?BER,testCompactBitString:compile(Config,?BER,[compact_bit_string,driver])), - ?line ?ber_driver(?BER,testCompactBitString:compact_bit_string(?BER)), - - ?line testCompactBitString:compile(Config,?PER,[compact_bit_string]), - ?line testCompactBitString:compact_bit_string(?PER), - ?line testCompactBitString:bit_string_unnamed(?PER), - - ?line ?per_bit_opt(testCompactBitString:compile(Config,?PER, - [compact_bit_string,optimize])), - ?line ?per_bit_opt(testCompactBitString:compact_bit_string(?PER)), - ?line ?per_bit_opt(testCompactBitString:bit_string_unnamed(?PER)), - ?line ?per_bit_opt(testCompactBitString:ticket_7734(?PER)), - - ?line ?uper_bin(testCompactBitString:compile(Config,uper_bin, - [compact_bit_string])), - ?line ?uper_bin(testCompactBitString:compact_bit_string(uper_bin)), - ?line ?uper_bin(testCompactBitString:bit_string_unnamed(uper_bin)), - - ?line testCompactBitString:compile(Config,?PER,[optimize,compact_bit_string]), - ?line testCompactBitString:compact_bit_string(?PER), - ?line testCompactBitString:bit_string_unnamed(?PER), - - ?line testCompactBitString:otp_4869(?PER). - - -testPrimStrings(suite) -> []; -testPrimStrings(Config) -> - - ?line testPrimStrings:compile(Config,?BER,[]), - ?line testPrimStrings_cases(?BER), - ?line testPrimStrings:more_strings(?BER), %% these are not implemented in per yet - ?line ?ber_driver(?BER,testPrimStrings:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testPrimStrings_cases(?BER)), - ?line ?ber_driver(?BER,testPrimStrings:more_strings(?BER)), - - ?line testPrimStrings:compile(Config,?PER,[]), - ?line testPrimStrings_cases(?PER), - - ?line ?per_bit_opt(testPrimStrings:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testPrimStrings_cases(?PER)), - - ?line ?uper_bin(testPrimStrings:compile(Config,uper_bin,[])), - ?line ?uper_bin(testPrimStrings_cases(uper_bin)), - - ?line testPrimStrings:compile(Config,?PER,[optimize]), - ?line testPrimStrings_cases(?PER). - -testPrimStrings_cases(Rules) -> - ?line testPrimStrings:bit_string(Rules), - ?line testPrimStrings:bit_string_unnamed(Rules), - ?line testPrimStrings:octet_string(Rules), - ?line testPrimStrings:numeric_string(Rules), - ?line testPrimStrings:other_strings(Rules), - ?line testPrimStrings:universal_string(Rules), - ?line testPrimStrings:bmp_string(Rules), - ?line testPrimStrings:times(Rules), - ?line testPrimStrings:utf8_string(Rules). - - - -testPrimExternal(suite) -> []; -testPrimExternal(Config) -> - - ?line testExternal:compile(Config,?BER,[]), - ?line testPrimExternal:compile(Config,?BER,[]), - ?line testPrimExternal_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testPrimExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testPrimExternal_cases(?BER)), - - ?line testExternal:compile(Config,?PER,[]), - ?line testPrimExternal:compile(Config,?PER,[]), - ?line testPrimExternal_cases(?PER), - - ?line ?per_bit_opt(testExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testPrimExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testPrimExternal_cases(?PER)), - - ?line ?uper_bin(testExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testPrimExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testPrimExternal_cases(uper_bin)), - - ?line testExternal:compile(Config,?PER,[optimize]), - ?line testPrimExternal:compile(Config,?PER,[optimize]), - ?line testPrimExternal_cases(?PER). - -testPrimExternal_cases(Rules) -> - ?line testPrimExternal:external(Rules). - - - - -testChoPrim(suite) -> []; -testChoPrim(Config) -> - - ?line testChoPrim:compile(Config,?BER,[]), - ?line testChoPrim_cases(?BER), - - ?line ?ber_driver(?BER,testChoPrim:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoPrim_cases(?BER)), - - ?line testChoPrim:compile(Config,?PER,[]), - ?line testChoPrim_cases(?PER), - - ?line ?per_bit_opt(testChoPrim:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoPrim_cases(?PER)), - - ?line ?uper_bin(testChoPrim:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoPrim_cases(uper_bin)), - - ?line testChoPrim:compile(Config,?PER,[optimize]), - ?line testChoPrim_cases(?PER). - -testChoPrim_cases(Rules) -> - ?line testChoPrim:bool(Rules), - ?line testChoPrim:int(Rules). - - - -testChoExtension(suite) -> []; -testChoExtension(Config) -> - - ?line testChoExtension:compile(Config,?BER,[]), - ?line testChoExtension_cases(?BER), - - ?line ?ber_driver(?BER,testChoExtension:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoExtension_cases(?BER)), - - ?line testChoExtension:compile(Config,?PER,[]), - ?line testChoExtension_cases(?PER), - - ?line ?per_bit_opt(testChoExtension:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoExtension_cases(?PER)), - - ?line ?uper_bin(testChoExtension:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoExtension_cases(uper_bin)), - - ?line testChoExtension:compile(Config,?PER,[optimize]), - ?line testChoExtension_cases(?PER). - -testChoExtension_cases(Rules) -> - ?line testChoExtension:extension(Rules). - - - -testChoExternal(suite) -> []; -testChoExternal(Config) -> - - ?line testExternal:compile(Config,?BER,[]), - ?line testChoExternal:compile(Config,?BER,[]), - ?line testChoExternal_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoExternal_cases(?BER)), - - ?line testExternal:compile(Config,?PER,[]), - ?line testChoExternal:compile(Config,?PER,[]), - ?line testChoExternal_cases(?PER), - - ?line ?per_bit_opt(testExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoExternal_cases(?PER)), - - ?line ?uper_bin(testExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoExternal_cases(uper_bin)), - - ?line testExternal:compile(Config,?PER,[optimize]), - ?line testChoExternal:compile(Config,?PER,[optimize]), - ?line testChoExternal_cases(?PER). - - -testChoExternal_cases(Rules) -> - ?line testChoExternal:external(Rules). - - - -testChoOptional(suite) -> []; -testChoOptional(Config) -> - - ?line testChoOptional:compile(Config,?BER,[]), - ?line testChoOptional_cases(?BER), - - ?line ?ber_driver(?BER,testChoOptional:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoOptional_cases(?BER)), - - ?line testChoOptional:compile(Config,?PER,[]), - ?line testChoOptional_cases(?PER), - - ?line ?per_bit_opt(testChoOptional:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoOptional_cases(?PER)), - - ?line ?uper_bin(testChoOptional:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoOptional_cases(uper_bin)), - - ?line testChoOptional:compile(Config,?PER,[optimize]), - ?line testChoOptional_cases(?PER). - -testChoOptional_cases(Rules) -> - ?line testChoOptional:optional(Rules). - -testChoOptionalImplicitTag(suite) -> []; -testChoOptionalImplicitTag(Config) -> - %% Only meaningful for ?BER - ?line testChoOptionalImplicitTag:compile(Config,?BER), - ?line testChoOptionalImplicitTag:optional(?BER). - - -testChoRecursive(suite) -> []; -testChoRecursive(Config) -> - - ?line testChoRecursive:compile(Config,?BER,[]), - ?line testChoRecursive_cases(?BER), - - ?line ?ber_driver(?BER,testChoRecursive:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoRecursive_cases(?BER)), - - ?line testChoRecursive:compile(Config,?PER,[]), - ?line testChoRecursive_cases(?PER), - - ?line ?per_bit_opt(testChoRecursive:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoRecursive_cases(?PER)), - - ?line ?uper_bin(testChoRecursive:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoRecursive_cases(uper_bin)), - - ?line testChoRecursive:compile(Config,?PER,[optimize]), - ?line testChoRecursive_cases(?PER). - -testChoRecursive_cases(Rules) -> - ?line testChoRecursive:recursive(Rules). - - - -testChoTypeRefCho(suite) -> []; -testChoTypeRefCho(Config) -> - - ?line testChoTypeRefCho:compile(Config,?BER,[]), - ?line testChoTypeRefCho_cases(?BER), - - ?line ?ber_driver(?BER,testChoTypeRefCho:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoTypeRefCho_cases(?BER)), - - ?line testChoTypeRefCho:compile(Config,?PER,[]), - ?line testChoTypeRefCho_cases(?PER), - - ?line ?per_bit_opt(testChoTypeRefCho:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoTypeRefCho_cases(?PER)), - - ?line ?uper_bin(testChoTypeRefCho:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoTypeRefCho_cases(uper_bin)), - - ?line testChoTypeRefCho:compile(Config,?PER,[optimize]), - ?line testChoTypeRefCho_cases(?PER). - -testChoTypeRefCho_cases(Rules) -> - ?line testChoTypeRefCho:choice(Rules). - - - -testChoTypeRefPrim(suite) -> []; -testChoTypeRefPrim(Config) -> - - ?line testChoTypeRefPrim:compile(Config,?BER,[]), - ?line testChoTypeRefPrim_cases(?BER), - - ?line ?ber_driver(?BER,testChoTypeRefPrim:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoTypeRefPrim_cases(?BER)), - - ?line testChoTypeRefPrim:compile(Config,?PER,[]), - ?line testChoTypeRefPrim_cases(?PER), - - ?line ?per_bit_opt(testChoTypeRefPrim:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoTypeRefPrim_cases(?PER)), - - ?line ?uper_bin(testChoTypeRefPrim:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoTypeRefPrim_cases(uper_bin)), - - ?line testChoTypeRefPrim:compile(Config,?PER,[optimize]), - ?line testChoTypeRefPrim_cases(?PER). - -testChoTypeRefPrim_cases(Rules) -> - ?line testChoTypeRefPrim:prim(Rules). - - - -testChoTypeRefSeq(suite) -> []; -testChoTypeRefSeq(Config) -> - - ?line testChoTypeRefSeq:compile(Config,?BER,[]), - ?line testChoTypeRefSeq_cases(?BER), - - ?line ?ber_driver(?BER,testChoTypeRefSeq:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoTypeRefSeq_cases(?BER)), - - ?line testChoTypeRefSeq:compile(Config,?PER,[]), - ?line testChoTypeRefSeq_cases(?PER), - - ?line ?per_bit_opt(testChoTypeRefSeq:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoTypeRefSeq_cases(?PER)), - - ?line ?uper_bin(testChoTypeRefSeq:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoTypeRefSeq_cases(uper_bin)), - - ?line testChoTypeRefSeq:compile(Config,?PER,[optimize]), - ?line testChoTypeRefSeq_cases(?PER). - -testChoTypeRefSeq_cases(Rules) -> - ?line testChoTypeRefSeq:seq(Rules). - - - -testChoTypeRefSet(suite) -> []; -testChoTypeRefSet(Config) -> - - ?line testChoTypeRefSet:compile(Config,?BER,[]), - ?line testChoTypeRefSet_cases(?BER), - - ?line ?ber_driver(?BER,testChoTypeRefSet:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoTypeRefSet_cases(?BER)), - - ?line testChoTypeRefSet:compile(Config,?PER,[]), - ?line testChoTypeRefSet_cases(?PER), - - ?line ?per_bit_opt(testChoTypeRefSet:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testChoTypeRefSet_cases(?PER)), - - ?line ?uper_bin(testChoTypeRefSet:compile(Config,uper_bin,[])), - ?line ?uper_bin(testChoTypeRefSet_cases(uper_bin)), - - ?line testChoTypeRefSet:compile(Config,?PER,[optimize]), - ?line testChoTypeRefSet_cases(?PER). - -testChoTypeRefSet_cases(Rules) -> - ?line testChoTypeRefSet:set(Rules). - - - -testDef(suite) -> []; -testDef(Config) -> - - ?line testDef:compile(Config,?BER,[]), - ?line testDef_cases(?BER), - - ?line ?ber_driver(?BER,testDef:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testDef_cases(?BER)), - - ?line testDef:compile(Config,?PER,[]), - ?line testDef_cases(?PER), - - ?line ?per_bit_opt(testDef:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testDef_cases(?PER)), - - ?line ?uper_bin(testDef:compile(Config,uper_bin,[])), - ?line ?uper_bin(testDef_cases(uper_bin)), - - ?line testDef:compile(Config,?PER,[optimize]), - ?line testDef_cases(?PER). - -testDef_cases(Rules) -> - ?line testDef:main(Rules). - - - -testOpt(suite) -> []; -testOpt(Config) -> - - ?line testOpt:compile(Config,?BER), - ?line testOpt_cases(?BER), - - ?line testOpt:compile(Config,?PER), - ?line testOpt_cases(?PER). - -testOpt_cases(Rules) -> - ?line testOpt:main(Rules). - - -testEnumExt(suite) -> []; -testEnumExt(Config) -> - - ?line testEnumExt:compile(Config,?BER,[]), - ?line testEnumExt:main(?BER), - - ?line ?ber_driver(?BER,testEnumExt:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testEnumExt:main(?BER)), - - ?line testEnumExt:compile(Config,?PER,[]), - ?line testEnumExt:main(?PER), - - ?line ?per_bit_opt(testEnumExt:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testEnumExt:main(?PER)), - - ?line ?uper_bin(testEnumExt:compile(Config,uper_bin,[])), - ?line ?uper_bin(testEnumExt:main(uper_bin)), - - ?line testEnumExt:compile(Config,?PER,[optimize]), - ?line testEnumExt:main(?PER). - -testSeqDefault(doc) -> ["Test of OTP-2523 ENUMERATED with extensionmark."]; -testSeqDefault(suite) -> []; -testSeqDefault(Config) -> - - ?line testSeqDefault:compile(Config,?BER,[]), - ?line testSeqDefault_cases(?BER), - - ?line ?ber_driver(?BER,testSeqDefault:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqDefault_cases(?BER)), - - ?line testSeqDefault:compile(Config,?PER,[]), - ?line testSeqDefault_cases(?PER), - - ?line ?per_bit_opt(testSeqDefault:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqDefault_cases(?PER)), - - ?line ?uper_bin(testSeqDefault:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqDefault_cases(uper_bin)), - - ?line testSeqDefault:compile(Config,?PER,[optimize]), - ?line testSeqDefault_cases(?PER). - -testSeqDefault_cases(Rules) -> - ?line testSeqDefault:main(Rules). - - - -testSeqExtension(suite) -> []; -testSeqExtension(Config) -> - - ?line testExternal:compile(Config,?BER,[]), - ?line testSeqExtension:compile(Config,?BER,[]), - ?line testSeqExtension_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqExtension:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqExtension_cases(?BER)). - -testSeqExtension_cases(Rules) -> - ?line testSeqExtension:main(Rules). - - - -testSeqExternal(suite) -> []; -testSeqExternal(Config) -> - - ?line testExternal:compile(Config,?BER,[]), - ?line testSeqExternal:compile(Config,?BER,[]), - ?line testSeqExternal_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqExternal_cases(?BER)). - -testSeqExternal_cases(Rules) -> - ?line testSeqExternal:main(Rules). - - -testSeqOptional(suite) -> []; -testSeqOptional(Config) -> - - ?line testSeqOptional:compile(Config,?BER,[]), - ?line testSeqOptional_cases(?BER), - - ?line ?ber_driver(?BER,testSeqOptional:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqOptional_cases(?BER)), - - ?line testSeqOptional:compile(Config,?PER,[]), - ?line testSeqOptional_cases(?PER), - - ?line ?per_bit_opt(testSeqOptional:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqOptional_cases(?PER)), - - ?line ?uper_bin(testSeqOptional:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqOptional_cases(uper_bin)), - - ?line testSeqOptional:compile(Config,?PER,[optimize]), - ?line testSeqOptional_cases(?PER). - -testSeqOptional_cases(Rules) -> - ?line testSeqOptional:main(Rules). - - - -testSeqPrim(suite) -> []; -testSeqPrim(Config) -> - - ?line testSeqPrim:compile(Config,?BER,[]), - ?line testSeqPrim_cases(?BER), - - ?line ?ber_driver(?BER,testSeqPrim:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqPrim_cases(?BER)), - - ?line testSeqPrim:compile(Config,?PER,[]), - ?line testSeqPrim_cases(?PER), - - ?line ?per_bit_opt(testSeqPrim:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqPrim_cases(?PER)), - - ?line ?uper_bin(testSeqPrim:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqPrim_cases(uper_bin)), - - ?line testSeqPrim:compile(Config,?PER,[optimize]), - ?line testSeqPrim_cases(?PER). - -testSeqPrim_cases(Rules) -> - ?line testSeqPrim:main(Rules). - - -testSeq2738(doc) -> ["Test of OTP-2738 Detect corrupt optional component."]; -testSeq2738(suite) -> []; -testSeq2738(Config) -> - - ?line testSeq2738:compile(Config,?BER,[]), - ?line testSeq2738_cases(?BER), - - ?line ?ber_driver(?BER,testSeq2738:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeq2738_cases(?BER)), - - ?line testSeq2738:compile(Config,?PER,[]), - ?line testSeq2738_cases(?PER), - - ?line ?per_bit_opt(testSeq2738:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeq2738_cases(?PER)), - - ?line ?uper_bin(testSeq2738:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeq2738_cases(uper_bin)), - - ?line testSeq2738:compile(Config,?PER,[optimize]), - ?line testSeq2738_cases(?PER). - -testSeq2738_cases(Rules) -> - ?line testSeq2738:main(Rules). - - -testSeqTag(suite) -> []; -testSeqTag(Config) -> - - ?line testExternal:compile(Config,?BER,[]), - ?line testSeqTag:compile(Config,?BER,[]), - ?line testSeqTag_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqTag:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqTag_cases(?BER)), - - ?line testExternal:compile(Config,?PER,[]), - ?line testSeqTag:compile(Config,?PER,[]), - ?line testSeqTag_cases(?PER), - - ?line ?per_bit_opt(testExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqTag:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqTag_cases(?PER)), - - ?line ?uper_bin(testExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqTag:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqTag_cases(uper_bin)), - - ?line testExternal:compile(Config,?PER,[optimize]), - ?line testSeqTag:compile(Config,?PER,[optimize]), - ?line testSeqTag_cases(?PER). - -testSeqTag_cases(Rules) -> - ?line testSeqTag:main(Rules). - - - - -testSeqTypeRefCho(suite) -> []; -testSeqTypeRefCho(Config) -> - - ?line testSeqTypeRefCho:compile(Config,?BER,[]), - ?line testSeqTypeRefCho_cases(?BER), - - ?line ?ber_driver(?BER,testSeqTypeRefCho:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqTypeRefCho_cases(?BER)), - - ?line testSeqTypeRefCho:compile(Config,?PER,[]), - ?line testSeqTypeRefCho_cases(?PER), - - ?line ?per_bit_opt(testSeqTypeRefCho:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqTypeRefCho_cases(?PER)), - - ?line ?uper_bin(testSeqTypeRefCho:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqTypeRefCho_cases(uper_bin)), - - ?line testSeqTypeRefCho:compile(Config,?PER,[optimize]), - ?line testSeqTypeRefCho_cases(?PER). - -testSeqTypeRefCho_cases(Rules) -> - ?line testSeqTypeRefCho:main(Rules). - - - -testSeqTypeRefPrim(suite) -> []; -testSeqTypeRefPrim(Config) -> - - ?line testSeqTypeRefPrim:compile(Config,?BER,[]), - ?line testSeqTypeRefPrim_cases(?BER), - - ?line ?ber_driver(?BER,testSeqTypeRefPrim:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqTypeRefPrim_cases(?BER)), - - ?line testSeqTypeRefPrim:compile(Config,?PER,[]), - ?line testSeqTypeRefPrim_cases(?PER), - - ?line ?per_bit_opt(testSeqTypeRefPrim:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqTypeRefPrim_cases(?PER)), - - ?line ?uper_bin(testSeqTypeRefPrim:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqTypeRefPrim_cases(uper_bin)), - - ?line testSeqTypeRefPrim:compile(Config,?PER,[optimize]), - ?line testSeqTypeRefPrim_cases(?PER). - -testSeqTypeRefPrim_cases(Rules) -> - ?line testSeqTypeRefPrim:main(Rules). - - - -testSeqTypeRefSeq(suite) -> []; -testSeqTypeRefSeq(Config) -> - - ?line testSeqTypeRefSeq:compile(Config,?BER,[]), - ?line testSeqTypeRefSeq_cases(?BER), - - ?line ?ber_driver(?BER,testSeqTypeRefSeq:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqTypeRefSeq_cases(?BER)), - - ?line testSeqTypeRefSeq:compile(Config,?PER,[]), - ?line testSeqTypeRefSeq_cases(?PER), - - ?line ?per_bit_opt(testSeqTypeRefSeq:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqTypeRefSeq_cases(?PER)), - - ?line ?uper_bin(testSeqTypeRefSeq:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqTypeRefSeq_cases(uper_bin)), - - ?line testSeqTypeRefSeq:compile(Config,?PER,[optimize]), - ?line testSeqTypeRefSeq_cases(?PER). - -testSeqTypeRefSeq_cases(Rules) -> - ?line testSeqTypeRefSeq:main(Rules). - - - -testSeqTypeRefSet(suite) -> []; -testSeqTypeRefSet(Config) -> - - ?line testSeqTypeRefSet:compile(Config,?BER,[]), - ?line testSeqTypeRefSet_cases(?BER), - - ?line ?ber_driver(?BER,testSeqTypeRefSet:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqTypeRefSet_cases(?BER)), - - ?line testSeqTypeRefSet:compile(Config,?PER,[]), - ?line testSeqTypeRefSet_cases(?PER), - - ?line ?per_bit_opt(testSeqTypeRefSet:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqTypeRefSet_cases(?PER)), - - ?line ?uper_bin(testSeqTypeRefSet:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqTypeRefSet_cases(uper_bin)), - - ?line testSeqTypeRefSet:compile(Config,?PER,[optimize]), - ?line testSeqTypeRefSet_cases(?PER). - -testSeqTypeRefSet_cases(Rules) -> - ?line testSeqTypeRefSet:main(Rules). - - - - -testSeqOf(suite) -> []; -testSeqOf(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSeqOf:compile(Config,?BER,[]), - ?line testSeqOf_cases(?BER), - - ?line ?ber_driver(?BER,testSeqOf:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqOf_cases(?BER)), - - ?line testSeqOf:compile(Config,?PER,[]), - ?line testSeqOf_cases(?PER), - - ?line ?per_bit_opt(testSeqOf:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqOf_cases(?PER)), - - ?line ?uper_bin(testSeqOf:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqOf_cases(uper_bin)), - - ?line testSeqOf:compile(Config,?PER,[optimize]), - ?line testSeqOf_cases(?PER). - -testSeqOf_cases(Rules) -> - ?line testSeqOf:main(Rules). - - - - -testSeqOfCho(suite) -> []; -testSeqOfCho(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSeqOfCho:compile(Config,?BER,[]), - ?line testSeqOfCho_cases(?BER), - - ?line ?ber_driver(?BER,testSeqOfCho:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqOfCho_cases(?BER)), - - ?line testSeqOfCho:compile(Config,?PER,[]), - ?line testSeqOfCho_cases(?PER), - - ?line ?per_bit_opt(testSeqOfCho:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqOfCho_cases(?PER)), - - ?line ?uper_bin(testSeqOfCho:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqOfCho_cases(uper_bin)), - - ?line testSeqOfCho:compile(Config,?PER,[optimize]), - ?line testSeqOfCho_cases(?PER). - -testSeqOfIndefinite(suite) -> []; -testSeqOfIndefinite(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSeqOfIndefinite:compile(Config,?BER,[]), - ?line testSeqOfIndefinite:main(), - - ?line ?ber_driver(?BER,testSeqOfIndefinite:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqOfIndefinite:main()). - -testSeqOfCho_cases(Rules) -> - ?line testSeqOfCho:main(Rules). - - -testSeqOfExternal(suite) -> []; -testSeqOfExternal(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testExternal:compile(Config,?BER,[]), - ?line testSeqOfExternal:compile(Config,?BER,[]), - ?line testSeqOfExternal_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqOfExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqOfExternal_cases(?BER)), - - ?line testExternal:compile(Config,?PER,[]), - ?line testSeqOfExternal:compile(Config,?PER,[]), - ?line testSeqOfExternal_cases(?PER), - - ?line ?per_bit_opt(testExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqOfExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqOfExternal_cases(?PER)), - - ?line ?uper_bin(testExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqOfExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqOfExternal_cases(uper_bin)), - - ?line testExternal:compile(Config,?PER,[optimize]), - ?line testSeqOfExternal:compile(Config,?PER,[optimize]), - ?line testSeqOfExternal_cases(?PER). - -testSeqOfExternal_cases(Rules) -> - ?line testSeqOfExternal:main(Rules). - - - -testSeqOfTag(suite) -> []; -testSeqOfTag(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testExternal:compile(Config,?BER,[]), - ?line testSeqOfTag:compile(Config,?BER,[]), - ?line testSeqOfTag_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqOfTag:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqOfTag_cases(?BER)), - - ?line testExternal:compile(Config,?PER,[]), - ?line testSeqOfTag:compile(Config,?PER,[]), - ?line testSeqOfTag_cases(?PER), - - ?line ?per_bit_opt(testExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqOfTag:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSeqOfTag_cases(?PER)), - - ?line ?uper_bin(testExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqOfTag:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSeqOfTag_cases(uper_bin)), - - ?line testExternal:compile(Config,?PER,[optimize]), - ?line testSeqOfTag:compile(Config,?PER,[optimize]), - ?line testSeqOfTag_cases(?PER). - -testSeqOfTag_cases(Rules) -> - ?line testSeqOfTag:main(Rules). - - - - -testSetDefault(suite) -> []; -testSetDefault(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetDefault:compile(Config,?BER,[]), - ?line testSetDefault_cases(?BER), - - ?line ?ber_driver(?BER,testSetDefault:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetDefault_cases(?BER)), - - ?line testSetDefault:compile(Config,?PER,[]), - ?line testSetDefault_cases(?PER), - - ?line ?per_bit_opt(testSetDefault:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetDefault_cases(?PER)), - - ?line ?uper_bin(testSetDefault:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetDefault_cases(uper_bin)), - - ?line testSetDefault:compile(Config,?PER,[optimize]), - ?line testSetDefault_cases(?PER). - -testSetDefault_cases(Rules) -> - ?line testSetDefault:main(Rules). - - -testParamBasic(suite) -> []; -testParamBasic(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testParamBasic:compile(Config,?BER,[]), - ?line testParamBasic_cases(?BER), - - ?line ?ber_driver(?BER,testParamBasic:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testParamBasic_cases(?BER)), - - ?line testParamBasic:compile(Config,?PER,[]), - ?line testParamBasic_cases(?PER), - - ?line ?per_bit_opt(testParamBasic:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testParamBasic_cases(?PER)), - - ?line ?uper_bin(testParamBasic:compile(Config,uper_bin,[])), - ?line ?uper_bin(testParamBasic_cases(uper_bin)), - - ?line testParamBasic:compile(Config,?PER,[optimize]), - ?line testParamBasic_cases(?PER). - - -testParamBasic_cases(Rules) -> - ?line testParamBasic:main(Rules). - -testSetExtension(suite) -> []; -testSetExtension(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testExternal:compile(Config,?BER,[]), - ?line testSetExtension:compile(Config,?BER,[]), - ?line testSetExtension_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetExtension:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetExtension_cases(?BER)). - -testSetExtension_cases(Rules) -> - ?line testSetExtension:main(Rules). - - -testSetExternal(suite) -> []; -testSetExternal(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testExternal:compile(Config,?BER,[]), - ?line testSetExternal:compile(Config,?BER,[]), - ?line testSetExternal_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetExternal_cases(?BER)). - -testSetExternal_cases(Rules) -> - ?line testSetExternal:main(Rules). - - -testSetOptional(suite) -> []; -testSetOptional(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetOptional:compile(Config,?BER,[]), - ?line testSetOptional_cases(?BER), - - ?line ?ber_driver(?BER,testSetOptional:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetOptional_cases(?BER)), - - ?line testSetOptional:compile(Config,?PER,[]), - ?line testSetOptional_cases(?PER), - - ?line ?per_bit_opt(testSetOptional:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetOptional_cases(?PER)), - - ?line ?uper_bin(testSetOptional:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetOptional_cases(uper_bin)), - - ?line testSetOptional:compile(Config,?PER,[optimize]), - ?line testSetOptional_cases(?PER). - -testSetOptional_cases(Rules) -> - ?line ok = testSetOptional:ticket_7533(Rules), - ?line ok = testSetOptional:main(Rules). - - - - -testSetPrim(suite) -> []; -testSetPrim(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetPrim:compile(Config,?BER,[]), - ?line testSetPrim_cases(?BER), - - ?line ?ber_driver(?BER,testSetPrim:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetPrim_cases(?BER)), - - ?line testSetPrim:compile(Config,?PER,[]), - ?line testSetPrim_cases(?PER), - - ?line ?per_bit_opt(testSetPrim:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetPrim_cases(?PER)), - - ?line ?uper_bin(testSetPrim:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetPrim_cases(uper_bin)), - - ?line testSetPrim:compile(Config,?PER,[optimize]), - ?line testSetPrim_cases(?PER). - -testSetPrim_cases(Rules) -> - ?line testSetPrim:main(Rules). - - - -testSetTag(suite) -> []; -testSetTag(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testExternal:compile(Config,?BER,[]), - ?line testSetTag:compile(Config,?BER,[]), - ?line testSetTag_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetTag:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetTag_cases(?BER)), - - ?line testExternal:compile(Config,?PER,[]), - ?line testSetTag:compile(Config,?PER,[]), - ?line testSetTag_cases(?PER), - - ?line ?per_bit_opt(testExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetTag:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetTag_cases(?PER)), - - ?line ?uper_bin(testExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetTag:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetTag_cases(uper_bin)), - - ?line testExternal:compile(Config,?PER,[optimize]), - ?line testSetTag:compile(Config,?PER,[optimize]), - ?line testSetTag_cases(?PER). - -testSetTag_cases(Rules) -> - ?line testSetTag:main(Rules). - - - -testSetTypeRefCho(suite) -> []; -testSetTypeRefCho(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetTypeRefCho:compile(Config,?BER,[]), - ?line testSetTypeRefCho_cases(?BER), - - ?line ?ber_driver(?BER,testSetTypeRefCho:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetTypeRefCho_cases(?BER)), - - ?line testSetTypeRefCho:compile(Config,?PER,[]), - ?line testSetTypeRefCho_cases(?PER), - - ?line ?per_bit_opt(testSetTypeRefCho:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetTypeRefCho_cases(?PER)), - - ?line ?uper_bin(testSetTypeRefCho:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetTypeRefCho_cases(uper_bin)), - - ?line testSetTypeRefCho:compile(Config,?PER,[optimize]), - ?line testSetTypeRefCho_cases(?PER). - -testSetTypeRefCho_cases(Rules) -> - ?line testSetTypeRefCho:main(Rules). - - - -testSetTypeRefPrim(suite) -> []; -testSetTypeRefPrim(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetTypeRefPrim:compile(Config,?BER,[]), - ?line testSetTypeRefPrim_cases(?BER), - - ?line ?ber_driver(?BER,testSetTypeRefPrim:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetTypeRefPrim_cases(?BER)), - - ?line testSetTypeRefPrim:compile(Config,?PER,[]), - ?line testSetTypeRefPrim_cases(?PER), - - ?line ?per_bit_opt(testSetTypeRefPrim:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetTypeRefPrim_cases(?PER)), - - ?line ?uper_bin(testSetTypeRefPrim:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetTypeRefPrim_cases(uper_bin)), - - ?line testSetTypeRefPrim:compile(Config,?PER,[optimize]), - ?line testSetTypeRefPrim_cases(?PER). - -testSetTypeRefPrim_cases(Rules) -> - ?line testSetTypeRefPrim:main(Rules). - - - -testSetTypeRefSeq(suite) -> []; -testSetTypeRefSeq(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetTypeRefSeq:compile(Config,?BER,[]), - ?line testSetTypeRefSeq_cases(?BER), - - ?line ?ber_driver(?BER,testSetTypeRefSeq:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetTypeRefSeq_cases(?BER)), - - ?line testSetTypeRefSeq:compile(Config,?PER,[]), - ?line testSetTypeRefSeq_cases(?PER), - - ?line ?per_bit_opt(testSetTypeRefSeq:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetTypeRefSeq_cases(?PER)), - - ?line ?uper_bin(testSetTypeRefSeq:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetTypeRefSeq_cases(uper_bin)), - - ?line testSetTypeRefSeq:compile(Config,?PER,[optimize]), - ?line testSetTypeRefSeq_cases(?PER). - -testSetTypeRefSeq_cases(Rules) -> - ?line testSetTypeRefSeq:main(Rules). - - - -testSetTypeRefSet(suite) -> []; -testSetTypeRefSet(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetTypeRefSet:compile(Config,?BER,[]), - ?line testSetTypeRefSet_cases(?BER), - - ?line ?ber_driver(?BER,testSetTypeRefSet:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetTypeRefSet_cases(?BER)), - - ?line testSetTypeRefSet:compile(Config,?PER,[]), - ?line testSetTypeRefSet_cases(?PER), - - ?line ?per_bit_opt(testSetTypeRefSet:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetTypeRefSet_cases(?PER)), - - ?line ?uper_bin(testSetTypeRefSet:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetTypeRefSet_cases(uper_bin)), - - ?line testSetTypeRefSet:compile(Config,?PER,[optimize]), - ?line testSetTypeRefSet_cases(?PER). - -testSetTypeRefSet_cases(Rules) -> - ?line testSetTypeRefSet:main(Rules). - - - -testSetOf(suite) -> []; -testSetOf(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetOf:compile(Config,?BER,[]), - ?line testSetOf_cases(?BER), - - ?line ?ber_driver(?BER,testSetOf:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetOf_cases(?BER)), - - ?line testSetOf:compile(Config,?PER,[]), - ?line testSetOf_cases(?PER), - - ?line ?per_bit_opt(testSetOf:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetOf_cases(?PER)), - - ?line ?uper_bin(testSetOf:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetOf_cases(uper_bin)), - - ?line testSetOf:compile(Config,?PER,[optimize]), - ?line testSetOf_cases(?PER). - -testSetOf_cases(Rules) -> - ?line testSetOf:main(Rules). - - - -testSetOfCho(suite) -> []; -testSetOfCho(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetOfCho:compile(Config,?BER,[]), - ?line testSetOfCho_cases(?BER), - - ?line ?ber_driver(?BER,testSetOfCho:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetOfCho_cases(?BER)), - - ?line testSetOfCho:compile(Config,?PER,[]), - ?line testSetOfCho_cases(?PER), - - ?line ?per_bit_opt(testSetOfCho:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetOfCho_cases(?PER)), - - ?line ?uper_bin(testSetOfCho:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetOfCho_cases(uper_bin)), - - ?line testSetOfCho:compile(Config,?PER,[optimize]), - ?line testSetOfCho_cases(?PER). - -testSetOfCho_cases(Rules) -> - ?line testSetOfCho:main(Rules). - - -testSetOfExternal(suite) -> []; -testSetOfExternal(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testExternal:compile(Config,?BER,[]), - ?line testSetOfExternal:compile(Config,?BER,[]), - ?line testSetOfExternal_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetOfExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetOfExternal_cases(?BER)), - - ?line testExternal:compile(Config,?PER,[]), - ?line testSetOfExternal:compile(Config,?PER,[]), - ?line testSetOfExternal_cases(?PER), - - ?line ?per_bit_opt(testExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetOfExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetOfExternal_cases(?PER)), - - ?line ?uper_bin(testExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetOfExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetOfExternal_cases(uper_bin)), - - ?line testExternal:compile(Config,?PER,[optimize]), - ?line testSetOfExternal:compile(Config,?PER,[optimize]), - ?line testSetOfExternal_cases(?PER). - -testSetOfExternal_cases(Rules) -> - ?line testSetOfExternal:main(Rules). - - - - -testSetOfTag(suite) -> []; -testSetOfTag(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testExternal:compile(Config,?BER,[]), - ?line testSetOfTag:compile(Config,?BER,[]), - ?line testSetOfTag_cases(?BER), - - ?line ?ber_driver(?BER,testExternal:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetOfTag:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetOfTag_cases(?BER)), - - ?line testExternal:compile(Config,?PER,[]), - ?line testSetOfTag:compile(Config,?PER,[]), - ?line testSetOfTag_cases(?PER), - - ?line ?per_bit_opt(testExternal:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetOfTag:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testSetOfTag_cases(?PER)), - - ?line ?uper_bin(testExternal:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetOfTag:compile(Config,uper_bin,[])), - ?line ?uper_bin(testSetOfTag_cases(uper_bin)), - - ?line testExternal:compile(Config,?PER,[optimize]), - ?line testSetOfTag:compile(Config,?PER,[optimize]), - ?line testSetOfTag_cases(?PER). - -testSetOfTag_cases(Rules) -> - ?line testSetOfTag:main(Rules). - - -sequence(suite) -> [{sequence,all}]. - -c_syntax(suite) -> []; -c_syntax(Config) -> - ?line DataDir% ?line testExternal:compile(Config,?PER), -% ?line testPrimExternal:compile(Config,?PER), -% ?line testPrimExternal_cases(?PER). - = ?config(data_dir,Config), - ?line _TempDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line {error,_R1} = asn1ct:compile(filename:join(DataDir,"Syntax")), - ?line {error,_R2} = asn1ct:compile(filename:join(DataDir,"BadTypeEnding")), - ?line {error,_R3} = asn1ct:compile(filename:join(DataDir, - "BadValueAssignment1")), - ?line {error,_R4} = asn1ct:compile(filename:join(DataDir, - "BadValueAssignment2")), - ?line {error,_R5} = asn1ct:compile(filename:join(DataDir, - "BadValueSet")), - ?line {error,_R6} = asn1ct:compile(filename:join(DataDir, - "ChoiceBadExtension")), - ?line {error,_R7} = asn1ct:compile(filename:join(DataDir, - "EnumerationBadExtension")), - ?line {error,_R8} = asn1ct:compile(filename:join(DataDir, - "Example")), - ?line {error,_R9} = asn1ct:compile(filename:join(DataDir, - "Export1")), - ?line {error,_R10} = asn1ct:compile(filename:join(DataDir, - "MissingEnd")), - ?line {error,_R11} = asn1ct:compile(filename:join(DataDir, - "SequenceBadComma")), - ?line {error,_R12} = asn1ct:compile(filename:join(DataDir, - "SequenceBadComponentName")), - ?line {error,_R13} = asn1ct:compile(filename:join(DataDir, - "SequenceBadComponentType")), - ?line {error,_R14} = asn1ct:compile(filename:join(DataDir, - "SeqBadComma")). - - -c_string_per(suite) -> []; -c_string_per(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line TempDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(filename:join(DataDir,"String"),[?PER,{outdir,TempDir}]). - -c_string_ber(suite) -> []; -c_string_ber(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line TempDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = asn1ct:compile(filename:join(DataDir,"String"),[?BER,{outdir,TempDir}]). - - -c_implicit_before_choice(suite) -> []; -c_implicit_before_choice(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line TempDir = ?config(priv_dir,Config), - ?line {error,_R2} = asn1ct:compile(filename:join(DataDir,"CCSNARG3"),[?BER,{outdir,TempDir}]). - -parse(suite) -> []; -parse(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - M1 = test_modules(), -% M2 = parse_modules(), - ?line ok = parse1(M1,DataDir,OutDir). - -parse1([M|T],DataDir,OutDir) -> - ?line ok = asn1ct:compile(DataDir ++ M,[abs,{outdir,OutDir}]), - parse1(T,DataDir,OutDir); -parse1([],_,_) -> - ok. - -per(suite) -> []; -per(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = per1(per_modules(),DataDir,OutDir), - ?line ?per_bit_opt(per1_bit_opt(per_modules(),DataDir,OutDir)), - ?line ok = per1_opt(per_modules(),DataDir,OutDir). - - -per1([M|T],DataDir,OutDir) -> - ?line ok = asn1ct:compile(DataDir ++ M,[?PER,{outdir,OutDir}]), - ?line ok = asn1ct:test(list_to_atom(M)), - per1(T,DataDir,OutDir); -per1([],_,_) -> - ok. - -per1_bit_opt([M|T],DataDir,OutDir) -> - ?line ok = asn1ct:compile(DataDir ++ M,[?PER,optimize,{outdir,OutDir}]), - ?line ok = asn1ct:test(list_to_atom(M)), - per1_bit_opt(T,DataDir,OutDir); -per1_bit_opt([],_,_) -> - ok. - -per1_opt([M|T],DataDir,OutDir) -> - ?line ok = asn1ct:compile(DataDir ++ M,[?PER,optimized,{outdir,OutDir}]), - ?line ok = asn1ct:test(list_to_atom(M)), - per1_opt(T,DataDir,OutDir); -per1_opt([],_,_) -> - ok. - -ber_choiceinseq(suite) ->[]; -ber_choiceinseq(Config) -> - ?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(filename:join(DataDir,"ChoiceInSeq"),[?BER,{outdir,OutDir}]). - -ber_optional(suite) ->[]; -ber_optional(Config) -> - ?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(filename:join(DataDir,"SOpttest"),[?BER,{outdir,OutDir}]), - ?line V = {'S',{'A',10,asn1_NOVALUE,asn1_NOVALUE}, - {'B',asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}, - {'C',asn1_NOVALUE,111,asn1_NOVALUE}}, - ?line {ok,B} = asn1_wrapper:encode('SOpttest','S',V), - ?line Bytes = lists:flatten(B), - ?line V2 = asn1_wrapper:decode('SOpttest','S',Bytes), - ?line ok = eq(V,element(2,V2)). - -ber_optional_keyed_list(suite) ->[]; -ber_optional_keyed_list(Config) -> - case ?BER of - ber_bin_v2 -> ok; - _ -> - ?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(filename:join(DataDir,"SOpttest"), - [?BER,keyed_list,{outdir,OutDir}]), - ?line Vrecord = {'S',{'A',10,asn1_NOVALUE,asn1_NOVALUE}, - {'B',asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}, - {'C',asn1_NOVALUE,111,asn1_NOVALUE}}, - ?line V = [ {a,[{scriptKey,10}]}, - {b,[]}, - {c,[{callingPartysCategory,111}]} ], - ?line {ok,B} = asn1_wrapper:encode('SOpttest','S',V), - ?line Bytes = lists:flatten(B), - ?line V2 = asn1_wrapper:decode('SOpttest','S',Bytes), - ?line ok = eq(Vrecord,element(2,V2)) - end. - - -eq(V,V) -> - ok. - - -ber_other(suite) ->[]; -ber_other(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line ok = ber1(ber_modules(),DataDir,OutDir). - - -ber1([M|T],DataDir,OutDir) -> - ?line ok = asn1ct:compile(DataDir ++ M,[?BER,{outdir,OutDir}]), - ?line ok = asn1ct:test(list_to_atom(M)), - ber1(T,DataDir,OutDir); -ber1([],_,_) -> - ok. - -default_per(suite) ->[]; -default_per(Config) -> - default1(?PER,Config,[]). - -default_per_opt(suite) -> []; -default_per_opt(Config) -> - ?per_bit_opt(default1(?PER,Config,[optimize])), - default1(?PER,Config,[optimize]). - -default_ber(suite) ->[]; -default_ber(Config) -> - default1(?BER,Config,[]). - -default1(Rule,Config,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",[Rule,{outdir,OutDir}]++Options), - ?line {ok,Bytes1} = asn1_wrapper:encode('Def','Def1',#'Def1'{bool0 = true, - bool1 = true, - bool2 = true, - bool3 = true}), - ?line {ok,{'Def1',true,true,true,true}} = asn1_wrapper:decode('Def','Def1',lists:flatten(Bytes1)), - - ?line {ok,Bytes2} = asn1_wrapper:encode('Def','Def1',#'Def1'{bool0 = true}), - ?line {ok,{'Def1',true,false,false,false}} = asn1_wrapper:decode('Def','Def1',lists:flatten(Bytes2)), - - ?line {ok,Bytes3} = asn1_wrapper:encode('Def','Def1',#'Def1'{bool0 = true,bool2=false}), - ?line {ok,{'Def1',true,false,false,false}} = asn1_wrapper:decode('Def','Def1',lists:flatten(Bytes3)). - - -value_test(suite) ->[]; -value_test(Config) -> - ?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 ++ "ObjIdValues",[?BER,{outdir,OutDir}]), - ?line {ok,_} = asn1_wrapper:encode('ObjIdValues','ObjIdType','ObjIdValues':'mobileDomainId'()), - ?line ok = asn1ct:compile(DataDir ++ "ObjIdValues",[?PER,{outdir,OutDir}]), - ?line {ok,_} = asn1_wrapper:encode('ObjIdValues','ObjIdType','ObjIdValues':'mobileDomainId'()), - ?line ok = test_bad_values:tests(Config), - ok. - - -constructed(suite) -> - []; -constructed(Config) -> - ?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 ++ "Constructed",[?BER,{outdir,OutDir}]), - ?line {ok,B} = asn1_wrapper:encode('Constructed','S',{'S',false}), - ?line [40,3,1,1,0] = lists:flatten(B), - ?line {ok,B1} = asn1_wrapper:encode('Constructed','S2',{'S2',false}), - ?line [40,5,48,3,1,1,0] = lists:flatten(B1), - ?line {ok,B2} = asn1_wrapper:encode('Constructed','I',10), - ?line [136,1,10] = lists:flatten(B2), - ok. - -ber_decode_error(suite) -> []; -ber_decode_error(Config) -> - ?line ok = ber_decode_error:compile(Config,?BER,[]), - ?line ok = ber_decode_error:run([]), - - ?line ok = ?ber_driver(?BER,ber_decode_error:compile(Config,?BER,[driver])), - ?line ok = ?ber_driver(?BER,ber_decode_error:run([driver])), - ok. - -h323test(suite) -> - []; -h323test(Config) -> - ?line ok = h323test:compile(Config,?PER,[]), - ?line ok = h323test:run(?PER), - ?line ?per_bit_opt(h323test:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(h323test:run(?PER)), - ?line ?uper_bin(h323test:compile(Config,uper_bin,[])), - ?line ?uper_bin(h323test:run(uper_bin)), - ?line ok = h323test:compile(Config,?PER,[optimize]), - ?line ok = h323test:run(?PER), - ok. - -per_GeneralString(suite) -> - []; -per_GeneralString(Config) -> - case erlang:module_loaded('MULTIMEDIA-SYSTEM-CONTROL') of - true -> - ok; - false -> - h323test:compile(Config,?PER,[]) - end, - UI = [109,64,1,57], - ?line {ok,_V} = asn1_wrapper:decode('MULTIMEDIA-SYSTEM-CONTROL', - 'MultimediaSystemControlMessage',UI). - -per_open_type(suite) -> - []; -per_open_type(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line ok = asn1ct:compile(DataDir ++ "OpenType",[?PER,{outdir,OutDir}]), - Stype = {'Stype',10,true}, - ?line {ok,Bytes} = asn1_wrapper:encode('OpenType','Ot',Stype), - ?line {ok,Stype} = asn1_wrapper:decode('OpenType','Ot',Bytes), - - ?line ?per_bit_opt(ok = asn1ct:compile(DataDir ++ "OpenType", - [?PER,optimize,{outdir,OutDir}])), - ?line ?per_bit_opt({ok,Bytes}=asn1_wrapper:encode('OpenType','Ot',Stype)), - ?line ?per_bit_opt({ok,Stype}=asn1_wrapper:decode('OpenType','Ot',Bytes)), - - ?line ?uper_bin(ok = asn1ct:compile(DataDir ++ "OpenType", - [uper_bin,{outdir,OutDir}])), - ?line ?uper_bin({ok,Bytes}=asn1_wrapper:encode('OpenType','Ot',Stype)), - ?line ?uper_bin({ok,Stype}=asn1_wrapper:decode('OpenType','Ot',Bytes)), - - ?line ok = asn1ct:compile(DataDir ++ "OpenType", - [?PER,optimize,{outdir,OutDir}]), - ?line {ok,Bytes} = asn1_wrapper:encode('OpenType','Ot',Stype), - ?line {ok,Stype} = asn1_wrapper:decode('OpenType','Ot',Bytes). - -testConstraints(suite) -> - []; -testConstraints(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testConstraints:compile(Config,?BER,[]), - ?line testConstraints:int_constraints(?BER), - - ?line ?ber_driver(?BER,testConstraints:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testConstraints:int_constraints(?BER)), - - ?line testConstraints:compile(Config,?PER,[]), - ?line testConstraints:int_constraints(?PER), - ?line testConstraints:refed_NNL_name(?PER), - - ?line ?per_bit_opt(testConstraints:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testConstraints:int_constraints(?PER)), - ?line ?per_bit_opt(testConstraints:refed_NNL_name(?PER)), - - ?line ?uper_bin(testConstraints:compile(Config,uper_bin,[])), - ?line ?uper_bin(testConstraints:int_constraints(uper_bin)), - ?line ?uper_bin(testConstraints:refed_NNL_name(uper_bin)), - - ?line testConstraints:compile(Config,?PER,[optimize]), - ?line testConstraints:int_constraints(?PER), - ?line testConstraints:refed_NNL_name(?PER). - -testSeqIndefinite(suite) -> []; -testSeqIndefinite(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSeqIndefinite:compile(Config,?BER,[]), - ?line testSeqIndefinite:main(?BER), - - ?line ?ber_driver(?BER,testSeqIndefinite:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSeqIndefinite:main(?BER)). - -testSetIndefinite(suite) -> []; -testSetIndefinite(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testSetIndefinite:compile(Config,?BER,[]), - ?line testSetIndefinite:main(?BER), - - ?line ?ber_driver(?BER,testSetIndefinite:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testSetIndefinite:main(?BER)). - -testChoiceIndefinite(suite) -> []; -testChoiceIndefinite(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testChoiceIndefinite:compile(Config,?BER,[]), - ?line testChoiceIndefinite:main(?BER), - - ?line ?ber_driver(?BER,testChoiceIndefinite:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testChoiceIndefinite:main(?BER)). - -testInfObjectClass(suite) -> - []; -testInfObjectClass(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testInfObjectClass:compile(Config,?PER,[]), - ?line testInfObjectClass:main(?PER), - ?line testInfObj:compile(Config,?PER,[]), - ?line testInfObj:main(?PER), - - ?line ?per_bit_opt(testInfObjectClass:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testInfObjectClass:main(?PER)), - ?line ?per_bit_opt(testInfObj:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testInfObj:main(?PER)), - - ?line ?uper_bin(testInfObjectClass:compile(Config,uper_bin,[])), - ?line ?uper_bin(testInfObjectClass:main(uper_bin)), - ?line ?uper_bin(testInfObj:compile(Config,uper_bin,[])), - ?line ?uper_bin(testInfObj:main(uper_bin)), - - ?line testInfObjectClass:compile(Config,?PER,[optimize]), - ?line testInfObjectClass:main(?PER), - ?line testInfObj:compile(Config,?PER,[optimize]), - ?line testInfObj:main(?PER), - - ?line testInfObjectClass:compile(Config,?BER,[]), - ?line testInfObjectClass:main(?BER), - ?line testInfObj:compile(Config,?BER,[]), - ?line testInfObj:main(?BER), - - ?line ?ber_driver(?BER,testInfObjectClass:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testInfObjectClass:main(?BER)), - ?line ?ber_driver(?BER,testInfObj:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testInfObj:main(?BER)), - - ?line testInfObj:compile_RANAPfiles(Config,?PER,[]), - - ?line ?per_bit_opt(testInfObj:compile_RANAPfiles(Config,?PER,[optimize])), - - ?line ?uper_bin(testInfObj:compile_RANAPfiles(Config,uper_bin,[])), - - ?line testInfObj:compile_RANAPfiles(Config,?PER,[optimize]), - - ?line testInfObj:compile_RANAPfiles(Config,?BER,[]). - -testParameterizedInfObj(suite) -> - []; -testParameterizedInfObj(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testParameterizedInfObj:compile(Config,?PER,[]), - ?line testParameterizedInfObj:main(?PER), - - ?line ?per_bit_opt(testParameterizedInfObj:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testParameterizedInfObj:main(?PER)), - - ?line ?uper_bin(testParameterizedInfObj:compile(Config,uper_bin,[])), - ?line ?uper_bin(testParameterizedInfObj:main(uper_bin)), - - ?line testParameterizedInfObj:compile(Config,?PER,[optimize]), - ?line testParameterizedInfObj:main(?PER), - - ?line testParameterizedInfObj:compile(Config,?BER,[]), - ?line testParameterizedInfObj:main(?BER), - - ?line ?ber_driver(?BER,testParameterizedInfObj:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testParameterizedInfObj:main(?BER)). - -testMergeCompile(suite) -> - []; -testMergeCompile(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testMergeCompile:compile(Config,?PER,[]), - ?line testMergeCompile:main(?PER), - ?line testMergeCompile:mvrasn(?PER), - - ?line ?per_bit_opt(testMergeCompile:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testMergeCompile:main(?PER)), - ?line ?per_bit_opt(testMergeCompile:mvrasn(?PER)), - - ?line ?uper_bin(testMergeCompile:compile(Config,uper_bin,[])), - ?line ?uper_bin(testMergeCompile:main(uper_bin)), - ?line ?uper_bin(testMergeCompile:mvrasn(uper_bin)), - - ?line testMergeCompile:compile(Config,?BER,[]), - ?line testMergeCompile:main(?BER), - ?line testMergeCompile:mvrasn(?BER), - - ?line ?ber_driver(?BER,testMergeCompile:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testMergeCompile:main(?BER)), - ?line ?ber_driver(?BER,testMergeCompile:mvrasn(?BER)). - -testobj(suite) -> - []; -testobj(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line ok = testRANAP:compile(Config,?PER,[]), - ?line ok = testRANAP:testobj(?PER), - ?line ok = testParameterizedInfObj:ranap(?PER), - - ?line ?per_bit_opt(ok = testRANAP:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(ok = testRANAP:testobj(?PER)), - ?line ?per_bit_opt(ok = testParameterizedInfObj:ranap(?PER)), - - ?line ?uper_bin(ok = testRANAP:compile(Config,uper_bin,[])), - ?line ?uper_bin(ok = testRANAP:testobj(uper_bin)), - ?line ?uper_bin(ok = testParameterizedInfObj:ranap(uper_bin)), - - ?line ok = testRANAP:compile(Config,?PER,[optimize]), - ?line ok = testRANAP:testobj(?PER), - ?line ok = testParameterizedInfObj:ranap(?PER), - - ?line ok = testRANAP:compile(Config,?BER,[]), - ?line ok = testRANAP:testobj(?BER), - ?line ok = testParameterizedInfObj:ranap(?BER), - - ?line ?ber_driver(?BER,testRANAP:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testRANAP:testobj(?BER)), - ?line ?ber_driver(?BER,testParameterizedInfObj:ranap(?BER)). - - -testDeepTConstr(suite) -> - []; -testDeepTConstr(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testDeepTConstr:compile(Config,?PER,[]), - ?line testDeepTConstr:main(?PER), - - ?line ?per_bit_opt(testDeepTConstr:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testDeepTConstr:main(?PER)), - - ?line ?uper_bin(testDeepTConstr:compile(Config,uper_bin,[])), - ?line ?uper_bin(testDeepTConstr:main(uper_bin)), - - ?line testDeepTConstr:compile(Config,?PER,[optimize]), - ?line testDeepTConstr:main(?PER), - - ?line testDeepTConstr:compile(Config,?BER,[]), - ?line testDeepTConstr:main(?BER), - - ?line ?ber_driver(?BER,testDeepTConstr:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testDeepTConstr:main(?BER)). - -testInvokeMod(suite) -> - []; -testInvokeMod(Config) -> - ?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(filename:join(DataDir,"PrimStrings"),[{outdir,OutDir}]), - ?line {ok,_Result1} = 'PrimStrings':encode('Bs1',[1,0,1,0]), - ?line ok = asn1ct:compile(filename:join(DataDir,"PrimStrings"),[?PER,{outdir,OutDir}]), - ?line {ok,_Result2} = 'PrimStrings':encode('Bs1',[1,0,1,0]). - -testExport(suite) -> - []; -testExport(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line {error,{asn1,_Reason}} = asn1ct:compile(filename:join(DataDir,"IllegalExport"),[{outdir,OutDir}]). - -testImport(suite) -> - []; -testImport(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line _OutDir = ?config(priv_dir,Config), - ?line {error,_} = asn1ct:compile(filename:join(DataDir,"ImportsFrom"),[?BER]), - ok. - -testMegaco(suite) -> - []; -testMegaco(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - io:format("Config: ~p~n",[Config]), - ?line {ok,ModuleName1,ModuleName2} = testMegaco:compile(Config,?BER,[]), - ?line ok = testMegaco:main(ModuleName1,Config), - ?line ok = testMegaco:main(ModuleName2,Config), - - case ?BER of - ber_bin_v2 -> - ?line {ok,ModuleName3,ModuleName4} = testMegaco:compile(Config,?BER,[driver]), - ?line ok = testMegaco:main(ModuleName3,Config), - ?line ok = testMegaco:main(ModuleName4,Config); - _-> ok - end, - - ?line {ok,ModuleName5,ModuleName6} = testMegaco:compile(Config,?PER,[]), - ?line ok = testMegaco:main(ModuleName5,Config), - ?line ok = testMegaco:main(ModuleName6,Config), - - ?line ?per_bit_opt({ok,ModuleName5,ModuleName6} = testMegaco:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(ok = testMegaco:main(ModuleName5,Config)), - ?line ?per_bit_opt(ok = testMegaco:main(ModuleName6,Config)), - - ?line ?uper_bin({ok,ModuleName5,ModuleName6} = testMegaco:compile(Config,uper_bin,[])), - ?line ?uper_bin(ok = testMegaco:main(ModuleName5,Config)), - ?line ?uper_bin(ok = testMegaco:main(ModuleName6,Config)), - - ?line {ok,ModuleName7,ModuleName8} = testMegaco:compile(Config,?PER,[optimize]), - ?line ok = testMegaco:main(ModuleName7,Config), - ?line ok = testMegaco:main(ModuleName8,Config). - - -testMvrasn6(suite) -> []; -testMvrasn6(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testMvrasn6:compile(Config,?BER), - ?line testMvrasn6:main(). - -testContextSwitchingTypes(suite) -> []; -testContextSwitchingTypes(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testContextSwitchingTypes:compile(Config,?BER,[]), - ?line testContextSwitchingTypes:test(), - - ?line ?ber_driver(?BER,testContextSwitchingTypes:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testContextSwitchingTypes:test()), - - ?line testContextSwitchingTypes:compile(Config,?PER,[]), - ?line testContextSwitchingTypes:test(), - - ?line ?per_bit_opt(testContextSwitchingTypes:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testContextSwitchingTypes:test()), - - ?line ?uper_bin(testContextSwitchingTypes:compile(Config,uper_bin,[])), - ?line ?uper_bin(testContextSwitchingTypes:test()), - - ?line testContextSwitchingTypes:compile(Config,?PER,[optimize]), - ?line testContextSwitchingTypes:test(). - -testTypeValueNotation(suite) -> []; -testTypeValueNotation(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - case ?BER of - Ber when Ber == ber; Ber == ber_bin -> - ?line testTypeValueNotation:compile(Config,?BER,[]), - ?line testTypeValueNotation:main(?BER,dummy); - _ -> - ok - end, - - ?line ?ber_driver(?BER,testTypeValueNotation:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testTypeValueNotation:main(?BER,optimize)), - - case ?BER of - Ber2 when Ber2 == ber; Ber2 == ber_bin -> - ?line testTypeValueNotation:compile(Config,?PER,[]), - ?line testTypeValueNotation:main(?PER,dummy); - _ -> - ok - end, - - ?line ?per_bit_opt(testTypeValueNotation:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testTypeValueNotation:main(?PER,optimize)), - - ?line ?uper_bin(testTypeValueNotation:compile(Config,uper_bin,[])), - ?line ?uper_bin(testTypeValueNotation:main(uper_bin,optimize)), - case ?BER of - Ber3 when Ber3 == ber; Ber3 == ber_bin -> - ?line testTypeValueNotation:compile(Config,?PER,[optimize]), - ?line testTypeValueNotation:main(?PER,optimize); - _ -> - ok - end. - -testOpenTypeImplicitTag(suite) -> []; -testOpenTypeImplicitTag(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testOpenTypeImplicitTag:compile(Config,?BER,[]), - ?line testOpenTypeImplicitTag:main(?BER), - - ?line ?ber_driver(?BER,testOpenTypeImplicitTag:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testOpenTypeImplicitTag:main(?BER)), - - ?line testOpenTypeImplicitTag:compile(Config,?PER,[]), - ?line testOpenTypeImplicitTag:main(?PER), - - ?line ?per_bit_opt(testOpenTypeImplicitTag:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testOpenTypeImplicitTag:main(?PER)), - - ?line ?uper_bin(testOpenTypeImplicitTag:compile(Config,uper_bin,[])), - ?line ?uper_bin(testOpenTypeImplicitTag:main(uper_bin)), - - ?line testOpenTypeImplicitTag:compile(Config,?PER,[optimize]), - ?line testOpenTypeImplicitTag:main(?PER). - -duplicate_tags(suite) -> []; -duplicate_tags(Config) -> - ?line DataDir = ?config(data_dir,Config), - {error,{asn1,[{error,{type,_,_,'SeqOpt1Imp',{asn1,{duplicates_of_the_tags,_}}}}]}} = - asn1ct:compile(filename:join(DataDir,"SeqOptional2"),[abs]), - ok. - -rtUI(suite) -> []; -rtUI(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line ok = asn1ct:compile(filename:join(DataDir,"Prim"),[?BER]), - ?line {ok,_} = asn1rt:info('Prim'), - - ?line ok = asn1ct:compile(filename:join(DataDir,"Prim"),[?PER]), - ?line {ok,_} = asn1rt:info('Prim'), - - ?line ok = asn1rt:load_driver(), - ?line ok = asn1rt:load_driver(), - ?line ok = asn1rt:unload_driver(). - -testROSE(suite) -> []; -testROSE(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testROSE:compile(Config,?BER,[]), - - ?line testROSE:compile(Config,?PER,[]), - ?line ?per_bit_opt(testROSE:compile(Config,?PER,[optimize])), - ?line ?uper_bin(testROSE:compile(Config,uper_bin,[])), - ?line testROSE:compile(Config,?PER,[optimize]). - -testINSTANCE_OF(suite) -> []; -testINSTANCE_OF(Config) -> - ?line testINSTANCE_OF:compile(Config,?BER,[]), - ?line testINSTANCE_OF:main(?BER), - - ?line ?ber_driver(?BER,testINSTANCE_OF:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testINSTANCE_OF:main(?BER)), - - ?line testINSTANCE_OF:compile(Config,?PER,[]), - ?line testINSTANCE_OF:main(?PER), - - ?line ?per_bit_opt(testINSTANCE_OF:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testINSTANCE_OF:main(?PER)), - - ?line ?uper_bin(testINSTANCE_OF:compile(Config,uper_bin,[])), - ?line ?uper_bin(testINSTANCE_OF:main(uper_bin)), - - ?line testINSTANCE_OF:compile(Config,?PER,[optimize]), - ?line testINSTANCE_OF:main(?PER). - -testTCAP(suite) -> []; -testTCAP(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testTCAP:compile(Config,?BER,[]), - ?line testTCAP:test(?BER,Config), - - ?line ?ber_driver(?BER,testTCAP:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testTCAP:test(?BER,Config)), - - ?line ?ber_driver(?BER,testTCAP:compile_asn1config(Config,?BER,[asn1config])), - ?line ?ber_driver(?BER,testTCAP:test_asn1config()). - -testDER(suite) ->[]; -testDER(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line testDER:compile(Config,?BER,[]), - ?line testDER:test(), - - ?line ?ber_driver(?BER,testDER:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testDER:test()), - - ?line testParamBasic:compile_der(Config,?BER), - ?line testParamBasic_cases(der), - - - ?line testSeqSetDefaultVal:compile(Config,?BER), - ?line testSeqSetDefaultVal_cases(?BER). - -testSeqSetDefaultVal_cases(?BER) -> - ?line testSeqSetDefaultVal:main(?BER). - - -specialized_decodes(suite) -> []; -specialized_decodes(Config) -> - ?line test_partial_incomplete_decode:compile(Config,?BER,[optimize]), - ?line test_partial_incomplete_decode:test(?BER,Config), - ?line test_selective_decode:test(?BER,Config). - -special_decode_performance(suite) ->[]; -special_decode_performance(Config) -> - ?line ?ber_driver(?BER,test_special_decode_performance:compile(Config,?BER)), - ?line ?ber_driver(?BER,test_special_decode_performance:go(all)). - - -test_driver_load(suite) -> []; -test_driver_load(Config) -> - ?line test_driver_load:compile(Config,?PER), - ?line test_driver_load:test(?PER,5). - -test_ParamTypeInfObj(suite) -> []; -test_ParamTypeInfObj(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line ok = asn1ct:compile(filename:join(DataDir,"IN-CS-1-Datatypes"),[ber_bin]). - -test_WS_ParamClass(suite) -> []; -test_WS_ParamClass(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line ok = asn1ct:compile(filename:join(DataDir,"InformationFramework"), - [ber_bin]). - -test_Defed_ObjectIdentifier(suite) -> []; -test_Defed_ObjectIdentifier(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line ok = asn1ct:compile(filename:join(DataDir,"UsefulDefinitions"), - [ber_bin]). - -testSelectionType(suite) -> []; -testSelectionType(Config) -> - - ?line ok = testSelectionTypes:compile(Config,?BER,[]), - ?line {ok,_} = testSelectionTypes:test(), - - ?line ok = testSelectionTypes:compile(Config,?PER,[]), - ?line {ok,_} = testSelectionTypes:test(). - -testSSLspecs(suite) -> []; -testSSLspecs(Config) -> - - ?line ok = testSSLspecs:compile(Config,?BER, - [optimize,compact_bit_string,der]), - ?line testSSLspecs:run(?BER), - - case code:which(asn1ct) of - cover_compiled -> - ok; - _ -> - ?line ok = testSSLspecs:compile_inline(Config,?BER), - ?line ok = testSSLspecs:run_inline(?BER) - end. - -testNortel(suite) -> []; -testNortel(Config) -> - ?line DataDir = ?config(data_dir,Config), - - ?line ok = asn1ct:compile(filename:join(DataDir,"Nortel"),[?BER]), - ?line ok = asn1ct:compile(filename:join(DataDir,"Nortel"), - [?BER,optimize]), - ?line ok = asn1ct:compile(filename:join(DataDir,"Nortel"), - [?BER,optimize,driver]), - ?line ok = asn1ct:compile(filename:join(DataDir,"Nortel"),[?PER]), - ?line ?per_bit_opt(ok = asn1ct:compile(filename:join(DataDir,"Nortel"), - [?PER,optimize])), - ?line ?uper_bin(ok = asn1ct:compile(filename:join(DataDir,"Nortel"),[uper_bin])), - ?line ok = asn1ct:compile(filename:join(DataDir,"Nortel"), - [?PER,optimize]). -test_undecoded_rest(suite) -> []; -test_undecoded_rest(Config) -> - - ?line ok = test_undecoded_rest:compile(Config,?BER,[]), - ?line ok = test_undecoded_rest:test([]), - - ?line ok = test_undecoded_rest:compile(Config,?BER,[undec_rest]), - ?line ok = test_undecoded_rest:test(undec_rest), - - ?line ok = test_undecoded_rest:compile(Config,?PER,[]), - ?line ok = test_undecoded_rest:test([]), - - ?line ?per_bit_opt(ok = test_undecoded_rest:compile(Config,?PER,[optimize,undec_rest])), - ?line ?per_bit_opt(ok = test_undecoded_rest:test(undec_rest)), - - ?line ?uper_bin(ok = test_undecoded_rest:compile(Config,uper_bin,[undec_rest])), - ?line ?uper_bin(ok = test_undecoded_rest:test(undec_rest)), - - ?line ok = test_undecoded_rest:compile(Config,?PER,[undec_rest]), - ?line ok = test_undecoded_rest:test(undec_rest). - -test_inline(suite) -> []; -test_inline(Config) -> - case code:which(asn1ct) of - cover_compiled -> - {skip,"Not runnable when cover compiled"}; - _ -> - ?line ok=test_inline:compile(Config,?BER,[]), - ?line test_inline:main(?BER), - ?line test_inline:inline1(Config,?BER,[]), - ?line test_inline:performance2() - end. - -%test_inline_prf(suite) -> []; -%test_inline_prf(Config) -> -% ?line test_inline:performance(Config). - -testTcapsystem(suite) -> []; -testTcapsystem(Config) -> - ?line ok=testTcapsystem:compile(Config,?BER,[]). - -testNBAPsystem(suite) -> []; -testNBAPsystem(Config) -> - ?line ok=testNBAPsystem:compile(Config,?PER,?per_optimize(?BER)), - ?line 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"}; - _ -> - ?line ok = test_compile_options:wrong_path(Config), - ?line ok = test_compile_options:path(Config), - ?line ok = test_compile_options:noobj(Config), - ?line ok = test_compile_options:record_name_prefix(Config), - ?line ok = test_compile_options:verbose(Config), - ?line ok = test_compile_options:warnings_as_errors(Config) - end. - -testDoubleEllipses(suite) -> []; -testDoubleEllipses(Config) -> - ?line testDoubleEllipses:compile(Config,?BER,[]), - ?line testDoubleEllipses:main(?BER), - ?line ?ber_driver(?BER,testDoubleEllipses:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testDoubleEllipses:main(?BER)), - ?line ?per_bit_opt(testDoubleEllipses:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testDoubleEllipses:main(?PER)), - ?line ?uper_bin(testDoubleEllipses:compile(Config,uper_bin,[])), - ?line ?uper_bin(testDoubleEllipses:main(uper_bin)), - ?line testDoubleEllipses:compile(Config,?PER,?per_optimize(?BER)), - ?line testDoubleEllipses:main(?PER). - -test_modified_x420(suite) -> []; -test_modified_x420(Config) -> - ?line test_modified_x420:compile(Config), - ?line test_modified_x420:test_io(Config). - -testX420(suite) -> []; -testX420(Config) -> - ?line testX420:compile(?BER,[der],Config), - ?line ok = testX420:ticket7759(?BER,Config), - ?line testX420:compile(?PER,[],Config). - -test_x691(suite) -> []; -test_x691(Config) -> - case ?PER of - per -> - ?line ok = test_x691:compile(Config,uper_bin,[]), - ?line true = test_x691:cases(uper_bin,unaligned), - ?line ok = test_x691:compile(Config,?PER,[]), - ?line true = test_x691:cases(?PER,aligned), -%% ?line ok = asn1_test_lib:ticket_7678(Config,[]), - ?line ok = asn1_test_lib:ticket_7708(Config,[]), - ?line ok = asn1_test_lib:ticket_7763(Config); - _ -> - ?line ok = test_x691:compile(Config,?PER,?per_optimize(?BER)), - ?line true = test_x691:cases(?PER,aligned) - end. -%% ?line ok = asn1_test_lib:ticket_7876(Config,?PER,[]), -%% ?line ok = asn1_test_lib:ticket_7876(Config,?PER,[compact_bit_string]), -%% ?line ok = asn1_test_lib:ticket_7876(Config,?PER,[optimize]), -%% ?line ok = asn1_test_lib:ticket_7876(Config,?PER,[optimize,compact_bit_string]). - - -ticket_6143(suite) -> []; -ticket_6143(Config) -> - ?line ok = test_compile_options:ticket_6143(Config). - -testExtensionAdditionGroup(suite) -> []; -testExtensionAdditionGroup(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line PrivDir = ?config(priv_dir,Config), - ?line Path = code:get_path(), - ?line code:add_patha(PrivDir), - DoIt = fun(Erule) -> - ?line ok = asn1ct:compile(filename:join(DataDir,"Extension-Addition-Group"),Erule ++ [{outdir,PrivDir}]), - ?line {ok,_M} = compile:file(filename:join(DataDir,"extensionAdditionGroup"),[{i,PrivDir},{outdir,PrivDir},debug_info]), - ?line ok = extensionAdditionGroup:run(Erule), - ?line ok = extensionAdditionGroup:run2(Erule), - ?line ok = asn1ct:compile(filename:join(DataDir,"EUTRA-RRC-Definitions"),Erule ++ [{record_name_prefix,"RRC-"},{outdir,PrivDir}]), - ?line ok = extensionAdditionGroup:run3(Erule) - end, - ?line [DoIt(Rule)|| Rule <- [[per_bin],[per_bin,optimize],[uper_bin]]], - %% FIXME problems with automatic tags [ber_bin],[ber_bin,optimize] - ?line 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" - ]. - - diff --git a/lib/asn1/test/asn1_SUITE_data/Constraints.py b/lib/asn1/test/asn1_SUITE_data/Constraints.py index b18c29bd89..87243121f7 100644 --- a/lib/asn1/test/asn1_SUITE_data/Constraints.py +++ b/lib/asn1/test/asn1_SUITE_data/Constraints.py @@ -4,9 +4,14 @@ BEGIN -- Single Value SingleValue ::= INTEGER (1) SingleValue2 ::= INTEGER (1..20) +predefined INTEGER ::= 1 +SingleValue3 ::= INTEGER (predefined | 5 | 10) Range2to19 ::= INTEGER (1<..<20) Range10to20 ::= INTEGER (10..20) ContainedSubtype ::= INTEGER (INCLUDES Range10to20) +-- Some ranges for additional constrained number testing. +LongLong ::= INTEGER (0..18446744073709551615) +Range256to65536 ::= INTEGER (256..65536) FixedSize ::= OCTET STRING (SIZE(10)) FixedSize2 ::= OCTET STRING (SIZE(10|20)) VariableSize ::= OCTET STRING (SIZE(1..10)) @@ -51,6 +56,7 @@ Thing ::= INTEGER {fred (0),fred2 (1),fred3 (2)} AnotherThing ::= Thing (fred | fred2) I ::= INTEGER (0|15..269) -- OTP-5457 +X1 ::= INTEGER (1..4 | 8 | 10 | 20) -- OTP-9946 -- OTP-5511 diff --git a/lib/asn1/test/asn1_SUITE_data/DirectoryAbstractService.asn b/lib/asn1/test/asn1_SUITE_data/DirectoryAbstractService.asn index 5a5d310729..5a5d310729 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/DirectoryAbstractService.asn +++ b/lib/asn1/test/asn1_SUITE_data/DirectoryAbstractService.asn diff --git a/lib/asn1/test/asn1_SUITE_data/EnumN2N.asn1 b/lib/asn1/test/asn1_SUITE_data/EnumN2N.asn1 new file mode 100644 index 0000000000..a724f2f3f5 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE_data/EnumN2N.asn1 @@ -0,0 +1,25 @@ +EnumN2N DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +NoExt ::= ENUMERATED { + blue(0), + red(1), + green(2) +} + +Ext ::= ENUMERATED { + blue(0), + red(1), + green(2), + ... +} + +Ext2 ::= ENUMERATED { + blue(0), + red(1), + green(2), + ..., + orange(7) +} + +END diff --git a/lib/asn1/test/asn1_SUITE_data/Extension-Addition-Group.asn b/lib/asn1/test/asn1_SUITE_data/Extension-Addition-Group.asn index fc244c30a2..b7cc74ab07 100644 --- a/lib/asn1/test/asn1_SUITE_data/Extension-Addition-Group.asn +++ b/lib/asn1/test/asn1_SUITE_data/Extension-Addition-Group.asn @@ -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 @@ -79,4 +79,43 @@ Ax3 ::= SEQUENCE { } -- { a 253, b TRUE, s {sa 17, sb TRUE, sextaddgroup 11}} + +-- This is to test the case with more than one ExtensionAdditionGroup +-- which did not work before + +AS-Config ::= SEQUENCE { + a INTEGER, + b BOOLEAN, + c OCTET STRING, + ..., + [[ sourceSystemInformationBlockType1Ext OCTET STRING OPTIONAL, + sourceOtherConfig-r9 INTEGER + ]], + [[ sourceSCellConfigList-r10 OCTET STRING OPTIONAL + ]] +} + +SystemInformationBlockType2 ::= SEQUENCE { + timeAlignmentTimerCommon TimeAlignmentTimer, + ..., + lateNonCriticalExtension OCTET STRING OPTIONAL, + [[ ssac-BarringForMMTEL-Voice-r9 AC-BarringConfig OPTIONAL, + ssac-BarringForMMTEL-Video-r9 AC-BarringConfig OPTIONAL + ]], + [[ ac-BarringForCSFB-r10 AC-BarringConfig OPTIONAL + ]] +} + +TimeAlignmentTimer ::= ENUMERATED { + sf500, sf750, sf1280, sf1920, sf2560, sf5120, + sf10240, infinity} + +AC-BarringConfig ::= SEQUENCE { + ac-BarringFactor ENUMERATED { + p00, p05, p10, p15, p20, p25, p30, p40, + p50, p60, p70, p75, p80, p85, p90, p95}, + ac-BarringTime ENUMERATED {s4, s8, s16, s32, s64, s128, s256, s512}, + ac-BarringForSpecialAC BIT STRING (SIZE(5)) +} + END diff --git a/lib/asn1/test/asn1_SUITE_data/InformationFramework.asn b/lib/asn1/test/asn1_SUITE_data/InformationFramework.asn index ef236e98a9..ef236e98a9 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/InformationFramework.asn +++ b/lib/asn1/test/asn1_SUITE_data/InformationFramework.asn diff --git a/lib/asn1/test/asn1_SUITE_data/LDAP.asn1 b/lib/asn1/test/asn1_SUITE_data/LDAP.asn1 index 4d845942e1..4d845942e1 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/LDAP.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/LDAP.asn1 diff --git a/lib/asn1/test/asn1_SUITE_data/LargeConstraints.py b/lib/asn1/test/asn1_SUITE_data/LargeConstraints.py new file mode 100644 index 0000000000..68c7616b62 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE_data/LargeConstraints.py @@ -0,0 +1,9 @@ +LargeConstraints DEFINITIONS ::= +BEGIN + +-- Maximum number that can be encoded as a constrained whole number: 1 bsl (255*8) +-- The number of octets needed to represent a number cannot be more than 255 +-- As the length field is encoded as a 8-bit bitfield. +RangeMax ::= INTEGER (1..126238304966058622268417487065116999845484776053576109500509161826268184136202698801551568013761380717534054534851164138648904527931605160527688095259563605939964364716019515983399209962459578542172100149937763938581219604072733422507180056009672540900709554109516816573779593326332288314873251559077853068444977864803391962580800682760017849589281937637993445539366428356761821065267423102149447628375691862210717202025241630303118559188678304314076943801692528246980959705901641444238894928620825482303431806955690226308773426829503900930529395181208739591967195841536053143145775307050594328881077553168201547776) + +END diff --git a/lib/asn1/test/asn1_SUITE_data/Nortel.asn b/lib/asn1/test/asn1_SUITE_data/Nortel.asn index a27c78a0b5..a27c78a0b5 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/Nortel.asn +++ b/lib/asn1/test/asn1_SUITE_data/Nortel.asn diff --git a/lib/asn1/test/asn1_SUITE_data/UpperBounds.asn b/lib/asn1/test/asn1_SUITE_data/UpperBounds.asn index 247260495b..247260495b 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/UpperBounds.asn +++ b/lib/asn1/test/asn1_SUITE_data/UpperBounds.asn diff --git a/lib/asn1/test/asn1_SUITE_data/UsefulDefinitions.asn b/lib/asn1/test/asn1_SUITE_data/UsefulDefinitions.asn index d9601bb7d0..d9601bb7d0 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/UsefulDefinitions.asn +++ b/lib/asn1/test/asn1_SUITE_data/UsefulDefinitions.asn diff --git a/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl b/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl index 5fcec23756..8148381d92 100644 --- a/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl +++ b/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl @@ -130,3 +130,26 @@ run3(Erule) -> _ -> exit({expected,Val, got, Val2}) end. +run3() -> + SI = #'SystemInformationBlockType2'{ + timeAlignmentTimerCommon = sf500, + lateNonCriticalExtension = asn1_NOVALUE, + 'ssac-BarringForMMTEL-Voice-r9' = asn1_NOVALUE, + 'ssac-BarringForMMTEL-Video-r9' = asn1_NOVALUE, + 'ac-BarringForCSFB-r10' = asn1_NOVALUE}, + Barring = #'AC-BarringConfig'{ + 'ac-BarringFactor' = p00, + 'ac-BarringTime' = s4, + 'ac-BarringForSpecialAC' = [0,0,0,0,0]}, + roundtrip(SI), + roundtrip(SI#'SystemInformationBlockType2'{ + 'ssac-BarringForMMTEL-Voice-r9'=Barring}), + roundtrip(SI#'SystemInformationBlockType2'{ + 'ssac-BarringForMMTEL-Video-r9'=Barring}), + roundtrip(SI#'SystemInformationBlockType2'{ + 'ac-BarringForCSFB-r10'=Barring}). + +roundtrip(V) -> + Mod = 'Extension-Addition-Group', + {ok,E} = Mod:encode('SystemInformationBlockType2', V), + {ok,V} = Mod:decode('SystemInformationBlockType2', iolist_to_binary(E)). diff --git a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-CommonDataTypes.asn b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-CommonDataTypes.asn index e3f6e83d6b..e3f6e83d6b 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-CommonDataTypes.asn +++ b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-CommonDataTypes.asn diff --git a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-Constants.asn b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-Constants.asn index 1411d455b7..1411d455b7 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-Constants.asn +++ b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-Constants.asn diff --git a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-Containers.asn b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-Containers.asn index fb08451103..fb08451103 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-Containers.asn +++ b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-Containers.asn diff --git a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-IEs.asn b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-IEs.asn index 848d8f6099..848d8f6099 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-IEs.asn +++ b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-IEs.asn diff --git a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Contents.asn b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Contents.asn index 9ecfa688a2..9ecfa688a2 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Contents.asn +++ b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Contents.asn diff --git a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Discriptions.asn b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Discriptions.asn index b9be9934e4..b9be9934e4 100755..100644 --- a/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Discriptions.asn +++ b/lib/asn1/test/asn1_SUITE_data/nbapsystem/NBAP-PDU-Discriptions.asn diff --git a/lib/asn1/test/asn1_app_test.erl b/lib/asn1/test/asn1_app_test.erl index c3797f08b2..2c31c3259d 100644 --- a/lib/asn1/test/asn1_app_test.erl +++ b/lib/asn1/test/asn1_app_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2010. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -138,7 +138,7 @@ check_asn1ct_modules(Extra) -> asn1ct_name,asn1ct_constructed_per,asn1ct_constructed_ber, asn1ct_gen_ber,asn1ct_constructed_ber_bin_v2, asn1ct_gen_ber_bin_v2,asn1ct_value, - asn1ct_tok,asn1ct_parser2], + asn1ct_tok,asn1ct_parser2,asn1ct_table], case Extra -- ASN1CTMods of [] -> ok; 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_bin_v2_particular_SUITE.erl.src b/lib/asn1/test/asn1_bin_v2_particular_SUITE.erl.src deleted file mode 100644 index abd21b0d78..0000000000 --- a/lib/asn1/test/asn1_bin_v2_particular_SUITE.erl.src +++ /dev/null @@ -1,95 +0,0 @@ - -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]), - - Parent = self(), - - ?line ok = asn1rt:load_driver(), - - smp2(Parent,NumOfProcs,Msg,2), - - N = 10000, - - ?line {Time1,ok} = timer:tc(?MODULE,smp2,[Parent,NumOfProcs,Msg, N]), - ?line {Time1S,ok} = timer:tc(?MODULE,sequential,[NumOfProcs * N,Msg]), - - ?line ok = testNBAPsystem:compile(Config,ber_bin,[optimize,driver]), - ?line {Time2,ok} = timer:tc(?MODULE,smp2,[Parent,NumOfProcs,Msg, N]), - - ?line {Time2S,ok} = timer:tc(?MODULE,sequential,[NumOfProcs * N,Msg]), - - {comment,lists:flatten(io_lib:format("Encode/decode time parallell with ~p cores: ~p [microsecs]~nEncode/decode time sequential: ~p [microsecs]",[NumOfProcs,Time1+Time2,Time1S+Time2S]))}; - false -> - {skipped,"No smp support"} - end. - -smp2(Parent,NumOfProcs,Msg, N) -> - Pids = [spawn_link(fun() -> worker(Msg,Parent, N) end) - || _ <- lists:seq(1,NumOfProcs)], - ?line ok = wait_pids(Pids). - -worker(Msg, Parent, N) -> - %% io:format("smp worker ~p with ~p worker loops.~n",[self(), N]), - worker_loop(N, Msg), - Parent ! self(). - -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). - - -wait_pids([]) -> - ok; -wait_pids(Pids) -> - receive - Pid when is_pid(Pid) -> - ?line true = lists:member(Pid,Pids), - Others = lists:delete(Pid,Pids), - io:format("wait_pid got ~p, still waiting for ~p\n",[Pid,Others]), - wait_pids(Others); - Err -> - io:format("Err: ~p~n",[Err]), - ?line exit(Err) - end. - -sequential(N,Msg) -> - %%io:format("sequential encode/decode with N = ~p~n",[N]), - worker_loop(N,Msg). - --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). 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 26cbdeb940..96c04a9436 100644 --- a/lib/asn1/test/asn1_test_lib.erl +++ b/lib/asn1/test/asn1_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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,11 +19,67 @@ %% -module(asn1_test_lib). +-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]). + ticket_7708/2, ticket_7763/1, ticket_7876/3]). -include_lib("test_server/include/test_server.hrl"). +compile(File, Config, Options) -> compile_all([File], Config, Options). + +compile_all(Files, Config, Options) -> + DataDir = ?config(data_dir, Config), + CaseDir = ?config(case_dir, Config), + [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) -> diff --git a/lib/asn1/test/ber_decode_error.erl b/lib/asn1/test/ber_decode_error.erl index 96d6545636..ff6e386a88 100644 --- a/lib/asn1/test/ber_decode_error.erl +++ b/lib/asn1/test/ber_decode_error.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,19 +19,10 @@ %% -module(ber_decode_error). --export([run/1, compile/3]). +-export([run/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 ++ "Constructed", - [Rules,{outdir,OutDir}]++Options). - - run([]) -> ?line {ok,B} = asn1_wrapper:encode('Constructed','S3',{'S3',17}), ?line [T,L|V] = lists:flatten(B), @@ -45,6 +36,10 @@ run([]) -> run([driver]) -> %% test of OTP-4797, bad indata to driver does not cause an EXIT ?line {error,_Reason} = asn1rt:decode('Constructed','S3',[3,5]), + ok; +run([nif]) -> + %% test of OTP-4797, bad indata to driver does not cause an EXIT + ?line {error,_Reason} = asn1rt:decode('Constructed','S3',[3,5]), ok. diff --git a/lib/asn1/test/h323test.erl b/lib/asn1/test/h323test.erl index 5545dd45b9..b7a7d6e4df 100644 --- a/lib/asn1/test/h323test.erl +++ b/lib/asn1/test/h323test.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,58 +19,20 @@ %% -module(h323test). --compile(export_all). --export([compile/3,run/1]). +-export([run/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 ++ "H235-SECURITY-MESSAGES",[Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "H323-MESSAGES",[Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "MULTIMEDIA-SYSTEM-CONTROL",[Rules,{outdir,OutDir}]++Options). - -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). @@ -78,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/pem_performance.erl b/lib/asn1/test/pem_performance.erl new file mode 100644 index 0000000000..87b8cbd61d --- /dev/null +++ b/lib/asn1/test/pem_performance.erl @@ -0,0 +1,37 @@ +%% %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>>). + +dsa_pem() -> + 'OTP-PUB-KEY':decode('DSAPrivateKey',<<48,130,1,187,2,1,0,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,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,20,89,128,159,14,187,249,182,172,15,88,162,110,211,71,179,209,29,125,217,38>>), + 'OTP-PUB-KEY':decode('SubjectPublicKeyInfo',<<48,130,1,183,48,130,1,44,6,7,42,134,72,206,56,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,3,129,132,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>>), + 'OTP-PUB-KEY':decode('DSAParams',<<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>>), + 'OTP-PUB-KEY':decode('DSAPublicKey',<<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>>), + 'OTP-PUB-KEY':encode('DSAParams',{params,{'Dss-Parms',129000451850199666185842362389296595317127259539517666765336291347244303954511451744518587442120964433734460998523119938005801396466878889993179871123036311260456172022864663021425348874648247531097042575063545128239655736096045972718934778583429973433661785691086624069991876932064334822608460064613803976593,1216700114794736143432235288305776850295620488937,104420402274523493329542694749036577763086597934731674202966304958550599470165597750883637440049774107540742087494301536297571301945349213110548764383811017178451900599240379681904765817950545426764751538502808499880604633364255316249231153053427235538288687666086821781456733226598288985591031656134573747213}}), + 'OTP-PUB-KEY':encode( + 'SubjectPublicKeyInfo', + {'SubjectPublicKeyInfo', + {'AlgorithmIdentifier', + {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>>}}). diff --git a/lib/asn1/test/testChoExtension.erl b/lib/asn1/test/testChoExtension.erl index 5e149ed247..b75cfb6831 100644 --- a/lib/asn1/test/testChoExtension.erl +++ b/lib/asn1/test/testChoExtension.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,21 +19,11 @@ %% -module(testChoExtension). --export([compile/3]). -export([extension/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 ++ "ChoExtension",[Rules,{outdir,OutDir}] ++ Options). - - - extension(_Rules) -> ?line {ok,Bytes1} = asn1_wrapper:encode('ChoExtension','ChoExt1',{'ChoExt1',{bool,true}}), diff --git a/lib/asn1/test/testChoExternal.erl b/lib/asn1/test/testChoExternal.erl index b6586b616b..b2d171f9c7 100644 --- a/lib/asn1/test/testChoExternal.erl +++ b/lib/asn1/test/testChoExternal.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 @@ -28,12 +28,12 @@ -compile(Config,Rules,Optimize) -> - - ?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 ++ "ChoExternal",[Rules,{outdir,OutDir}]++Optimize). +compile(Config, Rules, Optimize) -> + DataDir = ?config(data_dir, Config), + CaseDir = ?config(case_dir, Config), + true = code:add_patha(CaseDir), + ok = asn1ct:compile(DataDir ++ "ChoExternal", + [Rules, {outdir, CaseDir}] ++ Optimize). 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/testChoPrim.erl b/lib/asn1/test/testChoPrim.erl index f037db1c5d..936a38f76c 100644 --- a/lib/asn1/test/testChoPrim.erl +++ b/lib/asn1/test/testChoPrim.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,11 @@ %% -module(testChoPrim). --export([compile/3]). -export([bool/1]). -export([int/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 ++ "ChoPrim",[Rules,{outdir,OutDir}]++Options). - - - bool(Rules) -> ?line {ok,Bytes11} = asn1_wrapper:encode('ChoPrim','ChoCon',{bool0,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 cd5586602b..9563a31bf3 100644 --- a/lib/asn1/test/testCompactBitString.erl +++ b/lib/asn1/test/testCompactBitString.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 @@ -19,29 +19,11 @@ %% -module(testCompactBitString). --export([compile/3]). -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,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), - case Rules of - per_bin -> - ?line ok = asn1ct:compile(DataDir ++ "Constraints", - [Rules,{outdir,OutDir}]++Option); - _ -> ok - end. - - - compact_bit_string(Rules) -> %%========================================================== diff --git a/lib/asn1/test/testConstraints.erl b/lib/asn1/test/testConstraints.erl index dcbc04f8d8..543c106e8a 100644 --- a/lib/asn1/test/testConstraints.erl +++ b/lib/asn1/test/testConstraints.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 @@ -19,24 +19,11 @@ %% -module(testConstraints). --export([compile/3]). -export([int_constraints/1,refed_NNL_name/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 ++ "Constraints",[Rules,{outdir,OutDir}]++Options). - - - - int_constraints(Rules) -> %%========================================================== @@ -65,8 +52,6 @@ int_constraints(Rules) -> ?line {error,_Reason2} = asn1_wrapper:encode('Constraints','SingleValue',1000) end, - - %%========================================================== %% SingleValue2 ::= INTEGER (1..20) @@ -99,7 +84,21 @@ int_constraints(Rules) -> asn1_wrapper:encode('Constraints','SingleValue',1000) end, + %%========================================================== + %% SingleValue3 ::= INTEGER (Predefined | 5 | 10) + %% Testcase for OTP-10139. A single value subtyping of an integer type + %% where one value is predefined. + %%========================================================== + ?line {ok,BytesSV3} = asn1_wrapper:encode('Constraints','SingleValue3',1), + ?line {ok,1} = asn1_wrapper:decode('Constraints','SingleValue3', + lists:flatten(BytesSV3)), + ?line {ok,BytesSV3_2} = asn1_wrapper:encode('Constraints','SingleValue3',5), + ?line {ok,5} = asn1_wrapper:decode('Constraints','SingleValue3', + lists:flatten(BytesSV3_2)), + ?line {ok,BytesSV3_3} = asn1_wrapper:encode('Constraints','SingleValue3',10), + ?line {ok,10} = asn1_wrapper:decode('Constraints','SingleValue3', + lists:flatten(BytesSV3_3)), %%========================================================== %% Range2to19 ::= INTEGER (1<..<20) @@ -129,7 +128,65 @@ int_constraints(Rules) -> ?line {error,_Reason6} = asn1_wrapper:encode('Constraints','Range2to19',20) end, + + %%========================================================== + %% Tests for Range above 16^4 up to maximum supported by asn1 assuming the + %% octet length field is encoded on max 8 bits + %%========================================================== + LastNumWithoutLengthEncoding = 65536, + ?line {ok,BytesFoo} = asn1_wrapper:encode('Constraints','Range256to65536', + LastNumWithoutLengthEncoding), + ?line {ok,LastNumWithoutLengthEncoding} = + asn1_wrapper:decode('Constraints','Range256to65536',lists:flatten(BytesFoo)), + + FirstNumWithLengthEncoding = 65537, + ?line {ok,BytesBar} = asn1_wrapper:encode('LargeConstraints','RangeMax', + FirstNumWithLengthEncoding), + ?line {ok,FirstNumWithLengthEncoding} = + asn1_wrapper:decode('LargeConstraints','RangeMax',lists:flatten(BytesBar)), + + FirstNumOver16_6 = 16777217, + ?line {ok, BytesBaz} = + asn1_wrapper:encode('LargeConstraints','RangeMax', FirstNumOver16_6), + ?line {ok, FirstNumOver16_6} = + asn1_wrapper:decode('LargeConstraints','RangeMax',lists:flatten(BytesBaz)), + FirstNumOver16_8 = 4294967297, + ?line {ok, BytesQux} = + asn1_wrapper:encode('LargeConstraints','RangeMax', FirstNumOver16_8), + ?line {ok, FirstNumOver16_8} = + asn1_wrapper:decode('LargeConstraints','RangeMax',lists:flatten(BytesQux)), + + FirstNumOver16_10 = 1099511627776, + ?line {ok, BytesBur} = + asn1_wrapper:encode('LargeConstraints','RangeMax', FirstNumOver16_10), + ?line {ok, FirstNumOver16_10} = + asn1_wrapper:decode('LargeConstraints','RangeMax',lists:flatten(BytesBur)), + + FirstNumOver16_10 = 1099511627776, + ?line {ok, BytesBur} = + asn1_wrapper:encode('LargeConstraints','RangeMax', FirstNumOver16_10), + ?line {ok, FirstNumOver16_10} = + asn1_wrapper:decode('LargeConstraints','RangeMax',lists:flatten(BytesBur)), + + HalfMax = 1 bsl (128*8), + ?line {ok, BytesHalfMax} = + asn1_wrapper:encode('LargeConstraints','RangeMax', HalfMax), + ?line {ok, HalfMax} = + asn1_wrapper:decode('LargeConstraints','RangeMax',lists:flatten(BytesHalfMax)), + + Max = 1 bsl (255*8), + ?line {ok, BytesMax} = + asn1_wrapper:encode('LargeConstraints','RangeMax', Max), + ?line {ok, Max} = + asn1_wrapper:decode('LargeConstraints','RangeMax',lists:flatten(BytesMax)), + + %% Random number within longlong range + LongLong = 12672809400538808320, + ?line {ok, BytesLongLong} = + asn1_wrapper:encode('Constraints','LongLong', LongLong), + ?line {ok, LongLong} = + asn1_wrapper:decode('Constraints','LongLong',lists:flatten(BytesLongLong)), %%========================================================== %% Constraint Combinations (Duboisson p. 285) @@ -140,17 +197,26 @@ int_constraints(Rules) -> ?line {ok,0} = asn1_wrapper:decode('Constraints','I',Bytes12), ?line {ok,Bytes13} = asn1_wrapper:encode('Constraints','I',20), ?line {ok,20} = asn1_wrapper:decode('Constraints','I',Bytes13), - + + %%========================================================== + %% Constraint Combinations (Duboisson p. 285) + %% X1 ::= INTEGER (1..4|8|10|20) + %%========================================================== + + ?line {ok,Bytes14} = asn1_wrapper:encode('Constraints','X1',1), + ?line {ok,1} = asn1_wrapper:decode('Constraints','X1',Bytes14), + ?line {ok,Bytes15} = asn1_wrapper:encode('Constraints','X1',20), + ?line {ok,20} = asn1_wrapper:decode('Constraints','X1',Bytes15), %%========================================================== %% SIZE Constraint (Duboisson p. 268) %% T ::= IA5String (SIZE (1|2, ..., SIZE (1|2|3))) %% T2 ::= IA5String (SIZE (1|2, ..., 3)) %%========================================================== - ?line {ok,Bytes14} = asn1_wrapper:encode('Constraints','T',"IA"), - ?line {ok,"IA"} = asn1_wrapper:decode('Constraints','T',Bytes14), - ?line {ok,Bytes15} = asn1_wrapper:encode('Constraints','T2',"IA"), - ?line {ok,"IA"} = asn1_wrapper:decode('Constraints','T2',Bytes15). + ?line {ok,Bytes16} = asn1_wrapper:encode('Constraints','T',"IA"), + ?line {ok,"IA"} = asn1_wrapper:decode('Constraints','T',Bytes16), + ?line {ok,Bytes17} = asn1_wrapper:encode('Constraints','T2',"IA"), + ?line {ok,"IA"} = asn1_wrapper:decode('Constraints','T2',Bytes17). refed_NNL_name(_Erule) -> diff --git a/lib/asn1/test/testContextSwitchingTypes.erl b/lib/asn1/test/testContextSwitchingTypes.erl index 7d05e5c352..4f67942922 100644 --- a/lib/asn1/test/testContextSwitchingTypes.erl +++ b/lib/asn1/test/testContextSwitchingTypes.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2011. 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 @@ -19,29 +19,19 @@ %% -module(testContextSwitchingTypes). --export([compile/3]). --export([test/0]). +-export([test/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 ++ "ContextSwitchingTypes", - [Rules,{outdir,OutDir}]++Options). - - -test() -> +test(Config) -> ?line ValT = 'ContextSwitchingTypes':'val1-T'(), ?line {ok,Bytes1} = asn1_wrapper:encode('ContextSwitchingTypes','T',ValT), ?line {ok,Result1} = asn1_wrapper:decode('ContextSwitchingTypes','T',Bytes1), ?line ok = check_EXTERNAL(Result1), - ?line {ok,ValT2} = asn1ct:value('ContextSwitchingTypes','T'), + ?line {ok,ValT2} = asn1ct:value('ContextSwitchingTypes','T', + [{i, ?config(case_dir, Config)}]), ?line {ok,Bytes1_2} = asn1_wrapper:encode('ContextSwitchingTypes','T',ValT2), ?line {ok,Result1_2} = diff --git a/lib/asn1/test/testDER.erl b/lib/asn1/test/testDER.erl index 630f7ecc14..395116bd34 100644 --- a/lib/asn1/test/testDER.erl +++ b/lib/asn1/test/testDER.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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,19 +19,10 @@ %% -module(testDER). --export([compile/3]). -export([test/0]). -include_lib("test_server/include/test_server.hrl"). - -compile(Config,Rule,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 ++ "DERSpec", - [Rule,der,{outdir,OutDir}]++Options). - test() -> Val = {'Set',12,{version,214},true}, ?line {ok,Bin}=asn1_wrapper:encode('DERSpec','Set',Val), diff --git a/lib/asn1/test/testDeepTConstr.erl b/lib/asn1/test/testDeepTConstr.erl index 53d2b3040e..aa3afbb58f 100644 --- a/lib/asn1/test/testDeepTConstr.erl +++ b/lib/asn1/test/testDeepTConstr.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 @@ -21,23 +21,10 @@ -module(testDeepTConstr). --export([compile/3,main/1]). +-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 ++ - "TConstrChoice",[Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ - "TConstr",[Rules,{outdir,OutDir}]++Options). - - - main(_Erule) -> Val1 = {'FilterItem', {substrings, 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/testDoubleEllipses.erl b/lib/asn1/test/testDoubleEllipses.erl index 20be4ea215..9030a99ce2 100644 --- a/lib/asn1/test/testDoubleEllipses.erl +++ b/lib/asn1/test/testDoubleEllipses.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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(testDoubleEllipses). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -34,17 +33,6 @@ -record('SetAlt',{a,d,b,e,c,f,g}). -record('SetAltV2',{a,d,b,e,h,i,c,f,g}). - - - -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 ++ "DoubleEllipses",[Rules,{outdir,OutDir}]++Options). - - main(_Rules) -> %% SEQUENCE ?line {ok,Bytes} = diff --git a/lib/asn1/test/testEnumExt.erl b/lib/asn1/test/testEnumExt.erl index 4ea0f3b8a1..c97116413a 100644 --- a/lib/asn1/test/testEnumExt.erl +++ b/lib/asn1/test/testEnumExt.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-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,19 +19,10 @@ %% -module(testEnumExt). --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 ++ "EnumExt",[Rules,{outdir,OutDir}]++Options). - - main(Rules) when Rules == per; Rules == per_bin; Rules == uper_bin -> io:format("main(~p)~n",[Rules]), B32=[32],B64=[64], diff --git a/lib/asn1/test/testExternal.erl b/lib/asn1/test/testExternal.erl deleted file mode 100644 index 6e1fa0ee7d..0000000000 --- a/lib/asn1/test/testExternal.erl +++ /dev/null @@ -1,35 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-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(testExternal). - --export([compile/3]). - --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 test_server:format("Rules ~p~n",[Rules]), - ?line ok = asn1ct:compile(DataDir ++ "External",[Rules,{outdir,OutDir}]++Options). - - diff --git a/lib/asn1/test/testINSTANCE_OF.erl b/lib/asn1/test/testINSTANCE_OF.erl index 6ae656da44..5986a00ec5 100644 --- a/lib/asn1/test/testINSTANCE_OF.erl +++ b/lib/asn1/test/testINSTANCE_OF.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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,21 +19,10 @@ %% -module(testINSTANCE_OF). --export([compile/3,main/1]). +-export([main/1]). -include_lib("test_server/include/test_server.hrl"). - -compile(Config,Rules,Opt) -> - - ?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 ++ "INSTANCEOF.asn1", - [Rules,{outdir,OutDir}]++Opt). - - main(Erule) -> ?line {ok,Integer} = asn1_wrapper:encode('INSTANCEOF','Int',3), diff --git a/lib/asn1/test/testInfObj.erl b/lib/asn1/test/testInfObj.erl index 9d73be9f23..03e70c730a 100644 --- a/lib/asn1/test/testInfObj.erl +++ b/lib/asn1/test/testInfObj.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 @@ -20,7 +20,7 @@ -module(testInfObj). --export([compile/3,main/1,compile_RANAPfiles/3]). +-export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -28,42 +28,6 @@ -record('InitiatingMessage2',{procedureCode,criticality,value}). -record('Iu-ReleaseCommand',{first,second}). -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 ++ - "RANAPextract1",[Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "InfObj",[Rules,{outdir,OutDir}]++Options), - %% test case for OTP-4792 optional open type - ?line ok = asn1ct:compile(DataDir ++ "MAP-ExtensionDataTypes",[Rules,{outdir,OutDir}]++Options), - %% OTP-6707 - ?line ok = asn1ct:compile(DataDir ++ "Objects",[Rules,{outdir,OutDir}]++Options), - %% OTP-6717 - ?line ok = asn1ct:compile(DataDir ++ "INAPv2extract",[Rules,{outdir,OutDir}]++Options). - - -compile_RANAPfiles(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 ++ "RANAP-CommonDataTypes", - [Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "RANAP-Constants", - [Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "RANAP-Containers", - [Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "RANAP-IEs", - [Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "RANAP-PDU-Contents", - [Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "RANAP-PDU-Descriptions", - [Rules,{outdir,OutDir}]++Options). - - main(_Erule) -> Val1 = #'InitiatingMessage'{procedureCode=1, criticality=ignore, diff --git a/lib/asn1/test/testInfObjectClass.erl b/lib/asn1/test/testInfObjectClass.erl index 07ebb7dbd0..e639066246 100644 --- a/lib/asn1/test/testInfObjectClass.erl +++ b/lib/asn1/test/testInfObjectClass.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 @@ -21,22 +21,10 @@ -module(testInfObjectClass). --export([compile/3,main/1]). +-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 ++ "ErrorClass",[Rules,{outdir,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "InfClass",[Rules,{outdir,OutDir}]++Options). - - main(Rule) -> %% this test is added for OTP-4591, to test that elements in decoded %% value has terms in right order. diff --git a/lib/asn1/test/testMegaco.erl b/lib/asn1/test/testMegaco.erl index ca2b1062d1..f4edcebb7e 100644 --- a/lib/asn1/test/testMegaco.erl +++ b/lib/asn1/test/testMegaco.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 @@ -108,24 +108,17 @@ compile(_Config,ber,[optimize]) -> compile(_Config,per,[optimize]) -> {ok,no_module,no_module}; compile(Config,Erule,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 ++ - "MEDIA-GATEWAY-CONTROL.asn", - [Erule,{outdir,OutDir}]++Options), - - ?line ok = asn1ct:compile(DataDir ++ - "OLD-MEDIA-GATEWAY-CONTROL.asn", - [Erule,{outdir,OutDir}]++Options), + asn1_test_lib:compile("MEDIA-GATEWAY-CONTROL.asn", Config, [Erule|Options]), + asn1_test_lib:compile("OLD-MEDIA-GATEWAY-CONTROL.asn", Config, [Erule|Options]), {ok,'OLD-MEDIA-GATEWAY-CONTROL','MEDIA-GATEWAY-CONTROL'}. main(no_module,_) -> ok; -main('OLD-MEDIA-GATEWAY-CONTROL',_) -> +main('OLD-MEDIA-GATEWAY-CONTROL',Config) -> % Msg = msg11(), - {ok,Msg} = asn1ct:value('OLD-MEDIA-GATEWAY-CONTROL','MegacoMessage'), + CaseDir = ?config(case_dir, Config), + {ok,Msg} = asn1ct:value('OLD-MEDIA-GATEWAY-CONTROL','MegacoMessage', + [{i, CaseDir}]), ?line {ok,Bytes} = asn1_wrapper:encode('OLD-MEDIA-GATEWAY-CONTROL', 'MegacoMessage',Msg), ?line {ok,Msg} = asn1_wrapper:decode('OLD-MEDIA-GATEWAY-CONTROL', @@ -176,7 +169,7 @@ request(Mid, TransId, ContextId, CmdReq) when is_list(CmdReq) -> msg11() -> TimeStamp = #'TimeNotation'{date = "19990729", - time = "22010001"}, + time = "22012001"}, Parm = #'EventParameter'{eventParameterName = "ds", value = "916135551212"}, diff --git a/lib/asn1/test/testMergeCompile.erl b/lib/asn1/test/testMergeCompile.erl index 733cbc0eef..31aa3518f6 100644 --- a/lib/asn1/test/testMergeCompile.erl +++ b/lib/asn1/test/testMergeCompile.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 @@ -20,31 +20,13 @@ -module(testMergeCompile). --export([compile/3,main/1,mvrasn/1]). +-export([main/1,mvrasn/1]). -include_lib("test_server/include/test_server.hrl"). -record('InitiatingMessage',{procedureCode,criticality,value}). -record('Iu-ReleaseCommand',{protocolIEs,protocolExtensions}). -compile(Config,Erule,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 ++ - "MS.set.asn",[Erule,{outdir,OutDir}]++Options), - - ?line ok = asn1ct:compile(DataDir ++ - "RANAPSET.set.asn1",[Erule,{outdir,OutDir}]++Options), - - ?line ok = asn1ct:compile(filename:join([DataDir,"Mvrasn4.set.asn"]), - [Erule,{outdir,OutDir}]++Options), - - ?line ok = asn1ct:compile(filename:join([DataDir,"Mvrasn6.set.asn"]), - [Erule,{outdir,OutDir}]++Options). - - main(Erule) -> %% test of module MS.set.asn that tests OTP-4492: different tagdefault in %% modules and types with same name in modules diff --git a/lib/asn1/test/testMvrasn6.erl b/lib/asn1/test/testMvrasn6.erl deleted file mode 100644 index eaa667e6d7..0000000000 --- a/lib/asn1/test/testMvrasn6.erl +++ /dev/null @@ -1,44 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-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(testMvrasn6). - --export([compile/2]). --export([main/0]). - --include_lib("test_server/include/test_server.hrl"). - -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 Options = [Rules,{outdir,OutDir}], - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-21-4",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-20-6",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-19-6",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-15-6",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-18-6",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-14-6",Options), - ?line ok = asn1ct:compile(DataDir ++ "Mvrasn-11-6",Options). - - -main() -> - ok. - diff --git a/lib/asn1/test/testNBAPsystem.erl b/lib/asn1/test/testNBAPsystem.erl index 1269f94060..4e8381e51e 100644 --- a/lib/asn1/test/testNBAPsystem.erl +++ b/lib/asn1/test/testNBAPsystem.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2010. All Rights Reserved. +%% Copyright Ericsson AB 2005-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,7 @@ %% -module(testNBAPsystem). --export([compile/3,test/2,cell_setup_req_msg/0]). +-export([compile/2,test/2,cell_setup_req_msg/0]). -include_lib("test_server/include/test_server.hrl"). @@ -78,19 +78,15 @@ powerRaiseLimit, dLPowerAveragingWindowSize, 'iE-Extensions' = asn1_NOVALUE}). id, criticality, extensionValue}). -compile(Config,Rules,Opt) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line DataDir2 = filename:join([DataDir,nbapsystem]), - - ?line ok = asn1ct:compile(filename:join([DataDir2,"NBAP-CommonDataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"NBAP-IEs.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"NBAP-PDU-Contents.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"NBAP-PDU-Discriptions.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"NBAP-Constants.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"NBAP-Containers.asn"]),[Rules,{outdir,OutDir}]++Opt). +compile(Config, Options) -> + [asn1_test_lib:compile(filename:join([nbapsystem, M]), Config, Options) + || M <- ["NBAP-CommonDataTypes.asn", + "NBAP-IEs.asn", + "NBAP-PDU-Contents.asn", + "NBAP-PDU-Discriptions.asn", + "NBAP-Constants.asn", + "NBAP-Containers.asn"]], + ok. test(_Erule,Config) -> @@ -291,13 +287,7 @@ protocolIEs_051107() -> criticality = ignore, extensionValue = 'hsdpa-non-capable'}. - - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -compare(V,V) -> +compare(V,V) -> ok; compare(V,L) when is_list(L) -> compare(V,list_to_binary(L)); @@ -306,52 +296,7 @@ compare(_,_) -> check_record_names(Msg,Config) -> DataDir = ?config(data_dir,Config), - OutDir = ?config(priv_dir,Config), - io:format("check_record_names: compiling ~p~ninclude directory: ~p~n", - [filename:join([DataDir,"test_records"]),OutDir]), - ?line {ok,test_records} = compile:file(filename:join([DataDir,"test_records"]), - [{i,OutDir}]), - io:format("check_record_names: calling test_records:'check_record_names_OTP-5812'/1~n",[]), - ?line ok = test_records:'check_record_names_OTP-5812'(Msg). - -% check_record_names({initiatingMessage, -% #'InitiatingMessage'{procedureID = ProcedureID, -% criticality = _Criticality, -% messageDiscriminator = _MessageDisc, -% transactionID = _TransactionID, -% value = Value}}) -> - -% ?line ok = check_record_ProcedureID(ProcedureID), -% ?line ok = check_record_Value(Value). - -% check_record_ProcedureID(#'ProcedureID'{}) -> -% ok; -% check_record_ProcedureID(_) -> false. - -% check_record_Value(#'ResourceStatusIndication'{protocolIEs = ProtocolIEs}) -> -% ?line ok = check_record_ProtocolIEs(ProtocolIEs); -% check_record_Value(_) -> false. - -% check_record_ProtocolIEs(#'ProtocolIE-Field'{value =IndicationType}) -> -% ?line ok = check_record_NFResourceStatusInd(IndicationType); -% check_record_ProtocolIEs(_) -> false. - -% check_record_NFResourceStatusInd({'no-Failure',#'No-Failure-ResourceStatusInd'{'local-Cell-InformationList'=[LCI]}}) -> -% ?line ok = check_record_LCInfoResourceStatusInd(LCI); -% check_record_NFResourceStatusInd(_) -> false. - -% check_record_LCInfoResourceStatusInd(#'Local-Cell-InformationItem-ResourceStatusInd'{commonChannelsCapacityConsumptionLaw=[CCCCL],dedicatedChannelsCapacityConsumptionLaw=[DCCCL],'iE-Extensions' = [LCIRE]}) -> -% ?line ok = check_record_CCCCL(CCCCL), -% ?line ok = check_record_DCCCL(DCCCL), -% ?line ok = check_record_LCIRE(LCIRE). - -% check_record_CCCCL(#'CommonChannelsCapacityConsumptionLaw_SEQOF'{}) -> -% ok; -% check_record_CCCCL(_) -> false. - -% check_record_DCCCL(#'DedicatedChannelsCapacityConsumptionLaw_SEQOF'{}) -> -% ok; -% check_record_DCCCL(_) -> false. -% check_record_LCIRE(#'ProtocolExtensionField'{}) -> -% ok; -% check_record_LCIRE(_) -> false. + CaseDir = ?config(case_dir,Config), + {ok, test_records} = compile:file(filename:join([DataDir, "test_records"]), + [{i, CaseDir}]), + ok = test_records:'check_record_names_OTP-5812'(Msg). diff --git a/lib/asn1/test/testOpenTypeImplicitTag.erl b/lib/asn1/test/testOpenTypeImplicitTag.erl index 8662744ed3..a37d8004ef 100644 --- a/lib/asn1/test/testOpenTypeImplicitTag.erl +++ b/lib/asn1/test/testOpenTypeImplicitTag.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,21 +19,10 @@ %% -module(testOpenTypeImplicitTag). --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 ++ "OpenTypeImplicitTag",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes1} = diff --git a/lib/asn1/test/testParamBasic.erl b/lib/asn1/test/testParamBasic.erl index 4ba0029b54..b5780195b8 100644 --- a/lib/asn1/test/testParamBasic.erl +++ b/lib/asn1/test/testParamBasic.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 @@ -19,8 +19,6 @@ %% -module(testParamBasic). --export([compile/3]). --export([compile_der/2]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -30,22 +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). - -compile_der(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 ++ "ParamBasic", - [der,Rules,{outdir,OutDir}]). - main(Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testParameterizedInfObj.erl b/lib/asn1/test/testParameterizedInfObj.erl index b95d627d58..68faf08a61 100644 --- a/lib/asn1/test/testParameterizedInfObj.erl +++ b/lib/asn1/test/testParameterizedInfObj.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 @@ -20,7 +20,7 @@ -module(testParameterizedInfObj). --export([compile/3,main/1,ranap/1]). +-export([main/1,ranap/1]). -include_lib("test_server/include/test_server.hrl"). @@ -31,16 +31,6 @@ -record('Iu-ReleaseCommand',{protocolIEs,protocolExtensions}). -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 ++ "Param",[Rules,{outdir,OutDir}]++Options). -% ?line ok = asn1ct:compile(DataDir ++ "RANAP-CommonDataTypes",[Rules,{outdir,OutDir}]++Options). - - main(Erule) -> PERVal = #'AllocationOrRetentionPriority' {priorityLevel = true, diff --git a/lib/asn1/test/testPrim.erl b/lib/asn1/test/testPrim.erl index 97f99e7b1c..0d4427ba69 100644 --- a/lib/asn1/test/testPrim.erl +++ b/lib/asn1/test/testPrim.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(testPrim). --export([compile/3]). -export([bool/1]). -export([int/1]). -export([enum/1]). @@ -30,29 +29,6 @@ -include_lib("test_server/include/test_server.hrl"). - - -compile(Config,Rules,Opt) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - case Opt of - [optimize] -> - ?line ok = asn1ct:compile(DataDir ++ "Prim", - [Rules,optimize,{outdir,OutDir}]), - ?line ok = asn1ct:compile(DataDir ++ "Real", - [Rules,optimize,{outdir,OutDir}]); - __ -> - ?line ok = asn1ct:compile(DataDir ++ "Prim", - [Rules,{outdir,OutDir}]), - ?line ok = asn1ct:compile(DataDir ++ "Real", - [Rules,{outdir,OutDir}]) - end. - - - - bool(Rules) -> %%========================================================== diff --git a/lib/asn1/test/testPrimExternal.erl b/lib/asn1/test/testPrimExternal.erl index 23633177eb..65c3c3a31a 100644 --- a/lib/asn1/test/testPrimExternal.erl +++ b/lib/asn1/test/testPrimExternal.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,21 +19,10 @@ %% -module(testPrimExternal). --export([compile/3]). -export([external/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 ++ "PrimExternal",[Rules,{outdir,OutDir}]++Options). - - - external(_Rules) -> 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 52a58d850b..0000000000 --- a/lib/asn1/test/testRANAP.erl +++ /dev/null @@ -1,52 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-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(testRANAP). - --export([compile/3,testobj/1]). - --include_lib("test_server/include/test_server.hrl"). - - -compile(Config,Erule,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(filename:join(DataDir,"RANAP"),[Erule,{outdir,OutDir}]++Options), - ?line {ok,testobj} = compile:file(filename:join(DataDir,"testobj"),[{i,OutDir},{outdir,OutDir}]++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/testROSE.erl b/lib/asn1/test/testROSE.erl deleted file mode 100644 index a692ec7682..0000000000 --- a/lib/asn1/test/testROSE.erl +++ /dev/null @@ -1,36 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-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(testROSE). - --export([compile/3]). - --include_lib("test_server/include/test_server.hrl"). - - - -compile(Config,Rules,Opt) -> - - ?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 ++ "Remote-Operations-Merged.set.asn1", - [Rules,{outdir,OutDir}]++Opt). - diff --git a/lib/asn1/test/testSSLspecs.erl b/lib/asn1/test/testSSLspecs.erl index 10623af51e..51ef134e5f 100644 --- a/lib/asn1/test/testSSLspecs.erl +++ b/lib/asn1/test/testSSLspecs.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-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,58 +20,37 @@ -module(testSSLspecs). --export([compile/3,run/1,compile_inline/2,run_inline/1]). +-export([compile/2,run/1,compile_inline/2,run_inline/1]). -include_lib("test_server/include/test_server.hrl"). +compile(Config, Options) -> + DataDir = ?config(data_dir, Config), + CaseDir = ?config(case_dir, Config), + NewOptions = [{i, DataDir}, {i, CaseDir}|Options], -compile(Config,Rules,Options) -> + asn1_test_lib:compile_all(["SSL-PKIX", "PKIXAttributeCertificate"], + Config, NewOptions), - ?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 ++ - "SSL-PKIX",[Rules,{outdir,OutDir},{i,DataDir}, - {i,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "PKIXAttributeCertificate", - [Rules,{outdir,OutDir},{i,DataDir}, - {i,OutDir}]++Options), %% test case for OTP-4792 optional open type - ?line ok = asn1ct:compile(DataDir ++ "PKIX1Algorithms88", - [Rules,{outdir,OutDir},{i,DataDir}, - {i,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "PKIX1Explicit88", - [Rules,{outdir,OutDir},{i,DataDir}, - {i,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "PKIX1Implicit88", - [Rules,{outdir,OutDir},{i,DataDir}, - {i,OutDir}]++Options), + asn1_test_lib:compile_all(["PKIX1Algorithms88", "PKIX1Explicit88", + "PKIX1Implicit88"], + Config, NewOptions), + %% OTP-6698, OTP-6702 - ?line ok = remove_db_files(OutDir), - ?line ok = asn1ct:compile(DataDir ++ "PKIX1Explicit93", - [Rules,{outdir,OutDir},{i,DataDir}, - {i,OutDir}]++Options), - ?line ok = asn1ct:compile(DataDir ++ "PKIX1Implicit93", - [Rules,{outdir,OutDir},{i,DataDir}, - {i,OutDir}]++Options). - -compile_inline(Config,Rule) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - - case Rule of - BER when BER==ber_bin;BER==ber_bin_v2 -> - Options = [der,compact_bit_string,optimize, - asn1config,inline], - ?line ok = remove_db_file_inline(OutDir), - ?line ok = asn1ct:compile(DataDir ++ "OTP-PKIX.set.asn", - [Rule,{outdir,OutDir},{i,DataDir}, - {i,OutDir}]++Options); - _ -> - ok - end. + ok = remove_db_files(CaseDir), + asn1_test_lib:compile_all(["PKIX1Explicit93", "PKIX1Implicit93"], + Config, NewOptions). + +compile_inline(Config, Rule) when Rule == ber_bin; Rule == ber_bin_v2 -> + DataDir = ?config(data_dir, Config), + CaseDir = ?config(case_dir, Config), + Options = [{i, CaseDir}, {i, DataDir}, Rule, + der, compact_bit_string, optimize, asn1config, inline], + ok = remove_db_file_inline(CaseDir), + asn1_test_lib:compile("OTP-PKIX.set.asn", Config, Options); +compile_inline(_Config, _Rule) -> + ok. remove_db_files(Dir) -> ?line ok = remove_db_file(Dir ++ "PKIX1Explicit93.asn1db"), diff --git a/lib/asn1/test/testSelectionTypes.erl b/lib/asn1/test/testSelectionTypes.erl index 893c31622f..6d1641388f 100644 --- a/lib/asn1/test/testSelectionTypes.erl +++ b/lib/asn1/test/testSelectionTypes.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-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,19 +19,10 @@ %% -module(testSelectionTypes). --export([compile/3]). -export([test/0]). -include_lib("test_server/include/test_server.hrl"). - -compile(Config,Rule,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 ++ "SelectionType", - [Rule,{outdir,OutDir}]++Options). - test() -> Val = ["PrintableString","PrintableString","PrintableString"], ?line {ok,Bin}=asn1_wrapper:encode('SelectionType','MendeleyevTable',Val), diff --git a/lib/asn1/test/testSeq2738.erl b/lib/asn1/test/testSeq2738.erl index 9cf9c8fcb4..cddfe4b311 100644 --- a/lib/asn1/test/testSeq2738.erl +++ b/lib/asn1/test/testSeq2738.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,7 +19,6 @@ %% -module(testSeq2738). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -32,14 +31,6 @@ -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 ++ "Seq2738",[Rules,{outdir,OutDir}]++Options). - - main(_Rules) -> ?line {ok,Bytes} = diff --git a/lib/asn1/test/testSeqDefault.erl b/lib/asn1/test/testSeqDefault.erl index edf07cf1c1..a772b749bd 100644 --- a/lib/asn1/test/testSeqDefault.erl +++ b/lib/asn1/test/testSeqDefault.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(testSeqDefault). -include("External.hrl"). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -37,15 +36,6 @@ -record('SeqIn',{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 ++ "SeqDefault",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSeqExtension.erl b/lib/asn1/test/testSeqExtension.erl index 538e2c250b..7c77ab87e9 100644 --- a/lib/asn1/test/testSeqExtension.erl +++ b/lib/asn1/test/testSeqExtension.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(testSeqExtension). -include("External.hrl"). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -31,16 +30,6 @@ -record('SeqExt4',{bool, int}). -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 ++ "SeqExtension", - [Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSeqIndefinite.erl b/lib/asn1/test/testSeqIndefinite.erl index 9285d7b368..25742474bb 100644 --- a/lib/asn1/test/testSeqIndefinite.erl +++ b/lib/asn1/test/testSeqIndefinite.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,20 +19,11 @@ %% -module(testSeqIndefinite). --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 ++ "SeqSetIndefinite", - [Rules,{outdir,OutDir}]++Options). - main(per_bin) -> ok; main(per) -> ok; main(ber_bin_v2) -> 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/testSeqSetDefaultVal.erl b/lib/asn1/test/testSeqSetDefaultVal.erl index 5a1a443ebc..ab484db5f2 100644 --- a/lib/asn1/test/testSeqSetDefaultVal.erl +++ b/lib/asn1/test/testSeqSetDefaultVal.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 @@ -20,7 +20,6 @@ -module(testSeqSetDefaultVal). -include("External.hrl"). --export([compile/2]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -95,14 +94,6 @@ -record('S4_b',{ba = asn1_DEFAULT, bb = asn1_DEFAULT}). - -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 ++ "Default", - [Rules,der,{outdir,OutDir}]). - main(_Rules) -> ?line {ok,[48,0]} = diff --git a/lib/asn1/test/testSeqTag.erl b/lib/asn1/test/testSeqTag.erl index 60d3629840..9fdaae35dd 100644 --- a/lib/asn1/test/testSeqTag.erl +++ b/lib/asn1/test/testSeqTag.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(testSeqTag). --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 ++ "SeqTag",[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/testSeqTypeRefSeq.erl b/lib/asn1/test/testSeqTypeRefSeq.erl index 51b0f13c57..57ec6c19b1 100644 --- a/lib/asn1/test/testSeqTypeRefSeq.erl +++ b/lib/asn1/test/testSeqTypeRefSeq.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(testSeqTypeRefSeq). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -46,15 +45,6 @@ -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 ++ "SeqTypeRefSeq",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> diff --git a/lib/asn1/test/testSeqTypeRefSet.erl b/lib/asn1/test/testSeqTypeRefSet.erl index a704ce3403..c06a0e7a2b 100644 --- a/lib/asn1/test/testSeqTypeRefSet.erl +++ b/lib/asn1/test/testSeqTypeRefSet.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(testSeqTypeRefSet). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -31,15 +30,6 @@ -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 ++ "SeqTypeRefSet",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes41} = diff --git a/lib/asn1/test/testSetDefault.erl b/lib/asn1/test/testSetDefault.erl index e36894327c..8aa205e0f0 100644 --- a/lib/asn1/test/testSetDefault.erl +++ b/lib/asn1/test/testSetDefault.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(testSetDefault). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -30,16 +29,6 @@ -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 ++ "SetDefault",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = 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/testSetIndefinite.erl b/lib/asn1/test/testSetIndefinite.erl index bf8b242860..d8e2b6a9cf 100644 --- a/lib/asn1/test/testSetIndefinite.erl +++ b/lib/asn1/test/testSetIndefinite.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,20 +19,11 @@ %% -module(testSetIndefinite). --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 ++ "SeqSetIndefinite", - [Rules,{outdir,OutDir}]++Options). - main(per_bin) -> ok; main(per) -> ok; main(ber_bin_v2) -> diff --git a/lib/asn1/test/testSetOf.erl b/lib/asn1/test/testSetOf.erl index 0769b9a344..08723fb468 100644 --- a/lib/asn1/test/testSetOf.erl +++ b/lib/asn1/test/testSetOf.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(testSetOf). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -37,15 +36,6 @@ -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 ++ "SetOf",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSetOfCho.erl b/lib/asn1/test/testSetOfCho.erl index 474742fbdb..c89bf9596e 100644 --- a/lib/asn1/test/testSetOfCho.erl +++ b/lib/asn1/test/testSetOfCho.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(testSetOfCho). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -33,15 +32,6 @@ -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 ++ "SetOfCho",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSetOfExternal.erl b/lib/asn1/test/testSetOfExternal.erl index 9e2b01c698..6b280a2595 100644 --- a/lib/asn1/test/testSetOfExternal.erl +++ b/lib/asn1/test/testSetOfExternal.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(testSetOfExternal). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -32,15 +31,6 @@ -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 ++ "SetOfExternal",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes11} = diff --git a/lib/asn1/test/testSetOfTag.erl b/lib/asn1/test/testSetOfTag.erl index c101306d7a..2c7a2f5473 100644 --- a/lib/asn1/test/testSetOfTag.erl +++ b/lib/asn1/test/testSetOfTag.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(testSetOfTag). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -47,15 +46,6 @@ -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 ++ "SetOfTag",[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/testSetTypeRefCho.erl b/lib/asn1/test/testSetTypeRefCho.erl index 1f68a8fbc4..a0989926c7 100644 --- a/lib/asn1/test/testSetTypeRefCho.erl +++ b/lib/asn1/test/testSetTypeRefCho.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(testSetTypeRefCho). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -28,15 +27,6 @@ -record('SetTRcho',{setCho, setChoE, 'setCho-E', 'setChoE-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 ++ "SetTypeRefCho",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> diff --git a/lib/asn1/test/testSetTypeRefPrim.erl b/lib/asn1/test/testSetTypeRefPrim.erl index e6cec260e5..9c7fbd803e 100644 --- a/lib/asn1/test/testSetTypeRefPrim.erl +++ b/lib/asn1/test/testSetTypeRefPrim.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(testSetTypeRefPrim). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -27,15 +26,6 @@ -record('SetTR',{octStr, octStrI, octStrE, 'octStr-I', 'octStrI-I', 'octStrE-I', 'octStr-E', 'octStrI-E', 'octStrE-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 ++ "SetTypeRefPrim",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> diff --git a/lib/asn1/test/testSetTypeRefSeq.erl b/lib/asn1/test/testSetTypeRefSeq.erl index 0c1c9400bf..a3ef4b188d 100644 --- a/lib/asn1/test/testSetTypeRefSeq.erl +++ b/lib/asn1/test/testSetTypeRefSeq.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(testSetTypeRefSeq). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -31,15 +30,6 @@ -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 ++ "SetTypeRefSeq",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> ?line {ok,Bytes41} = diff --git a/lib/asn1/test/testSetTypeRefSet.erl b/lib/asn1/test/testSetTypeRefSet.erl index 6544e77458..ce77316ef8 100644 --- a/lib/asn1/test/testSetTypeRefSet.erl +++ b/lib/asn1/test/testSetTypeRefSet.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(testSetTypeRefSet). --export([compile/3]). -export([main/1]). -include_lib("test_server/include/test_server.hrl"). @@ -46,15 +45,6 @@ -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 ++ "SetTypeRefSet",[Rules,{outdir,OutDir}]++Options). - - - main(_Rules) -> diff --git a/lib/asn1/test/testTCAP.erl b/lib/asn1/test/testTCAP.erl index 5e29938a16..878ce7c070 100644 --- a/lib/asn1/test/testTCAP.erl +++ b/lib/asn1/test/testTCAP.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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,33 +19,23 @@ %% -module(testTCAP). --export([compile/3,test/2,compile_asn1config/3,test_asn1config/0]). +-export([compile/2,test/2,compile_asn1config/2,test_asn1config/0]). -include_lib("test_server/include/test_server.hrl"). +compile(Config, Options) -> + Files = ["Remote-Operations-Information-Objects", + "TCAPMessages", + "TCAPMessages-simple", + "TCAPPackage"], + asn1_test_lib:compile_all(Files, Config, Options), + asn1_test_lib:compile_erlang("TCAPPackage_msg", Config, []). - -compile(Config,Rules,Opt) -> - - ?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 ++ "Remote-Operations-Information-Objects",[Rules,{outdir,OutDir}]++Opt), -% ?line ok = asn1ct:compile(DataDir ++ "Remote-Operations-Generic-ROS-PDUs",[Rules,{outdir,OutDir}]++Opt), -% ?line ok = asn1ct:compile(DataDir ++ "Remote-Operations-Useful-Definitions",[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(DataDir ++ "TCAPMessages",[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(DataDir ++ "TCAPMessages-simple",[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(DataDir ++ "TCAPPackage",[Rules,{outdir,OutDir}]++Opt), - ?line compile:file(filename:join([DataDir,"TCAPPackage_msg"]),[{i,OutDir},{outdir,OutDir}]). - -compile_asn1config(Config,Rules,Opt) -> - ?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 ++ "TCAPPackage", - [Rules,{outdir,OutDir},{i,DataDir}]++Opt). +compile_asn1config(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/testTcapsystem.erl b/lib/asn1/test/testTcapsystem.erl index 2f13c11cd4..4979a385b2 100644 --- a/lib/asn1/test/testTcapsystem.erl +++ b/lib/asn1/test/testTcapsystem.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-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,54 +19,46 @@ %% -module(testTcapsystem). --export([compile/3]). +-export([compile/2]). -include_lib("test_server/include/test_server.hrl"). - - -compile(Config,Rules,Opt) -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line DataDir2 = filename:join([DataDir,tcapsystem]), - - ?line ok = asn1ct:compile(filename:join([DataDir2,"DialoguePDUs.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-ApplicationContexts.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-BS-Code.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-CallHandlingOperations.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-CH-DataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-CommonDataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-DialogueInformation.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-ER-DataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-Errors.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-ExtensionDataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-GR-DataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-Group-Call-Operations.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-LCS-DataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-LocationServiceOperations.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-MobileServiceOperations.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-MS-DataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-OM-DataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-OperationAndMaintenanceOperations.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-Protocol.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-SecureTransportOperations.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-ShortMessageServiceOperations.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-SM-DataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-SS-Code.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-SS-DataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-ST-DataTypes.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-SupplementaryServiceOperations.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MAP-TS-Code.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"MobileDomainDefinitions.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"Remote-Operations-Generic-ROS-PDUs.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"Remote-Operations-Information-Objects.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"Remote-Operations-Useful-Definitions.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"TCAP-Examples.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"TCAPMessages.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"TCAP-Tools.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"TC-Notation-Extensions.asn"]),[Rules,{outdir,OutDir}]++Opt), - ?line ok = asn1ct:compile(filename:join([DataDir2,"UnidialoguePDUs.asn"]),[Rules,{outdir,OutDir}]++Opt). - - +compile(Config, Options) -> + [asn1_test_lib:compile(filename:join([tcapsystem, M]), Config, Options) + || M <- ["DialoguePDUs.asn", + "MAP-ApplicationContexts.asn", + "MAP-BS-Code.asn", + "MAP-CallHandlingOperations.asn", + "MAP-CH-DataTypes.asn", + "MAP-CommonDataTypes.asn", + "MAP-DialogueInformation.asn", + "MAP-ER-DataTypes.asn", + "MAP-Errors.asn", + "MAP-ExtensionDataTypes.asn", + "MAP-GR-DataTypes.asn", + "MAP-Group-Call-Operations.asn", + "MAP-LCS-DataTypes.asn", + "MAP-LocationServiceOperations.asn", + "MAP-MobileServiceOperations.asn", + "MAP-MS-DataTypes.asn", + "MAP-OM-DataTypes.asn", + "MAP-OperationAndMaintenanceOperations.asn", + "MAP-Protocol.asn", + "MAP-SecureTransportOperations.asn", + "MAP-ShortMessageServiceOperations.asn", + "MAP-SM-DataTypes.asn", + "MAP-SS-Code.asn", + "MAP-SS-DataTypes.asn", + "MAP-ST-DataTypes.asn", + "MAP-SupplementaryServiceOperations.asn", + "MAP-TS-Code.asn", + "MobileDomainDefinitions.asn", + "Remote-Operations-Generic-ROS-PDUs.asn", + "Remote-Operations-Information-Objects.asn", + "Remote-Operations-Useful-Definitions.asn", + "TCAP-Examples.asn", + "TCAPMessages.asn", + "TCAP-Tools.asn", + "TC-Notation-Extensions.asn", + "UnidialoguePDUs.asn"]], + ok. 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 f0699370e0..cd5223ef23 100644 --- a/lib/asn1/test/testTypeValueNotation.erl +++ b/lib/asn1/test/testTypeValueNotation.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,60 +19,43 @@ %% -module(testTypeValueNotation). --export([compile/3]). -export([main/2]). -include_lib("test_server/include/test_server.hrl"). --record('Seq',{octstr, int, bool, enum, bitstr, null, oid, vstr}). - - -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 ++ "SeqTypeRefPrim", - [Rules,{outdir,OutDir}]++Options), - %% OTP-6695 - ?line ok = asn1ct:compile(DataDir ++ "ValueTest", - [Rules,{outdir,OutDir}]++Options). - - -main(Rules,Option) -> - - 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, - - ok. +-record('Seq', {octstr, int, bool, enum, bitstr, null, oid, vstr}). + +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). + +%% 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). + +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/testX420.erl b/lib/asn1/test/testX420.erl index 1d18e76c48..b222b15204 100644 --- a/lib/asn1/test/testX420.erl +++ b/lib/asn1/test/testX420.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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,32 +26,21 @@ -include_lib("test_server/include/test_server.hrl"). -compile(Erule,Options,Config) -> - +compile(Erule, Options, Config) -> Specs = specs(), - ?line 99 = length(Specs), - ?line ok = compile_loop(Erule,Specs,Options,Config). - - + 99 = length(Specs), + ok = compile_loop(Erule,Specs,Options,Config). -compile_loop(_Erule,[],_Options,_Config) -> +compile_loop(_Erule, [], _Options, _Config) -> ok; -compile_loop(Erule,[Spec|Specs],Options,Config) - when Erule == ber; Erule == ber_bin; Erule == ber_bin_v2; - Erule == per -> - - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - - case asn1ct:compile(DataDir ++ "/x420/" ++ Spec,[Erule,{outdir,OutDir}, - {i,OutDir}]++Options) of - ok -> - compile_loop(Erule,Specs,Options,Config); - Error -> - Error - end; -compile_loop(_Erule,_Specs,_Options,_Config) -> - ok.%%{skip,io_lib:format("Not tested for ~p",[Erule])}. +compile_loop(Erule, [Spec|Specs], Options, Config) + when Erule == ber; Erule == ber_bin; Erule == ber_bin_v2; Erule == per -> + CaseDir = ?config(case_dir, Config), + asn1_test_lib:compile(filename:join([x420, Spec]), Config, + [Erule, {i, CaseDir} | Options]), + compile_loop(Erule, Specs, Options, Config); +compile_loop(_Erule, _Specs, _Options, _Config) -> + ok. specs() -> @@ -91,7 +80,7 @@ specs() -> "Protected-Part-Descriptors", "ProtocolObjectIdentifiers", "Raster-Gr-Coding-Attributes", "Raster-Gr-Presentation-Attributes", "Raster-Gr-Profile-Attributes", "Reliable-Transfer-APDU", - "Remote-Operations-Abstract-Syntaxes", + "Remote-Operations-Abstract-Syntaxes", "Remote-Operations-Generic-ROS-PDUs", "Remote-Operations-Information-Objects-extensions", "Remote-Operations-Information-Objects", 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_compile_options.erl b/lib/asn1/test/test_compile_options.erl index a622d5bfd2..4e732308d8 100644 --- a/lib/asn1/test/test_compile_options.erl +++ b/lib/asn1/test/test_compile_options.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2011. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -40,10 +40,7 @@ wrong_path(Config) -> comp(Parent,Config) -> DataDir = ?config(data_dir,Config), OutDir = ?config(priv_dir,Config), - %%?line true = code:add_patha(?config(priv_dir,Config)), - io:format("DataDir: ~p~n",[DataDir]), ?line Err=asn1ct:compile(DataDir++"NoImport",[{i,OutDir},{i,filename:join([DataDir,"subdir"])},{outdir,OutDir}]), - io:format("compiling process terminated with value: ~p~n",[Err]), Parent!Err. %% OTP-5701 @@ -67,13 +64,7 @@ path(Config) -> file:set_cwd(CWD), ok. -ticket_6143(Config) -> - DataDir = ?config(data_dir,Config), - OutDir = ?config(priv_dir,Config), - io:format("DataDir: ~p~n",[DataDir]), - - ?line ok=asn1ct:compile(filename:join([DataDir,"AA1"]),[{i,DataDir},{outdir,OutDir}]), - ok. +ticket_6143(Config) -> asn1_test_lib:compile("AA1", Config, []). noobj(Config) -> DataDir = ?config(data_dir,Config), diff --git a/lib/asn1/test/test_driver_load.erl b/lib/asn1/test/test_driver_load.erl index 965f2473e9..e0e6602046 100644 --- a/lib/asn1/test/test_driver_load.erl +++ b/lib/asn1/test/test_driver_load.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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(test_driver_load). --export([compile/2,test/2,encode/0]). +-export([test/1,encode/0]). -include_lib("test_server/include/test_server.hrl"). -test(per_bin,0) -> +test(0) -> ok; -test(per_bin,N) -> +test(N) -> spawn(?MODULE,encode,[]), - test(per_bin,N-1); -test(_,_) -> - ok. - -compile(Config,per_bin) -> - ?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 ++ "P-Record", - [per_bin,optimize,{outdir,OutDir}]); -compile(_,Erule) -> - {skip,lists:concat(["not implemented for version: ",Erule])}. - + test(N-1). encode() -> ?line Msg = msg(), diff --git a/lib/asn1/test/test_inline.erl b/lib/asn1/test/test_inline.erl index b7ec0d8921..62625572e3 100644 --- a/lib/asn1/test/test_inline.erl +++ b/lib/asn1/test/test_inline.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-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,7 @@ %% -module(test_inline). --export([compile/3,main/1,inline1/3,performance/1,performance2/0]). +-export([compile/2,main/2,inline1/3,performance/1,performance2/0]). -export([mvrasn_inlined_encdec/2,mvrasn_encdec/2, mi_encdec/2,m_encdec/2]). @@ -27,52 +27,38 @@ -define(times, 5000). -define(times2, 50000). -compile(Config,_Rules,Opt) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line true = code:add_patha(DataDir), - - ?line ok=asn1ct:compile(DataDir++"Mvrasn.set.asn",[{inline,mvrasn_inlined},{outdir,OutDir}]++Opt), - ?line ok=asn1ct:compile(DataDir++"Mvrasn-11-6.asn",[{outdir,OutDir}]++Opt), +compile(Config, Options) -> + CaseDir = ?config(case_dir, Config), + asn1_test_lib:compile("Mvrasn.set.asn", Config, [{inline, mvrasn_inlined}|Options]), + asn1_test_lib:compile("Mod.set.asn", Config, [{inline, m}|Options]), + ok = remove_inlined_files(CaseDir, [filename:join([CaseDir, X])||X<-["m.erl", "m.beam"]]), + asn1_test_lib:compile("Mod.set.asn", Config, [inline|Options]), + ok = remove_inlined_files(CaseDir, []). - ?line ok=asn1ct:compile(DataDir++"Mod.set.asn",[{inline,m},{outdir,OutDir}]++Opt), - ?line ok=remove_inlined_files(OutDir,[filename:join([OutDir,X])||X<-["m.erl","m.beam"]]), - ?line ok=asn1ct:compile(DataDir++"Mod.set.asn",[inline,{outdir,OutDir}]++Opt), - ?line ok=remove_inlined_files(OutDir,[]). - -inline1(Config,Rule,Opt) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - - ?line ok=asn1ct:compile(DataDir++"P-Record", - [{inline,'inlined_P_Record'}, - {outdir,OutDir}]++Opt), - ?line test_inline1(), - - ?line ok=remove_inlined_files2(OutDir,ber_bin_v2), +inline1(Config, Rule, Opt) -> + CaseDir = ?config(case_dir, Config), + + asn1_test_lib:compile("P-Record", Config, [{inline, 'inlined_P_Record'}|Opt]), + test_inline1(), + + ok=remove_inlined_files2(CaseDir, ber_bin_v2), case Rule of - ber_bin_v2 -> - ?line ok=asn1ct:compile(DataDir++"P-Record", - [inline,asn1config,ber_bin,optimize, - {outdir,OutDir}]++Opt), - ?line test_inline2(Rule,'P-Record'), - ?line remove_inlined_files3(OutDir,Rule), - io:format("compiling ~p~nwith ~p~n", - [DataDir ++ "p_record.set.asn", - [inline,asn1config,ber_bin,optimize,{outdir,OutDir}]++Opt]), - ?line ok = asn1ct:compile(DataDir ++ "p_record.set.asn", - [inline,asn1config,ber_bin,optimize, - {outdir,OutDir}]++Opt), - ?line test_inline2(Rule,'p_record'), - ?line remove_inlined_files4(OutDir,Rule); - _ -> - ok + ber_bin_v2 -> + asn1_test_lib:compile("P-Record", Config, + [ber_bin, inline, asn1config, optimize|Opt]), + test_inline2(Rule, 'P-Record'), + remove_inlined_files3(CaseDir, Rule), + asn1_test_lib:compile("p_record.set.asn", Config, + [ber_bin, inline, asn1config, optimize|Opt]), + test_inline2(Rule, 'p_record'), + remove_inlined_files4(CaseDir, Rule); + _ -> + ok end. -main(_Erule) -> - ?line Val = val(), +main(Config, _Erule) -> + Val = val(Config), ?line {ok,Bytes}=asn1_wrapper:encode(mvrasn_inlined,'InsertSubscriberDataArg',Val), ?line {ok,_Val2}=asn1_wrapper:decode(mvrasn_inlined,'InsertSubscriberDataArg',Bytes). @@ -94,14 +80,13 @@ test_inline2(ber_bin_v2,Mod) -> test_inline2(_,_) -> ok. -val() -> - ?line {ok,Val} = asn1ct:value('Mvrasn-11-6','InsertSubscriberDataArg'), +val(Config) -> + {ok,Val} = asn1ct:value('Mvrasn','InsertSubscriberDataArg', + [{i, ?config(case_dir, Config)}]), Val. performance(Config) -> - ?line true = code:add_patha(?config(priv_dir,Config)), - ?line true = code:add_patha(?config(data_dir,Config)), - ?line Val = val(), + Val = val(Config), %% warm up timer:tc(?MODULE,mvrasn_inlined_encdec,[2,Val]), %% performance test diff --git a/lib/asn1/test/test_modified_x420.erl b/lib/asn1/test/test_modified_x420.erl index 4e96db070b..ae9d1989fb 100644 --- a/lib/asn1/test/test_modified_x420.erl +++ b/lib/asn1/test/test_modified_x420.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -18,35 +18,21 @@ %% %% -module(test_modified_x420). - -%-compile(export_all). --export([compile/1, test_io/1]). +-export([test/1]). -include_lib("test_server/include/test_server.hrl"). -compile(Config) -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - - ok = asn1ct:compile(filename:join([DataDir,modified_x420,"PKCS7"]),[der,{outdir,OutDir}]), - ok = asn1ct:compile(filename:join([DataDir,modified_x420,"InformationFramework"]),[der,{outdir,OutDir}]), - ok = asn1ct:compile(filename:join([DataDir,modified_x420,"AuthenticationFramework"]),[der,{outdir,OutDir}]). - -test_io(Config) -> - io:format("~p~n~n", [catch test(Config)]). - test(Config) -> - ?line DataDir = ?config(data_dir,Config), -% ?line OutDir = ?config(priv_dir,Config), + DataDir = ?config(data_dir,Config), - ?line Der = read_pem(filename:join([DataDir,modified_x420,"p7_signed_data.pem"])), - ?line {ok, {_,_,SignedData}} = 'PKCS7':decode('ContentInfo', Der), - ?line {ok,_} = 'PKCS7':decode('SignedData', SignedData). + Der = read_pem(filename:join([DataDir,modified_x420,"p7_signed_data.pem"])), + {ok,{_,_,SignedData}} = asn1_wrapper:decode('PKCS7', 'ContentInfo', Der), + {ok,_} = asn1_wrapper:decode('PKCS7', 'SignedData', SignedData). read_pem(File) -> - ?line {ok, Bin} = file:read_file(File), - ?line ssl_base64:join_decode(lists:flatten(extract_base64(Bin))). - + {ok,Bin} = file:read_file(File), + Der = base64:mime_decode(lists:flatten(extract_base64(Bin))), + binary_to_list(Der). extract_base64(Binary) -> diff --git a/lib/asn1/test/test_partial_incomplete_decode.erl b/lib/asn1/test/test_partial_incomplete_decode.erl index a2e0a96bd8..df56c27115 100644 --- a/lib/asn1/test/test_partial_incomplete_decode.erl +++ b/lib/asn1/test/test_partial_incomplete_decode.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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,40 +19,11 @@ %% -module(test_partial_incomplete_decode). --export([compile/3,test/2]). +-export([test/1]). -include_lib("test_server/include/test_server.hrl"). - - -compile(Config,Rule,Opt) when Rule == ber_bin_v2 -> - - ?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 ++ "PartialDecSeq.asn", - [Rule,{outdir,OutDir},{i,DataDir}, - asn1config]++Opt), - ?line ok = asn1ct:compile(DataDir ++ "PartialDecSeq2.asn", - [Rule,{outdir,OutDir},{i,DataDir}, - asn1config]++Opt), - ?line ok = asn1ct:compile(DataDir ++ "PartialDecSeq3.asn", - [Rule,{outdir,OutDir},{i,DataDir}, - asn1config]++Opt), - ?line ok = asn1ct:compile(DataDir ++ "PartialDecMyHTTP.asn", - [Rule,{outdir,OutDir},{i,DataDir}, - asn1config]++Opt), - ?line ok = asn1ct:compile(DataDir ++ "MEDIA-GATEWAY-CONTROL.asn", - [Rule,{outdir,OutDir},{i,DataDir}, - asn1config]++Opt), - ?line ok = asn1ct:compile(DataDir ++ "P-Record", - [Rule,{outdir,OutDir},{i,DataDir}, - asn1config]++Opt); -compile(_,Rule,_) -> - {skip,lists:concat(["not implemented yet for version: ",Rule])}. - -test(ber_bin_v2,Config) -> +test(Config) -> FMsg = msg('F'), ?line {ok,Bytes} = asn1_wrapper:encode('PartialDecSeq','F',FMsg), ?line {ok,_} = asn1_wrapper:decode('PartialDecSeq','F',Bytes), @@ -110,9 +81,7 @@ test(ber_bin_v2,Config) -> %% test of MEDIA-GATEWAY-CONTROL test_megaco(Config), - ok; -test(Erule,_) -> - {skip,lists:concat(["not implemented yet for version: ",Erule])}. + ok. test_megaco(Config) -> ?line DataDir = ?config(data_dir,Config), diff --git a/lib/asn1/test/test_selective_decode.erl b/lib/asn1/test/test_selective_decode.erl index e1e101b622..bb348611da 100644 --- a/lib/asn1/test/test_selective_decode.erl +++ b/lib/asn1/test/test_selective_decode.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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,12 +19,12 @@ %% -module(test_selective_decode). --export([test/2]). +-export([test/0]). -include_lib("test_server/include/test_server.hrl"). -test(ber_bin_v2,_Config) -> +test() -> FMsg = msg('F'), ?line {ok,Bytes} = asn1_wrapper:encode('PartialDecSeq','F',FMsg), ?line {ok,3} = @@ -48,10 +48,7 @@ test(ber_bin_v2,_Config) -> ?line {ok,Bytes4} = asn1_wrapper:encode('P-Record','PersonnelRecord', PRecMsg), ?line {ok,_} = 'P-Record':sel_dec(list_to_binary(Bytes4)), - - ok; -test(Erule,_) -> - {skip,lists:concat(["not implemented yet for version: ",Erule])}. + ok. diff --git a/lib/asn1/test/test_special_decode_performance.erl b/lib/asn1/test/test_special_decode_performance.erl index 60a95a3675..4ac0ff2b27 100644 --- a/lib/asn1/test/test_special_decode_performance.erl +++ b/lib/asn1/test/test_special_decode_performance.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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,25 +19,10 @@ %% -module(test_special_decode_performance). --export([compile/2,go/1,loop2/4,loop1/5]). +-export([go/1,loop2/4,loop1/5]). -include_lib("test_server/include/test_server.hrl"). - -compile(Config,Rule) when Rule==ber_bin_v2 -> - ?line DataDir = ?config(data_dir,Config), - ?line OutDir = ?config(priv_dir,Config), - ?line true = code:add_patha(?config(priv_dir,Config)), - - ?line asn1ct:compile(DataDir++"MEDIA-GATEWAY-CONTROL", - [ber_bin,optimize,asn1config,{outdir,OutDir}, - {i,DataDir}]), - ?line asn1ct:compile(DataDir++"PartialDecSeq", - [ber_bin,optimize,asn1config,{outdir,OutDir}, - {i,DataDir}]); -compile(_,Rule) -> - {skip,lists:concat(["not implemented yet for version: ",Rule])}. - go(all) -> {Time_S_s,Time_S_e,Time_S_c}=go(10000,'PartialDecSeq'), {Time_MGC_s,Time_MGC_e,Time_MGC_c}=go(10000,'MEDIA-GATEWAY-CONTROL'), diff --git a/lib/asn1/test/test_undecoded_rest.erl b/lib/asn1/test/test_undecoded_rest.erl index 647fe2bb1c..36fd26ed59 100644 --- a/lib/asn1/test/test_undecoded_rest.erl +++ b/lib/asn1/test/test_undecoded_rest.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-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,47 +19,35 @@ %% -module(test_undecoded_rest). --export([compile/3,test/1]). +-export([test/2]). -include_lib("test_server/include/test_server.hrl"). %% testing OTP-5104 -compile(Config,Rules,Opt) -> - - ?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 ++ "P-Record",[Rules,{outdir,OutDir}]++Opt). - - -test(Opt) -> - ?line {ok,Msg} = asn1ct:value('P-Record','PersonnelRecord'), - ?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), - +test(Opt, Config) -> + {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 bc8a3495d8..dcfa211d80 100644 --- a/lib/asn1/test/test_x691.erl +++ b/lib/asn1/test/test_x691.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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,25 +19,10 @@ %% -module(test_x691). --export([compile/3]). -export([cases/2]). -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 ++ "P-RecordA1", - [Rules, {outdir,OutDir}]++Option), - ?line ok = asn1ct:compile(DataDir ++ "P-RecordA2", - [Rules, {outdir,OutDir}]++Option), - ?line ok = asn1ct:compile(DataDir ++ "P-RecordA3", - [Rules, {outdir,OutDir}]++Option). - - cases(Erule,Variant) -> MsgA1 = a1(), ?line {ok,B1} = asn1_wrapper:encode('P-RecordA1','PersonnelRecord',MsgA1), |