From aa4e27ebac9eb287069fab859fe5dcdab82c75bf Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Thu, 12 Jan 2012 15:42:21 +0100 Subject: [asn1] Make tables and processes unnamed - Refactor and clean up asn1_db process - Remove unused stop function in asn1ct.erl - Remove infinite loop possibilites in asn1ct_check.erl - test/1,2,3 now run in separate process - Update documentation for new test options --- lib/asn1/test/asn1_SUITE.erl.src | 36 ++++++++++++++--------------- lib/asn1/test/testContextSwitchingTypes.erl | 9 ++++---- lib/asn1/test/testMegaco.erl | 8 ++++--- lib/asn1/test/test_inline.erl | 17 +++++++------- lib/asn1/test/test_modified_x420.erl | 8 +++---- lib/asn1/test/test_undecoded_rest.erl | 9 ++++---- 6 files changed, 46 insertions(+), 41 deletions(-) (limited to 'lib/asn1/test') diff --git a/lib/asn1/test/asn1_SUITE.erl.src b/lib/asn1/test/asn1_SUITE.erl.src index 3f51b125ec..912170fe12 100644 --- a/lib/asn1/test/asn1_SUITE.erl.src +++ b/lib/asn1/test/asn1_SUITE.erl.src @@ -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 @@ -1469,21 +1469,21 @@ per(Config) -> per1([M|T],DataDir,OutDir) -> ?line ok = asn1ct:compile(DataDir ++ M,[?PER,{outdir,OutDir}]), - ?line ok = asn1ct:test(list_to_atom(M)), + ?line ok = asn1ct:test(list_to_atom(M), [{i, OutDir}]), 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)), + ?line ok = asn1ct:test(list_to_atom(M), [{i, OutDir}]), 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)), + ?line ok = asn1ct:test(list_to_atom(M), [{i, OutDir}]), per1_opt(T,DataDir,OutDir); per1_opt([],_,_) -> ok. @@ -1546,7 +1546,7 @@ ber_other(Config) -> ber1([M|T],DataDir,OutDir) -> ?line ok = asn1ct:compile(DataDir ++ M,[?BER,{outdir,OutDir}]), - ?line ok = asn1ct:test(list_to_atom(M)), + ?line ok = asn1ct:test(list_to_atom(M), [{i, OutDir}]), ber1(T,DataDir,OutDir); ber1([],_,_) -> ok. @@ -1948,22 +1948,22 @@ testContextSwitchingTypes(Config) -> ?line true = code:add_patha(?config(priv_dir,Config)), ?line testContextSwitchingTypes:compile(Config,?BER,[]), - ?line testContextSwitchingTypes:test(), + ?line testContextSwitchingTypes:test(Config), ?line ?ber_driver(?BER,testContextSwitchingTypes:compile(Config,?BER,[driver])), - ?line ?ber_driver(?BER,testContextSwitchingTypes:test()), + ?line ?ber_driver(?BER,testContextSwitchingTypes:test(Config)), ?line testContextSwitchingTypes:compile(Config,?PER,[]), - ?line testContextSwitchingTypes:test(), + ?line testContextSwitchingTypes:test(Config), ?line ?per_bit_opt(testContextSwitchingTypes:compile(Config,?PER,[optimize])), - ?line ?per_bit_opt(testContextSwitchingTypes:test()), + ?line ?per_bit_opt(testContextSwitchingTypes:test(Config)), ?line ?uper_bin(testContextSwitchingTypes:compile(Config,uper_bin,[])), - ?line ?uper_bin(testContextSwitchingTypes:test()), + ?line ?uper_bin(testContextSwitchingTypes:test(Config)), ?line testContextSwitchingTypes:compile(Config,?PER,[optimize]), - ?line testContextSwitchingTypes:test(). + ?line testContextSwitchingTypes:test(Config). testTypeValueNotation(suite) -> []; testTypeValueNotation(Config) -> @@ -2181,22 +2181,22 @@ 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:test([], Config), ?line ok = test_undecoded_rest:compile(Config,?BER,[undec_rest]), - ?line ok = test_undecoded_rest:test(undec_rest), + ?line ok = test_undecoded_rest:test(undec_rest, Config), ?line ok = test_undecoded_rest:compile(Config,?PER,[]), - ?line ok = test_undecoded_rest:test([]), + ?line ok = test_undecoded_rest:test([], Config), ?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 ?per_bit_opt(ok = test_undecoded_rest:test(undec_rest, Config)), ?line ?uper_bin(ok = test_undecoded_rest:compile(Config,uper_bin,[undec_rest])), - ?line ?uper_bin(ok = test_undecoded_rest:test(undec_rest)), + ?line ?uper_bin(ok = test_undecoded_rest:test(undec_rest, Config)), ?line ok = test_undecoded_rest:compile(Config,?PER,[undec_rest]), - ?line ok = test_undecoded_rest:test(undec_rest). + ?line ok = test_undecoded_rest:test(undec_rest, Config). test_inline(suite) -> []; test_inline(Config) -> @@ -2205,7 +2205,7 @@ test_inline(Config) -> {skip,"Not runnable when cover compiled"}; _ -> ?line ok=test_inline:compile(Config,?BER,[]), - ?line test_inline:main(?BER), + ?line test_inline:main(Config, ?BER), ?line test_inline:inline1(Config,?BER,[]), ?line test_inline:performance2() end. diff --git a/lib/asn1/test/testContextSwitchingTypes.erl b/lib/asn1/test/testContextSwitchingTypes.erl index 7d05e5c352..66c1e831c3 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 @@ -20,7 +20,7 @@ -module(testContextSwitchingTypes). -export([compile/3]). --export([test/0]). +-export([test/1]). -include_lib("test_server/include/test_server.hrl"). @@ -34,14 +34,15 @@ compile(Config,Rules,Options) -> [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(priv_dir, Config)}]), ?line {ok,Bytes1_2} = asn1_wrapper:encode('ContextSwitchingTypes','T',ValT2), ?line {ok,Result1_2} = diff --git a/lib/asn1/test/testMegaco.erl b/lib/asn1/test/testMegaco.erl index ca2b1062d1..8413d00c25 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 @@ -123,9 +123,11 @@ compile(Config,Erule,Options) -> 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'), + OutDir = ?config(priv_dir, Config), + {ok,Msg} = asn1ct:value('OLD-MEDIA-GATEWAY-CONTROL','MegacoMessage', + [{i, OutDir}]), ?line {ok,Bytes} = asn1_wrapper:encode('OLD-MEDIA-GATEWAY-CONTROL', 'MegacoMessage',Msg), ?line {ok,Msg} = asn1_wrapper:decode('OLD-MEDIA-GATEWAY-CONTROL', diff --git a/lib/asn1/test/test_inline.erl b/lib/asn1/test/test_inline.erl index b7ec0d8921..8e25e65838 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/3,main/2,inline1/3,performance/1,performance2/0]). -export([mvrasn_inlined_encdec/2,mvrasn_encdec/2, mi_encdec/2,m_encdec/2]). @@ -34,7 +34,7 @@ compile(Config,_Rules,Opt) -> ?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), +% ?line ok=asn1ct:compile(DataDir++"Mvrasn-11-6.asn",[{outdir,OutDir}]++Opt), ?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"]]), @@ -71,8 +71,8 @@ inline1(Config,Rule,Opt) -> 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 +94,15 @@ 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(priv_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..fb8734ac21 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 @@ -28,9 +28,9 @@ 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}]). + ok = asn1ct:compile(filename:join([DataDir,modified_x420,"PKCS7"]),[der,{outdir,OutDir},{i,OutDir}]), + ok = asn1ct:compile(filename:join([DataDir,modified_x420,"InformationFramework"]),[der,{outdir,OutDir},{i,OutDir}]), + ok = asn1ct:compile(filename:join([DataDir,modified_x420,"AuthenticationFramework"]),[der,{outdir,OutDir},{i,OutDir}]). test_io(Config) -> io:format("~p~n~n", [catch test(Config)]). diff --git a/lib/asn1/test/test_undecoded_rest.erl b/lib/asn1/test/test_undecoded_rest.erl index 647fe2bb1c..277bad3a0a 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,7 +19,7 @@ %% -module(test_undecoded_rest). --export([compile/3,test/1]). +-export([compile/3,test/2]). -include_lib("test_server/include/test_server.hrl"). @@ -35,8 +35,9 @@ compile(Config,Rules,Opt) -> ?line ok = asn1ct:compile(DataDir ++ "P-Record",[Rules,{outdir,OutDir}]++Opt). -test(Opt) -> - ?line {ok,Msg} = asn1ct:value('P-Record','PersonnelRecord'), +test(Opt, Config) -> + ?line {ok,Msg} = asn1ct:value('P-Record','PersonnelRecord', + [{i, ?config(priv_dir, Config)}]), ?line {ok,Bytes} = asn1_wrapper:encode('P-Record','PersonnelRecord',Msg), Bytes2 = fun(B) when is_list(B) -> -- cgit v1.2.3