diff options
Diffstat (limited to 'lib')
850 files changed, 35283 insertions, 13896 deletions
diff --git a/lib/Makefile b/lib/Makefile index f5ffc6f166..00bcf27ee3 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -51,7 +51,7 @@ else # -------------- # ERTS_SUB_DIRECTORIES = stdlib sasl kernel compiler - OTHER_SUB_DIRECTORIES = tools test_server + OTHER_SUB_DIRECTORIES = tools test_server common_test runtime_tools ifdef BUILD_ALL ifeq ($(findstring win32,$(TARGET)),win32) # BUILD_ALL on win32 OTHER_SUB_DIRECTORIES += \ diff --git a/lib/asn1/doc/src/notes.xml b/lib/asn1/doc/src/notes.xml index 375e859d20..c93adeffe2 100644 --- a/lib/asn1/doc/src/notes.xml +++ b/lib/asn1/doc/src/notes.xml @@ -31,6 +31,31 @@ <p>This document describes the changes made to the asn1 application.</p> +<section><title>Asn1 1.6.15</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + The encoding of ExtensionAdditionGroup (for PER and UPER) + is corrected.</p> + <p> + Own Id: OTP-8866 Aux Id: OTP-8797, SEQ-11557 </p> + </item> + <item> + <p> + A race condition when several processes in parallel start + to do encode/decode using the driver could cause an error + log regarding crashing port owner process. This race is + now eliminated.</p> + <p> + Own Id: OTP-8948 Aux Id: seq11733 </p> + </item> + </list> + </section> + +</section> + <section><title>Asn1 1.6.14.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/asn1/src/asn1ct.erl b/lib/asn1/src/asn1ct.erl index 968468cb7f..947578f07d 100644 --- a/lib/asn1/src/asn1ct.erl +++ b/lib/asn1/src/asn1ct.erl @@ -39,7 +39,7 @@ add_tobe_refed_func/1,add_generated_refed_func/1, maybe_rename_function/3,latest_sindex/0,current_sindex/0, set_current_sindex/1,next_sindex/0,maybe_saved_sindex/2, - parse_and_save/2,report_verbose/3]). + parse_and_save/2,verbose/3,warning/3,error/3]). -include("asn1_records.hrl"). -include_lib("stdlib/include/erl_compile.hrl"). @@ -103,8 +103,8 @@ compile(File,Options) when is_list(Options) -> compile1(File,Options) when is_list(Options) -> - report_verbose("Erlang ASN.1 version ~p compiling ~p ~n",[?vsn,File],Options), - report_verbose("Compiler Options: ~p~n",[Options],Options), + verbose("Erlang ASN.1 version ~p compiling ~p ~n",[?vsn,File],Options), + verbose("Compiler Options: ~p~n",[Options],Options), Ext = filename:extension(File), Base = filename:basename(File,Ext), OutFile = outfile(Base,"",Options), @@ -149,17 +149,17 @@ compile1(File,Options) when is_list(Options) -> inline(true,Name,Module,Options) -> RTmodule = get_runtime_mod(Options), IgorOptions = igorify_options(remove_asn_flags(Options)), - IgorName = filename:rootname(filename:basename(Name)), + IgorName = list_to_atom(filename:rootname(filename:basename(Name))), % io:format("*****~nName: ~p~nModules: ~p~nIgorOptions: ~p~n*****~n", % [IgorName,Modules++RTmodule,IgorOptions]), - report_verbose("Inlining modules: ~p in ~p~n",[[Module]++RTmodule,IgorName],Options), + verbose("Inlining modules: ~p in ~p~n",[[Module]++RTmodule,IgorName],Options), case catch igor:merge(IgorName,[Module]++RTmodule,[{preprocess,true},{stubs,false},{backups,false}]++IgorOptions) of {'EXIT',{undef,Reason}} -> %% module igor first in R10B - io:format("Module igor in syntax_tools must be available:~n~p~n", - [Reason]), + error("Module igor in syntax_tools must be available:~n~p~n", + [Reason],Options), {error,'no_compilation'}; {'EXIT',Reason} -> - io:format("Merge by igor module failed due to ~p~n",[Reason]), + error("Merge by igor module failed due to ~p~n",[Reason],Options), {error,'no_compilation'}; _ -> %% io:format("compiling output module: ~p~n",[generated_file(Name,IgorOptions)]), @@ -173,8 +173,8 @@ inline(_,_,_,_) -> compile_set(SetBase,Files,Options) when is_list(hd(Files)),is_list(Options) -> %% case when there are several input files in a list - report_verbose("Erlang ASN.1 version ~p compiling ~p ~n",[?vsn,Files],Options), - report_verbose("Compiler Options: ~p~n",[Options],Options), + verbose("Erlang ASN.1 version ~p compiling ~p ~n",[?vsn,Files],Options), + verbose("Compiler Options: ~p~n",[Options],Options), OutFile = outfile(SetBase,"",Options), DbFile = outfile(SetBase,"asn1db",Options), Includes = [I || {i,I} <- Options], @@ -728,7 +728,7 @@ parse_set(ScanRes,Options) -> scan(File,Options) -> case asn1ct_tok:file(File) of {error,Reason} -> - io:format("~p~n",[Reason]), + error("~p~n",[Reason],Options), {false,{error,Reason}}; Tokens -> case lists:member(ss,Options) of @@ -753,16 +753,17 @@ parse({true,Tokens},File,Options) -> if is_integer(Line) -> BaseName = filename:basename(File), - io:format("syntax error at line ~p in module ~s:~n", - [Line,BaseName]); + error("syntax error at line ~p in module ~s:~n", + [Line,BaseName],Options); true -> - io:format("syntax error in module ~p:~n",[File]) + error("syntax error in module ~p:~n", + [File],Options) end, print_error_message(Message), {false,{error,Message}}; {error,{Line,_Mod,[Message,Token]}} -> - io:format("syntax error: ~p ~p at line ~p~n", - [Message,Token,Line]), + error("syntax error: ~p ~p at line ~p~n", + [Message,Token,Line],Options), {false,{error,{Line,[Message,Token]}}}; {ok,M} -> case lists:member(sp,Options) of @@ -772,7 +773,7 @@ parse({true,Tokens},File,Options) -> {true,M} end; OtherError -> - io:format("~p~n",[OtherError]) + error("~p~n",[OtherError],Options) end; parse({false,Tokens},_,_) -> {false,Tokens}. @@ -802,7 +803,7 @@ check({true,M},File,OutFile,Includes,EncodingRule,DbFile,Options,InputMods) -> NewM = Module#module{typeorval=NewTypeOrVal}, asn1_db:dbput(NewM#module.name,'MODULE',NewM), asn1_db:dbsave(DbFile,M#module.name), - report_verbose("--~p--~n",[{generated,DbFile}],Options), + verbose("--~p--~n",[{generated,DbFile}],Options), {true,{M,NewM,GenTypeOrVal}} end end; @@ -823,11 +824,11 @@ generate({true,{M,_Module,GenTOrV}},OutFile,EncodingRule,Options) -> % io:format("Options: ~p~n",[Options]), case catch specialized_decode_prepare(EncodingRule,M,GenTOrV,Options) of {error, enoent} -> ok; - {error, Reason} -> io:format("WARNING: Error in configuration" - "file: ~n~p~n",[Reason]); - {'EXIT',Reason} -> io:format("WARNING: Internal error when " - "analyzing configuration" - "file: ~n~p~n",[Reason]); + {error, Reason} -> warning("Error in configuration " + "file: ~n~p~n",[Reason],Options); + {'EXIT',Reason} -> warning("Internal error when " + "analyzing configuration " + "file: ~n~p~n",[Reason],Options); _ -> ok end, @@ -835,7 +836,7 @@ generate({true,{M,_Module,GenTOrV}},OutFile,EncodingRule,Options) -> case (catch asn1ct_gen:pgen(OutFile,EncodingRule, M#module.name,GenTOrV,Options)) of {'EXIT',Reason2} -> - io:format("ERROR: ~p~n",[Reason2]), + error("~p~n",[Reason2],Options), {error,Reason2}; _ -> ok @@ -878,7 +879,8 @@ parse_and_save(Module,S) -> _ -> ok end; Err -> - io:format("Warning: could not do a consistency check of the ~p file: no asn1 source file was found.~n",[lists:concat([Module,".asn1db"])]), + warning("could not do a consistency check of the ~p file: no asn1 source file was found.~n", + [lists:concat([Module,".asn1db"])],Options), {error,{asn1,input_file_error,Err}} end. parse_and_save1(S,File,Options,Includes) -> @@ -1183,6 +1185,7 @@ is_inline(Options) -> _ -> lists:keymember(inline,1,Options) end. + inline_output(Options,Default) -> case [X||{inline,X}<-Options] of [OutputName] -> @@ -1207,7 +1210,7 @@ compile_py(File,OutFile,Options) -> compile(File, _OutFile, Options) -> case catch compile(File, make_erl_options(Options)) of Exit = {'EXIT',_Reason} -> - io:format("~p~n~s~n",[Exit,"error"]), + error("~p~n~s~n",[Exit,"error"],Options), error; {error,_Reason} -> %% case occurs due to error in asn1ct_parser2,asn1ct_check @@ -1223,7 +1226,7 @@ compile(File, _OutFile, Options) -> io:format("~p~n",[ScanRes]), ok; Unknown -> - io:format("~p~n~s~n",[Unknown,"error"]), + error("~p~n~s~n",[Unknown,"error"],Options), error end. @@ -1237,7 +1240,7 @@ make_erl_options(Opts) -> Includes = Opts#options.includes, Defines = Opts#options.defines, Outdir = Opts#options.outdir, -%% Warning = Opts#options.warning, + Warning = Opts#options.warning, Verbose = Opts#options.verbose, Specific = Opts#options.specific, Optimize = Opts#options.optimize, @@ -1249,10 +1252,10 @@ make_erl_options(Opts) -> true -> [verbose]; false -> [] end ++ -%%% case Warning of -%%% 0 -> []; -%%% _ -> [report_warnings] -%%% end ++ + case Warning of + 0 -> []; + _ -> [warnings] + end ++ [] ++ case Optimize of 1 -> [optimize]; @@ -1276,7 +1279,7 @@ make_erl_options(Opts) -> uper_bin -> [uper_bin] end, - Options++[report_errors, {cwd, Cwd}, {outdir, Outdir}| + Options++[errors, {cwd, Cwd}, {outdir, Outdir}| lists:map(fun(Dir) -> {i, Dir} end, Includes)]++Specific. pretty2(Module,AbsFile) -> @@ -2518,13 +2521,48 @@ type_check(#'Externaltypereference'{}) -> make_suffix(_) -> "". -report_verbose(Format, Args, S) -> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Report functions. +%% +%% Errors messages are controlled with the 'errors' compiler option +%% Warning messages are controlled with the 'warnings' compiler option +%% Verbose messages are controlled with the 'verbose' compiler option + +error(Format, Args, S) -> + case is_error(S) of + true -> + io:format("Error: " ++ Format, Args); + false -> + ok + end. + +warning(Format, Args, S) -> + case is_warning(S) of + true -> + io:format("Warning: " ++ Format, Args); + false -> + ok + end. + +verbose(Format, Args, S) -> case is_verbose(S) of - true -> - io:format(Format, Args); - false -> - ok + true -> + io:format(Format, Args); + false -> + ok end. -is_verbose(S) -> - lists:member(verbose, S). +is_error(S) when is_record(S, state) -> + is_error(S#state.options); +is_error(O) -> + lists:member(errors, O) orelse is_verbose(O). + +is_warning(S) when is_record(S, state) -> + is_warning(S#state.options); +is_warning(O) -> + lists:member(warnings, O) orelse is_verbose(O). + +is_verbose(S) when is_record(S, state) -> + is_verbose(S#state.options); +is_verbose(O) -> + lists:member(verbose, O). diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl index c6f3b60786..8b1ee6e601 100644 --- a/lib/asn1/src/asn1ct_check.erl +++ b/lib/asn1/src/asn1ct_check.erl @@ -2029,8 +2029,9 @@ get_objectset_def2(_S,Set,CField) when is_list(Set) -> set=Set}}; get_objectset_def2(_S,T = #typedef{typespec=#'ObjectSet'{}},_CField) -> T; -get_objectset_def2(_S,T,_CField) -> - io:format("Warning get_objectset_def2: uncontrolled object set structure:~n~p~n",[T]). +get_objectset_def2(S,T,_CField) -> + asn1ct:warning("get_objectset_def2: uncontrolled object set structure:~n~p~n", + [T],S). type_name(S,#type{def=Def}) -> CurrMod = S#state.mname, @@ -2687,7 +2688,7 @@ normalize_value(S,Type,{'DEFAULT',Value},NameList) -> {'REAL',_,_} -> normalize_real(Value); {'ENUMERATED',CType,_} -> - normalize_enumerated(Value,CType); + normalize_enumerated(S,Value,CType); {'CHOICE',CType,NewNameList} -> normalize_choice(S,Value,CType,NewNameList); {'SEQUENCE',CType,NewNameList} -> @@ -2703,7 +2704,8 @@ normalize_value(S,Type,{'DEFAULT',Value},NameList) -> {'ASN1_OPEN_TYPE',{typefield,_TF},NL} -> %an open type normalize_objectclassfieldvalue(S,Value,NL); Err -> - io:format("WARNING: could not check default value ~p~nType:~n~p~nNameList:~n~p~n",[Value,Type,Err]), + asn1ct:warning("could not check default value ~p~nType:~n~p~nNameList:~n~p~n", + [Value,Type,Err],S), Value end; normalize_value(S,Type,Val,NameList) -> @@ -2788,23 +2790,23 @@ normalize_bitstring(S,Value,Type)-> end, case catch lists:map(F,RecList) of {error,Reason} -> - io:format("WARNING: default value not " + asn1ct:warning("default value not " "compatible with type definition ~p~n", - [Reason]), + [Reason],S), Value; NewList -> NewList end; _ -> - io:format("WARNING: default value not " + asn1ct:warning("default value not " "compatible with type definition ~p~n", - [RecList]), + [RecList],S), Value end; {Name,String} when is_atom(Name) -> normalize_bitstring(S,String,Type); Other -> - io:format("WARNING: illegal default value ~p~n",[Other]), + asn1ct:warning("illegal default value ~p~n",[Other],S), Value end. @@ -2843,12 +2845,13 @@ normalize_octetstring(S,Value,CType) -> %% check if list elements are valid octet values lists:map(fun([])-> ok; (H)when H > 255-> - io:format("WARNING: not legal octet value ~p in OCTET STRING, ~p~n",[H,List]); + asn1ct:warning("not legal octet value ~p in OCTET STRING, ~p~n", + [H,List],S); (_)-> ok end, List), List; Other -> - io:format("WARNING: unknown default value ~p~n",[Other]), + asn1ct:warning("unknown default value ~p~n",[Other],S), Value end. @@ -2895,23 +2898,23 @@ normalize_objectdescriptor(Value) -> normalize_real(Value) -> Value. -normalize_enumerated(#'Externalvaluereference'{value=V},CType) +normalize_enumerated(S,#'Externalvaluereference'{value=V},CType) when is_list(CType) -> - normalize_enumerated2(V,CType); -normalize_enumerated(Value,CType) when is_atom(Value),is_list(CType) -> - normalize_enumerated2(Value,CType); -normalize_enumerated({Name,EnumV},CType) when is_atom(Name) -> - normalize_enumerated(EnumV,CType); -normalize_enumerated(Value,{CType1,CType2}) when is_list(CType1), is_list(CType2)-> - normalize_enumerated(Value,CType1++CType2); -normalize_enumerated(V,CType) -> - io:format("WARNING: Enumerated unknown type ~p~n",[CType]), + normalize_enumerated2(S,V,CType); +normalize_enumerated(S,Value,CType) when is_atom(Value),is_list(CType) -> + normalize_enumerated2(S,Value,CType); +normalize_enumerated(S,{Name,EnumV},CType) when is_atom(Name) -> + normalize_enumerated(S,EnumV,CType); +normalize_enumerated(S,Value,{CType1,CType2}) when is_list(CType1), is_list(CType2)-> + normalize_enumerated(S,Value,CType1++CType2); +normalize_enumerated(S,V,CType) -> + asn1ct:warning("Enumerated unknown type ~p~n",[CType],S), V. -normalize_enumerated2(V,Enum) -> +normalize_enumerated2(S,V,Enum) -> case lists:keysearch(V,1,Enum) of {value,{Val,_}} -> Val; _ -> - io:format("WARNING: Enumerated value is not correct ~p~n",[V]), + asn1ct:warning("Enumerated value is not correct ~p~n",[V],S), V end. @@ -2922,8 +2925,7 @@ normalize_choice(S,{'CHOICE',{C,V}},CType,NameList) when is_atom(C) -> {C,normalize_value(S,CT,{'DEFAULT',V}, [Name|NameList])}; Other -> - io:format("WARNING: Wrong format of type/value ~p/~p~n", - [Other,V]), + asn1ct:warning("Wrong format of type/value ~p/~p~n",[Other,V],S), {C,V} end; normalize_choice(S,{'DEFAULT',ValueList},CType,NameList) when is_list(ValueList) -> @@ -3099,8 +3101,7 @@ normalize_s_of(SorS,S,Value,Type,NameList) when is_list(Value) -> List when is_list(List) -> List; _ -> - io:format("WARNING: ~p could not handle value ~p~n", - [SorS,Value]), + asn1ct:warning("~p could not handle value ~p~n",[SorS,Value],S), Value end; normalize_s_of(SorS,S,Value,Type,NameList) @@ -3152,15 +3153,13 @@ get_normalized_value(S,Val,Type,Func,AddArg) -> V2 = sort_val_if_set(AddArg,V,Type), call_Func(update_state(S,ExtM),V2,Type,Func,AddArg); {error,_} -> - io:format("WARNING: default value not " - "comparable ~p~n",[Val]), + asn1ct:warning("default value not comparable ~p~n",[Val],S), Val; {ExtM,NewVal} -> V2 = sort_val_if_set(AddArg,NewVal,Type), call_Func(update_state(S,ExtM),V2,Type,Func,AddArg); _ -> - io:format("WARNING: default value not " - "comparable ~p~n",[Val]), + asn1ct:warning("default value not comparable ~p~n",[Val],S), Val end. @@ -4109,7 +4108,7 @@ resolve_namednumber(S,#typedef{typespec=Type},Name) -> case Type#type.def of {'ENUMERATED',NameList} -> NamedNumberList=check_enumerated(S,NameList,Type#type.constraint), - N = normalize_enumerated(Name,NamedNumberList), + N = normalize_enumerated(S,Name,NamedNumberList), {value,{_,V}} = lists:keysearch(N,1,NamedNumberList), V; {'INTEGER',NameList} -> @@ -5710,9 +5709,9 @@ sort_components(der,S=#state{tname=TypeName},Components) -> end, case {untagged_choice(S,CompsList),Ext} of {false,noext} -> - {true,sort_components1(TypeName,CompsList,[],[],[],[])}; + {true,sort_components1(S,TypeName,CompsList,[],[],[],[])}; {false,_} -> - {true,{sort_components1(TypeName,CompsList,[],[],[],[]), []}}; + {true,{sort_components1(S,TypeName,CompsList,[],[],[],[]), []}}; {true,noext} -> %% sort in run-time {dynamic,R1}; @@ -5724,57 +5723,57 @@ sort_components(per,S=#state{tname=TypeName},Components) -> Root = tag_untagged_choice(S,R1++R2), case Ext of noext -> - {true,sort_components1(TypeName,Root,[],[],[],[])}; + {true,sort_components1(S,TypeName,Root,[],[],[],[])}; _ -> - {true,{sort_components1(TypeName,Root,[],[],[],[]), + {true,{sort_components1(S,TypeName,Root,[],[],[],[]), Ext}} end. -sort_components1(TypeName,[C=#'ComponentType'{tags=[{'UNIVERSAL',_}|_R]}|Cs], +sort_components1(S,TypeName,[C=#'ComponentType'{tags=[{'UNIVERSAL',_}|_R]}|Cs], UnivAcc,ApplAcc,ContAcc,PrivAcc) -> - sort_components1(TypeName,Cs,[C|UnivAcc],ApplAcc,ContAcc,PrivAcc); -sort_components1(TypeName,[C=#'ComponentType'{tags=[{'APPLICATION',_}|_R]}|Cs], + sort_components1(S,TypeName,Cs,[C|UnivAcc],ApplAcc,ContAcc,PrivAcc); +sort_components1(S,TypeName,[C=#'ComponentType'{tags=[{'APPLICATION',_}|_R]}|Cs], UnivAcc,ApplAcc,ContAcc,PrivAcc) -> - sort_components1(TypeName,Cs,UnivAcc,[C|ApplAcc],ContAcc,PrivAcc); -sort_components1(TypeName,[C=#'ComponentType'{tags=[{'CONTEXT',_}|_R]}|Cs], + sort_components1(S,TypeName,Cs,UnivAcc,[C|ApplAcc],ContAcc,PrivAcc); +sort_components1(S,TypeName,[C=#'ComponentType'{tags=[{'CONTEXT',_}|_R]}|Cs], UnivAcc,ApplAcc,ContAcc,PrivAcc) -> - sort_components1(TypeName,Cs,UnivAcc,ApplAcc,[C|ContAcc],PrivAcc); -sort_components1(TypeName,[C=#'ComponentType'{tags=[{'PRIVATE',_}|_R]}|Cs], + sort_components1(S,TypeName,Cs,UnivAcc,ApplAcc,[C|ContAcc],PrivAcc); +sort_components1(S,TypeName,[C=#'ComponentType'{tags=[{'PRIVATE',_}|_R]}|Cs], UnivAcc,ApplAcc,ContAcc,PrivAcc) -> - sort_components1(TypeName,Cs,UnivAcc,ApplAcc,ContAcc,[C|PrivAcc]); -sort_components1(TypeName,[],UnivAcc,ApplAcc,ContAcc,PrivAcc) -> + sort_components1(S,TypeName,Cs,UnivAcc,ApplAcc,ContAcc,[C|PrivAcc]); +sort_components1(S,TypeName,[],UnivAcc,ApplAcc,ContAcc,PrivAcc) -> I = #'ComponentType'.tags, - ascending_order_check(TypeName,sort_universal_type(UnivAcc)) ++ - ascending_order_check(TypeName,lists:keysort(I,ApplAcc)) ++ - ascending_order_check(TypeName,lists:keysort(I,ContAcc)) ++ - ascending_order_check(TypeName,lists:keysort(I,PrivAcc)). + ascending_order_check(S,TypeName,sort_universal_type(UnivAcc)) ++ + ascending_order_check(S,TypeName,lists:keysort(I,ApplAcc)) ++ + ascending_order_check(S,TypeName,lists:keysort(I,ContAcc)) ++ + ascending_order_check(S,TypeName,lists:keysort(I,PrivAcc)). -ascending_order_check(TypeName,Components) -> - ascending_order_check1(TypeName,Components), +ascending_order_check(S,TypeName,Components) -> + ascending_order_check1(S,TypeName,Components), Components. -ascending_order_check1(TypeName, +ascending_order_check1(S,TypeName, [C1 = #'ComponentType'{tags=[{_,T}|_]}, C2 = #'ComponentType'{tags=[{_,T}|_]}|Rest]) -> - io:format("WARNING: Indistinct tag ~p in SET ~p, components ~p and ~p~n", - [T,TypeName,C1#'ComponentType'.name,C2#'ComponentType'.name]), - ascending_order_check1(TypeName,[C2|Rest]); -ascending_order_check1(TypeName, + asn1ct:warning("Indistinct tag ~p in SET ~p, components ~p and ~p~n", + [T,TypeName,C1#'ComponentType'.name,C2#'ComponentType'.name],S), + ascending_order_check1(S,TypeName,[C2|Rest]); +ascending_order_check1(S,TypeName, [C1 = #'ComponentType'{tags=[{'UNIVERSAL',T1}|_]}, C2 = #'ComponentType'{tags=[{'UNIVERSAL',T2}|_]}|Rest]) -> case (decode_type(T1) == decode_type(T2)) of true -> - io:format("WARNING: Indistinct tags ~p and ~p in" + asn1ct:warning("Indistinct tags ~p and ~p in" " SET ~p, components ~p and ~p~n", [T1,T2,TypeName,C1#'ComponentType'.name, - C2#'ComponentType'.name]), - ascending_order_check1(TypeName,[C2|Rest]); + C2#'ComponentType'.name],S), + ascending_order_check1(S,TypeName,[C2|Rest]); _ -> - ascending_order_check1(TypeName,[C2|Rest]) + ascending_order_check1(S,TypeName,[C2|Rest]) end; -ascending_order_check1(N,[_|Rest]) -> - ascending_order_check1(N,Rest); -ascending_order_check1(_,[]) -> +ascending_order_check1(S,N,[_|Rest]) -> + ascending_order_check1(S,N,Rest); +ascending_order_check1(_,_,[]) -> ok. sort_universal_type(Components) -> diff --git a/lib/asn1/src/asn1ct_constructed_per.erl b/lib/asn1/src/asn1ct_constructed_per.erl index cce6eb9831..d6f23aca06 100644 --- a/lib/asn1/src/asn1ct_constructed_per.erl +++ b/lib/asn1/src/asn1ct_constructed_per.erl @@ -326,16 +326,14 @@ gen_decode_constructed(Erules,Typename,D) when is_record(D,type) -> textual_order([#'ComponentType'{textual_order=undefined}|_],TermList) -> TermList; textual_order(CompList,TermList) when is_list(CompList) -> - OrderList = [Ix||#'ComponentType'{textual_order=Ix} <- CompList], + OrderList = [Ix||#'ComponentType'{textual_order=Ix} <- CompList], [Term||{_,Term}<- lists:sort(lists:zip(OrderList, lists:sublist(TermList,length(OrderList))))]; %% sublist is just because Termlist can sometimes be longer than %% OrderList, which it really shouldn't textual_order({Root,Ext},TermList) -> - textual_order(Root ++ Ext,TermList); -textual_order({Root1,Ext,Root2},TermList) -> - textual_order(Root1 ++ Ext ++ Root2, TermList). + textual_order(Root ++ Ext,TermList). to_textual_order({Root,Ext}) -> {to_textual_order(Root),Ext}; diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl index 0bb0b65e5d..0844c38353 100644 --- a/lib/asn1/src/asn1ct_gen.erl +++ b/lib/asn1/src/asn1ct_gen.erl @@ -87,7 +87,7 @@ pgen_module(OutFile,Erules,Module, % gen_vars(asn1_db:mod_to_vars(Module)), % gen_tag_table(AllTypes), file:close(Fid), - asn1ct:report_verbose("--~p--~n",[{generated,ErlFile}],Options). + asn1ct:verbose("--~p--~n",[{generated,ErlFile}],Options). pgen_typeorval(Erules,Module,N2nConvEnums,{Types,Values,_Ptypes,_Classes,Objects,ObjectSets}) -> @@ -1340,9 +1340,9 @@ pgen_hrl(Erules,Module,TypeOrVal,Options,_Indent) -> Y -> Fid = get(gen_file_out), file:close(Fid), - asn1ct:report_verbose("--~p--~n", - [{generated,lists:concat([get(outfile),".hrl"])}], - Options), + asn1ct:verbose("--~p--~n", + [{generated,lists:concat([get(outfile),".hrl"])}], + Options), Y end. diff --git a/lib/asn1/src/asn1rt_ber_bin.erl b/lib/asn1/src/asn1rt_ber_bin.erl index ab04d981b0..22f9f2ecfd 100644 --- a/lib/asn1/src/asn1rt_ber_bin.erl +++ b/lib/asn1/src/asn1rt_ber_bin.erl @@ -2192,12 +2192,12 @@ decode_tag_and_length(Buffer) -> %% Check if valid tag %% %% check_if_valid_tag(Tag, List_of_valid_tags, OptOrMand) -> name of the tag -%%=============================================================================== +%%============================================================================ check_if_valid_tag(<<0,0,_/binary>>,_,_) -> asn1_EOC; check_if_valid_tag(<<>>, _, OptOrMand) -> - check_if_valid_tag2(false,[],[],OptOrMand); + check_if_valid_tag2_error([], OptOrMand); check_if_valid_tag(Bytes, ListOfTags, OptOrMand) when is_binary(Bytes) -> {Tag, _, _} = decode_tag(Bytes), check_if_valid_tag(Tag, ListOfTags, OptOrMand); @@ -2217,7 +2217,6 @@ check_if_valid_tag(Tag, ListOfTags, OptOrMand) -> check_if_valid_tag2(_Class_TagNo, [], Tag, MandOrOpt) -> check_if_valid_tag2_error(Tag,MandOrOpt); - check_if_valid_tag2(Class_TagNo, [{TagName,TagList}|T], Tag, OptOrMand) -> case check_if_valid_tag_loop(Class_TagNo, TagList) of true -> @@ -2226,7 +2225,7 @@ check_if_valid_tag2(Class_TagNo, [{TagName,TagList}|T], Tag, OptOrMand) -> check_if_valid_tag2(Class_TagNo, T, Tag, OptOrMand) end. --spec(check_if_valid_tag2_error/2 :: (term(),atom()) -> no_return()). +-spec check_if_valid_tag2_error(term(), atom()) -> no_return(). check_if_valid_tag2_error(Tag,mandatory) -> exit({error,{asn1,{invalid_tag,Tag}}}); diff --git a/lib/asn1/test/Makefile b/lib/asn1/test/Makefile index e8f65ec70b..8a23f8e869 100644 --- a/lib/asn1/test/Makefile +++ b/lib/asn1/test/Makefile @@ -193,7 +193,7 @@ release_tests_spec: opt $(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 $(INSTALL_PROGS) $(RELSYSDIR) + $(INSTALL_DATA) asn1.spec asn1.cover $(INSTALL_PROGS) $(RELSYSDIR) chmod -f -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 diff --git a/lib/asn1/test/asn1.cover b/lib/asn1/test/asn1.cover new file mode 100644 index 0000000000..589a8b7e3d --- /dev/null +++ b/lib/asn1/test/asn1.cover @@ -0,0 +1,2 @@ +{incl_app,asn1,details}. + diff --git a/lib/asn1/test/asn1.spec b/lib/asn1/test/asn1.spec index 6d9ae924fa..ae96de3a58 100644 --- a/lib/asn1/test/asn1.spec +++ b/lib/asn1/test/asn1.spec @@ -1,3 +1 @@ -{topcase, {dir, "../asn1_test"}}. - - +{suites,"../asn1_test",all}. diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl new file mode 100644 index 0000000000..e12dede3f7 --- /dev/null +++ b/lib/asn1/test/asn1_SUITE.erl @@ -0,0 +1,2489 @@ +%% +%% %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% +%% +%% +%%% Purpose : Test suite for the ASN.1 application + +-module(asn1_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() -> + [{option_tests, [], + [test_compile_options, ticket_6143]}, + {infobj, [], + [testInfObjectClass, testParameterizedInfObj, + testMergeCompile, testobj, testDeepTConstr]}, + {performance, [], + [testTimer_ber, testTimer_ber_opt_driver, testTimer_per, + testTimer_per_opt, testTimer_uper_bin]}, + {bugs, [], + [test_ParamTypeInfObj, test_WS_ParamClass, + test_Defed_ObjectIdentifier]}, + {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) -> + 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). + + +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) + 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) + end, + ?line [DoIt(Rule)|| Rule <- [per_bin,uper_bin,ber_bin]], + ?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", + "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" + ]. + + +%% +%% %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% +%% +%% + +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. + + +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). diff --git a/lib/asn1/test/asn1_app_test.erl b/lib/asn1/test/asn1_app_test.erl index 23a7e691e7..c3797f08b2 100644 --- a/lib/asn1/test/asn1_app_test.erl +++ b/lib/asn1/test/asn1_app_test.erl @@ -26,21 +26,24 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - fields, - modules, - exportall, - app_depend - ], - {req, [], {conf, app_init, Cases, app_fin}}. +all() -> + [fields, modules, exportall, app_depend]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -app_init(suite) -> []; -app_init(doc) -> []; -app_init(Config) when is_list(Config) -> +init_per_suite(suite) -> []; +init_per_suite(doc) -> []; +init_per_suite(Config) when is_list(Config) -> case is_app(asn1) of {ok, AppFile} -> io:format("AppFile: ~n~p~n", [AppFile]), @@ -60,9 +63,9 @@ is_app(App) -> end. -app_fin(suite) -> []; -app_fin(doc) -> []; -app_fin(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. diff --git a/lib/asn1/test/asn1_appup_test.erl b/lib/asn1/test/asn1_appup_test.erl index 4a60c814e8..a2c1423eda 100644 --- a/lib/asn1/test/asn1_appup_test.erl +++ b/lib/asn1/test/asn1_appup_test.erl @@ -26,18 +26,24 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - appup - ], - {req, [], {conf, appup_init, Cases, appup_fin}}. +all() -> + [appup]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -appup_init(suite) -> []; -appup_init(doc) -> []; -appup_init(Config) when is_list(Config) -> +init_per_suite(suite) -> []; +init_per_suite(doc) -> []; +init_per_suite(Config) when is_list(Config) -> AppFile = file_name(asn1, ".app"), AppupFile = file_name(asn1, ".appup"), [{app_file, AppFile}, {appup_file, AppupFile}|Config]. @@ -48,9 +54,9 @@ file_name(App, Ext) -> filename:join([LibDir, "ebin", atom_to_list(App) ++ Ext]). -appup_fin(suite) -> []; -appup_fin(doc) -> []; -appup_fin(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. diff --git a/lib/asn1/test/asn1_bin_SUITE.erl b/lib/asn1/test/asn1_bin_SUITE.erl new file mode 100644 index 0000000000..d8c5dd5b27 --- /dev/null +++ b/lib/asn1/test/asn1_bin_SUITE.erl @@ -0,0 +1,2382 @@ +%% +%% %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% +%% +%% +%%% Purpose : Test suite for the ASN.1 application + +-module(asn1_bin_SUITE). +-define(PER,'per_bin'). +-define(BER,'ber_bin'). +-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() -> + [{option_tests, [], + [test_compile_options, ticket_6143]}, + {infobj, [], + [testInfObjectClass, testParameterizedInfObj, + testMergeCompile, testobj, testDeepTConstr]}, + {performance, [], + [testTimer_ber, testTimer_ber_opt_driver, testTimer_per, + testTimer_per_opt, testTimer_uper_bin]}, + {bugs, [], + [test_ParamTypeInfObj, test_WS_ParamClass, + test_Defed_ObjectIdentifier]}, + {compile, [], + [c_syntax, c_string_per, c_string_ber, + c_implicit_before_choice]}, + {ber, [], + [ber_choiceinseq, ber_optional, ber_optional_keyed_list, + ber_other]}]. + +init_per_suite(Config) -> + 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). + + +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) + 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) + end, + ?line [DoIt(Rule)|| Rule <- [per_bin,uper_bin,ber_bin]], + ?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", + "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" + ]. + + +common() -> +[]. + +particular() -> +[]. diff --git a/lib/asn1/test/asn1_bin_v2_SUITE.erl b/lib/asn1/test/asn1_bin_v2_SUITE.erl new file mode 100644 index 0000000000..43d6ba0c6e --- /dev/null +++ b/lib/asn1/test/asn1_bin_v2_SUITE.erl @@ -0,0 +1,2474 @@ +%% +%% %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% +%% +%% +%%% Purpose : Test suite for the ASN.1 application + +-module(asn1_bin_v2_SUITE). +-define(PER,'per_bin'). +-define(BER,'ber_bin_v2'). +-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() -> + [{option_tests, [], + [test_compile_options, ticket_6143]}, + {infobj, [], + [testInfObjectClass, testParameterizedInfObj, + testMergeCompile, testobj, testDeepTConstr]}, + {performance, [], + [testTimer_ber, testTimer_ber_opt_driver, testTimer_per, + testTimer_per_opt, testTimer_uper_bin]}, + {bugs, [], + [test_ParamTypeInfObj, test_WS_ParamClass, + test_Defed_ObjectIdentifier]}, + {compile, [], + [c_syntax, c_string_per, c_string_ber, + c_implicit_before_choice]}, + {ber, [], + [ber_choiceinseq, ber_optional, ber_optional_keyed_list, + ber_other]}]. + +init_per_suite(Config) -> + 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). + + +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) + 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) + end, + ?line [DoIt(Rule)|| Rule <- [per_bin,uper_bin,ber_bin]], + ?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", + "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" + ]. + + +common() -> +[]. + +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/vsn.mk b/lib/asn1/vsn.mk index 0399ff2732..e900a52286 100644 --- a/lib/asn1/vsn.mk +++ b/lib/asn1/vsn.mk @@ -1,2 +1,2 @@ #next version number to use is 1.6.15 | 1.7 | 2.0 -ASN1_VSN = 1.6.14.1 +ASN1_VSN = 1.6.15 diff --git a/lib/common_test/doc/src/Makefile b/lib/common_test/doc/src/Makefile index 1a767a8197..a914dd0c19 100644 --- a/lib/common_test/doc/src/Makefile +++ b/lib/common_test/doc/src/Makefile @@ -52,7 +52,7 @@ CT_XML_FILES = $(CT_MODULES:=.xml) XML_APPLICATION_FILES = ref_man.xml XML_REF1_FILES = ct_run.xml -XML_REF3_FILES = $(CT_XML_FILES) +XML_REF3_FILES = $(CT_XML_FILES) ct_hooks.xml XML_REF6_FILES = common_test_app.xml XML_PART_FILES = part.xml @@ -71,6 +71,7 @@ XML_CHAPTER_FILES = \ cover_chapter.xml \ ct_master_chapter.xml \ event_handler_chapter.xml \ + ct_hooks_chapter.xml \ dependencies_chapter.xml \ notes.xml \ notes_history.xml diff --git a/lib/common_test/doc/src/common_test_app.xml b/lib/common_test/doc/src/common_test_app.xml index e30eef2488..b4e4b45d62 100644 --- a/lib/common_test/doc/src/common_test_app.xml +++ b/lib/common_test/doc/src/common_test_app.xml @@ -131,7 +131,8 @@ <type> <v> Info = {timetrap,Time} | {require,Required} | {require,Name,Required} | {userdata,UserData} | - {silent_connections,Conns} | {stylesheet,CSSFile}</v> + {silent_connections,Conns} | {stylesheet,CSSFile} | + {ct_hooks, CTHs}</v> <v> Time = MilliSec | {seconds,integer()} | {minutes,integer()} | {hours,integer()}</v> <v> MilliSec = integer()</v> @@ -143,6 +144,9 @@ <v> UserData = term()</v> <v> Conns = [atom()]</v> <v> CSSFile = string()</v> + <v> CTHs = [CTHModule | {CTHModule, CTHInitArgs}]</v> + <v> CTHModule = atom()</v> + <v> CTHInitArgs = term()</v> </type> <desc> @@ -170,6 +174,10 @@ <p>With <c>userdata</c>, it is possible for the user to specify arbitrary test suite related information which can be read by calling <c>ct:userdata/2</c>.</p> + + <p>The <c>ct_hooks</c> tag specifies which + <seealso marker="ct_hooks_chapter">Common Test Hooks</seealso> + are to be run together with this suite.</p> <p>Other tuples than the ones defined will simply be ignored.</p> diff --git a/lib/common_test/doc/src/ct_hooks.xml b/lib/common_test/doc/src/ct_hooks.xml new file mode 100644 index 0000000000..0d59ce3b22 --- /dev/null +++ b/lib/common_test/doc/src/ct_hooks.xml @@ -0,0 +1,556 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2010</year><year>2010</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>Common Test Hooks</title> + <prepared>Lukas Larsson</prepared> + <responsible>Lukas Larsson</responsible> + <docno></docno> + <approved></approved> + <checked></checked> + <date>2010-12-02</date> + <rev>PA1</rev> + <file>ct_hooks.sgml</file> + </header> + <module>ct_hooks</module> + <modulesummary>A callback interface on top of Common Test</modulesummary> + + <description> + + <warning><p>This feature is in alpha release right now. This means that the + interface may change in the future and that there may be bugs. We + encourage you to use this feature, but be prepared + that there might be bugs and that the interface might change + inbetween releases.</p></warning> + + <p>The <em>Common Test Hook</em> (henceforth called CTH) framework allows + extensions of the default behaviour of Common Test by means of callbacks + before and after all test suite calls. It is meant for advanced users of + Common Test which want to abstract out behaviour which is common to + multiple test suites. </p> + + <p>In brief, Common Test Hooks allows you to:</p> + + <list> + <item>Manipulate the runtime config before each suite + configuration call</item> + <item>Manipulate the return of all suite configuration calls and in + extension the result of the test themselves.</item> + </list> + + <p>The following sections describe the mandatory and optional CTH + functions Common Test will call during test execution. For more details + see <seealso marker="ct_hooks_chapter">Common Test Hooks</seealso> in + the User's Guide.</p> + + <p>For information about how to add a CTH to your suite see + <seealso marker="ct_hooks_chapter#installing">Installing a CTH + </seealso> in the User's Guide.</p> + + <note><p>See the + <seealso marker="ct_hooks_chapter#example">Example CTH</seealso> + in the User's Guide for a minimal example of a CTH. </p></note> + + </description> + + <section> + <title>CALLBACK FUNCTIONS</title> + <p>The following functions define the callback interface + for a Common Test Hook.</p> + </section> + + <funcs> + <func> + <name>Module:init(Id, Opts) -> State</name> + <fsummary>Initiates the Common Test Hook</fsummary> + <type> + <v>Id = reference() | term()</v> + <v>Opts = term()</v> + <v>State = term()</v> + </type> + + <desc> + <p> MANDATORY </p> + + <p>Always called before any other callback function. + Use this to initiate any common state. + It should return a state for this CTH.</p> + + <p><c>Id</c> is the return value of + <seealso marker="#Module:id-1">id/1</seealso>, or a <c>reference</c> + (created using + <seealso marker="erts:erlang#make_ref-0">make_ref/0</seealso>) + if <seealso marker="#Module:id-1">id/1</seealso> is not implemented. + </p> + + <p>For details about when init is called see + <seealso marker="ct_hooks_chapter#scope">scope</seealso> + in the User's Guide.</p> + + </desc> + </func> + + <func> + <name>Module:pre_init_per_suite(SuiteName, Config, CTHState) -> + Result</name> + <fsummary>Called before init_per_suite</fsummary> + <type> + <v>SuiteName = atom()</v> + <v>Config = NewConfig = [{Key,Value}]</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {Return, NewCTHState}</v> + <v>Return = NewConfig | SkipOrFail</v> + <v>SkipOrFail = {fail, Reason} | {skip, Reason}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called before + <seealso marker="common_test#Module:init_per_suite-1"> + init_per_suite</seealso> if it exists. + It typically contains initialization/logging which needs to be done + before init_per_suite is called. + If <c>{skip,Reason}</c> or <c>{fail,Reason}</c> is returned, + init_per_suite and all test cases of the suite will be skipped and + Reason printed in the overview log of the suite.</p> + + <p><c>SuiteName</c> is the name of the suite to be run.</p> + + <p><c>Config</c> is the original config list of the test suite.</p> + + <p><c>CTHState</c> is the current internal state of the CTH.</p> + + <p><c>Return</c> is the result of the init_per_suite function. + If it is <c>{skip,Reason}</c> or <c>{fail,Reason}</c> + <seealso marker="common_test#Module:init_per_suite-1">init_per_suite + </seealso> will never be called, instead the initiation is considered + to be skipped/failed respectively. If a <c>NewConfig</c> list + is returned, <seealso marker="common_test#Module:init_per_suite-1"> + init_per_suite</seealso> will be called with that <c>NewConfig</c> list. + See <seealso marker="ct_hooks_chapter#pre"> + Pre Hooks</seealso> in the User's Guide for more details.</p> + + + <p>Note that this function is only called if the CTH has been added + before init_per_suite is run, see + <seealso marker="ct_hooks_chapter#scope">CTH Scoping</seealso> + in the User's Guide for details.</p> + </desc> + </func> + + <func> + <name>Module:post_init_per_suite(SuiteName, Config, Return, CTHState) -> + Result</name> + <fsummary>Called after init_per_suite</fsummary> + <type> + <v>SuiteName = atom()</v> + <v>Config = [{Key,Value}]</v> + <v>Return = NewReturn = Config | SkipOrFail | term()</v> + <v>SkipOrFail = {fail, Reason} | {skip, Reason} | term()</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {NewReturn, NewCTHState}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called after + <seealso marker="common_test#Module:init_per_suite-1"> + init_per_suite</seealso> if it exists. It typically contains extra + checks to make sure that all the correct dependencies have + been started correctly.</p> + + <p><c>Return</c> is what + <seealso marker="common_test#Module:init_per_suite-1">init_per_suite + </seealso> returned, i.e. {fail,Reason}, {skip,Reason}, a <c>Config</c> + list or a term describing how + <seealso marker="common_test#Module:init_per_suite-1">init_per_suite + </seealso> failed.</p> + + <p><c>NewReturn</c> is the possibly modified return value of + <seealso marker="common_test#Module:init_per_suite-1">init_per_suite + </seealso>. It is here possible to recover from a failure in + <seealso marker="common_test#Module:init_per_suite-1">init_per_suite + </seealso> by returning the <c>ConfigList</c> with the <c>tc_status</c> + element removed. See <seealso marker="ct_hooks_chapter#post"> + Post Hooks</seealso> in the User's Guide for more details.</p> + + <p><c>CTHState</c> is the current internal state of the CTH.</p> + + <p>Note that this function is only called if the CTH has been added + before or in init_per_suite, see + <seealso marker="ct_hooks_chapter#scope">CTH Scoping</seealso> + in the User's Guide for details.</p> + </desc> + </func> + + <func> + <name>Module:pre_init_per_group(GroupName, Config, CTHState) -> + Result</name> + <fsummary>Called before init_per_group</fsummary> + <type> + <v>GroupName = atom()</v> + <v>Config = NewConfig = [{Key,Value}]</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {NewConfig | SkipOrFail, NewCTHState}</v> + <v>SkipOrFail = {fail,Reason} | {skip, Reason}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called before + <seealso marker="common_test#Module:init_per_group-2"> + init_per_group</seealso> if it exists. It behaves the same way as + <seealso marker="ct_hooks#Module:pre_init_per_suite-3"> + pre_init_per_suite</seealso>, but for the + <seealso marker="common_test#Module:init_per_group-2"> + init_per_group</seealso> instead.</p> + </desc> + </func> + + <func> + <name>Module:post_init_per_group(GroupName, Config, Return, CTHState) -> + Result</name> + <fsummary>Called after init_per_group</fsummary> + <type> + <v>GroupName = atom()</v> + <v>Config = [{Key,Value}]</v> + <v>Return = NewReturn = Config | SkipOrFail | term()</v> + <v>SkipOrFail = {fail,Reason} | {skip, Reason}</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {NewReturn, NewCTHState}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called after + <seealso marker="common_test#Module:init_per_group-2"> + init_per_group</seealso> if it exists. It behaves the same way as + <seealso marker="ct_hooks#Module:post_init_per_suite-4"> + post_init_per_suite</seealso>, but for the + <seealso marker="common_test#Module:init_per_group-2"> + init_per_group</seealso> instead.</p> + </desc> + </func> + + <func> + <name>Module:pre_init_per_testcase(TestcaseName, Config, CTHState) -> + Result</name> + <fsummary>Called before init_per_testcase</fsummary> + <type> + <v>TestcaseName = atom()</v> + <v>Config = NewConfig = [{Key,Value}]</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {NewConfig | SkipOrFail, NewCTHState}</v> + <v>SkipOrFail = {fail,Reason} | {skip, Reason}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called before + <seealso marker="common_test#Module:init_per_testcase-2"> + init_per_testcase</seealso> if it exists. It behaves the same way as + <seealso marker="ct_hooks#Module:pre_init_per_suite-3"> + pre_init_per_suite</seealso>, but for the + <seealso marker="common_test#Module:init_per_testcase-2"> + init_per_testcase</seealso> function instead.</p> + + <p>Note that it is not possible to add CTH's here right now, + that feature might be added later, + but it would right now break backwards compatability.</p> + </desc> + </func> + + <func> + <name>Module:post_end_per_testcase(TestcaseName, Config, Return, CTHState) + -> Result</name> + <fsummary>Called after end_per_testcase</fsummary> + <type> + <v>TestcaseName = atom()</v> + <v>Config = [{Key,Value}]</v> + <v>Return = NewReturn = Config | SkipOrFail | term()</v> + <v>SkipOrFail = {fail,Reason} | {skip, Reason}</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {NewReturn, NewCTHState}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called after + <seealso marker="common_test#Module:end_per_testcase-2"> + end_per_testcase</seealso> if it exists. It behaves the same way as + <seealso marker="ct_hooks#Module:post_init_per_suite-4"> + post_init_per_suite</seealso>, but for the + <seealso marker="common_test#Module:end_per_testcase-2"> + end_per_testcase</seealso> function instead.</p> + </desc> + </func> + + <func> + <name>Module:pre_end_per_group(GroupName, Config, CTHState) -> + Result</name> + <fsummary>Called before end_per_group</fsummary> + <type> + <v>GroupName = atom()</v> + <v>Config = NewConfig = [{Key,Value}]</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {NewConfig | SkipOrFail, NewCTHState}</v> + <v>SkipOrFail = {fail,Reason} | {skip, Reason}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called before + <seealso marker="common_test#Module:end_per_group-2"> + end_per_group</seealso> if it exists. It behaves the same way as + <seealso marker="ct_hooks#Module:pre_init_per_suite-3"> + pre_init_per_suite</seealso>, but for the + <seealso marker="common_test#Module:end_per_group-2"> + end_per_group</seealso> function instead.</p> + </desc> + </func> + + <func> + <name>Module:post_end_per_group(GroupName, Config, Return, CTHState) -> + Result</name> + <fsummary>Called after end_per_group</fsummary> + <type> + <v>GroupName = atom()</v> + <v>Config = [{Key,Value}]</v> + <v>Return = NewReturn = Config | SkipOrFail | term()</v> + <v>SkipOrFail = {fail,Reason} | {skip, Reason}</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {NewReturn, NewCTHState}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called after + <seealso marker="common_test#Module:end_per_group-2"> + end_per_group</seealso> if it exists. It behaves the same way as + <seealso marker="ct_hooks#Module:post_init_per_suite-4"> + post_init_per_suite</seealso>, but for the + <seealso marker="common_test#Module:end_per_group-2"> + end_per_group</seealso> function instead.</p> + </desc> + </func> + + <func> + <name>Module:pre_end_per_suite(SuiteName, Config, CTHState) -> + Result</name> + <fsummary>Called before end_per_suite</fsummary> + <type> + <v>SuiteName = atom()</v> + <v>Config = NewConfig = [{Key,Value}]</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {NewConfig | SkipOrFail, NewCTHState}</v> + <v>SkipOrFail = {fail,Reason} | {skip, Reason}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called before + <seealso marker="common_test#Module:end_per_suite-1"> + end_per_suite</seealso> if it exists. It behaves the same way as + <seealso marker="ct_hooks#Module:pre_init_per_suite-3"> + pre_init_per_suite</seealso>, but for the + <seealso marker="common_test#Module:end_per_suite-2"> + end_per_suite</seealso> function instead.</p> + </desc> + </func> + + <func> + <name>Module:post_end_per_suite(SuiteName, Config, Return, CTHState) -> + Result</name> + <fsummary>Called after end_per_suite</fsummary> + <type> + <v>SuiteName = atom()</v> + <v>Config = [{Key,Value}]</v> + <v>Return = NewReturn = Config | SkipOrFail | term()</v> + <v>SkipOrFail = {fail,Reason} | {skip, Reason}</v> + <v>CTHState = NewCTHState = term()</v> + <v>Result = {NewReturn, NewCTHState}</v> + <v>Key = atom()</v> + <v>Value = term()</v> + <v>Reason = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called after + <seealso marker="common_test#Module:end_per_suite-1"> + end_per_suite</seealso> if it exists. It behaves the same way as + <seealso marker="ct_hooks#Module:post_init_per_suite-4"> + post_init_per_suite</seealso>, but for the + <seealso marker="common_test#Module:end_per_suite-2"> + end_per_suite</seealso> function instead.</p> + </desc> + </func> + + <func> + <name>Module:on_tc_fail(TestcaseName, Reason, CTHState) -> + NewCTHState</name> + <fsummary>Called after the CTH scope ends</fsummary> + <type> + <v>TestcaseName = init_per_suite | end_per_suite | + init_per_group | end_per_group | atom()</v> + <v>Reason = term()</v> + <v>CTHState = NewCTHState = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called whenever a testcase fails. + It is called after the post function has been called for + the testcase which failed. i.e. + if init_per_suite fails this function is called after + <seealso marker="#Module:post_init_per_suite-4"> + post_init_per_suite</seealso>, and if a testcase fails it is called + after <seealso marker="#Module:post_end_per_testcase-4"> + post_end_per_testcase</seealso>.</p> + + <p>The data which comes with the Reason follows the same format as the + <seealso marker="event_handler_chapter#failreason">FailReason + </seealso> in the <seealso marker="event_handler_chapter#tc_done">tc_done</seealso> event. + See <seealso marker="event_handler_chapter#events">Event Handling + </seealso> in the User's Guide for details.</p> + </desc> + </func> + + <func> + <name>Module:on_tc_skip(TestcaseName, Reason, CTHState) -> + NewCTHState</name> + <fsummary>Called after the CTH scope ends</fsummary> + <type> + <v>TestcaseName = end_per_suite | init_per_group | + end_per_group | atom()</v> + <v>Reason = {tc_auto_skip | tc_user_skip, term()}</v> + <v>CTHState = NewCTHState = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called whenever a testcase is skipped. + It is called after the post function has been called for the + testcase which was skipped. + i.e. if init_per_group is skipped this function is called after + <seealso marker="#Module:post_init_per_suite-4">post_init_per_group + </seealso>, and if a testcase is skipped it is called after + <seealso marker="#Module:post_end_per_testcase-4">post_end_per_testcase + </seealso>.</p> + + <p>The data which comes with the Reason follows the same format as + <seealso marker="event_handler_chapter#tc_auto_skip">tc_auto_skip + </seealso> and <seealso marker="event_handler_chapter#tc_user_skip"> + tc_user_skip</seealso> events. + See <seealso marker="event_handler_chapter#events">Event Handling + </seealso> in the User's Guide for details.</p> + </desc> + </func> + + <func> + <name>Module:terminate(CTHState)</name> + <fsummary>Called after the CTH scope ends</fsummary> + <type> + <v>CTHState = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>This function is called at the end of a CTH's + <seealso marker="ct_hooks_chapter#scope">scope</seealso>. + </p> + </desc> + </func> + + <func> + <name>Module:id(Opts) -> Id</name> + <fsummary>Called before the init function of a CTH</fsummary> + <type> + <v>Opts = term()</v> + <v>Id = term()</v> + </type> + + <desc> + <p> OPTIONAL </p> + + <p>The <c>Id</c> is used to uniquely identify a CTH instance, + if two CTH's return the same <c>Id</c> the second CTH is ignored + and subsequent calls to the CTH will only be made to the first + instance. For more information see + <seealso marker="ct_hooks_chapter#installing">Installing a CTH + </seealso> in the User's Guide. + </p> + + <p>This function should NOT have any side effects as it might + be called multiple times by Common Test.</p> + + <p>If not implemented the CTH will act as if this function returned a + call to <c>make_ref/0</c>.</p> + </desc> + </func> + + </funcs> + +</erlref> + + diff --git a/lib/common_test/doc/src/ct_hooks_chapter.xml b/lib/common_test/doc/src/ct_hooks_chapter.xml new file mode 100644 index 0000000000..fc5ab48e1b --- /dev/null +++ b/lib/common_test/doc/src/ct_hooks_chapter.xml @@ -0,0 +1,401 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2011</year><year>2011</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>Common Test Hooks</title> + <prepared>Lukas Larsson</prepared> + <docno></docno> + <date></date> + <rev></rev> + <file>ct_hooks_chapter.xml</file> + </header> + + <marker id="general"></marker> + <section> + <title>General</title> + <warning><p>This feature is in alpha release right now. This means that the + interface may change in the future and that there may be bugs. We + encourage you to use this feature, but be prepared + that there might be bugs and that the interface might change + inbetween releases.</p></warning> + <p> + The <em>Common Test Hook</em> (henceforth called CTH) framework allows + extensions of the default behaviour of Common Test by means of hooks + before and after all test suite calls. CTHs allow advanced Common Test + users to abstract out behaviour which is common to multiple test suites + without littering all test suites with library calls. Some example + usages are: logging, starting and monitoring external systems, + building C files needed by the tests and much more!</p> + + <p>In brief, Common Test Hooks allows you to:</p> + + <list> + <item>Manipulate the runtime config before each suite + configuration call</item> + <item>Manipulate the return of all suite configuration calls and in + extension the result of the test themselves.</item> + </list> + + <p>The following sections describe how to use CTHs, when they are run + and how to manipulate your test results in a CTH</p> + + <warning><p>When executing within a CTH all timetraps are shutoff. So + if your CTH never returns, the entire test run will be stalled!</p> + </warning> + + </section> + + <marker id="installing"></marker> + <section> + <title>Installing a CTH</title> + <p>There are multiple ways to install a CTH in your test run. You can do it + for all tests in a run, for specific test suites and for specific groups + within a test suite. If you want a CTH to be present in all test suites + within your test run there are three different ways to accomplish that. + </p> + + <list> + <item>Add <c>-ct_hooks</c> as an argument to + <seealso marker="run_test_chapter#ct_run">ct_run</seealso>. + To add multiple CTHs using this method append them to each other + using the keyword <c>and</c>, i.e. + <c>ct_run -ct_hooks cth1 [{debug,true}] and cth2 ...</c>.</item> + <item>Add the <c>ct_hooks</c> tag to your + <seealso marker="run_test_chapter#test_specifications"> + Test Specification</seealso></item> + <item>Add the <c>ct_hooks</c> tag to your call to + <seealso marker="ct#run_test-1">ct:run_test/1</seealso></item> + </list> + + <p>You can also add CTHs within a test suite. This is done by returning + <c>{ct_hooks,[CTH]}</c> in the config list from + <seealso marker="common_test#Module:suite-0">suite/0</seealso>, + <seealso marker="common_test#Module:init_per_suite-1"> + init_per_suite/1</seealso> or + <seealso marker="common_test#Module:init_per_group-2"> + init_per_group/2</seealso>. <c>CTH</c> in this case can be either + only the module name of the CTH or a tuple with the module name and the + initial arguments to the CTH. Eg: + <c>{ct_hooks,[my_cth_module]}</c> or + <c>{ct_hooks,[{my_cth_module,[{debug,true}]}]}</c></p> + + <section> + <title>Overriding CTHs</title> + <p>By default each installation of a CTH will cause a new instance of it + to be activated. This can cause problems if you want to be able to + override CTHs in test specifications while still having them in the + suite info function. The + <seealso marker="ct_hooks#Module:id-1">id/1</seealso> + callback exists to address this problem. By returning the same + <c>id</c> in both places, Common Test knows that this CTH + has already been installed and will not try to install it again.</p> + </section> + + </section> + + <marker id="scope"/> + <section> + <title>CTH Scope</title> + <p>Once the CTH is installed into a certain test run it will be there until + its scope is expired. The scope of a CTH depends on when it is + installed. + The <seealso marker="ct_hooks#Module:init-2">init/2</seealso> is + called at the beginning of the scope and the + <seealso marker="ct_hooks#Module:terminate-1">terminate/1 + </seealso> function is called when the scope ends.</p> + <table> + <row> + <cell><em>CTH Installed in</em></cell> + <cell><em>CTH scope begins before</em></cell> + <cell><em>CTH scope ends after</em></cell> + </row> + <row> + <cell><seealso marker="run_test_chapter#ct_run">ct_run</seealso></cell> + <cell>the first test suite is to be run.</cell> + <cell>the last test suite has been run.</cell> + </row> + <row> + <cell><seealso marker="ct#run_test-1">ct:run_test</seealso></cell> + <cell>the first test suite is to be run.</cell> + <cell>the last test suite has been run.</cell> + </row> + <row> + <cell><seealso marker="run_test_chapter#test_specifications"> + Test Specification</seealso></cell> + <cell>the first test suite is to be run.</cell> + <cell>the last test suite has been run.</cell> + </row> + <row> + <cell><seealso marker="common_test#Module:suite-0">suite/0 + </seealso></cell> + <cell><seealso marker="ct_hooks#Module:pre_init_per_suite-3"> + pre_init_per_suite/3</seealso> is called.</cell> + <cell><seealso marker="ct_hooks#Module:post_end_per_suite-4"> + post_end_per_suite/4</seealso> has been called for that test suite.</cell> + </row> + <row> + <cell><seealso marker="common_test#Module:init_per_suite-1"> + init_per_suite/1</seealso></cell> + <cell><seealso marker="ct_hooks#Module:post_init_per_suite-4"> + post_init_per_suite/4</seealso> is called.</cell> + <cell><seealso marker="ct_hooks#Module:post_end_per_suite-4"> + post_end_per_suite/4</seealso> has been called for that test suite.</cell> + </row> + <row> + <cell><seealso marker="common_test#Module:init_per_group-2"> + init_per_group/2</seealso></cell> + <cell><seealso marker="ct_hooks#Module:post_init_per_group-4"> + post_init_per_group/4</seealso> is called.</cell> + <cell><seealso marker="ct_hooks#Module:post_end_per_suite-4"> + post_end_per_group/4</seealso> has been called for that group.</cell> + </row> + <tcaption>Scope of a CTH</tcaption> + </table> + + <section> + <title>CTH Processes and Tables</title> + <p>CTHs are run with the same process scoping as normal test suites + i.e. a different process will execute the init_per_suite hooks then the + init_per_group or per_testcase hooks. So if you want to spawn a + process in the CTH you cannot link with the CTH process as it will exit + after the post hook ends. Also if you for some reason need an ETS + table with your CTH, you will have to spawn a process which handles + it.</p> + </section> + + </section> + + <marker id="manipulating"/> + <section> + <title>Manipulating tests</title> + <p>It is through CTHs possible to manipulate the results of tests and + configuration functions. The main purpose of doing this with CTHs is to + allow common patterns to be abstracted out from test test suites and applied to + multiple test suites without duplicating any code. All of the callback + functions for a CTH follow a common interface, this interface is + described below.</p> + + <p>It is only possible to hook into test function which exists in the test + suite. So in order for a CTH to hook in before + <seealso marker="common_test#Module:init_per_suite-1">init_per_suite</seealso>, + the <seealso marker="common_test#Module:init_per_suite-1">init_per_suite</seealso> + function must exist in the test suite.</p> + + <marker id="pre"/> + <section> + <title>Pre Hooks</title> + <p> + It is possible in a CTH to hook in behaviour before + <seealso marker="common_test#Module:init_per_suite-1">init_per_suite</seealso>, + <seealso marker="common_test#Module:init_per_suite-1">init_per_group</seealso>, + <seealso marker="common_test#Module:init_per_suite-1">init_per_testcase</seealso>, + <seealso marker="common_test#Module:init_per_suite-1">end_per_group</seealso> and + <seealso marker="common_test#Module:init_per_suite-1">end_per_suite</seealso>. + This is done in the CTH functions called pre_<name of function>. + All of these functions take the same three arguments: <c>Name</c>, + <c>Config</c> and <c>CTHState</c>. The return value of the CTH function + is always a combination of an result for the suite/group/test and an + updated <c>CTHState</c>. If you want the test suite to continue on + executing you should return the config list which you want the test to + use as the result. If you for some reason want to skip/fail the test, + return a tuple with <c>skip</c> or <c>fail</c> and a reason as the + result. Example: + </p> + <code>pre_init_per_suite(SuiteName, Config, CTHState) -> + case db:connect() of + {error,_Reason} -> + {{fail, "Could not connect to DB"}, CTHState}; + {ok, Handle} -> + {[{db_handle, Handle} | Config], CTHState#state{ handle = Handle }} + end.</code> + + </section> + + <marker id="post"/> + <section> + <title>Post Hooks</title> + <p>It is also possible in a CTH to hook in behaviour after + <seealso marker="common_test#Module:init_per_suite-1">init_per_suite</seealso>, + <seealso marker="common_test#Module:init_per_suite-1">init_per_group</seealso>, + <seealso marker="common_test#Module:init_per_suite-1">end_per_testcase</seealso>, + <seealso marker="common_test#Module:init_per_suite-1">end_per_group</seealso> and + <seealso marker="common_test#Module:init_per_suite-1">end_per_suite</seealso>. + This is done in the CTH functions called post_<name of function>. + All of these function take the same four arguments: <c>Name</c>, + <c>Config</c>, <c>Return</c> and <c>CTHState</c>. <c>Config</c> in this + case is the same <c>Config</c> as the testcase is called with. + <c>Return</c> is the value returned by the testcase. If the testcase + failed by crashing, <c>Return</c> will be + <c>{'EXIT',{{Error,Reason},Stacktrace}}</c>.</p> + + <p>The return value of the CTH function is always a combination of an + result for the suite/group/test and an updated <c>CTHState</c>. If + you want the callback to not affect the outcome of the test you should + return the <c>Return</c> data as it is given to the CTH. You can also + modify the result of the test. By returning the <c>Config</c> list + with the <c>tc_status</c> element removed you can recover from a test + failure. As in all the pre hooks, it is also possible to fail/skip + the test case in the post hook. Example: </p> + + <code>post_end_per_testcase(_TC, Config, {'EXIT',{_,_}}, CTHState) -> + case db:check_consistency() of + true -> + %% DB is good, pass the test. + {proplists:delete(tc_status, Config), CTHState}; + false -> + %% DB is not good, mark as skipped instead of failing + {{skip, "DB is inconsisten!"}, CTHState} + end; +post_end_per_testcase(_TC, Config, Return, CTHState) -> + %% Do nothing if tc does not crash. + {Return, CTHState}.</code> + + <note>Recovering from a testcase failure using CTHs should only be done as + a last resort. If used wrongly it could become very difficult to + determine which tests pass or fail in a test run</note> + + </section> + + <marker id="skip_n_fail"/> + <section> + <title>Skip and Fail hooks</title> + <p> + After any post hook has been executed for all installed CTHs, + <seealso marker="ct_hooks#Module:on_tc_fail-3">on_tc_fail</seealso> + or <seealso marker="ct_hooks#Module:on_tc_fail-3">on_tc_skip</seealso> + might be called if the testcase failed or was skipped + respectively. You cannot affect the outcome of the tests any further at + this point. + </p> + </section> + + </section> + + <marker id="example"/> + <section> + <title>Example CTH</title> + <p>The CTH below will log information about a test run into a format + parseable by <seealso marker="kernel:file#consult-1">file:consult/1</seealso>. + </p> + <code>%%% @doc Common Test Example Common Test Hook module. +-module(example_cth). + +%% Callbacks +-export([id/1]). +-export([init/2]). + +-export([pre_init_per_suite/3]). +-export([post_init_per_suite/4]). +-export([pre_end_per_suite/3]). +-export([post_end_per_suite/4]). + +-export([pre_init_per_group/3]). +-export([post_init_per_group/4]). +-export([pre_end_per_group/3]). +-export([post_end_per_group/4]). + +-export([pre_init_per_testcase/3]). +-export([post_end_per_testcase/4]). + +-export([on_tc_fail/3]). +-export([on_tc_skip/3]). + +-export([terminate/1]). + +-record(state, { file_handle, total, suite_total, ts, tcs, data }). + +%% @doc Return a unique id for this CTH. +id(Opts) -> + proplists:get_value(filename, Opts, "/tmp/file.log"). + +%% @doc Always called before any other callback function. Use this to initiate +%% any common state. +init(Id, Opts) -> + {ok,D} = file:open(Id,[write]), + #state{ file_handle = D, total = 0, data = [] }. + +%% @doc Called before init_per_suite is called. +pre_init_per_suite(Suite,Config,State) -> + {Config, State#state{ suite_total = 0, tcs = [] }}. + +%% @doc Called after init_per_suite. +post_init_per_suite(Suite,Config,Return,State) -> + {Return, State}. + +%% @doc Called before end_per_suite. +pre_end_per_suite(Suite,Config,State) -> + {Config, State}. + +%% @doc Called after end_per_suite. +post_end_per_suite(Suite,Config,Return,State) -> + Data = {suites, Suite, State#state.suite_total, lists:reverse(State#state.tcs)}, + {Return, State#state{ data = [Data | State#state.data] , + total = State#state.total + State#state.suite_total } }. + +%% @doc Called before each init_per_group. +pre_init_per_group(Group,Config,State) -> + {Config, State}. + +%% @doc Called after each init_per_group. +post_init_per_group(Group,Config,Return,State) -> + {Return, State}. + +%% @doc Called after each end_per_group. +pre_end_per_group(Group,Config,State) -> + {Config, State}. + +%% @doc Called after each end_per_group. +post_end_per_group(Group,Config,Return,State) -> + {Return, State}. + +%% @doc Called before each test case. +pre_init_per_testcase(TC,Config,State) -> + {Config, State#state{ ts = now(), total = State#state.suite_total + 1 } }. + +%% @doc Called after each test case. +post_end_per_testcase(TC,Config,Return,State) -> + TCInfo = {testcase, TC, Return, timer:now_diff(now(), State#state.ts)}, + {Return, State#state{ ts = undefined, tcs = [TCInfo | State#state.tcs] } }. + +%% @doc Called after post_init_per_suite, post_end_per_suite, post_init_per_group, +%% post_end_per_group and post_end_per_testcase if the suite, group or test case failed. +on_tc_fail(TC, Reason, State) -> + State. + +%% @doc Called when a test case is skipped by either user action +%% or due to an init function failing. +on_tc_skip(TC, Reason, State) -> + State. + +%% @doc Called when the scope of the CTH is done +terminate(State) -> + io:format(State#state.file_handle, "~p.~n", + [{test_run, State#state.total, State#state.data}]), + file:close(State#state.file_handle), + ok.</code> + </section> + +</chapter> + + + + diff --git a/lib/common_test/doc/src/ct_junit_report.xml b/lib/common_test/doc/src/ct_junit_report.xml deleted file mode 100644 index 49a40cc1de..0000000000 --- a/lib/common_test/doc/src/ct_junit_report.xml +++ /dev/null @@ -1,109 +0,0 @@ -<?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> -<erlref> -<header> -<title>ct_junit_report</title> -<prepared></prepared> -<responsible></responsible> -<docno>1</docno> -<approved></approved> -<checked></checked> -<date></date> -<rev>A</rev> -<file>ct_junit_report.xml</file></header> -<module>ct_junit_report</module> -<modulesummary>Common Test Framework functions handling test specifications.</modulesummary> -<description> -<p>Common Test Framework functions handling test specifications.</p> - - <p>This module creates a junit report of the test run if plugged in - as a suite_callback.</p></description> -<funcs> -<func> -<name>init(Opts) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="init-1"/> - </desc></func> -<func> -<name>post_end_group(Group, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="post_end_group-3"/> - </desc></func> -<func> -<name>post_end_suite(Suite, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="post_end_suite-3"/> - </desc></func> -<func> -<name>post_end_tc(TC, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="post_end_tc-3"/> - </desc></func> -<func> -<name>post_init_group(Group, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="post_init_group-3"/> - </desc></func> -<func> -<name>post_init_suite(Suite, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="post_init_suite-3"/> - </desc></func> -<func> -<name>pre_end_group(Group, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="pre_end_group-3"/> - </desc></func> -<func> -<name>pre_end_suite(Suite, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="pre_end_suite-3"/> - </desc></func> -<func> -<name>pre_init_group(Group, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="pre_init_group-3"/> - </desc></func> -<func> -<name>pre_init_suite(Suite, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="pre_init_suite-3"/> - </desc></func> -<func> -<name>pre_init_tc(TC, Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="pre_init_tc-3"/> - </desc></func> -<func> -<name>terminate(Config, State) -> term() -</name> -<fsummary> </fsummary> - -<desc><marker id="terminate-2"/> - </desc></func></funcs> - -<authors> -<aname> </aname> -<email> </email></authors></erlref>
\ No newline at end of file diff --git a/lib/common_test/doc/src/event_handler_chapter.xml b/lib/common_test/doc/src/event_handler_chapter.xml index 904876ac46..a01feb59d1 100644 --- a/lib/common_test/doc/src/event_handler_chapter.xml +++ b/lib/common_test/doc/src/event_handler_chapter.xml @@ -61,6 +61,7 @@ itself.</p> </section> <section> + <marker id="usage"></marker> <title>Usage</title> <p>Event handlers may be installed by means of an <c>event_handler</c> start flag (<c>ct_run</c>) or option (<c>ct:run_test/1</c>), where the @@ -120,6 +121,7 @@ node the event has originated from (only relevant for CT Master event handlers). <c>data</c> is specific for the particular event.</p> + <marker id="events"></marker> <p><em>General events:</em></p> <list> @@ -172,6 +174,7 @@ are also given. </p></item> + <marker id="tc_done"/> <item><c>#event{name = tc_done, data = {Suite,FuncOrGroup,Result}}</c> <p><c>Suite = atom()</c>, name of the suite.</p> <p><c>FuncOrGroup = Func | {Conf,GroupName,GroupProperties}</c></p> @@ -181,12 +184,14 @@ (unknown if init- or end function times out).</p> <p><c>GroupProperties = list()</c>, list of execution properties for the group.</p> <p><c>Result = ok | {skipped,SkipReason} | {failed,FailReason}</c>, the result.</p> + <marker id="skipreason"/> <p><c>SkipReason = {require_failed,RequireInfo} | {require_failed_in_suite0,RequireInfo} | {failed,{Suite,init_per_testcase,FailInfo}} | UserTerm</c>, the reason why the case has been skipped.</p> - <p><c>FailReason = {error,FailInfo} | + <marker id="failreason"/> + <p><c>FailReason = {error,FailInfo} | {error,{RunTimeError,StackTrace}} | {timetrap_timeout,integer()} | {failed,{Suite,end_per_testcase,FailInfo}}</c>, reason for failure.</p> @@ -209,6 +214,7 @@ <c>end_per_testcase</c> for the case failed. </p></item> + <marker id="tc_auto_skip"></marker> <item><c>#event{name = tc_auto_skip, data = {Suite,Func,Reason}}</c> <p><c>Suite = atom()</c>, the name of the suite.</p> <p><c>Func = atom()</c>, the name of the test case or configuration function.</p> @@ -234,7 +240,8 @@ skipped because of <c>init_per_testcase</c> failing, since that information is carried with the <c>tc_done</c> event. </p></item> - + + <marker id="tc_user_skip"></marker> <item><c>#event{name = tc_user_skip, data = {Suite,TestCase,Comment}}</c> <p><c>Suite = atom()</c>, name of the suite.</p> <p><c>TestCase = atom()</c>, name of the test case.</p> diff --git a/lib/common_test/doc/src/notes.xml b/lib/common_test/doc/src/notes.xml index af9dbfa9ec..2fd5dcf4f1 100644 --- a/lib/common_test/doc/src/notes.xml +++ b/lib/common_test/doc/src/notes.xml @@ -32,6 +32,57 @@ <file>notes.xml</file> </header> +<section><title>Common_Test 1.5.2</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Updated ct:get_status documentation to describe + no_tests_running return value.</p> + <p> + Own Id: OTP-8895 Aux Id: seq11701 </p> + </item> + <item> + <p> + Fixed race condition test failures in the test suites + testing common test's parallel groups feature.</p> + <p> + Own Id: OTP-8921</p> + </item> + <item> + <p> + The include directive of testspecs now work when used on + a remote node.</p> + <p> + Own Id: OTP-8935 Aux Id: seq11731 </p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + ct:parse_table can now handle multiline sql rows</p> + <p> + Own Id: OTP-8907 Aux Id: seq11702 </p> + </item> + <item> + <p> + The run_test executable has been renamed to the less + generic ct_run to better work with other applications. + run_test will remain until R16B at which point it will be + removed.</p> + <p> + Own Id: OTP-8936</p> + </item> + </list> + </section> + +</section> + <section><title>Common_Test 1.5.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/common_test/doc/src/part.xml b/lib/common_test/doc/src/part.xml index 53a4cb1bbf..41371b60be 100644 --- a/lib/common_test/doc/src/part.xml +++ b/lib/common_test/doc/src/part.xml @@ -75,6 +75,7 @@ <xi:include href="ct_master_chapter.xml"/> <xi:include href="event_handler_chapter.xml"/> <xi:include href="dependencies_chapter.xml"/> + <xi:include href="ct_hooks_chapter.xml"/> <xi:include href="why_test_chapter.xml"/> </part> diff --git a/lib/common_test/doc/src/ref_man.xml b/lib/common_test/doc/src/ref_man.xml index d5985bb021..631e3871c2 100644 --- a/lib/common_test/doc/src/ref_man.xml +++ b/lib/common_test/doc/src/ref_man.xml @@ -76,6 +76,7 @@ <xi:include href="ct_telnet.xml"/> <xi:include href="unix_telnet.xml"/> <xi:include href="ct_slave.xml"/> + <xi:include href="ct_hooks.xml"/> </application> diff --git a/lib/common_test/doc/src/run_test_chapter.xml b/lib/common_test/doc/src/run_test_chapter.xml index 94fcf6bf01..7b485bdc35 100644 --- a/lib/common_test/doc/src/run_test_chapter.xml +++ b/lib/common_test/doc/src/run_test_chapter.xml @@ -105,6 +105,7 @@ RPC from a remote node.</p> </section> + <marker id="ct_run"></marker> <section> <title>Running tests from the OS command line</title> @@ -147,6 +148,8 @@ <seealso marker="event_handler_chapter#event_handling">event handlers</seealso>.</item> <item><c><![CDATA[-event_handler_init <event_handlers>]]></c>, to install <seealso marker="event_handler_chapter#event_handling">event handlers</seealso> including start arguments.</item> + <item><c><![CDATA[-ct_hooks <ct_hooks>]]></c>, to install + <seealso marker="ct_hooks_chapter#installing">Common Test Hooks</seealso> including start arguments.</item> <item><c><![CDATA[-include]]></c>, specifies include directories (see above).</item> <item><c><![CDATA[-no_auto_compile]]></c>, disables the automatic test suite compilation feature (see above).</item> <item><c><![CDATA[-multiply_timetraps <n>]]></c>, extends <seealso marker="write_test_chapter#timetraps">timetrap @@ -333,8 +336,8 @@ with <c>dir</c>.</p> </section> + <marker id="test_specifications"></marker> <section> - <marker id="test_specifications"></marker> <title>Using test specifications</title> <p>The most flexible way to specify what to test, is to use a so @@ -440,6 +443,9 @@ {event_handler, NodeRefs, EventHandlers}. {event_handler, EventHandlers, InitArgs}. {event_handler, NodeRefs, EventHandlers, InitArgs}. + + {ct_hooks, CTHModules}. + {ct_hooks, NodeRefs, CTHModules}. </pre> <p>Test terms:</p> <pre> @@ -478,6 +484,9 @@ LogDir = string() EventHandlers = atom() | [atom()] InitArgs = [term()] + CTHModules = [CTHModule | {CTHModule, CTHInitArgs}] + CTHModule = atom() + CTHInitArgs = term() DirRef = DirAlias | Dir Suites = atom() | [atom()] | all Suite = atom() diff --git a/lib/common_test/doc/src/write_test_chapter.xml b/lib/common_test/doc/src/write_test_chapter.xml index 5afec6de6a..76493d3616 100644 --- a/lib/common_test/doc/src/write_test_chapter.xml +++ b/lib/common_test/doc/src/write_test_chapter.xml @@ -115,6 +115,7 @@ </p> </section> + <marker id="per_testcase"/> <section> <title>Init and end per test case</title> diff --git a/lib/common_test/src/Makefile b/lib/common_test/src/Makefile index 027667e6b0..378a7ba08c 100644 --- a/lib/common_test/src/Makefile +++ b/lib/common_test/src/Makefile @@ -67,7 +67,9 @@ MODULES= \ ct_config \ ct_config_plain \ ct_config_xml \ - ct_slave + ct_slave \ + ct_hooks\ + ct_hooks_lock TARGET_MODULES= $(MODULES:%=$(EBIN)/%) diff --git a/lib/common_test/src/ct.erl b/lib/common_test/src/ct.erl index 405dc40c8b..b0a92dcc15 100644 --- a/lib/common_test/src/ct.erl +++ b/lib/common_test/src/ct.erl @@ -148,7 +148,8 @@ run(TestDirs) -> %%% {auto_compile,Bool} | {multiply_timetraps,M} | {scale_timetraps,Bool} | %%% {repeat,N} | {duration,DurTime} | {until,StopTime} | %%% {force_stop,Bool} | {decrypt,DecryptKeyOrFile} | -%%% {refresh_logs,LogDir} | {basic_html,Bool} +%%% {refresh_logs,LogDir} | {basic_html,Bool} | +%%% {ct_hooks, CTHs} %%% TestDirs = [string()] | string() %%% Suites = [string()] | string() %%% Cases = [atom()] | atom() @@ -176,6 +177,9 @@ run(TestDirs) -> %%% DecryptKeyOrFile = {key,DecryptKey} | {file,DecryptFile} %%% DecryptKey = string() %%% DecryptFile = string() +%%% CTHs = [CTHModule | {CTHModule, CTHInitArgs}] +%%% CTHModule = atom() +%%% CTHInitArgs = term() %%% Result = [TestResult] | {error,Reason} %%% @doc Run tests as specified by the combination of options in <code>Opts</code>. %%% The options are the same as those used with the diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl index f2ca023cff..b61eda7152 100644 --- a/lib/common_test/src/ct_framework.erl +++ b/lib/common_test/src/ct_framework.erl @@ -24,7 +24,7 @@ -module(ct_framework). --export([init_tc/3, end_tc/3, get_suite/2, report/2, warn/1]). +-export([init_tc/3, end_tc/4, get_suite/2, report/2, warn/1]). -export([error_notification/4]). -export([overview_html_header/1]). @@ -207,7 +207,7 @@ init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) -> {skip,{require_failed_in_suite0,Reason}}; {error,Reason} -> {auto_skip,{require_failed,Reason}}; - FinalConfig -> + {ok, FinalConfig} -> case MergeResult of {error,Reason} -> %% suite0 configure finished now, report that @@ -216,13 +216,25 @@ init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) -> _ -> case get('$test_server_framework_test') of undefined -> - FinalConfig; + ct_suite_init(Mod, FuncSpec, FinalConfig); Fun -> - Fun(init_tc, FinalConfig) + case Fun(init_tc, FinalConfig) of + NewConfig when is_list(NewConfig) -> + {ok,NewConfig}; + Else -> + Else + end end end end. - + +ct_suite_init(Mod, Func, [Config]) when is_list(Config) -> + case ct_hooks:init_tc( Mod, Func, Config) of + NewConfig when is_list(NewConfig) -> + {ok, [NewConfig]}; + Else -> + Else + end. add_defaults(Mod,Func,FuncInfo,DoInit) -> case (catch Mod:suite()) of @@ -239,7 +251,9 @@ add_defaults(Mod,Func,FuncInfo,DoInit) -> (_) -> false end, SuiteInfo) of true -> - SuiteInfo1 = merge_with_suite_defaults(Mod,SuiteInfo), + SuiteInfoNoCTH = + lists:keydelete(ct_hooks,1,SuiteInfo), + SuiteInfo1 = merge_with_suite_defaults(Mod,SuiteInfoNoCTH), case add_defaults1(Mod,Func,FuncInfo,SuiteInfo1,DoInit) of Error = {error,_} -> {SuiteInfo1,Error}; MergedInfo -> {SuiteInfo1,MergedInfo} @@ -362,6 +376,8 @@ configure([{timetrap,off}|Rest],Info,SuiteInfo,Scope,Config) -> configure([{timetrap,Time}|Rest],Info,SuiteInfo,Scope,Config) -> Dog = test_server:timetrap(Time), configure(Rest,Info,SuiteInfo,Scope,[{watchdog,Dog}|Config]); +configure([{ct_hooks, Hook} | Rest], Info, SuiteInfo, Scope, Config) -> + configure(Rest, Info, SuiteInfo, Scope, [{ct_hooks, Hook} | Config]); configure([_|Rest],Info,SuiteInfo,Scope,Config) -> configure(Rest,Info,SuiteInfo,Scope,Config); configure([],_,_,_,Config) -> @@ -418,14 +434,14 @@ try_set_default(Name,Key,Info,Where) -> %%% %%% @doc Test server framework callback, called by the test_server %%% when a test case is finished. -end_tc(?MODULE,error_in_suite,_) -> % bad start! +end_tc(?MODULE,error_in_suite,_, _) -> % bad start! ok; -end_tc(Mod,Func,{TCPid,Result,[Args]}) when is_pid(TCPid) -> - end_tc(Mod,Func,TCPid,Result,Args); -end_tc(Mod,Func,{Result,[Args]}) -> - end_tc(Mod,Func,self(),Result,Args). +end_tc(Mod,Func,{TCPid,Result,[Args]}, Return) when is_pid(TCPid) -> + end_tc(Mod,Func,TCPid,Result,Args,Return); +end_tc(Mod,Func,{Result,[Args]}, Return) -> + end_tc(Mod,Func,self(),Result,Args,Return). -end_tc(Mod,Func,TCPid,Result,Args) -> +end_tc(Mod,Func,TCPid,Result,Args,Return) -> case lists:keysearch(watchdog,1,Args) of {value,{watchdog,Dog}} -> test_server:timetrap_cancel(Dog); false -> ok @@ -448,8 +464,10 @@ end_tc(Mod,Func,TCPid,Result,Args) -> {_,GroupName,_Props} = Group -> case lists:keysearch(save_config,1,Args) of {value,{save_config,SaveConfig}} -> - ct_util:save_suite_data(last_saved_config, - {Mod,{group,GroupName}},SaveConfig), + ct_util:save_suite_data( + last_saved_config, + {Mod,{group,GroupName}}, + SaveConfig), Group; false -> Group @@ -466,12 +484,33 @@ end_tc(Mod,Func,TCPid,Result,Args) -> end, ct_util:reset_silent_connections(), - %% send sync notification so that event handlers may print - %% in the log file before it gets closed - ct_event:sync_notify(#event{name=tc_done, - node=node(), - data={Mod,FuncSpec,tag(Result)}}), - case Result of + case get('$test_server_framework_test') of + undefined -> + {FinalResult,FinalNotify} = + case ct_hooks:end_tc( + Mod, FuncSpec, Args, Result, Return) of + '$ct_no_change' -> + {FinalResult = ok,Result}; + FinalResult -> + {FinalResult,FinalResult} + end, + % send sync notification so that event handlers may print + % in the log file before it gets closed + ct_event:sync_notify(#event{name=tc_done, + node=node(), + data={Mod,FuncSpec, + tag_cth(FinalNotify)}}); + Fun -> + % send sync notification so that event handlers may print + % in the log file before it gets closed + ct_event:sync_notify(#event{name=tc_done, + node=node(), + data={Mod,FuncSpec,tag(Result)}}), + FinalResult = Fun(end_tc, Return) + end, + + + case FinalResult of {skip,{sequence_failed,_,_}} -> %% ct_logs:init_tc is never called for a skipped test case %% in a failing sequence, so neither should end_tc @@ -490,12 +529,7 @@ end_tc(Mod,Func,TCPid,Result,Args) -> _ -> ok end, - case get('$test_server_framework_test') of - undefined -> - ok; - Fun -> - Fun(end_tc, ok) - end. + FinalResult. %% {error,Reason} | {skip,Reason} | {timetrap_timeout,TVal} | %% {testcase_aborted,Reason} | testcase_aborted_or_killed | @@ -511,6 +545,21 @@ tag(E = testcase_aborted_or_killed) -> tag(Other) -> Other. +tag_cth({STag,Reason}) when STag == skip; STag == skipped -> + {skipped,Reason}; +tag_cth({fail, Reason}) -> + {failed, {error,Reason}}; +tag_cth(E = {ETag,_}) when ETag == error; ETag == 'EXIT'; + ETag == timetrap_timeout; + ETag == testcase_aborted -> + {failed,E}; +tag_cth(E = testcase_aborted_or_killed) -> + {failed,E}; +tag_cth(List) when is_list(List) -> + ok; +tag_cth(Other) -> + Other. + %%%----------------------------------------------------------------- %%% @spec error_notification(Mod,Func,Args,Error) -> ok %%% Mod = atom() @@ -694,12 +743,12 @@ get_suite(Mod, Group={conf,Props,_Init,TCs,_End}) -> %% init/end functions for top groups will be executed case catch proplists:get_value(name, element(2, hd(ConfTests))) of Name -> % top group - ConfTests; + delete_subs(ConfTests, ConfTests); _ -> [] end; false -> - ConfTests + delete_subs(ConfTests, ConfTests) end end; _ -> @@ -716,9 +765,25 @@ get_suite(Mod, Name) -> find_groups(Mod, Name, TCs, GroupDefs) -> Found = find(Mod, Name, TCs, GroupDefs, [], GroupDefs, false), Trimmed = trim(Found), - delete_subs(Trimmed, Trimmed). - -find(Mod, all, _TCs, [{Name,Props,Tests} | Gs], Known, Defs, _) -> + %% I cannot find a reason to why this function is called, + %% It deletes any group which is referenced in any other + %% group. i.e. + %% groups() -> + %% [{test, [], [testcase1]}, + %% {testcases, [], [{group, test}]}]. + %% Would be changed to + %% groups() -> + %% [{testcases, [], [testcase1]}]. + %% instead of what I believe is correct: + %% groups() -> + %% [{test, [], [testcase1]}, + %% {testcases, [], [testcase1]}]. + %% Have to double check with peppe + delete_subs(Trimmed, Trimmed), + Trimmed. + +find(Mod, all, _TCs, [{Name,Props,Tests} | Gs], Known, Defs, _) + when is_atom(Name), is_list(Props), is_list(Tests) -> cyclic_test(Mod, Name, Known), [make_conf(Mod, Name, Props, find(Mod, all, all, Tests, [Name | Known], Defs, true)) | @@ -740,8 +805,8 @@ find(Mod, Name, TCs, [{Name,Props,Tests} | _Gs], Known, Defs, false) find(Mod, Name, TCs, [{Name1,Props,Tests} | Gs], Known, Defs, false) when is_atom(Name1), is_list(Props), is_list(Tests) -> cyclic_test(Mod, Name1, Known), - [make_conf(Mod, Name1, Props, - find(Mod, Name, TCs, Tests, [Name1 | Known], Defs, false)) | + [make_conf(Mod,Name1,Props, + find(Mod, Name, TCs, Tests, [Name1 | Known], Defs, false)) | find(Mod, Name, TCs, Gs, [], Defs, false)]; find(Mod, Name, _TCs, [{Name,_Props,_Tests} | _Gs], _Known, _Defs, true) @@ -757,17 +822,31 @@ find(Mod, Name, all, [{Name1,Props,Tests} | Gs], Known, Defs, true) find(Mod, Name, all, Tests, [Name1 | Known], Defs, true)) | find(Mod, Name, all, Gs, [], Defs, true)]; -find(Mod, Name, TCs, [{group,Name1} | Gs], Known, Defs, Found) when is_atom(Name1) -> +find(Mod, Name, TCs, [{group,Name1} | Gs], Known, Defs, Found) + when is_atom(Name1) -> find(Mod, Name, TCs, [expand(Mod, Name1, Defs) | Gs], Known, Defs, Found); +%% Undocumented remote group feature, use with caution +find(Mod, Name, TCs, [{group, ExtMod, ExtGrp} | Gs], Known, Defs, true) + when is_atom(ExtMod), is_atom(ExtGrp) -> + ExternalDefs = ExtMod:groups(), + ExternalTCs = find(ExtMod, ExtGrp, TCs, [{group, ExtGrp}], + [], ExternalDefs, false), + ExternalTCs ++ find(Mod, Name, TCs, Gs, Known, Defs, true); + find(Mod, Name, TCs, [{Name1,Tests} | Gs], Known, Defs, Found) when is_atom(Name1), is_list(Tests) -> find(Mod, Name, TCs, [{Name1,[],Tests} | Gs], Known, Defs, Found); -find(Mod, Name, TCs, [TC | Gs], Known, Defs, false) when is_atom(TC) -> +find(Mod, Name, TCs, [_TC | Gs], Known, Defs, false) -> find(Mod, Name, TCs, Gs, Known, Defs, false); find(Mod, Name, TCs, [TC | Gs], Known, Defs, true) when is_atom(TC) -> + [{Mod, TC} | find(Mod, Name, TCs, Gs, Known, Defs, true)]; + +find(Mod, Name, TCs, [{ExternalTC, Case} = TC | Gs], Known, Defs, true) + when is_atom(ExternalTC), + is_atom(Case) -> [TC | find(Mod, Name, TCs, Gs, Known, Defs, true)]; find(Mod, _Name, _TCs, [BadTerm | _Gs], Known, _Defs, _Found) -> @@ -787,7 +866,7 @@ find(_Mod, _Name, _TCs, [], _Known, _Defs, false) -> find(_Mod, _Name, _TCs, [], _Known, _Defs, _Found) -> []. -delete_subs([Conf | Confs], All) -> +delete_subs([{conf, _,_,_,_} = Conf | Confs], All) -> All1 = delete_conf(Conf, All), case is_sub(Conf, All1) of true -> @@ -795,7 +874,8 @@ delete_subs([Conf | Confs], All) -> false -> delete_subs(Confs, All) end; - +delete_subs([_Else | Confs], All) -> + delete_subs(Confs, All); delete_subs([], All) -> All. @@ -887,7 +967,9 @@ make_all_conf(Mod) -> [] -> {error,{invalid_group_spec,Mod}}; ConfTests -> - [{conf,Props,Init,all,End} || {conf,Props,Init,_,End} <- ConfTests] + [{conf,Props,Init,all,End} || + {conf,Props,Init,_,End} + <- delete_subs(ConfTests, ConfTests)] end end. @@ -933,31 +1015,11 @@ get_all(Mod, ConfTests) -> [{?MODULE,error_in_suite,[[{error,What}]]}]; SeqsAndTCs -> %% expand group references in all() using ConfTests - Expand = - fun({group,Name}) -> - FindConf = - fun({conf,Props,_,_,_}) -> - case proplists:get_value(name, Props) of - Name -> true; - _ -> false - end - end, - case lists:filter(FindConf, ConfTests) of - [ConfTest|_] -> - ConfTest; - [] -> - E = "Invalid reference to group "++ - atom_to_list(Name)++" in "++ - atom_to_list(Mod)++":all/0", - throw({error,list_to_atom(E)}) - end; - (SeqOrTC) -> SeqOrTC - end, - case catch lists:map(Expand, SeqsAndTCs) of + case catch expand_groups(SeqsAndTCs, ConfTests, Mod) of {error,_} = Error -> [{?MODULE,error_in_suite,[[Error]]}]; Tests -> - Tests + delete_subs(Tests, Tests) end end; Skip = {skip,_Reason} -> @@ -968,6 +1030,30 @@ get_all(Mod, ConfTests) -> [{?MODULE,error_in_suite,[[{error,Reason}]]}] end. +expand_groups([H | T], ConfTests, Mod) -> + [expand_groups(H, ConfTests, Mod) | expand_groups(T, ConfTests, Mod)]; +expand_groups([], _ConfTests, _Mod) -> + []; +expand_groups({group,Name}, ConfTests, Mod) -> + FindConf = + fun({conf,Props,_,_,_}) -> + case proplists:get_value(name, Props) of + Name -> true; + _ -> false + end + end, + case lists:filter(FindConf, ConfTests) of + [ConfTest|_] -> + expand_groups(ConfTest, ConfTests, Mod); + [] -> + E = "Invalid reference to group "++ + atom_to_list(Name)++" in "++ + atom_to_list(Mod)++":all/0", + throw({error,list_to_atom(E)}) + end; +expand_groups(SeqOrTC, _ConfTests, _Mod) -> + SeqOrTC. + %%!============================================================ %%! The support for sequences by means of using sequences/0 @@ -1137,6 +1223,18 @@ report(What,Data) -> ok; tc_done -> {_Suite,Case,Result} = Data, + case Result of + {failed, _} -> + ct_hooks:on_tc_fail(What, Data); + {skipped,{failed,{_,init_per_testcase,_}}} -> + ct_hooks:on_tc_skip(tc_auto_skip, Data); + {skipped,{require_failed,_}} -> + ct_hooks:on_tc_skip(tc_auto_skip, Data); + {skipped,_} -> + ct_hooks:on_tc_skip(tc_user_skip, Data); + _Else -> + ok + end, case {Case,Result} of {init_per_suite,_} -> ok; @@ -1154,8 +1252,8 @@ report(What,Data) -> add_to_stats(auto_skipped); {_,{skipped,_}} -> add_to_stats(user_skipped); - {_,{FailOrSkip,_Reason}} -> - add_to_stats(FailOrSkip) + {_,{SkipOrFail,_Reason}} -> + add_to_stats(SkipOrFail) end; tc_user_skip -> %% test case specified as skipped in testspec @@ -1163,6 +1261,7 @@ report(What,Data) -> ct_event:sync_notify(#event{name=tc_user_skip, node=node(), data=Data}), + ct_hooks:on_tc_skip(What, Data), add_to_stats(user_skipped); tc_auto_skip -> %% test case skipped because of error in init_per_suite @@ -1175,6 +1274,7 @@ report(What,Data) -> ct_event:sync_notify(#event{name=tc_auto_skip, node=node(), data=Data}), + ct_hooks:on_tc_skip(What, Data), if Case /= end_per_suite, Case /= end_per_group -> add_to_stats(auto_skipped); true -> diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl new file mode 100644 index 0000000000..77b7566d9e --- /dev/null +++ b/lib/common_test/src/ct_hooks.erl @@ -0,0 +1,305 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2004-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% +%% + +%%% @doc Common Test Framework test execution control module. +%%% +%%% <p>This module is a proxy for calling and handling common test hooks.</p> + +-module(ct_hooks). + +%% API Exports +-export([init/1]). +-export([init_tc/3]). +-export([end_tc/5]). +-export([terminate/1]). +-export([on_tc_skip/2]). +-export([on_tc_fail/2]). + +-type proplist() :: [{atom(),term()}]. + +%% If you change this, remember to update ct_util:look -> stop clause as well. +-define(config_name, ct_hooks). + +%% ------------------------------------------------------------------------- +%% API Functions +%% ------------------------------------------------------------------------- + +%% @doc Called before any suites are started +-spec init(State :: term()) -> ok | + {error, Reason :: term()}. +init(Opts) -> + call([{Hook, call_id, undefined} || Hook <- get_new_hooks(Opts)], + ok, init, []). + + +%% @doc Called after all suites are done. +-spec terminate(Hooks :: term()) -> + ok. +terminate(Hooks) -> + call([{HookId, fun call_terminate/3} || {HookId,_,_} <- Hooks], + ct_hooks_terminate_dummy, terminate, Hooks), + ok. + +%% @doc Called as each test case is started. This includes all configuration +%% tests. +-spec init_tc(Mod :: atom(), Func :: atom(), Args :: list()) -> + NewConfig :: proplist() | + {skip, Reason :: term()} | + {auto_skip, Reason :: term()} | + {fail, Reason :: term()}. +init_tc(ct_framework, _Func, Args) -> + Args; +init_tc(Mod, init_per_suite, Config) -> + Info = case catch proplists:get_value(ct_hooks, Mod:suite()) of + List when is_list(List) -> + [{ct_hooks,List}]; + _Else -> + [] + end, + call(fun call_generic/3, Config ++ Info, [pre_init_per_suite, Mod]); +init_tc(Mod, end_per_suite, Config) -> + call(fun call_generic/3, Config, [pre_end_per_suite, Mod]); +init_tc(Mod, {init_per_group, GroupName, Opts}, Config) -> + maybe_start_locker(Mod, GroupName, Opts), + call(fun call_generic/3, Config, [pre_init_per_group, GroupName]); +init_tc(_Mod, {end_per_group, GroupName, _}, Config) -> + call(fun call_generic/3, Config, [pre_end_per_group, GroupName]); +init_tc(_Mod, TC, Config) -> + call(fun call_generic/3, Config, [pre_init_per_testcase, TC]). + +%% @doc Called as each test case is completed. This includes all configuration +%% tests. +-spec end_tc(Mod :: atom(), + Func :: atom(), + Args :: list(), + Result :: term(), + Resturn :: term()) -> + NewConfig :: proplist() | + {skip, Reason :: term()} | + {auto_skip, Reason :: term()} | + {fail, Reason :: term()} | + ok | '$ct_no_change'. +end_tc(ct_framework, _Func, _Args, Result, _Return) -> + Result; + +end_tc(Mod, init_per_suite, Config, _Result, Return) -> + call(fun call_generic/3, Return, [post_init_per_suite, Mod, Config], + '$ct_no_change'); + +end_tc(Mod, end_per_suite, Config, Result, _Return) -> + call(fun call_generic/3, Result, [post_end_per_suite, Mod, Config], + '$ct_no_change'); + +end_tc(_Mod, {init_per_group, GroupName, _}, Config, _Result, Return) -> + call(fun call_generic/3, Return, [post_init_per_group, GroupName, Config], + '$ct_no_change'); + +end_tc(Mod, {end_per_group, GroupName, Opts}, Config, Result, _Return) -> + Res = call(fun call_generic/3, Result, + [post_end_per_group, GroupName, Config], '$ct_no_change'), + maybe_stop_locker(Mod, GroupName,Opts), + Res; + +end_tc(_Mod, TC, Config, Result, _Return) -> + call(fun call_generic/3, Result, [post_end_per_testcase, TC, Config], + '$ct_no_change'). + +on_tc_skip(How, {_Suite, Case, Reason}) -> + call(fun call_cleanup/3, {How, Reason}, [on_tc_skip, Case]). + +on_tc_fail(_How, {_Suite, Case, Reason}) -> + call(fun call_cleanup/3, Reason, [on_tc_fail, Case]). + +%% ------------------------------------------------------------------------- +%% Internal Functions +%% ------------------------------------------------------------------------- +call_id(Mod, Config, Meta) when is_atom(Mod) -> + call_id({Mod, []}, Config, Meta); +call_id({Mod, Opts}, Config, Scope) -> + Id = catch_apply(Mod,id,[Opts], make_ref()), + {Config, {Id, scope(Scope), {Mod, {Id,Opts}}}}. + +call_init({Mod,{Id,Opts}},Config,_Meta) -> + NewState = Mod:init(Id, Opts), + {Config, {Mod, NewState}}. + +call_terminate({Mod, State}, _, _) -> + catch_apply(Mod,terminate,[State], ok), + {[],{Mod,State}}. + +call_cleanup({Mod, State}, Reason, [Function | Args]) -> + NewState = catch_apply(Mod,Function, Args ++ [Reason, State], + State), + {Reason, {Mod, NewState}}. + +call_generic({Mod, State}, Value, [Function | Args]) -> + {NewValue, NewState} = catch_apply(Mod, Function, Args ++ [Value, State], + {Value,State}), + {NewValue, {Mod, NewState}}. + +%% Generic call function +call(Fun, Config, Meta) -> + maybe_lock(), + Hooks = get_hooks(), + Res = call([{HookId,Fun} || {HookId,_, _} <- Hooks] ++ + get_new_hooks(Config, Fun), + remove(?config_name,Config), Meta, Hooks), + maybe_unlock(), + Res. + +call(Fun, Config, Meta, NoChangeRet) when is_function(Fun) -> + case call(Fun,Config,Meta) of + Config -> NoChangeRet; + NewReturn -> NewReturn + end; + +call([{Hook, call_id, NextFun} | Rest], Config, Meta, Hooks) -> + try + {Config, {NewId, _, _} = NewHook} = call_id(Hook, Config, Meta), + {NewHooks, NewRest} = + case lists:keyfind(NewId, 1, Hooks) of + false when NextFun =:= undefined -> + {Hooks ++ [NewHook], + [{NewId, fun call_init/3} | Rest]}; + ExistingHook when is_tuple(ExistingHook) -> + {Hooks, Rest}; + _ -> + {Hooks ++ [NewHook], + [{NewId, fun call_init/3},{NewId,NextFun} | Rest]} + end, + call(NewRest, Config, Meta, NewHooks) + catch Error:Reason -> + Trace = erlang:get_stacktrace(), + ct_logs:log("Suite Hook","Failed to start a CTH: ~p:~p", + [Error,{Reason,Trace}]), + call([], {fail,"Failed to start CTH" + ", see the CT Log for details"}, Meta, Hooks) + end; +call([{HookId, Fun} | Rest], Config, Meta, Hooks) -> + try + {_,Scope,ModState} = lists:keyfind(HookId, 1, Hooks), + {NewConf, NewHookInfo} = Fun(ModState, Config, Meta), + NewCalls = get_new_hooks(NewConf, Fun), + NewHooks = lists:keyreplace(HookId, 1, Hooks, {HookId, Scope, NewHookInfo}), + call(NewCalls ++ Rest, remove(?config_name, NewConf), Meta, + terminate_if_scope_ends(HookId, Meta, NewHooks)) + catch throw:{error_in_cth_call,Reason} -> + call(Rest, {fail, Reason}, Meta, + terminate_if_scope_ends(HookId, Meta, Hooks)) + end; +call([], Config, _Meta, Hooks) -> + save_suite_data_async(Hooks), + Config. + +remove(Key,List) when is_list(List) -> + [Conf || Conf <- List, is_tuple(Conf) =:= false + orelse element(1, Conf) =/= Key]; +remove(_, Else) -> + Else. + +%% Translate scopes, i.e. init_per_group,group1 -> end_per_group,group1 etc +scope([pre_init_per_testcase, TC|_]) -> + [post_end_per_testcase, TC]; +scope([pre_init_per_group, GroupName|_]) -> + [post_end_per_group, GroupName]; +scope([post_init_per_group, GroupName|_]) -> + [post_end_per_group, GroupName]; +scope([pre_init_per_suite, SuiteName|_]) -> + [post_end_per_suite, SuiteName]; +scope([post_init_per_suite, SuiteName|_]) -> + [post_end_per_suite, SuiteName]; +scope(init) -> + none. + +terminate_if_scope_ends(HookId, [Function,Tag|T], Hooks) when T =/= [] -> + terminate_if_scope_ends(HookId,[Function,Tag],Hooks); +terminate_if_scope_ends(HookId, Function, Hooks) -> + case lists:keyfind(HookId, 1, Hooks) of + {HookId, Function, _ModState} = Hook -> + terminate([Hook]), + lists:keydelete(HookId, 1, Hooks); + _ -> + Hooks + end. + +%% Fetch hook functions +get_new_hooks(Config, Fun) -> + lists:foldl(fun(NewHook, Acc) -> + [{NewHook, call_id, Fun} | Acc] + end, [], get_new_hooks(Config)). + +get_new_hooks(Config) when is_list(Config) -> + lists:flatmap(fun({?config_name, HookConfigs}) -> + HookConfigs; + (_) -> + [] + end, Config); +get_new_hooks(_Config) -> + []. + +save_suite_data_async(Hooks) -> + ct_util:save_suite_data_async(?config_name, Hooks). + +get_hooks() -> + ct_util:read_suite_data(?config_name). + +catch_apply(M,F,A, Default) -> + try + apply(M,F,A) + catch error:Reason -> + case erlang:get_stacktrace() of + %% Return the default if it was the CTH module which did not have the function. + [{M,F,A}|_] when Reason == undef -> + Default; + Trace -> + ct_logs:log("Suite Hook","Call to CTH failed: ~p:~p", + [error,{Reason,Trace}]), + throw({error_in_cth_call, + lists:flatten( + io_lib:format("~p:~p/~p CTH call failed", + [M,F,length(A)]))}) + end + end. + + +%% We need to lock around the state for parallel groups only. This is because +%% we will get several processes reading and writing the state for a single +%% cth at the same time. +maybe_start_locker(Mod,GroupName,Opts) -> + case lists:member(parallel,Opts) of + true -> + {ok, _Pid} = ct_hooks_lock:start({Mod,GroupName}); + false -> + ok + end. + +maybe_stop_locker(Mod,GroupName,Opts) -> + case lists:member(parallel,Opts) of + true -> + stopped = ct_hooks_lock:stop({Mod,GroupName}); + false -> + ok + end. + + +maybe_lock() -> + locked = ct_hooks_lock:request(). + +maybe_unlock() -> + unlocked = ct_hooks_lock:release(). diff --git a/lib/common_test/src/ct_hooks_lock.erl b/lib/common_test/src/ct_hooks_lock.erl new file mode 100644 index 0000000000..98794201bb --- /dev/null +++ b/lib/common_test/src/ct_hooks_lock.erl @@ -0,0 +1,132 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2004-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% +%% + +%%% @doc Common Test Framework test execution control module. +%%% +%%% <p>This module is a proxy for calling and handling locks in +%%% common test hooks.</p> + +-module(ct_hooks_lock). + +-behaviour(gen_server). + +%% API +-export([start/1, stop/1, request/0, release/0]). + +%% gen_server callbacks +-export([init/1, handle_call/3, handle_cast/2, handle_info/2, + terminate/2, code_change/3]). + +-define(SERVER, ?MODULE). + +-record(state, { id, locked = false, requests = [] }). + +%%%=================================================================== +%%% API +%%%=================================================================== + +%% @doc Starts the server +start(Id) -> + case gen_server:start({local, ?SERVER}, ?MODULE, Id, []) of + {error,{already_started, Pid}} -> + {ok,Pid}; + Else -> + Else + end. + +stop(Id) -> + try + gen_server:call(?SERVER, {stop,Id}) + catch exit:{noproc,_} -> + stopped + end. + +request() -> + try + gen_server:call(?SERVER,{request,self()},infinity) + catch exit:{noproc,_} -> + locked + end. + +release() -> + try + gen_server:call(?SERVER,{release,self()}) + catch exit:{noproc,_} -> + unlocked + end. + +%%%=================================================================== +%%% gen_server callbacks +%%%=================================================================== + +%% @doc Initiates the server +init(Id) -> + {ok, #state{ id = Id }}. + +%% @doc Handling call messages +handle_call({stop,Id}, _From, #state{ id = Id, requests = Reqs } = State) -> + [gen_server:reply(Req, locker_stopped) || {Req,_ReqId} <- Reqs], + {stop, normal, stopped, State}; +handle_call({stop,_Id}, _From, State) -> + {reply, stopped, State}; +handle_call({request, Pid}, _From, #state{ locked = false, + requests = [] } = State) -> + Ref = monitor(process, Pid), + {reply, locked, State#state{ locked = {true, Pid, Ref}} }; +handle_call({request, Pid}, From, #state{ requests = Reqs } = State) -> + {noreply, State#state{ requests = Reqs ++ [{From,Pid}] }}; +handle_call({release, Pid}, _From, #state{ locked = {true, Pid, Ref}, + requests = []} = State) -> + demonitor(Ref,[flush]), + {reply, unlocked, State#state{ locked = false }}; +handle_call({release, Pid}, _From, + #state{ locked = {true, Pid, Ref}, + requests = [{NextFrom,NextPid}|Rest]} = State) -> + demonitor(Ref,[flush]), + gen_server:reply(NextFrom,locked), + NextRef = monitor(process, NextPid), + {reply,unlocked,State#state{ locked = {true, NextPid, NextRef}, + requests = Rest } }; +handle_call({release, _Pid}, _From, State) -> + {reply, not_locked, State}. + +%% @doc Handling cast messages +handle_cast(_Msg, State) -> + {noreply, State}. + +%% @doc Handling all non call/cast messages +handle_info({'DOWN',Ref,process,Pid,_}, + #state{ locked = {true, Pid, Ref}, + requests = [{NextFrom,NextPid}|Rest] } = State) -> + gen_server:reply(NextFrom, locked), + NextRef = monitor(process, NextPid), + {noreply,State#state{ locked = {true, NextPid, NextRef}, + requests = Rest } }. + +%% @doc This function is called by a gen_server when it is about to terminate. +terminate(_Reason, _State) -> + ok. + +%% @doc Convert process state when code is changed +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%% ------------------------------------------------------------------------- +%% Internal Functions +%% ------------------------------------------------------------------------- diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index d0e6ba5fa6..f50a46a241 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -54,6 +54,7 @@ logdir, config = [], event_handlers = [], + ct_hooks = [], include = [], silent_connections, stylesheet, @@ -171,6 +172,7 @@ script_start1(Parent, Args) -> ([]) -> true end, false, Args), EvHandlers = event_handler_args2opts(Args), + CTHooks = ct_hooks_args2opts(Args), %% check flags and set corresponding application env variables @@ -234,6 +236,7 @@ script_start1(Parent, Args) -> StartOpts = #opts{label = Label, vts = Vts, shell = Shell, cover = Cover, logdir = LogDir, event_handlers = EvHandlers, + ct_hooks = CTHooks, include = IncludeDirs, silent_connections = SilentConns, stylesheet = Stylesheet, @@ -305,6 +308,10 @@ script_start2(StartOpts = #opts{vts = undefined, SpecStartOpts#opts.scale_timetraps), AllEvHs = merge_vals([StartOpts#opts.event_handlers, SpecStartOpts#opts.event_handlers]), + AllCTHooks = merge_vals( + [StartOpts#opts.ct_hooks, + SpecStartOpts#opts.ct_hooks]), + AllInclude = merge_vals([StartOpts#opts.include, SpecStartOpts#opts.include]), application:set_env(common_test, include, AllInclude), @@ -315,6 +322,7 @@ script_start2(StartOpts = #opts{vts = undefined, logdir = LogDir, config = SpecStartOpts#opts.config, event_handlers = AllEvHs, + ct_hooks = AllCTHooks, include = AllInclude, multiply_timetraps = MultTT, scale_timetraps = ScaleTT}} @@ -332,7 +340,8 @@ script_start2(StartOpts = #opts{vts = undefined, {error,no_testspec_specified}; {undefined,_} -> % no testspec used case check_and_install_configfiles(InitConfig, TheLogDir, - Opts#opts.event_handlers) of + Opts#opts.event_handlers, + Opts#opts.ct_hooks) of ok -> % go on read tests from start flags script_start3(Opts#opts{config=InitConfig, logdir=TheLogDir}, Args); @@ -343,7 +352,8 @@ script_start2(StartOpts = #opts{vts = undefined, %% merge config from start flags with config from testspec AllConfig = merge_vals([InitConfig, Opts#opts.config]), case check_and_install_configfiles(AllConfig, TheLogDir, - Opts#opts.event_handlers) of + Opts#opts.event_handlers, + Opts#opts.ct_hooks) of ok -> % read tests from spec {Run,Skip} = ct_testspec:prepare_tests(Terms, node()), do_run(Run, Skip, Opts#opts{config=AllConfig, @@ -358,7 +368,8 @@ script_start2(StartOpts, Args) -> InitConfig = ct_config:prepare_config_list(Args), LogDir = which(logdir, StartOpts#opts.logdir), case check_and_install_configfiles(InitConfig, LogDir, - StartOpts#opts.event_handlers) of + StartOpts#opts.event_handlers, + StartOpts#opts.ct_hooks) of ok -> % go on read tests from start flags script_start3(StartOpts#opts{config=InitConfig, logdir=LogDir}, Args); @@ -366,11 +377,12 @@ script_start2(StartOpts, Args) -> Error end. -check_and_install_configfiles(Configs, LogDir, EvHandlers) -> +check_and_install_configfiles(Configs, LogDir, EvHandlers, CTHooks) -> case ct_config:check_config_files(Configs) of false -> install([{config,Configs}, - {event_handler,EvHandlers}], LogDir); + {event_handler,EvHandlers}, + {ct_hooks,CTHooks}], LogDir); {value,{error,{nofile,File}}} -> {error,{cant_read_config_file,File}}; {value,{error,{wrong_config,Message}}}-> @@ -438,11 +450,13 @@ script_start4(#opts{vts = true, config = Config, event_handlers = EvHandlers, script_start4(#opts{label = Label, shell = true, config = Config, event_handlers = EvHandlers, + ct_hooks = CTHooks, logdir = LogDir, testspecs = Specs}, _Args) -> %% label - used by ct_logs application:set_env(common_test, test_label, Label), - InstallOpts = [{config,Config},{event_handler,EvHandlers}], + InstallOpts = [{config,Config},{event_handler,EvHandlers}, + {ct_hooks, CTHooks}], if Config == [] -> ok; true -> @@ -508,6 +522,7 @@ script_usage() -> "\n\t[-stylesheet CSSFile]" "\n\t[-cover CoverCfgFile]" "\n\t[-event_handler EvHandler1 EvHandler2 .. EvHandlerN]" + "\n\t[-ct_hooks CTHook1 CTHook2 .. CTHookN]" "\n\t[-include InclDir1 InclDir2 .. InclDirN]" "\n\t[-no_auto_compile]" "\n\t[-multiply_timetraps N]" @@ -526,6 +541,7 @@ script_usage() -> "\n\t[-stylesheet CSSFile]" "\n\t[-cover CoverCfgFile]" "\n\t[-event_handler EvHandler1 EvHandler2 .. EvHandlerN]" + "\n\t[-ct_hooks CTHook1 CTHook2 .. CTHookN]" "\n\t[-include InclDir1 InclDir2 .. InclDirN]" "\n\t[-no_auto_compile]" "\n\t[-multiply_timetraps N]" @@ -664,6 +680,9 @@ run_test1(StartOpts) -> end, Hs)) end, + %% CT Hooks + CTHooks = get_start_opt(ct_hooks, value, [], StartOpts), + %% silent connections SilentConns = get_start_opt(silent_connections, fun(all) -> []; @@ -733,7 +752,9 @@ run_test1(StartOpts) -> Opts = #opts{label = Label, cover = Cover, step = Step, logdir = LogDir, config = CfgFiles, - event_handlers = EvHandlers, include = Include, + event_handlers = EvHandlers, + ct_hooks = CTHooks, + include = Include, silent_connections = SilentConns, stylesheet = Stylesheet, multiply_timetraps = MultiplyTT, @@ -784,11 +805,16 @@ run_spec_file(Relaxed, SpecOpts#opts.event_handlers]), AllInclude = merge_vals([Opts#opts.include, SpecOpts#opts.include]), + + AllCTHooks = merge_vals([Opts#opts.ct_hooks, + SpecOpts#opts.ct_hooks]), + application:set_env(common_test, include, AllInclude), case check_and_install_configfiles(AllConfig, which(logdir,LogDir), - AllEvHs) of + AllEvHs, + AllCTHooks) of ok -> Opts1 = Opts#opts{label = Label, cover = Cover, @@ -798,7 +824,8 @@ run_spec_file(Relaxed, include = AllInclude, testspecs = AbsSpecs, multiply_timetraps = MultTT, - scale_timetraps = ScaleTT}, + scale_timetraps = ScaleTT, + ct_hooks = AllCTHooks}, {Run,Skip} = ct_testspec:prepare_tests(TS, node()), reformat_result(catch do_run(Run, Skip, Opts1, StartOpts)); {error,GCFReason} -> @@ -808,10 +835,12 @@ run_spec_file(Relaxed, run_prepared(Run, Skip, Opts = #opts{logdir = LogDir, config = CfgFiles, - event_handlers = EvHandlers}, + event_handlers = EvHandlers, + ct_hooks = CTHooks}, StartOpts) -> LogDir1 = which(logdir, LogDir), - case check_and_install_configfiles(CfgFiles, LogDir1, EvHandlers) of + case check_and_install_configfiles(CfgFiles, LogDir1, + EvHandlers, CTHooks) of ok -> reformat_result(catch do_run(Run, Skip, Opts#opts{logdir = LogDir1}, StartOpts)); @@ -842,7 +871,8 @@ check_config_file(Callback, File)-> run_dir(Opts = #opts{logdir = LogDir, config = CfgFiles, - event_handlers = EvHandlers}, StartOpts) -> + event_handlers = EvHandlers, + ct_hooks = CTHook }, StartOpts) -> LogDir1 = which(logdir, LogDir), Opts1 = Opts#opts{logdir = LogDir1}, AbsCfgFiles = @@ -863,7 +893,9 @@ run_dir(Opts = #opts{logdir = LogDir, check_config_file(Callback, File) end, FileList)} end, CfgFiles), - case install([{config,AbsCfgFiles},{event_handler,EvHandlers}], LogDir1) of + case install([{config,AbsCfgFiles}, + {event_handler,EvHandlers}, + {ct_hooks, CTHook}], LogDir1) of ok -> ok; {error,IReason} -> exit(IReason) end, @@ -968,7 +1000,8 @@ run_testspec1(TestSpec) -> application:set_env(common_test, include, AllInclude), LogDir1 = which(logdir,Opts#opts.logdir), case check_and_install_configfiles(Opts#opts.config, LogDir1, - Opts#opts.event_handlers) of + Opts#opts.event_handlers, + Opts#opts.ct_hooks) of ok -> Opts1 = Opts#opts{testspecs = [], logdir = LogDir1, @@ -986,6 +1019,7 @@ get_data_for_node(#testspec{label = Labels, config = Cfgs, userconfig = UsrCfgs, event_handler = EvHs, + ct_hooks = CTHooks, include = Incl, multiply_timetraps = MTs, scale_timetraps = STs}, Node) -> @@ -1000,12 +1034,14 @@ get_data_for_node(#testspec{label = Labels, ConfigFiles = [{?ct_config_txt,F} || {N,F} <- Cfgs, N==Node] ++ [CBF || {N,CBF} <- UsrCfgs, N==Node], EvHandlers = [{H,A} || {N,H,A} <- EvHs, N==Node], + FiltCTHooks = [Hook || {N,Hook} <- CTHooks, N==Node], Include = [I || {N,I} <- Incl, N==Node], #opts{label = Label, logdir = LogDir, cover = Cover, config = ConfigFiles, event_handlers = EvHandlers, + ct_hooks = FiltCTHooks, include = Include, multiply_timetraps = MT, scale_timetraps = ST}. @@ -1036,15 +1072,7 @@ refresh_logs(LogDir) -> which(logdir, undefined) -> "."; which(logdir, Dir) -> - Dir; -which(multiply_timetraps, undefined) -> - 1; -which(multiply_timetraps, MT) -> - MT; -which(scale_timetraps, undefined) -> - false; -which(scale_timetraps, ST) -> - ST. + Dir. choose_val(undefined, V1) -> V1; @@ -2032,12 +2060,37 @@ get_start_opt(Key, IfExists, IfNotExists, Args) -> Val; {value,{Key,_Val}} -> IfExists; - _ when is_function(IfNotExists) -> - IfNotExists(); _ -> IfNotExists end. +ct_hooks_args2opts(Args) -> + ct_hooks_args2opts( + proplists:get_value(ct_hooks, Args, []),[]). + +ct_hooks_args2opts([CTH,Arg,"and"| Rest],Acc) -> + ct_hooks_args2opts(Rest,[{list_to_atom(CTH), + parse_cth_args(Arg)}|Acc]); +ct_hooks_args2opts([CTH], Acc) -> + ct_hooks_args2opts([CTH,"and"],Acc); +ct_hooks_args2opts([CTH, "and" | Rest], Acc) -> + ct_hooks_args2opts(Rest,[list_to_atom(CTH)|Acc]); +ct_hooks_args2opts([CTH, Args], Acc) -> + ct_hooks_args2opts([CTH, Args, "and"],Acc); +ct_hooks_args2opts([],Acc) -> + lists:reverse(Acc). + +parse_cth_args(String) -> + try + true = io_lib:printable_list(String), + {ok,Toks,_} = erl_scan:string(String++"."), + {ok, Args} = erl_parse:parse_term(Toks), + Args + catch _:_ -> + String + end. + + event_handler_args2opts(Args) -> case proplists:get_value(event_handler, Args) of undefined -> @@ -2165,6 +2218,22 @@ opts2args(EnvStartOpts) -> end, EHs), [_LastAnd|StrsR] = lists:reverse(lists:flatten(Strs)), [{event_handler_init,lists:reverse(StrsR)}]; + ({ct_hooks,[]}) -> + []; + ({ct_hooks,CTHs}) when is_list(CTHs) -> + io:format(user,"ct_hooks: ~p",[CTHs]), + Strs = lists:flatmap( + fun({CTH,Arg}) -> + [atom_to_list(CTH), + lists:flatten( + io_lib:format("~p",[Arg])), + "and"]; + (CTH) when is_atom(CTH) -> + [atom_to_list(CTH),"and"] + end,CTHs), + [_LastAnd|StrsR] = lists:reverse(Strs), + io:format(user,"return: ~p",[lists:reverse(StrsR)]), + [{ct_hooks,lists:reverse(StrsR)}]; ({Opt,As=[A|_]}) when is_atom(A) -> [{Opt,[atom_to_list(Atom) || Atom <- As]}]; ({Opt,Strs=[S|_]}) when is_list(S) -> @@ -2263,12 +2332,19 @@ do_trace(Terms) -> dbg:tracer(), dbg:p(self(), [sos,call]), lists:foreach(fun({m,M}) -> - case dbg:tpl(M,[{'_',[],[{return_trace}]}]) of + case dbg:tpl(M,x) of + {error,What} -> exit({error,{tracing_failed,What}}); + _ -> ok + end; + ({me,M}) -> + case dbg:tp(M,[{'_',[],[{exception_trace}, + {message,{caller}}]}]) of {error,What} -> exit({error,{tracing_failed,What}}); _ -> ok end; ({f,M,F}) -> - case dbg:tpl(M,F,[{'_',[],[{return_trace}]}]) of + case dbg:tpl(M,F,[{'_',[],[{exception_trace}, + {message,{caller}}]}]) of {error,What} -> exit({error,{tracing_failed,What}}); _ -> ok end; diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl index f5069427a2..2b6abefb72 100644 --- a/lib/common_test/src/ct_testspec.erl +++ b/lib/common_test/src/ct_testspec.erl @@ -394,8 +394,6 @@ filter_init_terms([Term|Ts], NewTerms, Spec)-> filter_init_terms([], NewTerms, Spec)-> {lists:reverse(NewTerms), Spec}. -add_option([], _, List, _)-> - List; add_option({Key, Value}, Node, List, WarnIfExists) when is_list(Value)-> OldOptions = case lists:keyfind(Node, 1, List) of {Node, Options}-> @@ -625,6 +623,20 @@ add_tests([{event_handler,Node,H,Args}|Ts],Spec) when is_atom(H) -> Node1 = ref2node(Node,Spec#testspec.nodes), add_tests(Ts,Spec#testspec{event_handler=[{Node1,H,Args}|EvHs]}); +%% --- ct_hooks -- +add_tests([{ct_hooks, all_nodes, Hooks} | Ts], Spec) -> + Tests = [{ct_hooks,N,Hooks} || N <- list_nodes(Spec)], + add_tests(Tests ++ Ts, Spec); +add_tests([{ct_hooks, Node, [Hook|Hooks]}|Ts], Spec) -> + SuiteCbs = Spec#testspec.ct_hooks, + Node1 = ref2node(Node,Spec#testspec.nodes), + add_tests([{ct_hooks, Node, Hooks} | Ts], + Spec#testspec{ct_hooks = [{Node1,Hook} | SuiteCbs]}); +add_tests([{ct_hooks, _Node, []}|Ts], Spec) -> + add_tests(Ts, Spec); +add_tests([{ct_hooks, Hooks}|Ts], Spec) -> + add_tests([{ct_hooks, all_nodes, Hooks}|Ts], Spec); + %% --- include --- add_tests([{include,all_nodes,InclDirs}|Ts],Spec) -> Tests = lists:map(fun(N) -> {include,N,InclDirs} end, list_nodes(Spec)), @@ -1051,6 +1063,8 @@ valid_terms() -> {event_handler,2}, {event_handler,3}, {event_handler,4}, + {ct_hooks,2}, + {ct_hooks,3}, {multiply_timetraps,2}, {multiply_timetraps,3}, {scale_timetraps,2}, diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl index b5ab4cbb6e..0476e1599f 100644 --- a/lib/common_test/src/ct_util.erl +++ b/lib/common_test/src/ct_util.erl @@ -32,7 +32,9 @@ -export([close_connections/0]). --export([save_suite_data/3, save_suite_data/2, read_suite_data/1, +-export([save_suite_data/3, save_suite_data/2, + save_suite_data_async/3, save_suite_data_async/2, + read_suite_data/1, delete_suite_data/0, delete_suite_data/1, match_delete_suite_data/1, delete_testdata/0, delete_testdata/1, set_testdata/1, get_testdata/1, update_testdata/2]). @@ -159,6 +161,17 @@ do_start(Parent,Mode,LogDir) -> ok end, {StartTime,TestLogDir} = ct_logs:init(Mode), + + %% Initiate ct_hooks + case catch ct_hooks:init(Opts) of + ok -> + ok; + {_,CTHReason} -> + ct_logs:tc_print('Suite Callback',CTHReason,[]), + Parent ! {self(), CTHReason}, + self() ! {{stop,normal},{self(),make_ref()}} + end, + ct_event:notify(#event{name=test_start, node=node(), data={StartTime, @@ -182,12 +195,19 @@ read_opts() -> {error,{bad_installation,Error}} end. + save_suite_data(Key, Value) -> call({save_suite_data, {Key, undefined, Value}}). save_suite_data(Key, Name, Value) -> call({save_suite_data, {Key, Name, Value}}). +save_suite_data_async(Key, Value) -> + save_suite_data_async(Key, undefined, Value). + +save_suite_data_async(Key, Name, Value) -> + cast({save_suite_data, {Key, Name, Value}}). + read_suite_data(Key) -> call({read_suite_data, Key}). @@ -268,6 +288,9 @@ loop(Mode,TestData,StartDir) -> TestData1 = lists:keydelete(Key,1,TestData), return(From,ok), loop(Mode,[New|TestData1],StartDir); + {{get_testdata, all}, From} -> + return(From, TestData), + loop(From, TestData, StartDir); {{get_testdata,Key},From} -> case lists:keysearch(Key,1,TestData) of {value,{Key,Val}} -> @@ -299,6 +322,10 @@ loop(Mode,TestData,StartDir) -> ct_event:sync_notify(#event{name=test_done, node=node(), data=Time}), + Callbacks = ets:lookup_element(?suite_table, + ct_hooks, + #suite_data.value), + ct_hooks:terminate(Callbacks), close_connections(ets:tab2list(?conn_table)), ets:delete(?conn_table), ets:delete(?board_table), @@ -308,6 +335,9 @@ loop(Mode,TestData,StartDir) -> ct_config:stop(), file:set_cwd(StartDir), return(From,ok); + {Ref, _Msg} when is_reference(Ref) -> + %% This clause is used when doing cast operations. + loop(Mode,TestData,StartDir); {get_mode,From} -> return(From,Mode), loop(Mode,TestData,StartDir); @@ -713,6 +743,9 @@ call(Msg) -> return({To,Ref},Result) -> To ! {Ref, Result}. +cast(Msg) -> + ct_util_server ! {Msg, {ct_util_server, make_ref()}}. + seconds(T) -> test_server:seconds(T). diff --git a/lib/common_test/src/ct_util.hrl b/lib/common_test/src/ct_util.hrl index ee973f6220..4ed29bdcd1 100644 --- a/lib/common_test/src/ct_util.hrl +++ b/lib/common_test/src/ct_util.hrl @@ -36,6 +36,7 @@ config=[], userconfig=[], event_handler=[], + ct_hooks=[], include=[], multiply_timetraps=[], scale_timetraps=[], diff --git a/lib/common_test/test/Makefile b/lib/common_test/test/Makefile index f2fe3390cf..be4b4c32b8 100644 --- a/lib/common_test/test/Makefile +++ b/lib/common_test/test/Makefile @@ -40,7 +40,8 @@ MODULES= \ ct_test_server_if_1_SUITE \ ct_config_SUITE \ ct_master_SUITE \ - ct_misc_1_SUITE + ct_misc_1_SUITE \ + ct_hooks_SUITE ERL_FILES= $(MODULES:%=%.erl) diff --git a/lib/common_test/test/common_test.spec b/lib/common_test/test/common_test.spec index 7619a75b31..8755b08117 100644 --- a/lib/common_test/test/common_test.spec +++ b/lib/common_test/test/common_test.spec @@ -1 +1 @@ -{topcase, {dir, "../common_test"}}. +{suites,"../common_test_test",all}.
\ No newline at end of file diff --git a/lib/common_test/test/ct_config_SUITE.erl b/lib/common_test/test/ct_config_SUITE.erl index fc15abc5bc..2ddc7d6422 100644 --- a/lib/common_test/test/ct_config_SUITE.erl +++ b/lib/common_test/test/ct_config_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -64,19 +64,22 @@ end_per_testcase(install_config = TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - [""]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [require, install_config, userconfig_static, + userconfig_dynamic, testspec_legacy, testspec_static, + testspec_dynamic]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [ - require, - install_config, - userconfig_static, - userconfig_dynamic, - testspec_legacy, - testspec_static, - testspec_dynamic - ]. %%-------------------------------------------------------------------- %% TEST CASES @@ -199,74 +202,74 @@ events_to_check(Test, N) -> expected_events(Test) ++ events_to_check(Test, N-1). expected_events(config_static_SUITE)-> -[ - {?eh,start_logging,{'DEF','RUNDIR'}}, - {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, - {?eh,start_info,{1,1,8}}, - {?eh,tc_start,{config_static_SUITE,init_per_suite}}, - {?eh,tc_done,{config_static_SUITE,init_per_suite,ok}}, - {?eh,tc_start,{config_static_SUITE,test_get_config_simple}}, - {?eh,tc_done,{config_static_SUITE,test_get_config_simple,ok}}, - {?eh,test_stats,{1,0,{0,0}}}, - {?eh,tc_start,{config_static_SUITE,test_get_config_nested}}, - {?eh,tc_done,{config_static_SUITE,test_get_config_nested,ok}}, - {?eh,test_stats,{2,0,{0,0}}}, - {?eh,tc_start,{config_static_SUITE,test_default_suitewide}}, - {?eh,tc_done,{config_static_SUITE,test_default_suitewide,ok}}, - {?eh,test_stats,{3,0,{0,0}}}, - {?eh,tc_start,{config_static_SUITE,test_config_name_already_in_use1}}, - {?eh,tc_done, - {config_static_SUITE,test_config_name_already_in_use1,{skipped,{config_name_already_in_use,[x1]}}}}, - {?eh,test_stats,{3,0,{1,0}}}, - {?eh,tc_start,{config_static_SUITE,test_default_tclocal}}, - {?eh,tc_done,{config_static_SUITE,test_default_tclocal,ok}}, - {?eh,test_stats,{4,0,{1,0}}}, - {?eh,tc_start,{config_static_SUITE,test_config_name_already_in_use2}}, - {?eh,tc_done, - {config_static_SUITE,test_config_name_already_in_use2, - {skipped,{config_name_already_in_use,[x1,alias]}}}}, - {?eh,test_stats,{4,0,{2,0}}}, - {?eh,tc_start,{config_static_SUITE,test_alias_tclocal}}, - {?eh,tc_done,{config_static_SUITE,test_alias_tclocal,ok}}, - {?eh,test_stats,{5,0,{2,0}}}, - {?eh,tc_start,{config_static_SUITE,test_get_config_undefined}}, - {?eh,tc_done,{config_static_SUITE,test_get_config_undefined,ok}}, - {?eh,test_stats,{6,0,{2,0}}}, - {?eh,tc_start,{config_static_SUITE,end_per_suite}}, - {?eh,tc_done,{config_static_SUITE,end_per_suite,ok}}, - {?eh,test_done,{'DEF','STOP_TIME'}}, - {?eh,stop_logging,[]} -]; + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,8}}, + {?eh,tc_start,{config_static_SUITE,init_per_suite}}, + {?eh,tc_done,{config_static_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{config_static_SUITE,test_get_config_simple}}, + {?eh,tc_done,{config_static_SUITE,test_get_config_simple,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + {?eh,tc_start,{config_static_SUITE,test_get_config_nested}}, + {?eh,tc_done,{config_static_SUITE,test_get_config_nested,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{config_static_SUITE,test_default_suitewide}}, + {?eh,tc_done,{config_static_SUITE,test_default_suitewide,ok}}, + {?eh,test_stats,{3,0,{0,0}}}, + {?eh,tc_start,{config_static_SUITE,test_config_name_already_in_use1}}, + {?eh,tc_done, + {config_static_SUITE,test_config_name_already_in_use1,{skipped,{config_name_already_in_use,[x1]}}}}, + {?eh,test_stats,{3,0,{1,0}}}, + {?eh,tc_start,{config_static_SUITE,test_default_tclocal}}, + {?eh,tc_done,{config_static_SUITE,test_default_tclocal,ok}}, + {?eh,test_stats,{4,0,{1,0}}}, + {?eh,tc_start,{config_static_SUITE,test_config_name_already_in_use2}}, + {?eh,tc_done, + {config_static_SUITE,test_config_name_already_in_use2, + {skipped,{config_name_already_in_use,[x1,alias]}}}}, + {?eh,test_stats,{4,0,{2,0}}}, + {?eh,tc_start,{config_static_SUITE,test_alias_tclocal}}, + {?eh,tc_done,{config_static_SUITE,test_alias_tclocal,ok}}, + {?eh,test_stats,{5,0,{2,0}}}, + {?eh,tc_start,{config_static_SUITE,test_get_config_undefined}}, + {?eh,tc_done,{config_static_SUITE,test_get_config_undefined,ok}}, + {?eh,test_stats,{6,0,{2,0}}}, + {?eh,tc_start,{config_static_SUITE,end_per_suite}}, + {?eh,tc_done,{config_static_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; expected_events(config_dynamic_SUITE)-> -[ - {?eh,start_logging,{'DEF','RUNDIR'}}, - {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, - {?eh,start_info,{1,1,5}}, - {?eh,tc_start,{config_dynamic_SUITE,init_per_suite}}, - {?eh,tc_done,{config_dynamic_SUITE,init_per_suite,ok}}, - {?eh,tc_start,{config_dynamic_SUITE,test_get_known_variable}}, - {?eh,tc_done, - {config_dynamic_SUITE,test_get_known_variable,ok}}, - {?eh,test_stats,{1,0,{0,0}}}, - {?eh,tc_start,{config_dynamic_SUITE,test_localtime_update}}, - {?eh,tc_done,{config_dynamic_SUITE,test_localtime_update,ok}}, - {?eh,test_stats,{2,0,{0,0}}}, - {?eh,tc_start,{config_dynamic_SUITE,test_server_pid}}, - {?eh,tc_done,{config_dynamic_SUITE,test_server_pid,ok}}, - {?eh,test_stats,{3,0,{0,0}}}, - {?eh,tc_start, - {config_dynamic_SUITE,test_disappearable_variable}}, - {?eh,tc_done, - {config_dynamic_SUITE,test_disappearable_variable,ok}}, - {?eh,test_stats,{4,0,{0,0}}}, - {?eh,tc_start, - {config_dynamic_SUITE,test_disappearable_variable_alias}}, - {?eh,tc_done, - {config_dynamic_SUITE,test_disappearable_variable_alias,ok}}, - {?eh,test_stats,{5,0,{0,0}}}, - {?eh,tc_start,{config_dynamic_SUITE,end_per_suite}}, - {?eh,tc_done,{config_dynamic_SUITE,end_per_suite,ok}}, - {?eh,test_done,{'DEF','STOP_TIME'}}, - {?eh,stop_logging,[]} -]. + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,5}}, + {?eh,tc_start,{config_dynamic_SUITE,init_per_suite}}, + {?eh,tc_done,{config_dynamic_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{config_dynamic_SUITE,test_get_known_variable}}, + {?eh,tc_done, + {config_dynamic_SUITE,test_get_known_variable,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + {?eh,tc_start,{config_dynamic_SUITE,test_localtime_update}}, + {?eh,tc_done,{config_dynamic_SUITE,test_localtime_update,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{config_dynamic_SUITE,test_server_pid}}, + {?eh,tc_done,{config_dynamic_SUITE,test_server_pid,ok}}, + {?eh,test_stats,{3,0,{0,0}}}, + {?eh,tc_start, + {config_dynamic_SUITE,test_disappearable_variable}}, + {?eh,tc_done, + {config_dynamic_SUITE,test_disappearable_variable,ok}}, + {?eh,test_stats,{4,0,{0,0}}}, + {?eh,tc_start, + {config_dynamic_SUITE,test_disappearable_variable_alias}}, + {?eh,tc_done, + {config_dynamic_SUITE,test_disappearable_variable_alias,ok}}, + {?eh,test_stats,{5,0,{0,0}}}, + {?eh,tc_start,{config_dynamic_SUITE,end_per_suite}}, + {?eh,tc_done,{config_dynamic_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]. diff --git a/lib/common_test/test/ct_error_SUITE.erl b/lib/common_test/test/ct_error_SUITE.erl index 2fa031b884..17faf5ee3f 100644 --- a/lib/common_test/test/ct_error_SUITE.erl +++ b/lib/common_test/test/ct_error_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -56,19 +56,22 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - [""]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [cfg_error, lib_error, no_compile, timetrap_end_conf, + timetrap_normal, timetrap_extended]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -all(suite) -> - [ - cfg_error, - lib_error, - no_compile, - timetrap_end_conf, - timetrap_normal, - timetrap_extended - ]. - %%-------------------------------------------------------------------- %% TEST CASES @@ -122,7 +125,7 @@ lib_error(Config) when is_list(Config) -> TestEvents = events_to_check(lib_error), ok = ct_test_support:verify_events(TestEvents, Events, Config). - + %%%----------------------------------------------------------------- %%% @@ -140,7 +143,7 @@ no_compile(Config) when is_list(Config) -> TestEvents = events_to_check(no_compile), ok = ct_test_support:verify_events(TestEvents, Events, Config). - + %%%----------------------------------------------------------------- %%% timetrap_end_conf(Config) when is_list(Config) -> @@ -214,8 +217,8 @@ setup(Test, Config) -> reformat(Events, EH) -> ct_test_support:reformat(Events, EH). -%reformat(Events, _EH) -> -% Events. + %reformat(Events, _EH) -> + % Events. %%%----------------------------------------------------------------- %%% TEST EVENTS @@ -248,7 +251,7 @@ test_events(cfg_error) -> {?eh,test_stats,{0,0,{0,2}}}, {?eh,tc_auto_skip, {cfg_error_1_SUITE,end_per_suite,{failed,{cfg_error_1_SUITE,init_per_suite, - {'EXIT',init_per_suite_fails}}}}}, + {'EXIT',init_per_suite_fails}}}}}, {?eh,tc_start,{cfg_error_2_SUITE,init_per_suite}}, {?eh,tc_done, @@ -378,12 +381,12 @@ test_events(cfg_error) -> {?eh,tc_auto_skip, {cfg_error_8_SUITE,tc1, {failed,{cfg_error_8_SUITE,init_per_group, - {'EXIT',{init_per_group_fails,g1}}}}}}, + {'EXIT',{init_per_group_fails,g1}}}}}}, {?eh,test_stats,{4,0,{0,11}}}, {?eh,tc_auto_skip, {cfg_error_8_SUITE,end_per_group, {failed,{cfg_error_8_SUITE,init_per_group, - {'EXIT',{init_per_group_fails,g1}}}}}}], + {'EXIT',{init_per_group_fails,g1}}}}}}], [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g2,[]}}}, {?eh,tc_done,{cfg_error_8_SUITE, @@ -396,7 +399,7 @@ test_events(cfg_error) -> {?eh,tc_auto_skip,{cfg_error_8_SUITE,end_per_group, {failed,{cfg_error_8_SUITE,init_per_group, {timetrap_timeout,2000}}}}}], - + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g3,[]}}}, {?eh,tc_done, {cfg_error_8_SUITE,{init_per_group,g3,[]}, @@ -436,7 +439,7 @@ test_events(cfg_error) -> {?eh,test_stats,{5,0,{0,13}}}, {?eh,tc_start,{cfg_error_8_SUITE,{end_per_group,g4,[]}}}, {?eh,tc_done,{cfg_error_8_SUITE,{end_per_group,g4,[]},ok}}], - + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g5,[]}}}, {?eh,tc_done,{cfg_error_8_SUITE,{init_per_group,g5,[]},ok}}, {?eh,tc_start,{cfg_error_8_SUITE,tc1}}, diff --git a/lib/common_test/test/ct_event_handler_SUITE.erl b/lib/common_test/test/ct_event_handler_SUITE.erl index 00a4c4ded3..b27770881d 100644 --- a/lib/common_test/test/ct_event_handler_SUITE.erl +++ b/lib/common_test/test/ct_event_handler_SUITE.erl @@ -28,7 +28,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). %-include_lib("common_test/include/ct_event.hrl"). @@ -56,12 +56,21 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - []; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> +all() -> [start_stop, results]. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% TEST CASES diff --git a/lib/common_test/test/ct_groups_test_1_SUITE.erl b/lib/common_test/test/ct_groups_test_1_SUITE.erl index 64d61fc104..3712bc0e33 100644 --- a/lib/common_test/test/ct_groups_test_1_SUITE.erl +++ b/lib/common_test/test/ct_groups_test_1_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -56,12 +56,21 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - ["Run smoke tests of Common Test."]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [groups_suite_1, groups_suite_2, groups_suites_1, + groups_dir_1, groups_dirs_1]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [groups_suite_1, groups_suite_2, - groups_suites_1, groups_dir_1, groups_dirs_1]. %%-------------------------------------------------------------------- %% TEST CASES diff --git a/lib/common_test/test/ct_groups_test_2_SUITE.erl b/lib/common_test/test/ct_groups_test_2_SUITE.erl index c4371501b3..32e8d0c6d7 100644 --- a/lib/common_test/test/ct_groups_test_2_SUITE.erl +++ b/lib/common_test/test/ct_groups_test_2_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -56,12 +56,21 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - ["Run smoke tests of Common Test."]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> +all() -> [missing_conf, repeat_1]. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% TEST CASES %%-------------------------------------------------------------------- diff --git a/lib/common_test/test/ct_hooks_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE.erl new file mode 100644 index 0000000000..1e187aa205 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE.erl @@ -0,0 +1,1021 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-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% +%% + +%%%------------------------------------------------------------------- +%%% File: ct_error_SUITE +%%% +%%% Description: +%%% Test various errors in Common Test suites. +%%% +%%% The suites used for the test are located in the data directory. +%%%------------------------------------------------------------------- +-module(ct_hooks_SUITE). + +-compile(export_all). + +-include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +-define(eh, ct_test_support_eh). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Description: Since Common Test starts another Test Server +%% instance, the tests need to be performed on a separate node (or +%% there will be clashes with logging processes etc). +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + DataDir = ?config(data_dir, Config), + TestDir = filename:join(DataDir,"cth/tests/"), + CTHs = filelib:wildcard(filename:join(TestDir,"*_cth.erl")), + io:format("CTHs: ~p",[CTHs]), + [io:format("Compiling ~p: ~p", + [FileName,compile:file(FileName,[{outdir,TestDir},debug_info])]) || + FileName <- CTHs], + ct_test_support:init_per_suite([{path_dirs,[TestDir]} | Config]). + +end_per_suite(Config) -> + ct_test_support:end_per_suite(Config). + +init_per_testcase(TestCase, Config) -> + ct_test_support:init_per_testcase(TestCase, Config). + +end_per_testcase(TestCase, Config) -> + ct_test_support:end_per_testcase(TestCase, Config). + + +suite() -> + [{timetrap,{seconds,20}}]. + +all() -> + all(suite). + +all(suite) -> + lists:reverse( + [ + one_cth, two_cth, faulty_cth_no_init, faulty_cth_id_no_init, + faulty_cth_exit_in_init, faulty_cth_exit_in_id, + faulty_cth_exit_in_init_scope_suite, minimal_cth, + minimal_and_maximal_cth, faulty_cth_undef, + scope_per_suite_cth, scope_per_group_cth, scope_suite_cth, + scope_per_suite_state_cth, scope_per_group_state_cth, + scope_suite_state_cth, + fail_pre_suite_cth, fail_post_suite_cth, skip_pre_suite_cth, + skip_post_suite_cth, recover_post_suite_cth, update_config_cth, + state_update_cth, options_cth, same_id_cth, + fail_n_skip_with_minimal_cth + ] + ) + . + + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% +one_cth(Config) when is_list(Config) -> + do_test(one_empty_cth, "ct_cth_empty_SUITE.erl",[empty_cth], Config). + +two_cth(Config) when is_list(Config) -> + do_test(two_empty_cth, "ct_cth_empty_SUITE.erl",[empty_cth,empty_cth], + Config). + +faulty_cth_no_init(Config) when is_list(Config) -> + do_test(faulty_cth_no_init, "ct_cth_empty_SUITE.erl",[askjhdkljashdkaj], + Config,{error,"Failed to start CTH, see the " + "CT Log for details"}). + +faulty_cth_id_no_init(Config) when is_list(Config) -> + do_test(faulty_cth_id_no_init, "ct_cth_empty_SUITE.erl",[id_no_init_cth], + Config,{error,"Failed to start CTH, see the " + "CT Log for details"}). + +minimal_cth(Config) when is_list(Config) -> + do_test(minimal_cth, "ct_cth_empty_SUITE.erl",[minimal_cth],Config). + +minimal_and_maximal_cth(Config) when is_list(Config) -> + do_test(minimal_and_maximal_cth, "ct_cth_empty_SUITE.erl", + [minimal_cth, empty_cth],Config). + +faulty_cth_undef(Config) when is_list(Config) -> + do_test(faulty_cth_undef, "ct_cth_empty_SUITE.erl", + [undef_cth],Config). + +faulty_cth_exit_in_init_scope_suite(Config) when is_list(Config) -> + do_test(faulty_cth_exit_in_init_scope_suite, + "ct_exit_in_init_scope_suite_cth_SUITE.erl", + [],Config). + +faulty_cth_exit_in_init(Config) when is_list(Config) -> + do_test(faulty_cth_exit_in_init, "ct_cth_empty_SUITE.erl", + [crash_init_cth], Config, + {error,"Failed to start CTH, see the " + "CT Log for details"}). + +faulty_cth_exit_in_id(Config) when is_list(Config) -> + do_test(faulty_cth_exit_in_id, "ct_cth_empty_SUITE.erl", + [crash_id_cth], Config, + {error,"Failed to start CTH, see the " + "CT Log for details"}). + +scope_per_suite_cth(Config) when is_list(Config) -> + do_test(scope_per_suite_cth, "ct_scope_per_suite_cth_SUITE.erl", + [],Config). + +scope_suite_cth(Config) when is_list(Config) -> + do_test(scope_suite_cth, "ct_scope_suite_cth_SUITE.erl", + [],Config). + +scope_per_group_cth(Config) when is_list(Config) -> + do_test(scope_per_group_cth, "ct_scope_per_group_cth_SUITE.erl", + [],Config). + +scope_per_suite_state_cth(Config) when is_list(Config) -> + do_test(scope_per_suite_state_cth, "ct_scope_per_suite_state_cth_SUITE.erl", + [],Config). + +scope_suite_state_cth(Config) when is_list(Config) -> + do_test(scope_suite_state_cth, "ct_scope_suite_state_cth_SUITE.erl", + [],Config). + +scope_per_group_state_cth(Config) when is_list(Config) -> + do_test(scope_per_group_state_cth, "ct_scope_per_group_state_cth_SUITE.erl", + [],Config). + +fail_pre_suite_cth(Config) when is_list(Config) -> + do_test(fail_pre_suite_cth, "ct_cth_empty_SUITE.erl", + [fail_pre_suite_cth],Config). + +fail_post_suite_cth(Config) when is_list(Config) -> + do_test(fail_post_suite_cth, "ct_cth_empty_SUITE.erl", + [fail_post_suite_cth],Config). + +skip_pre_suite_cth(Config) when is_list(Config) -> + do_test(skip_pre_suite_cth, "ct_cth_empty_SUITE.erl", + [skip_pre_suite_cth],Config). + +skip_post_suite_cth(Config) when is_list(Config) -> + do_test(skip_post_suite_cth, "ct_cth_empty_SUITE.erl", + [skip_post_suite_cth],Config). + +recover_post_suite_cth(Config) when is_list(Config) -> + do_test(recover_post_suite_cth, "ct_cth_fail_per_suite_SUITE.erl", + [recover_post_suite_cth],Config). + +update_config_cth(Config) when is_list(Config) -> + do_test(update_config_cth, "ct_update_config_SUITE.erl", + [update_config_cth],Config). + +state_update_cth(Config) when is_list(Config) -> + do_test(state_update_cth, "ct_cth_fail_one_skip_one_SUITE.erl", + [state_update_cth,state_update_cth],Config). + +options_cth(Config) when is_list(Config) -> + do_test(options_cth, "ct_cth_empty_SUITE.erl", + [{empty_cth,[test]}],Config). + +same_id_cth(Config) when is_list(Config) -> + do_test(same_id_cth, "ct_cth_empty_SUITE.erl", + [same_id_cth,same_id_cth],Config). + +fail_n_skip_with_minimal_cth(Config) when is_list(Config) -> + do_test(fail_n_skip_with_minimal_cth, "ct_cth_fail_one_skip_one_SUITE.erl", + [minimal_terminate_cth],Config). + +%%%----------------------------------------------------------------- +%%% HELP FUNCTIONS +%%%----------------------------------------------------------------- + +do_test(Tag, SWC, CTHs, Config) -> + do_test(Tag, SWC, CTHs, Config, ok). +do_test(Tag, SWC, CTHs, Config, {error,_} = Res) -> + do_test(Tag, SWC, CTHs, Config, Res, 1); +do_test(Tag, SWC, CTHs, Config, Res) -> + do_test(Tag, SWC, CTHs, Config, Res, 2). + +do_test(Tag, SuiteWildCard, CTHs, Config, Res, EC) -> + + DataDir = ?config(data_dir, Config), + Suites = filelib:wildcard( + filename:join([DataDir,"cth/tests",SuiteWildCard])), + {Opts,ERPid} = setup([{suite,Suites}, + {ct_hooks,CTHs},{label,Tag}], Config), + Res = ct_test_support:run(Opts, Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(Tag, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = events_to_check(Tag, EC), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +setup(Test, Config) -> + Opts0 = ct_test_support:get_opts(Config), + Level = ?config(trace_level, Config), + EvHArgs = [{cbm,ct_test_support},{trace_level,Level}], + Opts = Opts0 ++ [{event_handler,{?eh,EvHArgs}}|Test], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). +%reformat(Events, _EH) -> +% Events. + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- +events_to_check(Test) -> + %% 2 tests (ct:run_test + script_start) is default + events_to_check(Test, 2). + +events_to_check(_, 0) -> + []; +events_to_check(Test, N) -> + test_events(Test) ++ events_to_check(Test, N-1). + +test_events(one_empty_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{empty_cth,id,[[]]}}, + {?eh,cth,{empty_cth,init,[{'_','_','_'},[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,cth,{empty_cth,pre_init_per_suite, + [ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{empty_cth,post_init_per_suite, + [ct_cth_empty_SUITE,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,test_case}}, + {?eh,cth,{empty_cth,pre_init_per_testcase,[test_case,'$proplist',[]]}}, + {?eh,cth,{empty_cth,post_end_per_testcase,[test_case,'$proplist','_',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}}, + {?eh,cth,{empty_cth,pre_end_per_suite, + [ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{empty_cth,post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{empty_cth,terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(two_empty_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',id,[[]]}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,cth,{'_',id,[[]]}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}}, + {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}}, + {?eh,cth,{'_',post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(faulty_cth_no_init) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(faulty_cth_id_no_init) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',id,[[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {negative,{?eh,tc_start,'_'}, + {?eh,test_done,{'DEF','STOP_TIME'}}}, + {?eh,stop_logging,[]} + ]; + +test_events(minimal_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {negative,{?eh,cth,{'_',id,['_',[]]}}, + {?eh,cth,{'_',init,['_',[]]}}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,test_case}}, + {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}}, + {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(minimal_and_maximal_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {negative,{?eh,cth,{'_',id,['_',[]]}}, + {?eh,cth,{'_',init,['_',[]]}}}, + {?eh,cth,{'_',id,[[]]}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}}, + {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(faulty_cth_undef) -> + FailReasonStr = "undef_cth:pre_init_per_suite/3 CTH call failed", + FailReason = {ct_cth_empty_SUITE,init_per_suite, + {failed,FailReasonStr}}, + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite, + {failed, {error,FailReasonStr}}}}, + {?eh,cth,{'_',on_tc_fail,'_'}}, + + {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case, + {failed, FailReason}}}, + {?eh,cth,{'_',on_tc_skip,'_'}}, + + {?eh,tc_auto_skip,{ct_cth_empty_SUITE,end_per_suite, + {failed, FailReason}}}, + {?eh,cth,{'_',on_tc_skip,'_'}}, + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(faulty_cth_exit_in_init_scope_suite) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{'_',init_per_suite}}, + {?eh,cth,{empty_cth,init,['_',[]]}}, + {?eh,tc_done, + {ct_exit_in_init_scope_suite_cth_SUITE,init_per_suite, + {failed, + {error, + "Failed to start CTH, see the CT Log for details"}}}}, + {?eh,tc_auto_skip, + {ct_exit_in_init_scope_suite_cth_SUITE,test_case, + {failed, + {ct_exit_in_init_scope_suite_cth_SUITE,init_per_suite, + {failed, + "Failed to start CTH, see the CT Log for details"}}}}}, + {?eh,tc_auto_skip, + {ct_exit_in_init_scope_suite_cth_SUITE,end_per_suite, + {failed, + {ct_exit_in_init_scope_suite_cth_SUITE,init_per_suite, + {failed, + "Failed to start CTH, see the CT Log for details"}}}}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]}]; + +test_events(faulty_cth_exit_in_init) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{empty_cth,init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]}]; + +test_events(faulty_cth_exit_in_id) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{empty_cth,id,[[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {negative, {?eh,tc_start,'_'}, + {?eh,test_done,{'DEF','STOP_TIME'}}}, + {?eh,stop_logging,[]}]; + +test_events(scope_per_suite_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_scope_per_suite_cth_SUITE,init_per_suite}}, + {?eh,cth,{'_',id,[[]]}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_scope_per_suite_cth_SUITE,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_scope_per_suite_cth_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_scope_per_suite_cth_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_scope_per_suite_cth_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_scope_per_suite_cth_SUITE,end_per_suite}}, + {?eh,cth,{'_',pre_end_per_suite, + [ct_scope_per_suite_cth_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_suite,[ct_scope_per_suite_cth_SUITE,'$proplist','_',[]]}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,tc_done,{ct_scope_per_suite_cth_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(scope_suite_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_scope_suite_cth_SUITE,init_per_suite}}, + {?eh,cth,{'_',id,[[]]}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_scope_suite_cth_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_scope_suite_cth_SUITE,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_scope_suite_cth_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_scope_suite_cth_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_scope_suite_cth_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_scope_suite_cth_SUITE,end_per_suite}}, + {?eh,cth,{'_',pre_end_per_suite,[ct_scope_suite_cth_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_suite,[ct_scope_suite_cth_SUITE,'$proplist','_',[]]}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,tc_done,{ct_scope_suite_cth_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(scope_per_group_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_scope_per_group_cth_SUITE,init_per_suite}}, + {?eh,tc_done,{ct_scope_per_group_cth_SUITE,init_per_suite,ok}}, + + [{?eh,tc_start,{ct_scope_per_group_cth_SUITE,{init_per_group,group1,[]}}}, + {?eh,cth,{'_',id,[[]]}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,cth,{'_',post_init_per_group,[group1,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_scope_per_group_cth_SUITE,{init_per_group,group1,[]},ok}}, + + {?eh,tc_start,{ct_scope_per_group_cth_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_scope_per_group_cth_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_scope_per_group_cth_SUITE,{end_per_group,group1,[]}}}, + {?eh,cth,{'_',pre_end_per_group,[group1,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_group,[group1,'$proplist','_',[]]}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,tc_done,{ct_scope_per_group_cth_SUITE,{end_per_group,group1,[]},ok}}], + + {?eh,tc_start,{ct_scope_per_group_cth_SUITE,end_per_suite}}, + {?eh,tc_done,{ct_scope_per_group_cth_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(scope_per_suite_state_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_scope_per_suite_state_cth_SUITE,init_per_suite}}, + {?eh,cth,{'_',id,[[test]]}}, + {?eh,cth,{'_',init,['_',[test]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_scope_per_suite_state_cth_SUITE,'$proplist','$proplist',[test]]}}, + {?eh,tc_done,{ct_scope_per_suite_state_cth_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_scope_per_suite_state_cth_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[test]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[test]]}}, + {?eh,tc_done,{ct_scope_per_suite_state_cth_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_scope_per_suite_state_cth_SUITE,end_per_suite}}, + {?eh,cth,{'_',pre_end_per_suite, + [ct_scope_per_suite_state_cth_SUITE,'$proplist',[test]]}}, + {?eh,cth,{'_',post_end_per_suite,[ct_scope_per_suite_state_cth_SUITE,'$proplist','_',[test]]}}, + {?eh,cth,{'_',terminate,[[test]]}}, + {?eh,tc_done,{ct_scope_per_suite_state_cth_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(scope_suite_state_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_scope_suite_state_cth_SUITE,init_per_suite}}, + {?eh,cth,{'_',id,[[test]]}}, + {?eh,cth,{'_',init,['_',[test]]}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_scope_suite_state_cth_SUITE,'$proplist',[test]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_scope_suite_state_cth_SUITE,'$proplist','$proplist',[test]]}}, + {?eh,tc_done,{ct_scope_suite_state_cth_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_scope_suite_state_cth_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[test]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[test]]}}, + {?eh,tc_done,{ct_scope_suite_state_cth_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_scope_suite_state_cth_SUITE,end_per_suite}}, + {?eh,cth,{'_',pre_end_per_suite,[ct_scope_suite_state_cth_SUITE,'$proplist',[test]]}}, + {?eh,cth,{'_',post_end_per_suite,[ct_scope_suite_state_cth_SUITE,'$proplist','_',[test]]}}, + {?eh,cth,{'_',terminate,[[test]]}}, + {?eh,tc_done,{ct_scope_suite_state_cth_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(scope_per_group_state_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,init_per_suite}}, + {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,init_per_suite,ok}}, + + [{?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,{init_per_group,group1,[]}}}, + {?eh,cth,{'_',id,[[test]]}}, + {?eh,cth,{'_',init,['_',[test]]}}, + {?eh,cth,{'_',post_init_per_group,[group1,'$proplist','$proplist',[test]]}}, + {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,{init_per_group,group1,[]},ok}}, + + {?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[test]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[test]]}}, + {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,{end_per_group,group1,[]}}}, + {?eh,cth,{'_',pre_end_per_group,[group1,'$proplist',[test]]}}, + {?eh,cth,{'_',post_end_per_group,[group1,'$proplist','_',[test]]}}, + {?eh,cth,{'_',terminate,[[test]]}}, + {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,{end_per_group,group1,[]},ok}}], + + {?eh,tc_start,{ct_scope_per_group_state_cth_SUITE,end_per_suite}}, + {?eh,tc_done,{ct_scope_per_group_state_cth_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(fail_pre_suite_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + + + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist', + {fail,"Test failure"},[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite, + {failed, {error,"Test failure"}}}}, + {?eh,cth,{'_',on_tc_fail, + [init_per_suite,{failed,"Test failure"},[]]}}, + + + {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case, + {failed,{ct_cth_empty_SUITE,init_per_suite, + {failed,"Test failure"}}}}}, + {?eh,cth,{'_',on_tc_skip, + [test_case, {tc_auto_skip, + {failed, {ct_cth_empty_SUITE, init_per_suite, + {failed, "Test failure"}}}},[]]}}, + + + {?eh,tc_auto_skip, {ct_cth_empty_SUITE, end_per_suite, + {failed, {ct_cth_empty_SUITE, init_per_suite, + {failed, "Test failure"}}}}}, + {?eh,cth,{'_',on_tc_skip, + [end_per_suite, {tc_auto_skip, + {failed, {ct_cth_empty_SUITE, init_per_suite, + {failed, "Test failure"}}}},[]]}}, + + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth, {'_',terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(fail_post_suite_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite, + {failed,{error,"Test failure"}}}}, + {?eh,cth,{'_',on_tc_fail,[init_per_suite, {failed,"Test failure"}, []]}}, + + {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case, + {failed,{ct_cth_empty_SUITE,init_per_suite, + {failed,"Test failure"}}}}}, + {?eh,cth,{'_',on_tc_skip,[test_case,{tc_auto_skip,'_'},[]]}}, + + {?eh,tc_auto_skip, {ct_cth_empty_SUITE, end_per_suite, + {failed, {ct_cth_empty_SUITE, init_per_suite, + {failed, "Test failure"}}}}}, + {?eh,cth,{'_',on_tc_skip,[end_per_suite,{tc_auto_skip,'_'},[]]}}, + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth, {'_',terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(skip_pre_suite_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist',{skip,"Test skip"},[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,{skipped,"Test skip"}}}, + {?eh,cth,{'_',on_tc_skip, + [init_per_suite,{tc_user_skip,{skipped,"Test skip"}},[]]}}, + + {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case,"Test skip"}}, + {?eh,cth,{'_',on_tc_skip,[test_case,{tc_auto_skip,"Test skip"},[]]}}, + + {?eh,tc_auto_skip, {ct_cth_empty_SUITE, end_per_suite,"Test skip"}}, + {?eh,cth,{'_',on_tc_skip,[end_per_suite,{tc_auto_skip,"Test skip"},[]]}}, + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth, {'_',terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(skip_post_suite_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_init_per_suite,[ct_cth_empty_SUITE,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,{skipped,"Test skip"}}}, + {?eh,cth,{'_',on_tc_skip, + [init_per_suite,{tc_user_skip,{skipped,"Test skip"}},[]]}}, + + {?eh,tc_auto_skip,{ct_cth_empty_SUITE,test_case,"Test skip"}}, + {?eh,cth,{'_',on_tc_skip,[test_case,{tc_auto_skip,"Test skip"},[]]}}, + + {?eh,tc_auto_skip, {ct_cth_empty_SUITE, end_per_suite,"Test skip"}}, + {?eh,cth,{'_',on_tc_skip,[end_per_suite,{tc_auto_skip,"Test skip"},[]]}}, + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(recover_post_suite_cth) -> + Suite = ct_cth_fail_per_suite_SUITE, + [ + {?eh,start_logging,'_'}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{Suite,init_per_suite}}, + {?eh,cth,{'_',pre_init_per_suite,[Suite,'$proplist','$proplist']}}, + {?eh,cth,{'_',post_init_per_suite,[Suite,contains([tc_status]), + {'EXIT',{'_','_'}},[]]}}, + {?eh,tc_done,{Suite,init_per_suite,ok}}, + + {?eh,tc_start,{Suite,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase, + [test_case, not_contains([tc_status]),[]]}}, + {?eh,cth,{'_',post_end_per_testcase, + [test_case, contains([tc_status]),'_',[]]}}, + {?eh,tc_done,{Suite,test_case,ok}}, + + {?eh,tc_start,{Suite,end_per_suite}}, + {?eh,cth,{'_',pre_end_per_suite, + [Suite,not_contains([tc_status]),[]]}}, + {?eh,cth,{'_',post_end_per_suite, + [Suite,not_contains([tc_status]),'_',[]]}}, + {?eh,tc_done,{Suite,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(update_config_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + + {?eh,tc_start,{ct_update_config_SUITE,init_per_suite}}, + {?eh,cth,{'_',pre_init_per_suite, + [ct_update_config_SUITE,contains([]),[]]}}, + {?eh,cth,{'_',post_init_per_suite, + [ct_update_config_SUITE, + '$proplist', + contains( + [init_per_suite, + pre_init_per_suite]), + []]}}, + {?eh,tc_done,{ct_update_config_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_update_config_SUITE, {init_per_group,group1,[]}}}, + {?eh,cth,{'_',pre_init_per_group, + [group1,contains( + [post_init_per_suite, + init_per_suite, + pre_init_per_suite]), + []]}}, + {?eh,cth,{'_',post_init_per_group, + [group1, + contains( + [post_init_per_suite, + init_per_suite, + pre_init_per_suite]), + contains( + [init_per_group, + pre_init_per_group, + post_init_per_suite, + init_per_suite, + pre_init_per_suite]), + []]}}, + {?eh,tc_done,{ct_update_config_SUITE,{init_per_group,group1,[]},ok}}, + + {?eh,tc_start,{ct_update_config_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase, + [test_case,contains( + [post_init_per_group, + init_per_group, + pre_init_per_group, + post_init_per_suite, + init_per_suite, + pre_init_per_suite]), + []]}}, + {?eh,cth,{'_',post_end_per_testcase, + [test_case,contains( + [init_per_testcase, + pre_init_per_testcase, + post_init_per_group, + init_per_group, + pre_init_per_group, + post_init_per_suite, + init_per_suite, + pre_init_per_suite]), + ok,[]]}}, + {?eh,tc_done,{ct_update_config_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_update_config_SUITE, {end_per_group,group1,[]}}}, + {?eh,cth,{'_',pre_end_per_group, + [group1,contains( + [post_init_per_group, + init_per_group, + pre_init_per_group, + post_init_per_suite, + init_per_suite, + pre_init_per_suite]), + []]}}, + {?eh,cth,{'_',post_end_per_group, + [group1, + contains( + [pre_end_per_group, + post_init_per_group, + init_per_group, + pre_init_per_group, + post_init_per_suite, + init_per_suite, + pre_init_per_suite]), + ok,[]]}}, + {?eh,tc_done,{ct_update_config_SUITE,{end_per_group,group1,[]},ok}}, + + {?eh,tc_start,{ct_update_config_SUITE,end_per_suite}}, + {?eh,cth,{'_',pre_end_per_suite, + [ct_update_config_SUITE,contains( + [post_init_per_suite, + init_per_suite, + pre_init_per_suite]), + []]}}, + {?eh,cth,{'_',post_end_per_suite, + [ct_update_config_SUITE,contains( + [pre_end_per_suite, + post_init_per_suite, + init_per_suite, + pre_init_per_suite]), + '_',[]]}}, + {?eh,tc_done,{ct_update_config_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{'_',terminate,[contains( + [post_end_per_suite, + pre_end_per_suite, + post_init_per_suite, + init_per_suite, + pre_init_per_suite])]}}, + {?eh,stop_logging,[]} + ]; + +test_events(state_update_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{'_',init_per_suite}}, + + {?eh,tc_done,{'_',end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{'_',terminate,[contains( + [post_end_per_suite,pre_end_per_suite, + post_end_per_group,pre_end_per_group, + {not_in_order, + [post_end_per_testcase,pre_init_per_testcase, + on_tc_skip,post_end_per_testcase, + pre_init_per_testcase,on_tc_fail, + post_end_per_testcase,pre_init_per_testcase] + }, + post_init_per_group,pre_init_per_group, + post_init_per_suite,pre_init_per_suite, + init])]}}, + {?eh,cth,{'_',terminate,[contains( + [post_end_per_suite,pre_end_per_suite, + post_end_per_group,pre_end_per_group, + {not_in_order, + [post_end_per_testcase,pre_init_per_testcase, + on_tc_skip,post_end_per_testcase, + pre_init_per_testcase,on_tc_fail, + post_end_per_testcase,pre_init_per_testcase] + }, + post_init_per_group,pre_init_per_group, + post_init_per_suite,pre_init_per_suite, + init] + )]}}, + {?eh,stop_logging,[]} + ]; + +test_events(options_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{empty_cth,init,['_',[test]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,cth,{empty_cth,pre_init_per_suite, + [ct_cth_empty_SUITE,'$proplist',[test]]}}, + {?eh,cth,{empty_cth,post_init_per_suite, + [ct_cth_empty_SUITE,'$proplist','$proplist',[test]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,test_case}}, + {?eh,cth,{empty_cth,pre_init_per_testcase,[test_case,'$proplist',[test]]}}, + {?eh,cth,{empty_cth,post_end_per_testcase,[test_case,'$proplist','_',[test]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}}, + {?eh,cth,{empty_cth,pre_end_per_suite, + [ct_cth_empty_SUITE,'$proplist',[test]]}}, + {?eh,cth,{empty_cth,post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[test]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{empty_cth,terminate,[[test]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(same_id_cth) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',id,[[]]}}, + {?eh,cth,{'_',init,[same_id_cth,[]]}}, + {?eh,cth,{'_',id,[[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}}, + {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {negative, + {?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_init_per_suite, + [ct_cth_empty_SUITE,'$proplist','$proplist',[]]}}}, + {negative, + {?eh,cth,{'_',post_init_per_suite, + [ct_cth_empty_SUITE,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,init_per_suite,ok}}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,test_case}}, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}}, + {negative, + {?eh,cth,{'_',pre_init_per_testcase,[test_case,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}}, + {negative, + {?eh,cth,{'_',post_end_per_testcase,[test_case,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,test_case,ok}}}, + + {?eh,tc_start,{ct_cth_empty_SUITE,end_per_suite}}, + {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {negative, + {?eh,cth,{'_',pre_end_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}}, + {?eh,cth,{'_',post_end_per_suite,[ct_cth_empty_SUITE,'$proplist','_',[]]}}}, + {negative, + {?eh,cth,{'_',post_end_per_suite, + [ct_cth_empty_SUITE,'$proplist','_',[]]}}, + {?eh,tc_done,{ct_cth_empty_SUITE,end_per_suite,ok}}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(fail_n_skip_with_minimal_cth) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,cth,{'_',init,['_',[]]}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,tc_start,{'_',init_per_suite}}, + + {?eh,tc_done,{'_',end_per_suite,ok}}, + {?eh,cth,{'_',terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + +test_events(ok) -> + ok. + + +%% test events help functions +contains(List) -> + fun(Proplist) when is_list(Proplist) -> + contains(List,Proplist) + end. + +contains([{not_in_order,List}|T],Rest) -> + contains_parallel(List,Rest), + contains(T,Rest); +contains([{Ele,Pos}|T] = L,[H|T2]) -> + case element(Pos,H) of + Ele -> + contains(T,T2); + _ -> + contains(L,T2) + end; +contains([Ele|T],[{Ele,_}|T2])-> + contains(T,T2); +contains([Ele|T],[Ele|T2])-> + contains(T,T2); +contains(List,[_|T]) -> + contains(List,T); +contains([],_) -> + match. + +contains_parallel([Key | T], Elems) -> + contains([Key],Elems), + contains_parallel(T,Elems); +contains_parallel([],_Elems) -> + match. + +not_contains(List) -> + fun(Proplist) when is_list(Proplist) -> + [] = [Ele || {Ele,_} <- Proplist, + Test <- List, + Test =:= Ele] + end. diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_id_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_id_cth.erl new file mode 100644 index 0000000000..02c36e378c --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_id_cth.erl @@ -0,0 +1,34 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(crash_id_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-export([id/1]).
+
+id(Opts) ->
+ empty_cth:id(Opts),
+ exit(diediedie).
+
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl new file mode 100644 index 0000000000..6ed23565f6 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl @@ -0,0 +1,34 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(crash_init_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-export([init/2]).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts),
+ exit(diediedie).
+
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl new file mode 100644 index 0000000000..499069b382 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl @@ -0,0 +1,47 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_cth_empty_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+all() ->
+ [test_case].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_one_skip_one_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_one_skip_one_SUITE.erl new file mode 100644 index 0000000000..017812c719 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_one_skip_one_SUITE.erl @@ -0,0 +1,64 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_cth_fail_one_skip_one_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_group(_Group,Config) ->
+ Config.
+
+end_per_group(_Group,_Config) ->
+ ok.
+
+init_per_testcase(test_case2, Config) ->
+ {skip,"skip it"};
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+groups() ->
+ [{group1,[parallel],[{group2,[parallel],[test_case1,test_case2,test_case3]}]}].
+
+all() ->
+ [{group,group1}].
+
+%% Test cases starts here.
+test_case1(Config) ->
+ ok = nok.
+
+test_case2(Config) ->
+ ok.
+
+test_case3(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_per_suite_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_per_suite_SUITE.erl new file mode 100644 index 0000000000..136a15ec96 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_fail_per_suite_SUITE.erl @@ -0,0 +1,47 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_cth_fail_per_suite_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+init_per_suite(Config) ->
+ ok = nok.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+all() ->
+ [test_case].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_exit_in_init_scope_suite_cth_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_exit_in_init_scope_suite_cth_SUITE.erl new file mode 100644 index 0000000000..42be0a659e --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_exit_in_init_scope_suite_cth_SUITE.erl @@ -0,0 +1,50 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_exit_in_init_scope_suite_cth_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include_lib("common_test/include/ct.hrl").
+
+%% Test server callback functions
+suite() ->
+ [{ct_hooks,[crash_init_cth]}].
+
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+all() ->
+ [test_case].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_cth_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_cth_SUITE.erl new file mode 100644 index 0000000000..628bca774c --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_cth_SUITE.erl @@ -0,0 +1,56 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_scope_per_group_cth_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+init_per_group(GroupName, Config) ->
+ [{ct_hooks,[empty_cth]}|Config].
+
+end_per_group(GroupName, Config) ->
+ ok.
+
+all() ->
+ [{group,group1}].
+
+groups() ->
+ [{group1,[],[test_case]}].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_state_cth_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_state_cth_SUITE.erl new file mode 100644 index 0000000000..14ea52bf8c --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_group_state_cth_SUITE.erl @@ -0,0 +1,56 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_scope_per_group_state_cth_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+init_per_group(_GroupName, Config) ->
+ [{ct_hooks,[{empty_cth,[test]}]}|Config].
+
+end_per_group(_GroupName, _Config) ->
+ ok.
+
+all() ->
+ [{group,group1}].
+
+groups() ->
+ [{group1,[],[test_case]}].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_cth_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_cth_SUITE.erl new file mode 100644 index 0000000000..5c1658be44 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_cth_SUITE.erl @@ -0,0 +1,47 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_scope_per_suite_cth_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+init_per_suite(Config) ->
+ [{ct_hooks,[empty_cth]}|Config].
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+all() ->
+ [test_case].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_state_cth_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_state_cth_SUITE.erl new file mode 100644 index 0000000000..96d00e3b28 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_suite_state_cth_SUITE.erl @@ -0,0 +1,47 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_scope_per_suite_state_cth_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+init_per_suite(Config) ->
+ [{ct_hooks,[{empty_cth,[test]}]}|Config].
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+all() ->
+ [test_case].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_tc_cth_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_tc_cth_SUITE.erl new file mode 100644 index 0000000000..fa632444c5 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_per_tc_cth_SUITE.erl @@ -0,0 +1,110 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_scope_per_tc_cth_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+%%--------------------------------------------------------------------
+%% @doc
+%% Config - [tuple()]
+%% A list of key/value pairs, holding the test case configuration.
+%%
+%% Initiation before the whole suite
+%%
+%% Note: This function is free to add any key/value pairs to the Config
+%% variable, but should NOT alter/remove any existing entries.
+%%
+%% @spec init_per_suite(Config) -> Config
+%% @end
+%%--------------------------------------------------------------------
+init_per_suite(Config) ->
+ Config.
+
+%%--------------------------------------------------------------------
+%% @doc
+%% Config - [tuple()]
+%% A list of key/value pairs, holding the test case configuration.
+%%
+%% Cleanup after the whole suite
+%%
+%% @spec end_per_suite(Config) -> _
+%% @end
+%%--------------------------------------------------------------------
+end_per_suite(_Config) ->
+ ok.
+
+%%--------------------------------------------------------------------
+%% @doc
+%% Case - atom()
+%% Name of the test case that is about to be run.
+%% Config - [tuple()]
+%% A list of key/value pairs, holding the test case configuration.
+%%
+%% Initiation before each test case
+%%
+%% Note: This function is free to add any key/value pairs to the Config
+%% variable, but should NOT alter/remove any existing entries.
+%% Initiation before each test case
+%%
+%% @spec init_per_testcase(TestCase, Config) -> Config
+%% @end
+%%--------------------------------------------------------------------
+init_per_testcase(_TestCase, Config) ->
+ [{ct_hooks,[empty_cth]}|Config].
+
+%%--------------------------------------------------------------------
+%% @doc
+%% Case - atom()
+%% Name of the test case that is about to be run.
+%% Config - [tuple()]
+%% A list of key/value pairs, holding the test case configuration.
+%%
+%% Cleanup after each test case
+%%
+%% @spec end_per_testcase(TestCase, Config) -> _
+%% @end
+%%--------------------------------------------------------------------
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+%%--------------------------------------------------------------------
+%% @doc
+%% TestCases - [Case]
+%% Case - atom()
+%% Name of a test case.
+%%
+%% Returns a list of all test cases in this test suite
+%%
+%% @spec all() -> TestCases
+%% @end
+%%--------------------------------------------------------------------
+all() ->
+ [test_case].
+
+%% Test cases starts here.
+%%--------------------------------------------------------------------
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_cth_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_cth_SUITE.erl new file mode 100644 index 0000000000..988a0969ca --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_cth_SUITE.erl @@ -0,0 +1,50 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_scope_suite_cth_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+suite() ->
+ [{ct_hooks,[empty_cth]}].
+
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+all() ->
+ [test_case].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_state_cth_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_state_cth_SUITE.erl new file mode 100644 index 0000000000..18b68fbcdc --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_scope_suite_state_cth_SUITE.erl @@ -0,0 +1,50 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_scope_suite_state_cth_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+suite() ->
+ [{ct_hooks,[{empty_cth,[test]}]}].
+
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+all() ->
+ [test_case].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl new file mode 100644 index 0000000000..57fea347f6 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_update_config_SUITE.erl @@ -0,0 +1,56 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(ct_update_config_SUITE).
+
+-suite_defaults([{timetrap, {minutes, 10}}]).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%% Test server callback functions
+init_per_suite(Config) ->
+ [{init_per_suite,now()}|Config].
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ [{init_per_testcase,now()}|Config].
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+init_per_group(GroupName, Config) ->
+ [{init_per_group,now()}|Config].
+
+end_per_group(GroupName, Config) ->
+ ok.
+
+all() ->
+ [{group,group1}].
+
+groups() ->
+ [{group1,[],[test_case]}].
+
+%% Test cases starts here.
+test_case(Config) when is_list(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl new file mode 100644 index 0000000000..5d07cd3dea --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl @@ -0,0 +1,278 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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%
+%%
+
+%%% @doc Common Test Example Suite Callback module.
+%%%
+%%% <p>This module gives an example of a common test CTH (Common Test Hook).
+%%% There are many ways to add a CTH to a test run, you can do it either in
+%%% the command line using -ct_hook, in a test spec using
+%%% {ct_hook,M} or in the suite it self by returning ct_hook
+%%% from either suite/0, init_per_suite/1, init_per_group/2 and
+%%% init_per_testcase/2. The scope of the CTH is determined by where is it
+%%% started. If it is started in the command line or test spec then it will
+%%% be stopped at the end of all tests. If it is started in init_per_suite,
+%%% it will be stopped after end_per_suite and so on. See terminate
+%%% documentation for a table describing the scoping machanics.
+%%%
+%%% All of callbacks except init/1 in a CTH are optional.</p>
+
+-module(empty_cth).
+
+%% CT Hooks
+-export([id/1]).
+-export([init/2]).
+
+-export([pre_init_per_suite/3]).
+-export([post_init_per_suite/4]).
+-export([pre_end_per_suite/3]).
+-export([post_end_per_suite/4]).
+
+-export([pre_init_per_group/3]).
+-export([post_init_per_group/4]).
+-export([pre_end_per_group/3]).
+-export([post_end_per_group/4]).
+
+-export([pre_init_per_testcase/3]).
+-export([post_end_per_testcase/4]).
+
+-export([on_tc_fail/3]).
+-export([on_tc_skip/3]).
+
+-export([terminate/1]).
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+-type proplist() :: list({atom(),term()}).
+-type config() :: proplist().
+-type reason() :: term().
+-type skip_or_fail() :: {skip, reason()} |
+ {auto_skip, reason()} |
+ {fail, reason()} |
+ {'EXIT',reason()}.
+
+-record(state, { id = ?MODULE :: term()}).
+
+%% @doc Always called before any other callback function. Use this to initiate
+%% any common state. It should return an state for this CTH.
+-spec init(Id :: term(), Opts :: proplist()) ->
+ State :: #state{}.
+init(Id, Opts) ->
+ gen_event:notify(?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, init, [Id, Opts]}}),
+ Opts.
+
+%% @doc The ID is used to uniquly identify an CTH instance, if two CTH's
+%% return the same ID the seconds CTH is ignored. This function should NOT
+%% have any side effects as it might be called multiple times by common test.
+-spec id(Opts :: proplist()) ->
+ Id :: term().
+id(Opts) ->
+ gen_event:notify(?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, id, [Opts]}}),
+ now().
+
+%% @doc Called before init_per_suite is called. Note that this callback is
+%% only called if the CTH is added before init_per_suite is run (eg. in a test
+%% specification, suite/0 function etc).
+%% You can change the config in the this function.
+-spec pre_init_per_suite(Suite :: atom(),
+ Config :: config(),
+ State :: #state{}) ->
+ {config() | skip_or_fail(), NewState :: #state{}}.
+pre_init_per_suite(Suite,Config,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, pre_init_per_suite,
+ [Suite,Config,State]}}),
+ {Config, State}.
+
+%% @doc Called after init_per_suite.
+%% you can change the return value in this function.
+-spec post_init_per_suite(Suite :: atom(),
+ Config :: config(),
+ Return :: config() | skip_or_fail(),
+ State :: #state{}) ->
+ {config() | skip_or_fail(), NewState :: #state{}}.
+post_init_per_suite(Suite,Config,Return,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, post_init_per_suite,
+ [Suite,Config,Return,State]}}),
+ {Return, State}.
+
+%% @doc Called before end_per_suite. The config/state can be changed here,
+%% though it will only affect the *end_per_suite function.
+-spec pre_end_per_suite(Suite :: atom(),
+ Config :: config() | skip_or_fail(),
+ State :: #state{}) ->
+ {ok | skip_or_fail(), NewState :: #state{}}.
+pre_end_per_suite(Suite,Config,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, pre_end_per_suite,
+ [Suite,Config,State]}}),
+ {Config, State}.
+
+%% @doc Called after end_per_suite. Note that the config cannot be
+%% changed here, only the status of the suite.
+-spec post_end_per_suite(Suite :: atom(),
+ Config :: config(),
+ Return :: term(),
+ State :: #state{}) ->
+ {ok | skip_or_fail(), NewState :: #state{}}.
+post_end_per_suite(Suite,Config,Return,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, post_end_per_suite,
+ [Suite,Config,Return,State]}}),
+ {Return, State}.
+
+%% @doc Called before each init_per_group.
+%% You can change the config in this function.
+-spec pre_init_per_group(Group :: atom(),
+ Config :: config(),
+ State :: #state{}) ->
+ {config() | skip_or_fail(), NewState :: #state{}}.
+pre_init_per_group(Group,Config,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, pre_init_per_group,
+ [Group,Config,State]}}),
+ {Config, State}.
+
+%% @doc Called after each init_per_group.
+%% You can change the return value in this function.
+-spec post_init_per_group(Group :: atom(),
+ Config :: config(),
+ Return :: config() | skip_or_fail(),
+ State :: #state{}) ->
+ {config() | skip_or_fail(), NewState :: #state{}}.
+post_init_per_group(Group,Config,Return,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, post_init_per_group,
+ [Group,Config,Return,State]}}),
+ {Return, State}.
+
+%% @doc Called after each end_per_group. The config/state can be changed here,
+%% though it will only affect the *end_per_group functions.
+-spec pre_end_per_group(Group :: atom(),
+ Config :: config() | skip_or_fail(),
+ State :: #state{}) ->
+ {ok | skip_or_fail(), NewState :: #state{}}.
+pre_end_per_group(Group,Config,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, pre_end_per_group,
+ [Group,Config,State]}}),
+ {Config, State}.
+
+%% @doc Called after each end_per_group. Note that the config cannot be
+%% changed here, only the status of the group.
+-spec post_end_per_group(Group :: atom(),
+ Config :: config(),
+ Return :: term(),
+ State :: #state{}) ->
+ {ok | skip_or_fail(), NewState :: #state{}}.
+post_end_per_group(Group,Config,Return,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, post_end_per_group,
+ [Group,Config,Return,State]}}),
+ {Return, State}.
+
+%% @doc Called before each test case.
+%% You can change the config in this function.
+-spec pre_init_per_testcase(TC :: atom(),
+ Config :: config(),
+ State :: #state{}) ->
+ {config() | skip_or_fail(), NewState :: #state{}}.
+pre_init_per_testcase(TC,Config,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, pre_init_per_testcase,
+ [TC,Config,State]}}),
+ {Config, State}.
+
+%% @doc Called after each test case. Note that the config cannot be
+%% changed here, only the status of the test case.
+-spec post_end_per_testcase(TC :: atom(),
+ Config :: config(),
+ Return :: term(),
+ State :: #state{}) ->
+ {ok | skip_or_fail(), NewState :: #state{}}.
+post_end_per_testcase(TC,Config,Return,State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, post_end_per_testcase,
+ [TC,Config,Return,State]}}),
+ {Return, State}.
+
+%% @doc Called after post_init_per_suite, post_end_per_suite, post_init_per_group,
+%% post_end_per_group and post_end_per_tc if the suite, group or test case failed.
+%% This function should be used for extra cleanup which might be needed.
+%% It is not possible to modify the config or the status of the test run.
+-spec on_tc_fail(TC :: init_per_suite | end_per_suite |
+ init_per_group | end_per_group | atom(),
+ Reason :: term(), State :: #state{}) ->
+ NewState :: #state{}.
+on_tc_fail(TC, Reason, State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, on_tc_fail,
+ [TC,Reason,State]}}),
+ State.
+
+%% @doc Called when a test case is skipped by either user action
+%% or due to an init function failing. Test case can be
+%% end_per_suite, init_per_group, end_per_group and the actual test cases.
+-spec on_tc_skip(TC :: end_per_suite |
+ init_per_group | end_per_group | atom(),
+ {tc_auto_skip, {failed, {Mod :: atom(), Function :: atom(), Reason :: term()}}} |
+ {tc_user_skip, {skipped, Reason :: term()}},
+ State :: #state{}) ->
+ NewState :: #state{}.
+on_tc_skip(TC, Reason, State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, on_tc_skip,
+ [TC,Reason,State]}}),
+ State.
+
+%% @doc Called when the scope of the CTH is done, this depends on
+%% when the CTH was specified. This translation table describes when this
+%% function is called.
+%%
+%% | Started in | terminate called |
+%% |---------------------|-------------------------|
+%% | command_line | after all tests are run |
+%% | test spec | after all tests are run |
+%% | suite/0 | after SUITE is done |
+%% | init_per_suite/1 | after SUITE is done |
+%% | init_per_group/2 | after group is done |
+%% |-----------------------------------------------|
+%%
+-spec terminate(State :: #state{}) ->
+ term().
+terminate(State) ->
+ gen_event:notify(
+ ?CT_EVMGR_REF, #event{ name = cth, node = node(),
+ data = {?MODULE, terminate, [State]}}),
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_post_suite_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_post_suite_cth.erl new file mode 100644 index 0000000000..b4c26259a6 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_post_suite_cth.erl @@ -0,0 +1,72 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(fail_post_suite_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-compile(export_all).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
+pre_init_per_suite(Suite, Config, State) ->
+ empty_cth:pre_init_per_suite(Suite,Config,State).
+
+post_init_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
+ {{fail, "Test failure"}, State}.
+
+pre_end_per_suite(Suite,Config,State) ->
+ empty_cth:pre_end_per_suite(Suite,Config,State).
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
+
+pre_init_per_group(Group,Config,State) ->
+ empty_cth:pre_init_per_group(Group,Config,State).
+
+post_init_per_group(Group,Config,Return,State) ->
+ empty_cth:post_init_per_group(Group,Config,Return,State).
+
+pre_end_per_group(Group,Config,State) ->
+ empty_cth:pre_end_per_group(Group,Config,State).
+
+post_end_per_group(Group,Config,Return,State) ->
+ empty_cth:post_end_per_group(Group,Config,Return,State).
+
+pre_init_per_testcase(TC,Config,State) ->
+ empty_cth:pre_init_per_testcase(TC,Config,State).
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State).
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State).
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl new file mode 100644 index 0000000000..acf80a1b2e --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl @@ -0,0 +1,72 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(fail_pre_suite_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-compile(export_all).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
+pre_init_per_suite(Suite, Config, State) ->
+ empty_cth:pre_init_per_suite(Suite,Config,State),
+ {{fail, "Test failure"}, State}.
+
+post_init_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
+
+pre_end_per_suite(Suite,Config,State) ->
+ empty_cth:pre_end_per_suite(Suite,Config,State).
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
+
+pre_init_per_group(Group,Config,State) ->
+ empty_cth:pre_init_per_group(Group,Config,State).
+
+post_init_per_group(Group,Config,Return,State) ->
+ empty_cth:post_init_per_group(Group,Config,Return,State).
+
+pre_end_per_group(Group,Config,State) ->
+ empty_cth:pre_end_per_group(Group,Config,State).
+
+post_end_per_group(Group,Config,Return,State) ->
+ empty_cth:post_end_per_group(Group,Config,Return,State).
+
+pre_init_per_testcase(TC,Config,State) ->
+ empty_cth:pre_init_per_testcase(TC,Config,State).
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State).
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State).
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/id_no_init_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/id_no_init_cth.erl new file mode 100644 index 0000000000..58ed400e1c --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/id_no_init_cth.erl @@ -0,0 +1,32 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(id_no_init_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-export([id/1]).
+
+id(Opts) ->
+ empty_cth:id(Opts).
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl new file mode 100644 index 0000000000..a18f4bf2f3 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl @@ -0,0 +1,33 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(minimal_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-export([init/2]).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl new file mode 100644 index 0000000000..79cd55f68e --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl @@ -0,0 +1,38 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(minimal_terminate_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-export([init/2]).
+-export([terminate/1]).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
+terminate(State) ->
+ empty_cth:terminate(State).
+
+
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl new file mode 100644 index 0000000000..01a932bd59 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl @@ -0,0 +1,74 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(recover_post_suite_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-compile(export_all).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
+pre_init_per_suite(Suite, Config, State) ->
+ empty_cth:pre_init_per_suite(Suite,Config,State).
+
+post_init_per_suite(Suite,Config,{'EXIT',Reason} = Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
+ {lists:keydelete(tc_status,1,Config),State};
+post_init_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
+
+pre_end_per_suite(Suite,Config,State) ->
+ empty_cth:pre_end_per_suite(Suite,Config,State).
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
+
+pre_init_per_group(Group,Config,State) ->
+ empty_cth:pre_init_per_group(Group,Config,State).
+
+post_init_per_group(Group,Config,Return,State) ->
+ empty_cth:post_init_per_group(Group,Config,Return,State).
+
+pre_end_per_group(Group,Config,State) ->
+ empty_cth:pre_end_per_group(Group,Config,State).
+
+post_end_per_group(Group,Config,Return,State) ->
+ empty_cth:post_end_per_group(Group,Config,Return,State).
+
+pre_init_per_testcase(TC,Config,State) ->
+ empty_cth:pre_init_per_testcase(TC,Config,State).
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State).
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State).
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl new file mode 100644 index 0000000000..acfb93fe26 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl @@ -0,0 +1,75 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(same_id_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-compile(export_all).
+
+id(Opts) ->
+ empty_cth:id(Opts),
+ ?MODULE.
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
+pre_init_per_suite(Suite, Config, State) ->
+ empty_cth:pre_init_per_suite(Suite,Config,State).
+
+post_init_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
+
+pre_end_per_suite(Suite,Config,State) ->
+ empty_cth:pre_end_per_suite(Suite,Config,State).
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
+
+pre_init_per_group(Group,Config,State) ->
+ empty_cth:pre_init_per_group(Group,Config,State).
+
+post_init_per_group(Group,Config,Return,State) ->
+ empty_cth:post_init_per_group(Group,Config,Return,State).
+
+pre_end_per_group(Group,Config,State) ->
+ empty_cth:pre_end_per_group(Group,Config,State).
+
+post_end_per_group(Group,Config,Return,State) ->
+ empty_cth:post_end_per_group(Group,Config,Return,State).
+
+pre_init_per_testcase(TC,Config,State) ->
+ empty_cth:pre_init_per_testcase(TC,Config,State).
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State).
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State).
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl new file mode 100644 index 0000000000..6d4605b33b --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl @@ -0,0 +1,72 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(skip_post_suite_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-compile(export_all).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
+pre_init_per_suite(Suite, Config, State) ->
+ empty_cth:pre_init_per_suite(Suite,Config,State).
+
+post_init_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
+ {{skip, "Test skip"}, State}.
+
+pre_end_per_suite(Suite,Config,State) ->
+ empty_cth:pre_end_per_suite(Suite,Config,State).
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
+
+pre_init_per_group(Group,Config,State) ->
+ empty_cth:pre_init_per_group(Group,Config,State).
+
+post_init_per_group(Group,Config,Return,State) ->
+ empty_cth:post_init_per_group(Group,Config,Return,State).
+
+pre_end_per_group(Group,Config,State) ->
+ empty_cth:pre_end_per_group(Group,Config,State).
+
+post_end_per_group(Group,Config,Return,State) ->
+ empty_cth:post_end_per_group(Group,Config,Return,State).
+
+pre_init_per_testcase(TC,Config,State) ->
+ empty_cth:pre_init_per_testcase(TC,Config,State).
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State).
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State).
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl new file mode 100644 index 0000000000..49efd0d0cd --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl @@ -0,0 +1,73 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(skip_pre_suite_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-compile(export_all).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
+
+pre_init_per_suite(Suite, Config, State) ->
+ empty_cth:pre_init_per_suite(Suite,Config,State),
+ {{skip, "Test skip"}, State}.
+
+post_init_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
+
+pre_end_per_suite(Suite,Config,State) ->
+ empty_cth:pre_end_per_suite(Suite,Config,State).
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
+
+pre_init_per_group(Group,Config,State) ->
+ empty_cth:pre_init_per_group(Group,Config,State).
+
+post_init_per_group(Group,Config,Return,State) ->
+ empty_cth:post_init_per_group(Group,Config,Return,State).
+
+pre_end_per_group(Group,Config,State) ->
+ empty_cth:pre_end_per_group(Group,Config,State).
+
+post_end_per_group(Group,Config,Return,State) ->
+ empty_cth:post_end_per_group(Group,Config,Return,State).
+
+pre_init_per_testcase(TC,Config,State) ->
+ empty_cth:pre_init_per_testcase(TC,Config,State).
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State).
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State).
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl new file mode 100644 index 0000000000..53d75e6ce3 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl @@ -0,0 +1,83 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(state_update_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+%% CT Hooks
+-compile(export_all).
+
+init(Id, Opts) ->
+ State = empty_cth:init(Id, Opts),
+ [init|State].
+
+pre_init_per_suite(Suite, Config, State) ->
+ empty_cth:pre_init_per_suite(Suite,Config,State),
+ {Config, [pre_init_per_suite|State]}.
+
+post_init_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
+ {Config, [post_init_per_suite|State]}.
+
+pre_end_per_suite(Suite,Config,State) ->
+ empty_cth:pre_end_per_suite(Suite,Config,State),
+ {Config, [pre_end_per_suite|State]}.
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_end_per_suite(Suite,Config,Return,State),
+ {Return, [post_end_per_suite|State]}.
+
+pre_init_per_group(Group,Config,State) ->
+ empty_cth:pre_init_per_group(Group,Config,State),
+ {Config, [pre_init_per_group|State]}.
+
+post_init_per_group(Group,Config,Return,State) ->
+ empty_cth:post_init_per_group(Group,Config,Return,State),
+ {Return, [post_init_per_group|State]}.
+
+pre_end_per_group(Group,Config,State) ->
+ empty_cth:pre_end_per_group(Group,Config,State),
+ {Config, [pre_end_per_group|State]}.
+
+post_end_per_group(Group,Config,Return,State) ->
+ empty_cth:post_end_per_group(Group,Config,Return,State),
+ {Return, [post_end_per_group|State]}.
+
+pre_init_per_testcase(TC,Config,State) ->
+ empty_cth:pre_init_per_testcase(TC,Config,State),
+ {Config, [pre_init_per_testcase|State]}.
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ empty_cth:post_end_per_testcase(TC,Config,Return,State),
+ {Return, [post_end_per_testcase|State]}.
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State),
+ [on_tc_fail|State].
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State),
+ [on_tc_skip|State].
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl new file mode 100644 index 0000000000..4c44ef025b --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl @@ -0,0 +1,71 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(undef_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-compile(export_all).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
+pre_init_per_suite(_Suite, _Config, _State) ->
+ lists:flaten([1,2,[3,4]]).
+
+post_init_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State).
+
+pre_end_per_suite(Suite,Config,State) ->
+ empty_cth:pre_end_per_suite(Suite,Config,State).
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
+
+pre_init_per_group(Group,Config,State) ->
+ empty_cth:pre_init_per_group(Group,Config,State).
+
+post_init_per_group(Group,Config,Return,State) ->
+ empty_cth:post_init_per_group(Group,Config,Return,State).
+
+pre_end_per_group(Group,Config,State) ->
+ empty_cth:pre_end_per_group(Group,Config,State).
+
+post_end_per_group(Group,Config,Return,State) ->
+ empty_cth:post_end_per_group(Group,Config,Return,State).
+
+pre_init_per_testcase(TC,Config,State) ->
+ empty_cth:pre_init_per_testcase(TC,Config,State).
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State).
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State).
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl new file mode 100644 index 0000000000..788ef2cec2 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl @@ -0,0 +1,82 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(update_config_cth).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% CT Hooks
+-compile(export_all).
+
+init(Id, Opts) ->
+ empty_cth:init(Id, Opts).
+
+pre_init_per_suite(Suite, Config, State) ->
+ empty_cth:pre_init_per_suite(Suite,Config,State),
+ {[{pre_init_per_suite,now()}|Config],State}.
+
+post_init_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_init_per_suite(Suite,Config,Return,State),
+ {[{post_init_per_suite,now()}|Return],State}.
+
+pre_end_per_suite(Suite,Config,State) ->
+ empty_cth:pre_end_per_suite(Suite,Config,State),
+ {[{pre_end_per_suite,now()}|Config],State}.
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ empty_cth:post_end_per_suite(Suite,Config,Return,State),
+ NewConfig = [{post_end_per_suite,now()}|Config],
+ {NewConfig,NewConfig}.
+
+pre_init_per_group(Group,Config,State) ->
+ empty_cth:pre_init_per_group(Group,Config,State),
+ {[{pre_init_per_group,now()}|Config],State}.
+
+post_init_per_group(Group,Config,Return,State) ->
+ empty_cth:post_init_per_group(Group,Config,Return,State),
+ {[{post_init_per_group,now()}|Return],State}.
+
+pre_end_per_group(Group,Config,State) ->
+ empty_cth:pre_end_per_group(Group,Config,State),
+ {[{pre_end_per_group,now()}|Config],State}.
+
+post_end_per_group(Group,Config,Return,State) ->
+ empty_cth:post_end_per_group(Group,Config,Return,State),
+ {[{post_end_per_group,now()}|Config],State}.
+
+pre_init_per_testcase(TC,Config,State) ->
+ empty_cth:pre_init_per_testcase(TC,Config,State),
+ {[{pre_init_per_testcase,now()}|Config],State}.
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ empty_cth:post_end_per_testcase(TC,Config,Return,State),
+ {[{post_end_per_testcase,now()}|Config],State}.
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State).
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State).
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_master_SUITE.erl b/lib/common_test/test/ct_master_SUITE.erl index 5ac2866227..e208397296 100644 --- a/lib/common_test/test/ct_master_SUITE.erl +++ b/lib/common_test/test/ct_master_SUITE.erl @@ -28,7 +28,7 @@ -module(ct_master_SUITE). -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -81,15 +81,19 @@ end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all() -> - all(suite). -all(doc) -> - [""]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> - [ - ct_master_test - ]. +all() -> + [ct_master_test]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %%-------------------------------------------------------------------- %% TEST CASES diff --git a/lib/common_test/test/ct_misc_1_SUITE.erl b/lib/common_test/test/ct_misc_1_SUITE.erl index 8c8b2d0d41..f5904ca180 100644 --- a/lib/common_test/test/ct_misc_1_SUITE.erl +++ b/lib/common_test/test/ct_misc_1_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("test_server/include/test_server_line.hrl"). -include_lib("common_test/include/ct_event.hrl"). @@ -57,13 +57,23 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - [""]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> - [ - beam_me_up, parse_table - ]. +all() -> + [beam_me_up, {group,parse_table}]. + +groups() -> + [{parse_table,[parallel], + [parse_table_empty, parse_table_single, + parse_table_multiline_row, + parse_table_one_column_multiline, + parse_table_one_column_simple]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %%-------------------------------------------------------------------- %% TEST CASES @@ -106,13 +116,6 @@ beam_me_up(Config) when is_list(Config) -> TestEvents = events_to_check(beam_me_up, 1), ok = ct_test_support:verify_events(TestEvents, Events, Config). - -parse_table(suite) -> - [parse_table_empty, parse_table_single, - parse_table_multiline_row, - parse_table_one_column_multiline, - parse_table_one_column_simple]. - parse_table_empty(Config) when is_list(Config) -> String = ["+----+-------+---------+---------+----------+------+--------+", diff --git a/lib/common_test/test/ct_repeat_1_SUITE.erl b/lib/common_test/test/ct_repeat_1_SUITE.erl index 1b4cafc9d3..40ef3e42fb 100644 --- a/lib/common_test/test/ct_repeat_1_SUITE.erl +++ b/lib/common_test/test/ct_repeat_1_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -56,24 +56,26 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - []; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> - [repeat_cs, - repeat_cs_and_grs, - repeat_seq, - repeat_cs_until_any_ok, - repeat_gr_until_any_ok, - repeat_cs_until_any_fail, - repeat_gr_until_any_fail, - repeat_cs_until_all_ok, - repeat_gr_until_all_ok, - repeat_cs_until_all_fail, - repeat_gr_until_all_fail, +all() -> + [repeat_cs, repeat_cs_and_grs, repeat_seq, + repeat_cs_until_any_ok, repeat_gr_until_any_ok, + repeat_cs_until_any_fail, repeat_gr_until_any_fail, + repeat_cs_until_all_ok, repeat_gr_until_all_ok, + repeat_cs_until_all_fail, repeat_gr_until_all_fail, repeat_seq_until_any_fail, - repeat_shuffled_seq_until_any_fail - ]. + repeat_shuffled_seq_until_any_fail]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%-------------------------------------------------------------------- %% TEST CASES diff --git a/lib/common_test/test/ct_sequence_1_SUITE.erl b/lib/common_test/test/ct_sequence_1_SUITE.erl index 0cf40f106a..0876a6f8b8 100644 --- a/lib/common_test/test/ct_sequence_1_SUITE.erl +++ b/lib/common_test/test/ct_sequence_1_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -56,13 +56,24 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(suite) -> - [subgroup_return_fail, - subgroup_init_fail, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [subgroup_return_fail, subgroup_init_fail, subgroup_after_failed_case, case_after_subgroup_return_fail, case_after_subgroup_fail_init]. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% TEST CASES %%-------------------------------------------------------------------- diff --git a/lib/common_test/test/ct_skip_SUITE.erl b/lib/common_test/test/ct_skip_SUITE.erl index 2e02061dec..2b64062e4d 100644 --- a/lib/common_test/test/ct_skip_SUITE.erl +++ b/lib/common_test/test/ct_skip_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -56,14 +56,20 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - [""]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [auto_skip, user_skip]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [ - auto_skip, - user_skip - ]. %%-------------------------------------------------------------------- diff --git a/lib/common_test/test/ct_smoke_test_SUITE.erl b/lib/common_test/test/ct_smoke_test_SUITE.erl index 05a2c20695..096171f951 100644 --- a/lib/common_test/test/ct_smoke_test_SUITE.erl +++ b/lib/common_test/test/ct_smoke_test_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -112,14 +112,22 @@ end_per_testcase(TestCase, Config) -> %% Description: Returns a description of the test suite (doc) and a %% list of all test cases in the suite (suite). %%-------------------------------------------------------------------- -all(doc) -> - ["Run smoke tests of Common Test."]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> - [dir1, dir2, dir1_2, - suite11, suite21, suite11_21, +all() -> + [dir1, dir2, dir1_2, suite11, suite21, suite11_21, tc111, tc211, tc111_112]. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% TEST CASES diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE.erl index eb85409073..44c30d7a38 100644 --- a/lib/common_test/test/ct_test_server_if_1_SUITE.erl +++ b/lib/common_test/test/ct_test_server_if_1_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -56,13 +56,20 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - [""]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [ts_if_1]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [ - ts_if_1 - ]. %%-------------------------------------------------------------------- diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl index b0c98e7f7f..b4f1a0e71f 100644 --- a/lib/common_test/test/ct_test_support.erl +++ b/lib/common_test/test/ct_test_support.erl @@ -43,6 +43,14 @@ init_per_suite(Config) -> init_per_suite(Config, 50). init_per_suite(Config, Level) -> + case os:type() of + {win32, _} -> + %% Extend timeout for windows as starting node + %% can take a long time there + test_server:timetrap( 120000 * test_server:timetrap_scale_factor()); + _ -> + ok + end, case delete_old_logs(os:type(), Config) of {'EXIT',DelLogsReason} -> test_server:format(0, "Failed to delete old log directories: ~p~n", @@ -50,7 +58,13 @@ init_per_suite(Config, Level) -> _ -> ok end, + + start_slave(Config, Level). + +start_slave(Config,Level) -> [_,Host] = string:tokens(atom_to_list(node()), "@"), + + test_server:format(0, "Trying to start ~s~n", ["ct@"++Host]), case slave:start(Host, ct, []) of {error,Reason} -> test_server:fail(Reason); @@ -126,9 +140,16 @@ init_per_testcase(_TestCase, Config) -> end_per_testcase(_TestCase, Config) -> CTNode = ?config(ct_node, Config), - wait_for_ct_stop(CTNode), - ok. - + case wait_for_ct_stop(CTNode) of + %% Common test was not stopped to we restart node. + false -> + cover:stop(CTNode), + slave:stop(CTNode), + start_slave(Config,proplists:get_value(trace_level,Config)), + {fail, "Could not stop common_test"}; + true -> + ok + end. %%%----------------------------------------------------------------- %%% @@ -219,11 +240,11 @@ wait_for_ct_stop(CTNode) -> wait_for_ct_stop(0, CTNode) -> test_server:format(0, "Giving up! Stopping ~p.", [CTNode]), - ok; + false; wait_for_ct_stop(Retries, CTNode) -> case rpc:call(CTNode, erlang, whereis, [ct_util_server]) of undefined -> - ok; + true; Pid -> test_server:format(0, "Waiting for CT (~p) to finish (~p)...", [Pid,Retries]), @@ -866,22 +887,49 @@ locate({TEH,tc_done,{undefined,undefined,{testcase_aborted, nomatch end; -%% matches any event of type Name -locate({TEH,Name,Data}, Node, [Ev|Evs], Config) when Data == '_' -> - case Ev of - {TEH,#event{name=Name, node=Node}} -> - {Config,Evs}; +%% Negative matching: Given two events, the first should not be present before +%% the other is matched. +locate({negative,NotMatch, Match} = Neg, Node, Evs, Config) -> + case locate(NotMatch, Node, Evs, Config) of + nomatch -> + locate(Match, Node, Evs, Config); _ -> - nomatch + exit({found_negative_event,Neg}) end; -locate({TEH,Name,Data}, Node, [Ev|Evs], Config) -> - case Ev of - {TEH,#event{name=Name, node=Node, data=Data}} -> - {Config,Evs}; - _ -> +%% matches any event of type Name +locate({TEH,Name,Data}, Node, [{TEH,#event{name=Name, + data = EvData, + node = Node}}|Evs], + Config) -> + try match_data(Data, EvData) of + match -> + {Config,Evs} + catch _:_ -> nomatch - end. + end; + +locate({_TEH,_Name,_Data}, _Node, [_|_Evs], _Config) -> + nomatch. + +match_data(D,D) -> + match; +match_data('_',_) -> + match; +match_data(Fun,Data) when is_function(Fun) -> + Fun(Data); +match_data('$proplist',Proplist) -> + match_data( + fun(List) -> + lists:foreach(fun({_,_}) -> ok end,List) + end,Proplist); +match_data([H1|MatchT],[H2|ValT]) -> + match_data(H1,H2), + match_data(MatchT,ValT); +match_data(Tuple1,Tuple2) when is_tuple(Tuple1),is_tuple(Tuple2) -> + match_data(tuple_to_list(Tuple1),tuple_to_list(Tuple2)); +match_data([],[]) -> + match. log_events(TC, Events, PrivDir) -> LogFile = filename:join(PrivDir, atom_to_list(TC)++".events"), diff --git a/lib/common_test/test/ct_testspec_1_SUITE.erl b/lib/common_test/test/ct_testspec_1_SUITE.erl index dc399bfb4c..c2a7bd8fd7 100644 --- a/lib/common_test/test/ct_testspec_1_SUITE.erl +++ b/lib/common_test/test/ct_testspec_1_SUITE.erl @@ -29,7 +29,7 @@ -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct_event.hrl"). -define(eh, ct_test_support_eh). @@ -56,24 +56,28 @@ init_per_testcase(TestCase, Config) -> end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). -all(doc) -> - ["Run smoke tests of Common Test."]; - -all(suite) -> - [all_suites, skip_all_suites, - suite, skip_suite, - all_testcases, skip_all_testcases, - testcase, skip_testcase, - all_groups, skip_all_groups, - group, skip_group, - group_all_testcases, skip_group_all_testcases, - group_testcase, skip_group_testcase, - topgroup, - subgroup, skip_subgroup, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [all_suites, skip_all_suites, suite, skip_suite, + all_testcases, skip_all_testcases, testcase, + skip_testcase, all_groups, skip_all_groups, group, + skip_group, group_all_testcases, + skip_group_all_testcases, group_testcase, + skip_group_testcase, topgroup, subgroup, skip_subgroup, subgroup_all_testcases, skip_subgroup_all_testcases, subgroup_testcase, skip_subgroup_testcase, - sub_skipped_by_top, - testcase_in_multiple_groups]. + sub_skipped_by_top, testcase_in_multiple_groups]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%-------------------------------------------------------------------- %% TEST CASES diff --git a/lib/common_test/vsn.mk b/lib/common_test/vsn.mk index 413ef21df3..1a820848b5 100644 --- a/lib/common_test/vsn.mk +++ b/lib/common_test/vsn.mk @@ -1,3 +1,3 @@ -COMMON_TEST_VSN = 1.5.1 +COMMON_TEST_VSN = 1.5.2 diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml index c3d65b4cb5..f2af932aef 100644 --- a/lib/compiler/doc/src/compile.xml +++ b/lib/compiler/doc/src/compile.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2010</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -164,6 +164,70 @@ for details.</p> </item> + <tag><c>makedep</c></tag> + <item> + <p>Produce a Makefile rule to track headers dependencies. + No object file is produced. + </p> + <p>By default, this rule is written to + <c><![CDATA[<File>.Pbeam]]></c>. However, if the option + <c>binary</c> is set, nothing is written and the rule is + returned in <c>Binary</c>. + </p> + <p>For instance, if one has the following module: + </p> + <code> +-module(module). + +-include_lib("eunit/include/eunit.hrl"). +-include("header.hrl"). + </code> + <p>Here is the Makefile rule generated by this option: + </p> + <code> +module.beam: module.erl \ + /usr/local/lib/erlang/lib/eunit/include/eunit.hrl \ + header.hrl + </code> + </item> + + <tag><c>{makedep_output, Output}</c></tag> + <item> + <p>Write generated rule(s) to <c>Output</c> instead of the + default <c><![CDATA[<File>.Pbeam]]></c>. <c>Output</c> + can be a filename or an <c>io_device()</c>. To write to + stdout, use <c>standard_io</c>. However if <c>binary</c> + is set, nothing is written to <c>Output</c> and the + result is returned to the caller with + <c>{ok, ModuleName, Binary}</c>. + </p> + </item> + + <tag><c>{makedep_target, Target}</c></tag> + <item> + <p>Change the name of the rule emitted to <c>Target</c>. + </p> + </item> + + <tag><c>makedep_quote_target</c></tag> + <item> + <p>Characters in <c>Target</c> special to make(1) are quoted. + </p> + </item> + + <tag><c>makedep_add_missing</c></tag> + <item> + <p>Consider missing headers as generated files and add them to the + dependencies. + </p> + </item> + + <tag><c>makedep_phony</c></tag> + <item> + <p>Add a phony target for each dependency. + </p> + </item> + <tag><c>'P'</c></tag> <item> <p>Produces a listing of the parsed code after preprocessing diff --git a/lib/compiler/doc/src/notes.xml b/lib/compiler/doc/src/notes.xml index 00ea0da55c..9d89b17afb 100644 --- a/lib/compiler/doc/src/notes.xml +++ b/lib/compiler/doc/src/notes.xml @@ -31,6 +31,56 @@ <p>This document describes the changes made to the Compiler application.</p> +<section><title>Compiler 4.7.2</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Two compiler bugs (that would cause the compiler to + terminate) reported by Christopher Williams have been + fixed.</p> + <p> + Own Id: OTP-8949</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>The compiler would translate binary comprehensions + containing tail segments in a way that would would + confuse Dialyzer. For instance:</p> + <p><c>[42 || <<_:8/integer, _/bits>> <= + Bits]</c></p> + <p> + would produce a Dialyzer warning.</p> + <p> + Own Id: OTP-8864</p> + </item> + <item> + <p> + Code such as <c>foo(A) -> <<A:0>></c> + would crash the compiler.</p> + <p> + Own Id: OTP-8865</p> + </item> + <item> + <p> + The compiler could fail with an internal error when + variables were exported from a receive block but the + return value of the receive block were not used. (Thanks + to Jim Engquist for reporting this error.)</p> + <p> + Own Id: OTP-8888</p> + </item> + </list> + </section> + +</section> + <section><title>Compiler 4.7.1</title> <section><title>Improvements and New Features</title> diff --git a/lib/compiler/src/Makefile b/lib/compiler/src/Makefile index 0f6d2f6193..9da9253f5b 100644 --- a/lib/compiler/src/Makefile +++ b/lib/compiler/src/Makefile @@ -118,7 +118,9 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) ifeq ($(NATIVE_LIBS_ENABLED),yes) ERL_COMPILE_FLAGS += +native endif -ERL_COMPILE_FLAGS += +inline +warn_unused_import -I../../stdlib/include -I$(EGEN) -W +ERL_COMPILE_FLAGS += +inline +warn_unused_import \ + +warnings_as_errors \ + -I../../stdlib/include -I$(EGEN) -W # ---------------------------------------------------- # Targets diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index 26da3ecad2..ce8a5bf864 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -112,9 +112,10 @@ noenv_forms(Forms, Opt) when is_atom(Opt) -> -spec noenv_output_generated([option()]) -> boolean(). noenv_output_generated(Opts) -> + {_,Passes} = passes(file, expand_opts(Opts)), any(fun ({save_binary,_F}) -> true; (_Other) -> false - end, passes(file, expand_opts(Opts))). + end, Passes). %% %% Local functions @@ -205,6 +206,9 @@ format_error(write_error) -> format_error({rename,From,To,Error}) -> io_lib:format("failed to rename ~s to ~s: ~s", [From,To,file:format_error(Error)]); +format_error({delete,File,Error}) -> + io_lib:format("failed to delete file ~s: ~s", + [File,file:format_error(Error)]); format_error({delete_temp,File,Error}) -> io_lib:format("failed to delete temporary file ~s: ~s", [File,file:format_error(Error)]); @@ -240,26 +244,12 @@ internal(Master, Input, Opts) -> end}. internal({forms,Forms}, Opts) -> - Ps = passes(forms, Opts), + {_,Ps} = passes(forms, Opts), internal_comp(Ps, "", "", #compile{code=Forms,options=Opts}); internal({file,File}, Opts) -> - Ps = passes(file, Opts), + {Ext,Ps} = passes(file, Opts), Compile = #compile{options=Opts}, - case member(from_core, Opts) of - true -> internal_comp(Ps, File, ".core", Compile); - false -> - case member(from_beam, Opts) of - true -> - internal_comp(Ps, File, ".beam", Compile); - false -> - case member(from_asm, Opts) orelse member(asm, Opts) of - true -> - internal_comp(Ps, File, ".S", Compile); - false -> - internal_comp(Ps, File, ".erl", Compile) - end - end - end. + internal_comp(Ps, File, Ext, Compile). internal_comp(Passes, File, Suffix, St0) -> Dir = filename:dirname(File), @@ -367,42 +357,52 @@ mpf(Ms) -> [{File,[M || {F,M} <- Ms, F =:= File]} || File <- lists:usort([F || {F,_} <- Ms])]. -%% passes(forms|file, [Option]) -> [{Name,PassFun}] -%% Figure out which passes that need to be run. - -passes(forms, Opts) -> - case member(from_core, Opts) of - true -> - select_passes(core_passes(), Opts); - false -> - select_passes(standard_passes(), Opts) +%% passes(forms|file, [Option]) -> {Extension,[{Name,PassFun}]} +%% Figure out the extension of the input file and which passes +%% that need to be run. + +passes(Type, Opts) -> + {Ext,Passes0} = passes_1(Opts), + Passes1 = case Type of + file -> Passes0; + forms -> tl(Passes0) + end, + Passes = select_passes(Passes1, Opts), + + %% If the last pass saves the resulting binary to a file, + %% insert a first pass to remove the file (unless the + %% source file is a BEAM file). + {Ext,case last(Passes) of + {save_binary,_Fun} -> + case Passes of + [{read_beam_file,_}|_] -> + %% The BEAM is both input and output. + %% Don't remove it. + Passes; + _ -> + [?pass(remove_file)|Passes] + end; + _ -> + Passes + end}. + +passes_1([Opt|Opts]) -> + case pass(Opt) of + {_,_}=Res -> Res; + none -> passes_1(Opts) end; -passes(file, Opts) -> - case member(from_beam, Opts) of - true -> - Ps = [?pass(read_beam_file)|binary_passes()], - select_passes(Ps, Opts); - false -> - Ps = case member(from_asm, Opts) orelse member(asm, Opts) of - true -> - [?pass(beam_consult_asm)|asm_passes()]; - false -> - case member(from_core, Opts) of - true -> - [?pass(parse_core)|core_passes()]; - false -> - [?pass(parse_module)|standard_passes()] - end - end, - Fs = select_passes(Ps, Opts), - - %% If the last pass saves the resulting binary to a file, - %% insert a first pass to remove the file. - case last(Fs) of - {save_binary,_Fun} -> [?pass(remove_file)|Fs]; - _Other -> Fs - end - end. +passes_1([]) -> + {".erl",[?pass(parse_module)|standard_passes()]}. + +pass(from_core) -> + {".core",[?pass(parse_core)|core_passes()]}; +pass(from_asm) -> + {".S",[?pass(beam_consult_asm)|asm_passes()]}; +pass(asm) -> + pass(from_asm); +pass(from_beam) -> + {".beam",[?pass(read_beam_file)|binary_passes()]}; +pass(_) -> none. %% select_passes([Command], Opts) -> [{Name,Function}] %% Interpret the lists of commands to return a pure list of passes. @@ -435,6 +435,8 @@ passes(file, Opts) -> %% file will be Ext. (Ext should not contain %% a period.) No more passes will be run. %% +%% done End compilation at this point. +%% %% {done,Ext} End compilation at this point. Produce a listing %% as with {listing,Ext}, unless 'binary' is %% specified, in which case the current @@ -468,6 +470,8 @@ select_passes([{src_listing,Ext}|_], _Opts) -> [{listing,fun (St) -> src_listing(Ext, St) end}]; select_passes([{listing,Ext}|_], _Opts) -> [{listing,fun (St) -> listing(Ext, St) end}]; +select_passes([done|_], _Opts) -> + []; select_passes([{done,Ext}|_], Opts) -> select_passes([{unless,binary,{listing,Ext}}], Opts); select_passes([{iff,Flag,Pass}|Ps], Opts) -> @@ -550,6 +554,13 @@ select_list_passes_1([], _, Acc) -> standard_passes() -> [?pass(transform_module), + + {iff,makedep,[ + ?pass(makedep), + {unless,binary,?pass(makedep_output)} + ]}, + {iff,makedep,done}, + {iff,'dpp',{listing,"pp"}}, ?pass(lint_module), {iff,'P',{src_listing,"P"}}, @@ -901,6 +912,184 @@ core_lint_module(St) -> errors=St#compile.errors ++ Es}} end. +makedep(#compile{code=Code,options=Opts}=St) -> + Ifile = St#compile.ifile, + Ofile = St#compile.ofile, + + %% Get the target of the Makefile rule. + Target0 = + case proplists:get_value(makedep_target, Opts) of + undefined -> + %% The target is derived from the output filename: possibly + %% remove the current working directory to obtain a relative + %% path. + shorten_filename(Ofile); + T -> + %% The caller specified one. + T + end, + + %% Quote the target is the called asked for this. + Target1 = case proplists:get_value(makedep_quote_target, Opts) of + true -> + %% For now, only "$" is replaced by "$$". + Fun = fun + ($$) -> "$$"; + (C) -> C + end, + map(Fun, Target0); + _ -> + Target0 + end, + Target = Target1 ++ ":", + + %% List the dependencies (includes) for this target. + {MainRule,PhonyRules} = makedep_add_headers( + Ifile, % The input file name. + Code, % The parsed source. + [], % The list of dependencies already added. + length(Target), % The current line length. + Target, % The target. + "", % Phony targets. + Opts), + + %% Prepare the content of the Makefile. For instance: + %% hello.erl: hello.hrl common.hrl + %% + %% Or if phony targets are enabled: + %% hello.erl: hello.hrl common.hrl + %% + %% hello.hrl: + %% + %% common.hrl: + Makefile = case proplists:get_value(makedep_phony, Opts) of + true -> MainRule ++ PhonyRules; + _ -> MainRule + end, + {ok,St#compile{code=iolist_to_binary([Makefile,"\n"])}}. + +makedep_add_headers(Ifile, [{attribute,_,file,{File,_}}|Rest], + Included, LineLen, MainTarget, Phony, Opts) -> + %% The header "File" exists, add it to the dependencies. + {Included1,LineLen1,MainTarget1,Phony1} = + makedep_add_header(Ifile, Included, LineLen, MainTarget, Phony, File), + makedep_add_headers(Ifile, Rest, Included1, LineLen1, + MainTarget1, Phony1, Opts); +makedep_add_headers(Ifile, [{error,{_,epp,{include,file,File}}}|Rest], + Included, LineLen, MainTarget, Phony, Opts) -> + %% The header "File" doesn't exist, do we add it to the dependencies? + case proplists:get_value(makedep_add_missing, Opts) of + true -> + {Included1,LineLen1,MainTarget1,Phony1} = + makedep_add_header(Ifile, Included, LineLen, MainTarget, + Phony, File), + makedep_add_headers(Ifile, Rest, Included1, LineLen1, + MainTarget1, Phony1, Opts); + _ -> + makedep_add_headers(Ifile, Rest, Included, LineLen, + MainTarget, Phony, Opts) + end; +makedep_add_headers(Ifile, [_|Rest], Included, LineLen, + MainTarget, Phony, Opts) -> + makedep_add_headers(Ifile, Rest, Included, + LineLen, MainTarget, Phony, Opts); +makedep_add_headers(_Ifile, [], _Included, _LineLen, + MainTarget, Phony, _Opts) -> + {MainTarget,Phony}. + +makedep_add_header(Ifile, Included, LineLen, MainTarget, Phony, File) -> + case member(File, Included) of + true -> + %% This file was already listed in the dependencies, skip it. + {Included,LineLen,MainTarget,Phony}; + false -> + Included1 = [File|Included], + + %% Remove "./" in front of the dependency filename. + File1 = case File of + "./" ++ File0 -> File0; + _ -> File + end, + + %% Prepare the phony target name. + Phony1 = case File of + Ifile -> Phony; + _ -> Phony ++ "\n\n" ++ File1 ++ ":" + end, + + %% Add the file to the dependencies. Lines longer than 76 columns + %% are splitted. + if + LineLen + 1 + length(File1) > 76 -> + LineLen1 = 2 + length(File1), + MainTarget1 = MainTarget ++ " \\\n " ++ File1, + {Included1,LineLen1,MainTarget1,Phony1}; + true -> + LineLen1 = LineLen + 1 + length(File1), + MainTarget1 = MainTarget ++ " " ++ File1, + {Included1,LineLen1,MainTarget1,Phony1} + end + end. + +makedep_output(#compile{code=Code,options=Opts,ofile=Ofile}=St) -> + %% Write this Makefile (Code) to the selected output. + %% If no output is specified, the default is to write to a file named after + %% the output file. + Output0 = case proplists:get_value(makedep_output, Opts) of + undefined -> + %% Prepare the default filename. + outfile(filename:basename(Ofile, ".beam"), "Pbeam", Opts); + O -> + O + end, + + %% If the caller specified an io_device(), there's nothing to do. If he + %% specified a filename, we must create it. Furthermore, this created file + %% must be closed before returning. + Ret = case Output0 of + _ when is_list(Output0) -> + case file:delete(Output0) of + Ret2 when Ret2 =:= ok; Ret2 =:= {error,enoent} -> + case file:open(Output0, [write]) of + {ok,IODev} -> + {ok,IODev,true}; + {error,Reason2} -> + {error,open,Reason2} + end; + {error,Reason1} -> + {error,delete,Reason1} + end; + _ -> + {ok,Output0,false} + end, + + case Ret of + {ok,Output1,CloseOutput} -> + try + %% Write the Makefile. + io:fwrite(Output1, "~s", [Code]), + %% Close the file if relevant. + if + CloseOutput -> file:close(Output1); + true -> ok + end, + {ok,St} + catch + exit:_ -> + %% Couldn't write to output Makefile. + Err = {St#compile.ifile,[{none,?MODULE,write_error}]}, + {error,St#compile{errors=St#compile.errors++[Err]}} + end; + {error,open,Reason} -> + %% Couldn't open output Makefile. + Err = {St#compile.ifile,[{none,?MODULE,{open,Reason}}]}, + {error,St#compile{errors=St#compile.errors++[Err]}}; + {error,delete,Reason} -> + %% Couldn't open output Makefile. + Err = {St#compile.ifile,[{none,?MODULE,{delete,Output0,Reason}}]}, + {error,St#compile{errors=St#compile.errors++[Err]}} + end. + %% expand_module(State) -> State' %% Do the common preprocessing of the input forms. diff --git a/lib/compiler/src/v3_codegen.erl b/lib/compiler/src/v3_codegen.erl index 77da6c8d00..f24a46c5a9 100644 --- a/lib/compiler/src/v3_codegen.erl +++ b/lib/compiler/src/v3_codegen.erl @@ -235,7 +235,7 @@ match_cg(M, Rs, Le, Vdb, Bef, St0) -> I = Le#l.i, {Sis,Int0} = adjust_stack(Bef, I, I+1, Vdb), {B,St1} = new_label(St0), - {Mis,Int1,St2} = match_cg(M, St0#cg.ultimate_failure, + {Mis,Int1,St2} = match_cg(M, St1#cg.ultimate_failure, Int0, St1#cg{break=B}), %% Put return values in registers. Reg = load_vars(Rs, Int1#sr.reg), diff --git a/lib/compiler/src/v3_kernel.erl b/lib/compiler/src/v3_kernel.erl index fbe4d8617e..3b33a08cf7 100644 --- a/lib/compiler/src/v3_kernel.erl +++ b/lib/compiler/src/v3_kernel.erl @@ -147,6 +147,7 @@ attributes([]) -> []. include_attribute(type) -> false; include_attribute(spec) -> false; include_attribute(opaque) -> false; +include_attribute(export_type) -> false; include_attribute(_) -> true. function({#c_var{name={F,Arity}=FA},Body}, St0) -> diff --git a/lib/compiler/src/v3_kernel_pp.erl b/lib/compiler/src/v3_kernel_pp.erl index a300dd283f..9bd13f7032 100644 --- a/lib/compiler/src/v3_kernel_pp.erl +++ b/lib/compiler/src/v3_kernel_pp.erl @@ -50,28 +50,34 @@ format(Node) -> format(Node, #ctxt{}). format(Node, Ctxt) -> case canno(Node) of -%% [] -> -%% format_1(Node, Ctxt); -%% [L,{file,_}] when is_integer(L) -> -%% format_1(Node, Ctxt); -%% #k{a=Anno}=K when Anno =/= [] -> -%% format(setelement(2, Node, K#k{a=[]}), Ctxt); -%% List -> -%% format_anno(List, Ctxt, fun (Ctxt1) -> -%% format_1(Node, Ctxt1) -%% end); - _ -> - format_1(Node, Ctxt) + [] -> + format_1(Node, Ctxt); + [L,{file,_}] when is_integer(L) -> + format_1(Node, Ctxt); + #k{a=Anno}=K when Anno =/= [] -> + format(setelement(2, Node, K#k{a=[]}), Ctxt); + List -> + format_anno(List, Ctxt, fun (Ctxt1) -> + format_1(Node, Ctxt1) + end) end. -%% format_anno(Anno, Ctxt0, ObjFun) -> -%% Ctxt1 = ctxt_bump_indent(Ctxt0, 1), -%% ["( ", -%% ObjFun(Ctxt0), -%% nl_indent(Ctxt1), -%% "-| ",io_lib:write(Anno), -%% " )"]. - +format_anno(Anno, Ctxt0, ObjFun) -> + case annotations_enabled() of + true -> + Ctxt1 = ctxt_bump_indent(Ctxt0, 1), + ["( ", + ObjFun(Ctxt0), + nl_indent(Ctxt1), + "-| ",io_lib:write(Anno), + " )"]; + false -> + ObjFun(Ctxt0) + end. + +%% By default, don't show annotations since they clutter up the output. +annotations_enabled() -> + false. %% format_1(Kexpr, Context) -> string(). @@ -107,6 +113,8 @@ format_1(#k_bin_int{size=Sz,unit=U,flags=Fs,val=Val,next=Next}, Ctxt) -> [format_bin_seg_1(S, Ctxt), format_bin_seg(Next, ctxt_bump_indent(Ctxt, 2))]; format_1(#k_bin_end{}, _Ctxt) -> "#<>#"; +format_1(#k_literal{val=Term}, _Ctxt) -> + io_lib:format("~p", [Term]); format_1(#k_local{name=N,arity=A}, Ctxt) -> "local " ++ format_fa_pair({N,A}, Ctxt); format_1(#k_remote{mod=M,name=N,arity=A}, _Ctxt) -> diff --git a/lib/compiler/test/Makefile b/lib/compiler/test/Makefile index 2d08e71e09..934bf39393 100644 --- a/lib/compiler/test/Makefile +++ b/lib/compiler/test/Makefile @@ -153,7 +153,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) compiler.dynspec compiler.cover \ + $(INSTALL_DATA) compiler.spec compiler.cover \ $(EMAKEFILE) $(ERL_FILES) $(CORE_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(NO_OPT_ERL_FILES) $(POST_OPT_ERL_FILES) \ $(INLINE_ERL_FILES) $(RELSYSDIR) diff --git a/lib/compiler/test/andor_SUITE.erl b/lib/compiler/test/andor_SUITE.erl index 84cfd16e60..2438fad6ca 100644 --- a/lib/compiler/test/andor_SUITE.erl +++ b/lib/compiler/test/andor_SUITE.erl @@ -18,16 +18,35 @@ %% -module(andor_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, t_case/1,t_and_or/1,t_andalso/1,t_orelse/1,inside/1,overlap/1, combined/1,in_case/1,before_and_inside_if/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(andor_SUITE), + [t_case, t_and_or, t_andalso, t_orelse, inside, overlap, + combined, in_case, before_and_inside_if]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [t_case,t_and_or,t_andalso,t_orelse,inside,overlap,combined,in_case, - before_and_inside_if]. t_case(Config) when is_list(Config) -> %% We test boolean cases almost but not quite like cases diff --git a/lib/compiler/test/apply_SUITE.erl b/lib/compiler/test/apply_SUITE.erl index f23dd6c2db..f309042911 100644 --- a/lib/compiler/test/apply_SUITE.erl +++ b/lib/compiler/test/apply_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -18,15 +18,34 @@ %% -module(apply_SUITE). --export([all/1,mfa/1,fun_apply/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,mfa/1,fun_apply/1]). -export([foo/0,bar/1,baz/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(apply_SUITE), + [mfa, fun_apply]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [mfa,fun_apply]. -define(APPLY0(M, F), (fun(Res) -> Res = M:F() end)(apply(M, F, []))). -define(APPLY1(M, F, A1), (fun(Res) -> Res = M:F(A1) end)(apply(M, F, [A1]))). diff --git a/lib/compiler/test/beam_validator_SUITE.erl b/lib/compiler/test/beam_validator_SUITE.erl index 74b5d7c7eb..7fca737a20 100644 --- a/lib/compiler/test/beam_validator_SUITE.erl +++ b/lib/compiler/test/beam_validator_SUITE.erl @@ -18,7 +18,9 @@ %% -module(beam_validator_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, beam_files/1,compiler_bug/1,stupid_but_valid/1, xrange/1,yrange/1,stack/1,call_last/1,merge_undefined/1, uninit/1,unsafe_catch/1, @@ -30,34 +32,49 @@ state_after_fault_in_catch/1,no_exception_in_catch/1, undef_label/1,illegal_instruction/1,failing_gc_guard_bif/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = test_server:timetrap(?t:minutes(10)), [{watchdog,Dog}|Config]. -fin_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> +end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -all(suite) -> - test_lib:recompile(?MODULE), - [beam_files,compiler_bug,stupid_but_valid, - xrange,yrange,stack,call_last,merge_undefined, - uninit,unsafe_catch, - dead_code,mult_labels, - overwrite_catchtag,overwrite_trytag,accessing_tags,bad_catch_try, - cons_guard, - freg_range,freg_uninit,freg_state, - bin_match,bin_aligned, - bad_dsetel,state_after_fault_in_catch,no_exception_in_catch, - undef_label,illegal_instruction,failing_gc_guard_bif]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(beam_validator_SUITE), + [beam_files, compiler_bug, stupid_but_valid, xrange, + yrange, stack, call_last, merge_undefined, uninit, + unsafe_catch, dead_code, mult_labels, + overwrite_catchtag, overwrite_trytag, accessing_tags, + bad_catch_try, cons_guard, freg_range, freg_uninit, + freg_state, bin_match, bin_aligned, bad_dsetel, + state_after_fault_in_catch, no_exception_in_catch, + undef_label, illegal_instruction, failing_gc_guard_bif]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + beam_files(Config) when is_list(Config) -> - ?line {ok,Cwd} = file:get_cwd(), - ?line Parent = filename:dirname(Cwd), - ?line Wc = filename:join([Parent,"*","*.beam"]), + ?line DataDir = proplists:get_value(data_dir, Config), + ?line Wc = filename:join([DataDir,"..","..","*","*.beam"]), %% Must have at least two files here, or there will be %% a grammatical error in the output of the io:format/2 call below. ;-) ?line [_,_|_] = Fs = filelib:wildcard(Wc), diff --git a/lib/compiler/test/bs_bincomp_SUITE.erl b/lib/compiler/test/bs_bincomp_SUITE.erl index 74f69893af..28801bd7d0 100644 --- a/lib/compiler/test/bs_bincomp_SUITE.erl +++ b/lib/compiler/test/bs_bincomp_SUITE.erl @@ -21,19 +21,36 @@ -module(bs_bincomp_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, byte_aligned/1,bit_aligned/1,extended_byte_aligned/1, extended_bit_aligned/1,mixed/1,filters/1,trim_coverage/1, nomatch/1,sizes/1,tail/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - test_lib:recompile(?MODULE), - [byte_aligned,bit_aligned,extended_byte_aligned, - extended_bit_aligned,mixed,filters,trim_coverage, - nomatch,sizes,tail]. +suite() -> [{ct_hooks,[ts_install_cth]}]. +all() -> + test_lib:recompile(bs_bincomp_SUITE), + [byte_aligned, bit_aligned, extended_byte_aligned, + extended_bit_aligned, mixed, filters, trim_coverage, + nomatch, sizes, tail]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. byte_aligned(Config) when is_list(Config) -> cs_init(), diff --git a/lib/compiler/test/bs_bit_binaries_SUITE.erl b/lib/compiler/test/bs_bit_binaries_SUITE.erl index 6337460b13..052289e00c 100644 --- a/lib/compiler/test/bs_bit_binaries_SUITE.erl +++ b/lib/compiler/test/bs_bit_binaries_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -21,19 +21,39 @@ -module(bs_bit_binaries_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, misc/1,horrid_match/1,test_bitstr/1,test_bit_size/1,asymmetric_tests/1, big_asymmetric_tests/1,binary_to_and_from_list/1, big_binary_to_and_from_list/1,send_and_receive/1, send_and_receive_alot/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(bs_bit_binaries_SUITE), + [misc, horrid_match, test_bitstr, test_bit_size, + asymmetric_tests, big_asymmetric_tests, + binary_to_and_from_list, big_binary_to_and_from_list, + send_and_receive, send_and_receive_alot]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [misc,horrid_match,test_bitstr,test_bit_size,asymmetric_tests, - big_asymmetric_tests,binary_to_and_from_list,big_binary_to_and_from_list, - send_and_receive,send_and_receive_alot]. misc(Config) when is_list(Config) -> ?line <<1:100>> = <<1:100>>, diff --git a/lib/compiler/test/bs_construct_SUITE.erl b/lib/compiler/test/bs_construct_SUITE.erl index dfe4301791..c430b12b70 100644 --- a/lib/compiler/test/bs_construct_SUITE.erl +++ b/lib/compiler/test/bs_construct_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -23,23 +23,44 @@ -module(bs_construct_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, two/1,test1/1,fail/1,float_bin/1,in_guard/1,in_catch/1, nasty_literals/1,coerce_to_float/1,side_effect/1, opt/1,otp_7556/1,float_arith/1,otp_8054/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(bs_construct_SUITE), + [two, test1, fail, float_bin, in_guard, in_catch, + nasty_literals, side_effect, opt, otp_7556, float_arith, + otp_8054]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [two,test1,fail,float_bin,in_guard,in_catch,nasty_literals, - side_effect,opt,otp_7556,float_arith,otp_8054]. init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> +end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. @@ -210,7 +231,7 @@ one_test({C_bin, E_bin, Str, Result}) -> ok; %% For situations where the final bits may not matter, like %% for floats: - N when integer(N) -> + N when is_integer(N) -> io:format("Info: compiled and interpreted differ in the" " last bytes:~n ~p, ~p.~n", [bitstring_to_list(C_bin), bitstring_to_list(E_bin)]), diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl index caaa587006..d674f273f0 100644 --- a/lib/compiler/test/bs_match_SUITE.erl +++ b/lib/compiler/test/bs_match_SUITE.erl @@ -20,7 +20,9 @@ -module(bs_match_SUITE). -compile(nowarn_shadow_vars). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, fun_shadow/1,int_float/1,otp_5269/1,null_fields/1,wiger/1, bin_tail/1,save_restore/1,shadowed_size_var/1, partitioned_bs_match/1,function_clause/1, @@ -35,24 +37,45 @@ -export([coverage_id/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - test_lib:recompile(?MODULE), - [fun_shadow,int_float,otp_5269,null_fields,wiger,bin_tail,save_restore, - shadowed_size_var,partitioned_bs_match,function_clause,unit, - shared_sub_bins,bin_and_float,dec_subidentifiers,skip_optional_tag, - wfbm,degenerated_match,bs_sum,coverage,multiple_uses,zero_label, - followed_by_catch,matching_meets_construction,simon,matching_and_andalso, - otp_7188,otp_7233,otp_7240,otp_7498,match_string,zero_width,bad_size, - haystack,cover_beam_bool]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(bs_match_SUITE), + [fun_shadow, int_float, otp_5269, null_fields, wiger, + bin_tail, save_restore, shadowed_size_var, + partitioned_bs_match, function_clause, unit, + shared_sub_bins, bin_and_float, dec_subidentifiers, + skip_optional_tag, wfbm, degenerated_match, bs_sum, + coverage, multiple_uses, zero_label, followed_by_catch, + matching_meets_construction, simon, + matching_and_andalso, otp_7188, otp_7233, otp_7240, + otp_7498, match_string, zero_width, bad_size, haystack, + cover_beam_bool]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> +end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. diff --git a/lib/compiler/test/bs_utf_SUITE.erl b/lib/compiler/test/bs_utf_SUITE.erl index 4281874a24..af57688347 100644 --- a/lib/compiler/test/bs_utf_SUITE.erl +++ b/lib/compiler/test/bs_utf_SUITE.erl @@ -19,18 +19,37 @@ -module(bs_utf_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, utf8_roundtrip/1,unused_utf_char/1,utf16_roundtrip/1, utf32_roundtrip/1,guard/1,extreme_tripping/1, literals/1,coverage/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(bs_utf_SUITE), + [utf8_roundtrip, unused_utf_char, utf16_roundtrip, + utf32_roundtrip, guard, extreme_tripping, literals, + coverage]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [utf8_roundtrip,unused_utf_char,utf16_roundtrip, - utf32_roundtrip,guard,extreme_tripping, - literals,coverage]. utf8_roundtrip(Config) when is_list(Config) -> ?line [utf8_roundtrip_1(P) || P <- utf_data()], diff --git a/lib/compiler/test/compilation_SUITE.erl b/lib/compiler/test/compilation_SUITE.erl index 935e384d2d..ba225b66d0 100644 --- a/lib/compiler/test/compilation_SUITE.erl +++ b/lib/compiler/test/compilation_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -20,34 +20,46 @@ -module(compilation_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -compile(export_all). -all(suite) -> - test_lib:recompile(?MODULE), - [self_compile_old_inliner,self_compile, - compiler_1,compiler_3,compiler_5, - beam_compiler_1, beam_compiler_2, beam_compiler_3, - beam_compiler_4, beam_compiler_5, beam_compiler_6, - beam_compiler_7, beam_compiler_8, beam_compiler_9, - beam_compiler_10, beam_compiler_11, beam_compiler_12, - nested_tuples_in_case_expr, - otp_2330, guards, vsn, - otp_2380, otp_2141, otp_2173, otp_4790, - const_list_256, - bin_syntax_1, bin_syntax_2, bin_syntax_3, - bin_syntax_4, bin_syntax_5, bin_syntax_6, - live_var, convopts, - bad_functional_value, - catch_in_catch, redundant_case, long_string, - otp_5076, complex_guard, otp_5092, otp_5151, - otp_5235,otp_5244, - trycatch_4, opt_crash, - otp_5404,otp_5436,otp_5481,otp_5553,otp_5632, - otp_5714,otp_5872,otp_6121,otp_6121a,otp_6121b, - otp_7202,otp_7345,on_load,string_table,otp_8949_a,otp_8949_a - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(compilation_SUITE), + [self_compile_old_inliner, self_compile, compiler_1, + compiler_3, compiler_5, beam_compiler_1, + beam_compiler_2, beam_compiler_3, beam_compiler_4, + beam_compiler_5, beam_compiler_6, beam_compiler_7, + beam_compiler_8, beam_compiler_9, beam_compiler_10, + beam_compiler_11, beam_compiler_12, + nested_tuples_in_case_expr, otp_2330, guards, + {group, vsn}, otp_2380, otp_2141, otp_2173, otp_4790, + const_list_256, bin_syntax_1, bin_syntax_2, + bin_syntax_3, bin_syntax_4, bin_syntax_5, bin_syntax_6, + live_var, convopts, bad_functional_value, + catch_in_catch, redundant_case, long_string, otp_5076, + complex_guard, otp_5092, otp_5151, otp_5235, otp_5244, + trycatch_4, opt_crash, otp_5404, otp_5436, otp_5481, + otp_5553, otp_5632, otp_5714, otp_5872, otp_6121, + otp_6121a, otp_6121b, otp_7202, otp_7345, on_load, + string_table,otp_8949_a,otp_8949_a]. + +groups() -> + [{vsn, [], [vsn_1, vsn_2, vsn_3]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -define(comp(N), N(Config) when is_list(Config) -> try_it(N, Config)). @@ -151,7 +163,7 @@ split({int, N}, <<N:16,B:N/binary,T/binary>>) -> beam_compiler_7(doc) -> "Code snippet submitted from Ulf Wiger which fails in R3 Beam."; beam_compiler_7(suite) -> []; -beam_compiler_7(Config) when list(Config) -> +beam_compiler_7(Config) when is_list(Config) -> ?line done = empty(2, false). empty(N, Toggle) when N > 0 -> @@ -311,12 +323,11 @@ from(H, [H | T]) -> T; from(H, [_ | T]) -> from(H, T); from(_, []) -> []. -vsn(suite) -> [vsn_1, vsn_2, vsn_3]. vsn_1(doc) -> "Test generation of 'vsn' attribute"; vsn_1(suite) -> []; -vsn_1(Conf) when list(Conf) -> +vsn_1(Conf) when is_list(Conf) -> ?line M = vsn_1, ?line compile_load(M, ?config(data_dir, Conf), Conf), @@ -340,7 +351,7 @@ vsn_1(Conf) when list(Conf) -> vsn_2(doc) -> "Test overriding of generation of 'vsn' attribute"; vsn_2(suite) -> []; -vsn_2(Conf) when list(Conf) -> +vsn_2(Conf) when is_list(Conf) -> ?line M = vsn_2, ?line compile_load(M, ?config(data_dir, Conf), Conf), @@ -356,7 +367,7 @@ vsn_2(Conf) when list(Conf) -> vsn_3(doc) -> "Test that different code yields different generated 'vsn'"; vsn_3(suite) -> []; -vsn_3(Conf) when list(Conf) -> +vsn_3(Conf) when is_list(Conf) -> ?line M = vsn_3, ?line compile_load(M, ?config(data_dir, Conf), Conf), diff --git a/lib/compiler/test/compile_SUITE.erl b/lib/compiler/test/compile_SUITE.erl index e1cc5dafb5..037c078fd0 100644 --- a/lib/compiler/test/compile_SUITE.erl +++ b/lib/compiler/test/compile_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -20,33 +20,50 @@ %% Tests compile:file/1 and compile:file/2 with various options. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, app_test/1, file_1/1, module_mismatch/1, big_file/1, outdir/1, - binary/1, cond_and_ifdef/1, listings/1, listings_big/1, + binary/1, makedep/1, cond_and_ifdef/1, listings/1, listings_big/1, other_output/1, package_forms/1, encrypted_abstr/1, - bad_record_use/1, bad_record_use1/1, bad_record_use2/1, strict_record/1, + bad_record_use1/1, bad_record_use2/1, strict_record/1, missing_testheap/1, cover/1, env/1, core/1, asm/1]). -export([init/3]). +suite() -> [{ct_hooks,[ts_install_cth]}]. %% To cover the stripping of 'type' and 'spec' in beam_asm. -type all_return_type() :: [atom()]. --spec all('suite' | [_]) -> all_return_type(). - -all(suite) -> - test_lib:recompile(?MODULE), - [app_test, - file_1, module_mismatch, big_file, outdir, binary, - cond_and_ifdef, listings, listings_big, - other_output, package_forms, - encrypted_abstr, - bad_record_use, strict_record, +-spec all() -> all_return_type(). + +all() -> + test_lib:recompile(compile_SUITE), + [app_test, file_1, module_mismatch, big_file, outdir, + binary, makedep, cond_and_ifdef, listings, listings_big, + other_output, package_forms, encrypted_abstr, + {group, bad_record_use}, strict_record, missing_testheap, cover, env, core, asm]. +groups() -> + [{bad_record_use, [], + [bad_record_use1, bad_record_use2]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %% Test that the Application file has no `basic' errors."; app_test(Config) when is_list(Config) -> @@ -132,6 +149,76 @@ binary(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. +%% Tests that the dependencies-Makefile-related options work. + +makedep(Config) when is_list(Config) -> + ?line Dog = test_server:timetrap(test_server:seconds(60)), + ?line {Simple,Target} = files(Config, "makedep"), + ?line DataDir = ?config(data_dir, Config), + ?line SimpleRootname = filename:rootname(Simple), + ?line IncludeDir = filename:join(filename:dirname(Simple), "include"), + ?line IncludeOptions = [ + {d,need_foo}, + {d,foo_value,42}, + {d,include_generated}, + {i,IncludeDir} + ], + %% Basic rule. + ?line BasicMf1Name = SimpleRootname ++ "-basic1.mk", + ?line {ok,BasicMf1} = file:read_file(BasicMf1Name), + ?line {ok,_,Mf1} = compile:file(Simple, [binary,makedep]), + ?line BasicMf1 = makedep_canonicalize_result(Mf1, DataDir), + %% Basic rule with one existing header. + ?line BasicMf2Name = SimpleRootname ++ "-basic2.mk", + ?line {ok,BasicMf2} = file:read_file(BasicMf2Name), + ?line {ok,_,Mf2} = compile:file(Simple, [binary,makedep|IncludeOptions]), + ?line BasicMf2 = makedep_canonicalize_result(Mf2, DataDir), + %% Rule with one existing header and one missing header. + ?line MissingMfName = SimpleRootname ++ "-missing.mk", + ?line {ok,MissingMf} = file:read_file(MissingMfName), + ?line {ok,_,Mf3} = compile:file(Simple, + [binary,makedep,makedep_add_missing|IncludeOptions]), + ?line MissingMf = makedep_canonicalize_result(Mf3, DataDir), + %% Rule with modified target. + ?line TargetMf1Name = SimpleRootname ++ "-target1.mk", + ?line {ok,TargetMf1} = file:read_file(TargetMf1Name), + ?line {ok,_,Mf4} = compile:file(Simple, + [binary,makedep,{makedep_target,"$target"}|IncludeOptions]), + ?line TargetMf1 = makedep_modify_target( + makedep_canonicalize_result(Mf4, DataDir), "$$target"), + %% Rule with quoted modified target. + ?line TargetMf2Name = SimpleRootname ++ "-target2.mk", + ?line {ok,TargetMf2} = file:read_file(TargetMf2Name), + ?line {ok,_,Mf5} = compile:file(Simple, + [binary,makedep,{makedep_target,"$target"},makedep_quote_target| + IncludeOptions]), + ?line TargetMf2 = makedep_modify_target( + makedep_canonicalize_result(Mf5, DataDir), "$$target"), + %% Basic rule written to some file. + ?line {ok,_} = compile:file(Simple, + [makedep,{makedep_output,Target}|IncludeOptions]), + ?line {ok,Mf6} = file:read_file(Target), + ?line BasicMf2 = makedep_canonicalize_result(Mf6, DataDir), + + ?line ok = file:delete(Target), + ?line ok = file:del_dir(filename:dirname(Target)), + ?line test_server:timetrap_cancel(Dog), + ok. + +makedep_canonicalize_result(Mf, DataDir) -> + Mf0 = binary_to_list(Mf), + %% Replace the Datadir by "$(srcdir)". + Mf1 = re:replace(Mf0, DataDir, "$(srcdir)/", + [global,multiline,{return,list}]), + %% Long lines are splitted, put back everything on one line. + Mf2 = re:replace(Mf1, "\\\\\n ", "", [global,multiline,{return,list}]), + list_to_binary(Mf2). + +makedep_modify_target(Mf, Target) -> + Mf0 = binary_to_list(Mf), + Mf1 = re:replace(Mf0, Target, "$target", [{return,list}]), + list_to_binary(Mf1). + %% Tests that conditional compilation, defining values, including files work. cond_and_ifdef(Config) when is_list(Config) -> @@ -465,7 +552,6 @@ exists(Name) -> {error, _} -> false end. -bad_record_use(suite) -> [bad_record_use1, bad_record_use2]. %% Tests that the compiler does not accept %% bad use of records. diff --git a/lib/compiler/test/compile_SUITE_data/simple-basic1.mk b/lib/compiler/test/compile_SUITE_data/simple-basic1.mk new file mode 100644 index 0000000000..4073fa82d0 --- /dev/null +++ b/lib/compiler/test/compile_SUITE_data/simple-basic1.mk @@ -0,0 +1 @@ +simple.beam: $(srcdir)/simple.erl diff --git a/lib/compiler/test/compile_SUITE_data/simple-basic2.mk b/lib/compiler/test/compile_SUITE_data/simple-basic2.mk new file mode 100644 index 0000000000..761d1d9582 --- /dev/null +++ b/lib/compiler/test/compile_SUITE_data/simple-basic2.mk @@ -0,0 +1 @@ +simple.beam: $(srcdir)/simple.erl $(srcdir)/include/simple.hrl diff --git a/lib/compiler/test/compile_SUITE_data/simple-missing.mk b/lib/compiler/test/compile_SUITE_data/simple-missing.mk new file mode 100644 index 0000000000..b13d44ec36 --- /dev/null +++ b/lib/compiler/test/compile_SUITE_data/simple-missing.mk @@ -0,0 +1 @@ +simple.beam: $(srcdir)/simple.erl $(srcdir)/include/simple.hrl generated.hrl diff --git a/lib/compiler/test/compile_SUITE_data/simple-target1.mk b/lib/compiler/test/compile_SUITE_data/simple-target1.mk new file mode 100644 index 0000000000..dd9fa0d6e5 --- /dev/null +++ b/lib/compiler/test/compile_SUITE_data/simple-target1.mk @@ -0,0 +1 @@ +$target: $(srcdir)/simple.erl $(srcdir)/include/simple.hrl diff --git a/lib/compiler/test/compile_SUITE_data/simple-target2.mk b/lib/compiler/test/compile_SUITE_data/simple-target2.mk new file mode 100644 index 0000000000..a5fc6f461d --- /dev/null +++ b/lib/compiler/test/compile_SUITE_data/simple-target2.mk @@ -0,0 +1 @@ +$$target: $(srcdir)/simple.erl $(srcdir)/include/simple.hrl diff --git a/lib/compiler/test/compile_SUITE_data/simple.erl b/lib/compiler/test/compile_SUITE_data/simple.erl index 2021056388..0c1c70a778 100644 --- a/lib/compiler/test/compile_SUITE_data/simple.erl +++ b/lib/compiler/test/compile_SUITE_data/simple.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -37,3 +37,7 @@ foo() -> {?included_value, ?foo_value}. -endif. + +-ifdef(include_generated). +-include("generated.hrl"). +-endif. diff --git a/lib/compiler/test/compiler.cover b/lib/compiler/test/compiler.cover index 69d284ea6c..9fc4c7dd43 100644 --- a/lib/compiler/test/compiler.cover +++ b/lib/compiler/test/compiler.cover @@ -1,3 +1,5 @@ +{incl_app,compiler,details}. + %% -*- erlang -*- -{exclude,[sys_pre_attributes,core_scan,core_parse]}. +{excl_mods,[sys_pre_attributes,core_scan,core_parse]}. diff --git a/lib/compiler/test/compiler.dynspec b/lib/compiler/test/compiler.dynspec deleted file mode 100644 index 7e452cef6c..0000000000 --- a/lib/compiler/test/compiler.dynspec +++ /dev/null @@ -1,10 +0,0 @@ -%% -*- erlang -*- -%% You can test this file using this command. -%% file:script("compiler.dynspec", [{'Os',"Unix"}]). - -case Os of - "VxWorks" -> - [{skip,{compile_SUITE,listings,"VxWorks filesystem too slow"}}]; - _ -> - [] -end. diff --git a/lib/compiler/test/compiler.spec b/lib/compiler/test/compiler.spec new file mode 100644 index 0000000000..f2546c3ced --- /dev/null +++ b/lib/compiler/test/compiler.spec @@ -0,0 +1,2 @@ +%% -*- erlang -*- +{suites,"../compiler_test",all}. diff --git a/lib/compiler/test/core_SUITE.erl b/lib/compiler/test/core_SUITE.erl index 54cf799057..c5969b5580 100644 --- a/lib/compiler/test/core_SUITE.erl +++ b/lib/compiler/test/core_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -18,10 +18,12 @@ %% -module(core_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, dehydrated_itracer/1,nested_tries/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(comp(N), N(Config) when is_list(Config) -> try_it(N, Config)). @@ -30,14 +32,32 @@ init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = test_server:timetrap(?t:minutes(5)), [{watchdog,Dog}|Config]. -fin_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> +end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -all(suite) -> - test_lib:recompile(?MODULE), - [dehydrated_itracer,nested_tries]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(core_SUITE), + [dehydrated_itracer, nested_tries]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + ?comp(dehydrated_itracer). ?comp(nested_tries). diff --git a/lib/compiler/test/core_fold_SUITE.erl b/lib/compiler/test/core_fold_SUITE.erl index 5f2c905d4a..c13e4d2162 100644 --- a/lib/compiler/test/core_fold_SUITE.erl +++ b/lib/compiler/test/core_fold_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -18,18 +18,37 @@ %% -module(core_fold_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, t_element/1,setelement/1,t_length/1,append/1,t_apply/1,bifs/1, eq/1,nested_call_in_case/1,coverage/1]). -export([foo/0,foo/1,foo/2,foo/3]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(core_fold_SUITE), + [t_element, setelement, t_length, append, t_apply, bifs, + eq, nested_call_in_case, coverage]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [t_element,setelement,t_length,append,t_apply,bifs, - eq,nested_call_in_case,coverage]. t_element(Config) when is_list(Config) -> X = make_ref(), diff --git a/lib/compiler/test/error_SUITE.erl b/lib/compiler/test/error_SUITE.erl index ec58a0761e..2bb3fea438 100644 --- a/lib/compiler/test/error_SUITE.erl +++ b/lib/compiler/test/error_SUITE.erl @@ -18,14 +18,32 @@ %% -module(error_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, head_mismatch_line/1,warnings_as_errors/1, bif_clashes/1]). -all(suite) -> - test_lib:recompile(?MODULE), - [head_mismatch_line,warnings_as_errors,bif_clashes]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(error_SUITE), + [head_mismatch_line, warnings_as_errors, bif_clashes]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. bif_clashes(Config) when is_list(Config) -> diff --git a/lib/compiler/test/float_SUITE.erl b/lib/compiler/test/float_SUITE.erl index b48b1daa32..cad144ea63 100644 --- a/lib/compiler/test/float_SUITE.erl +++ b/lib/compiler/test/float_SUITE.erl @@ -17,13 +17,34 @@ %% %CopyrightEnd% %% -module(float_SUITE). --export([all/1,pending/1,bif_calls/1,math_functions/1,mixed_float_and_int/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + pending/1,bif_calls/1,math_functions/1,mixed_float_and_int/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(float_SUITE), + [pending, bif_calls, math_functions, + mixed_float_and_int]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [pending,bif_calls,math_functions,mixed_float_and_int]. %% Thanks to Tobias Lindahl <[email protected]> %% Shows the effect of pending exceptions on the x86. diff --git a/lib/compiler/test/fun_SUITE.erl b/lib/compiler/test/fun_SUITE.erl index fb2667245a..dbf2416f3c 100644 --- a/lib/compiler/test/fun_SUITE.erl +++ b/lib/compiler/test/fun_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -18,14 +18,33 @@ %% -module(fun_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, test1/1,overwritten_fun/1,otp_7202/1,bif_fun/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(fun_SUITE), + [test1, overwritten_fun, otp_7202, bif_fun]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [test1,overwritten_fun,otp_7202,bif_fun]. %%% The help functions below are copied from emulator:bs_construct_SUITE. diff --git a/lib/compiler/test/guard_SUITE.erl b/lib/compiler/test/guard_SUITE.erl index 8f23bd2e5a..482564a32b 100644 --- a/lib/compiler/test/guard_SUITE.erl +++ b/lib/compiler/test/guard_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% 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 @@ -18,9 +18,10 @@ %% -module(guard_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, misc/1,const_cond/1,basic_not/1,complex_not/1,nested_nots/1, semicolon/1,complex_semicolon/1,comma/1, or_guard/1,more_or_guards/1, @@ -33,17 +34,33 @@ basic_andalso_orelse/1,traverse_dcd/1, check_qlc_hrl/1,andalso_semi/1,t_tuple_size/1,binary_part/1]). -all(suite) -> - test_lib:recompile(?MODULE), - [misc,const_cond,basic_not,complex_not,nested_nots, - semicolon,complex_semicolon, - comma,or_guard,more_or_guards, - complex_or_guards,and_guard, - xor_guard,more_xor_guards, - build_in_guard,old_guard_tests,gbif, - t_is_boolean,is_function_2,tricky,rel_ops,literal_type_tests, - basic_andalso_orelse,traverse_dcd,check_qlc_hrl,andalso_semi, - t_tuple_size,binary_part]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(guard_SUITE), + [misc, const_cond, basic_not, complex_not, nested_nots, + semicolon, complex_semicolon, comma, or_guard, + more_or_guards, complex_or_guards, and_guard, xor_guard, + more_xor_guards, build_in_guard, old_guard_tests, gbif, + t_is_boolean, is_function_2, tricky, rel_ops, + literal_type_tests, basic_andalso_orelse, traverse_dcd, + check_qlc_hrl, andalso_semi, t_tuple_size, binary_part]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + misc(Config) when is_list(Config) -> ?line 42 = case id(42) of @@ -94,8 +111,8 @@ const_cond(Config) when is_list(Config) -> const_cond(T, Sz) -> case T of _X when false -> never; - _X when tuple(T), eq == eq, tuple_size(T) == Sz -> ok; - _X when tuple(T), eq == leq, tuple_size(T) =< Sz -> ok; + _X when is_tuple(T), eq == eq, tuple_size(T) == Sz -> ok; + _X when is_tuple(T), eq == leq, tuple_size(T) =< Sz -> ok; _X -> error end. @@ -1137,7 +1154,7 @@ make_test([{T,L}|Ts]) -> make_test([]) -> []. test(T, L) -> - S0 = io_lib:format("begin io:format(\"~~p~~n\", [{~p,~p}]), if ~w(~w) -> true; true -> false end end. ", [T,L,T,L]), + S0 = io_lib:format("begin io:format(\"~~p~n\", [{~p,~p}]), if ~w(~w) -> true; true -> false end end. ", [T,L,T,L]), S = lists:flatten(S0), {ok,Toks,_Line} = erl_scan:string(S), {ok,E} = erl_parse:parse_exprs(Toks), @@ -1145,7 +1162,7 @@ test(T, L) -> {match,0,{atom,0,Val},hd(E)}. test(T, L1, L2) -> - S0 = io_lib:format("begin io:format(\"~~p~~n\", [{~p,~p,~p}]), if ~w(~w, ~w) -> true; true -> false end end. ", [T,L1,L2,T,L1,L2]), + S0 = io_lib:format("begin io:format(\"~~p~n\", [{~p,~p,~p}]), if ~w(~w, ~w) -> true; true -> false end end. ", [T,L1,L2,T,L1,L2]), S = lists:flatten(S0), {ok,Toks,_Line} = erl_scan:string(S), {ok,E} = erl_parse:parse_exprs(Toks), diff --git a/lib/compiler/test/inline_SUITE.erl b/lib/compiler/test/inline_SUITE.erl index 396fb450b7..7b9600c2f6 100644 --- a/lib/compiler/test/inline_SUITE.erl +++ b/lib/compiler/test/inline_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -20,7 +20,7 @@ -module(inline_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -compile(export_all). -compile({inline,[badarg/2]}). @@ -28,10 +28,29 @@ %% Needed by test case `lists'. -compile(inline_list_funcs). -all(suite) -> - test_lib:recompile(?MODULE), - [attribute,bsdecode,bsdes,barnes2,decode1,smith,itracer,pseudoknot,lists, - really_inlined,otp_7223,coverage]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(inline_SUITE), + [attribute, bsdecode, bsdes, barnes2, decode1, smith, + itracer, pseudoknot, lists, really_inlined, otp_7223, + coverage]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + attribute(Config) when is_list(Config) -> Name = "attribute", @@ -49,7 +68,7 @@ attribute(Config) when is_list(Config) -> ok. -define(comp(Name), - Name(Config) when list(Config) -> + Name(Config) when is_list(Config) -> try_inline(Name, Config)). ?comp(bsdecode). diff --git a/lib/compiler/test/lc_SUITE.erl b/lib/compiler/test/lc_SUITE.erl index 40bf67e1fa..bcdcf2fd9f 100644 --- a/lib/compiler/test/lc_SUITE.erl +++ b/lib/compiler/test/lc_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% 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 @@ -19,21 +19,41 @@ -module(lc_SUITE). -author('[email protected]'). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, basic/1,deeply_nested/1,no_generator/1, empty_generator/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(lc_SUITE), + [basic, deeply_nested, no_generator, empty_generator]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [basic,deeply_nested,no_generator,empty_generator]. init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> +end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. @@ -160,7 +180,7 @@ empty_generator(Config) when is_list(Config) -> id(I) -> I. fc(Args, {'EXIT',{function_clause,[{?MODULE,_,Args}|_]}}) -> ok; -fc(Args, {'EXIT',{function_clause,[{?MODULE,Name,Arity}|_]}}) +fc(Args, {'EXIT',{function_clause,[{?MODULE,_,Arity}|_]}}) when length(Args) =:= Arity -> true = test_server:is_native(?MODULE); fc(Args, {'EXIT',{{case_clause,ActualArgs},_}}) diff --git a/lib/compiler/test/match_SUITE.erl b/lib/compiler/test/match_SUITE.erl index fd51b777ac..b9b9fdd158 100644 --- a/lib/compiler/test/match_SUITE.erl +++ b/lib/compiler/test/match_SUITE.erl @@ -18,17 +18,36 @@ %% -module(match_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, pmatch/1,mixed/1,aliases/1,match_in_call/1, untuplify/1,shortcut_boolean/1,letify_guard/1, selectify/1,underscore/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(match_SUITE), + [pmatch, mixed, aliases, match_in_call, untuplify, + shortcut_boolean, letify_guard, selectify, underscore]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [pmatch,mixed,aliases,match_in_call,untuplify,shortcut_boolean, - letify_guard,selectify,underscore]. pmatch(Config) when is_list(Config) -> ?line ok = doit(1), diff --git a/lib/compiler/test/misc_SUITE.erl b/lib/compiler/test/misc_SUITE.erl index 450a4e279d..bf8d6c7b7c 100644 --- a/lib/compiler/test/misc_SUITE.erl +++ b/lib/compiler/test/misc_SUITE.erl @@ -18,11 +18,13 @@ %% -module(misc_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, tobias/1,empty_string/1,md5/1,silly_coverage/1, confused_literals/1,integer_encoding/1,override_bif/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% For the override_bif testcase. %% NB, no other testcases in this testsuite can use these without erlang:prefix! @@ -45,17 +47,34 @@ init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = test_server:timetrap(?t:minutes(10)), [{watchdog,Dog}|Config]. -fin_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> +end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. --spec all(any()) -> misc_SUITE_test_cases(). +suite() -> [{ct_hooks,[ts_install_cth]}]. + +-spec all() -> misc_SUITE_test_cases(). +all() -> + test_lib:recompile(misc_SUITE), + [tobias, empty_string, md5, silly_coverage, + confused_literals, integer_encoding, override_bif]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [tobias,empty_string,md5,silly_coverage,confused_literals, - integer_encoding, override_bif]. %% diff --git a/lib/compiler/test/num_bif_SUITE.erl b/lib/compiler/test/num_bif_SUITE.erl index 912f7366dd..29610aec6e 100644 --- a/lib/compiler/test/num_bif_SUITE.erl +++ b/lib/compiler/test/num_bif_SUITE.erl @@ -18,7 +18,7 @@ %% -module(num_bif_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Tests optimization of the BIFs: %% abs/1 @@ -30,17 +30,37 @@ %% round/1 %% trunc/1 --export([all/1, t_abs/1, t_float/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, t_abs/1, t_float/1, t_float_to_list/1, t_integer_to_list/1, t_list_to_integer/1, - t_list_to_float/1, t_list_to_float_safe/1, t_list_to_float_risky/1, + t_list_to_float_safe/1, t_list_to_float_risky/1, t_round/1, t_trunc/1]). -all(suite) -> - test_lib:recompile(?MODULE), +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(num_bif_SUITE), [t_abs, t_float, t_float_to_list, t_integer_to_list, - t_list_to_float, t_list_to_integer, - t_round, t_trunc]. + {group, t_list_to_float}, t_list_to_integer, t_round, + t_trunc]. + +groups() -> + [{t_list_to_float, [], + [t_list_to_float_safe, t_list_to_float_risky]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + t_abs(Config) when is_list(Config) -> %% Floats. @@ -142,7 +162,6 @@ t_integer_to_list(Config) when is_list(Config) -> %% Tests list_to_float/1. -t_list_to_float(suite) -> [t_list_to_float_safe, t_list_to_float_risky]. t_list_to_float_safe(Config) when is_list(Config) -> ?line 0.0 = list_to_float("0.0"), diff --git a/lib/compiler/test/parteval_SUITE.erl b/lib/compiler/test/parteval_SUITE.erl index 3ef84571b9..b8faaf5f87 100644 --- a/lib/compiler/test/parteval_SUITE.erl +++ b/lib/compiler/test/parteval_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -18,11 +18,31 @@ %% -module(parteval_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, pe2/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, pe2/1]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [pe2]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> [pe2]. %% (This is more general than needed, since we once compiled the same %% source code with and without a certain option.) diff --git a/lib/compiler/test/pmod_SUITE.erl b/lib/compiler/test/pmod_SUITE.erl index 13503ce905..f9fcae6ba8 100644 --- a/lib/compiler/test/pmod_SUITE.erl +++ b/lib/compiler/test/pmod_SUITE.erl @@ -18,20 +18,40 @@ %% -module(pmod_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, basic/1, otp_8447/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - test_lib:recompile(?MODULE), +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(pmod_SUITE), [basic, otp_8447]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> +end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. diff --git a/lib/compiler/test/receive_SUITE.erl b/lib/compiler/test/receive_SUITE.erl index 2a592dd669..bf6f289656 100644 --- a/lib/compiler/test/receive_SUITE.erl +++ b/lib/compiler/test/receive_SUITE.erl @@ -20,23 +20,42 @@ -module(receive_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, - recv/1,coverage/1,otp_7980/1,ref_opt/1,export/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + export/1,recv/1,coverage/1,otp_7980/1,ref_opt/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). init_per_testcase(_Case, Config) -> ?line Dog = test_server:timetrap(test_server:minutes(2)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - test_lib:recompile(?MODULE), - [recv,coverage,otp_7980,ref_opt,export]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(receive_SUITE), + [recv, coverage, otp_7980, ref_opt, export]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -record(state, {ena = true}). diff --git a/lib/compiler/test/record_SUITE.erl b/lib/compiler/test/record_SUITE.erl index f26ff769c7..6f85adbb77 100644 --- a/lib/compiler/test/record_SUITE.erl +++ b/lib/compiler/test/record_SUITE.erl @@ -20,9 +20,11 @@ -module(record_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, errors/1,record_test_2/1,record_test_3/1,record_access_in_guards/1, guard_opt/1,eval_once/1,foobar/1,missing_test_heap/1, nested_access/1]). @@ -30,15 +32,34 @@ init_per_testcase(_Case, Config) -> ?line Dog = test_server:timetrap(test_server:minutes(2)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - test_lib:recompile(?MODULE), - [errors,record_test_2,record_test_3,record_access_in_guards, - guard_opt,eval_once,foobar,missing_test_heap,nested_access]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(record_SUITE), + [errors, record_test_2, record_test_3, + record_access_in_guards, guard_opt, eval_once, foobar, + missing_test_heap, nested_access]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -record(foo, {a,b,c,d}). -record(bar, {a,b,c,d}). diff --git a/lib/compiler/test/test_lib.erl b/lib/compiler/test/test_lib.erl index d8799952a9..53d8c04169 100644 --- a/lib/compiler/test/test_lib.erl +++ b/lib/compiler/test/test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -41,7 +41,7 @@ smoke_disasm(Mod) when is_atom(Mod) -> smoke_disasm(code:which(Mod)); smoke_disasm(File) when is_list(File) -> Res = beam_disasm:file(File), - {beam_file,Mod} = {element(1, Res),element(2, Res)}. + {beam_file,_Mod} = {element(1, Res),element(2, Res)}. %% Retrieve the "interesting" compiler options (options for optimization %% and compatibility) for the given module. @@ -62,16 +62,16 @@ opt_opts(Mod) -> (_) -> false end, Opts). -%% Some test suites gets cloned (e.g. to "record_SUITE" to "record_no_opt_SUITE"), -%% but the data directory is not cloned. This function retrieves the path to -%% the original data directory. +%% Some test suites gets cloned (e.g. to "record_SUITE" to +%% "record_no_opt_SUITE"), but the data directory is not cloned. +%% This function retrieves the path to the original data directory. get_data_dir(Config) -> Data0 = ?config(data_dir, Config), - {ok,Data1,_} = regexp:sub(Data0, "_no_opt_SUITE", "_SUITE"), - {ok,Data2,_} = regexp:sub(Data1, "_post_opt_SUITE", "_SUITE"), - {ok,Data,_} = regexp:sub(Data2, "_inline_SUITE", "_SUITE"), - Data. + Opts = [{return,list}], + Data1 = re:replace(Data0, "_no_opt_SUITE", "_SUITE", Opts), + Data = re:replace(Data1, "_post_opt_SUITE", "_SUITE", Opts), + re:replace(Data, "_inline_SUITE", "_SUITE", Opts). %% p_run(fun(Data) -> ok|error, List) -> ok %% Will fail the test case if there were any errors. diff --git a/lib/compiler/test/trycatch_SUITE.erl b/lib/compiler/test/trycatch_SUITE.erl index c2f6dc24be..db438e28f8 100644 --- a/lib/compiler/test/trycatch_SUITE.erl +++ b/lib/compiler/test/trycatch_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -18,21 +18,40 @@ %% -module(trycatch_SUITE). --export([all/1,basic/1,lean_throw/1,try_of/1,try_after/1,%after_bind/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,basic/1,lean_throw/1, + try_of/1,try_after/1,%after_bind/1, catch_oops/1,after_oops/1,eclectic/1,rethrow/1, nested_of/1,nested_catch/1,nested_after/1, nested_horrid/1,last_call_optimization/1,bool/1, plain_catch_coverage/1,andalso_orelse/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(trycatch_SUITE), + [basic, lean_throw, try_of, try_after, catch_oops, + after_oops, eclectic, rethrow, nested_of, nested_catch, + nested_after, nested_horrid, last_call_optimization, + bool, plain_catch_coverage, andalso_orelse]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - test_lib:recompile(?MODULE), - [basic,lean_throw,try_of,try_after,%after_bind, - catch_oops,after_oops,eclectic,rethrow, - nested_of,nested_catch,nested_after, - nested_horrid,last_call_optimization, - bool,plain_catch_coverage,andalso_orelse]. basic(Conf) when is_list(Conf) -> diff --git a/lib/compiler/test/warnings_SUITE.erl b/lib/compiler/test/warnings_SUITE.erl index 5ed8836c70..75e2b17de4 100644 --- a/lib/compiler/test/warnings_SUITE.erl +++ b/lib/compiler/test/warnings_SUITE.erl @@ -26,12 +26,14 @@ -define(privdir, "warnings_SUITE_priv"). -define(t, test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(datadir, ?config(data_dir, Conf)). -define(privdir, ?config(priv_dir, Conf)). -endif. --export([all/1,init_per_testcase/2,fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2]). -export([pattern/1,pattern2/1,pattern3/1,pattern4/1, guard/1,bad_arith/1,bool_cases/1,bad_apply/1, @@ -44,16 +46,34 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - test_lib:recompile(?MODULE), - [pattern,pattern2,pattern3,pattern4, - guard,bad_arith,bool_cases,bad_apply,files,effect, - bin_opt_info,bin_construction]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + test_lib:recompile(warnings_SUITE), + [pattern, pattern2, pattern3, pattern4, guard, + bad_arith, bool_cases, bad_apply, files, effect, + bin_opt_info, bin_construction]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + pattern(Config) when is_list(Config) -> %% Test warnings generated by v3_core. diff --git a/lib/compiler/vsn.mk b/lib/compiler/vsn.mk index 4658eccd19..d180ecd4e2 100644 --- a/lib/compiler/vsn.mk +++ b/lib/compiler/vsn.mk @@ -1 +1 @@ -COMPILER_VSN = 4.7.1 +COMPILER_VSN = 4.7.2 diff --git a/lib/cosEvent/test/Makefile b/lib/cosEvent/test/Makefile index 3d95075ee1..d37d3e4e3c 100644 --- a/lib/cosEvent/test/Makefile +++ b/lib/cosEvent/test/Makefile @@ -34,6 +34,7 @@ RELSYSDIR = $(RELEASE_PATH)/cosEvent_test # Target Specs # ---------------------------------------------------- TEST_SPEC_FILE = cosEvent.spec +COVER_FILE = cosEvent.cover IDL_FILES = \ @@ -146,7 +147,7 @@ release_docs_spec: release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(ERL_FILES) $(RELSYSDIR) + $(COVER_FILE) $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(SUITE_TARGET_FILES) $(RELSYSDIR) $(INSTALL_DIR) $(RELSYSDIR)/$(IDLOUTDIR) $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ diff --git a/lib/cosEvent/test/cosEvent.cover b/lib/cosEvent/test/cosEvent.cover new file mode 100644 index 0000000000..df12ea3ca9 --- /dev/null +++ b/lib/cosEvent/test/cosEvent.cover @@ -0,0 +1,2 @@ +{incl_app,cosEvent,details}. + diff --git a/lib/cosEvent/test/cosEvent.spec b/lib/cosEvent/test/cosEvent.spec index 910f7a7c28..f793693779 100644 --- a/lib/cosEvent/test/cosEvent.spec +++ b/lib/cosEvent/test/cosEvent.spec @@ -1,19 +1 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-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% -%% -{topcase, {dir, "../cosEvent_test"}}. +{suites,"../cosEvent_test",all}. diff --git a/lib/cosEvent/test/event_channel_SUITE.erl b/lib/cosEvent/test/event_channel_SUITE.erl index 2b0cf1fe30..6c7194e8c7 100644 --- a/lib/cosEvent/test/event_channel_SUITE.erl +++ b/lib/cosEvent/test/event_channel_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -module(event_channel_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -53,21 +53,33 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, event_objects_api/1, events_api/1, events_sync_api/1, - cases/0, init_all/1, finish_all/1, - init_per_testcase/2, fin_per_testcase/2, app_test/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + event_objects_api/1, events_api/1, events_sync_api/1, + cases/0, init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, app_test/1]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- -all(doc) -> ["API tests for the cosEvent interfaces", ""]; -all(suite) -> {req, - [mnesia, orber], - {conf, init_all, cases(), finish_all}}. - -cases() -> - [events_api, events_sync_api, event_objects_api, app_test]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [events_api, events_sync_api, event_objects_api, + app_test]. %%----------------------------------------------------------------- %% Init and cleanup functions. @@ -78,12 +90,12 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> Path = code:which(?MODULE), code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), mnesia:delete_schema([node()]), @@ -96,7 +108,7 @@ init_all(Config) when is_list(Config) -> oe_event_test_server:oe_register(), Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> oe_event_test_server:oe_unregister(), cosEventApp:stop(), cosEventApp:uninstall(), diff --git a/lib/cosEvent/test/event_test_PullC_impl.erl b/lib/cosEvent/test/event_test_PullC_impl.erl index 186d1cbd51..4b81572cad 100644 --- a/lib/cosEvent/test/event_test_PullC_impl.erl +++ b/lib/cosEvent/test/event_test_PullC_impl.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 diff --git a/lib/cosEvent/test/event_test_PullS_impl.erl b/lib/cosEvent/test/event_test_PullS_impl.erl index b7fa0c34f0..81685980fb 100644 --- a/lib/cosEvent/test/event_test_PullS_impl.erl +++ b/lib/cosEvent/test/event_test_PullS_impl.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 diff --git a/lib/cosEvent/test/event_test_PushC_impl.erl b/lib/cosEvent/test/event_test_PushC_impl.erl index 6eadf74a31..c2be1d4c08 100644 --- a/lib/cosEvent/test/event_test_PushC_impl.erl +++ b/lib/cosEvent/test/event_test_PushC_impl.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 diff --git a/lib/cosEvent/test/event_test_PushS_impl.erl b/lib/cosEvent/test/event_test_PushS_impl.erl index da82e97211..35cfc66e6b 100644 --- a/lib/cosEvent/test/event_test_PushS_impl.erl +++ b/lib/cosEvent/test/event_test_PushS_impl.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 diff --git a/lib/cosEvent/test/generated_SUITE.erl b/lib/cosEvent/test/generated_SUITE.erl index 2d75b18451..b3c8f91267 100644 --- a/lib/cosEvent/test/generated_SUITE.erl +++ b/lib/cosEvent/test/generated_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ -module(generated_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -71,12 +71,12 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -84,19 +84,42 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing IC generated files"]; -all(suite) -> - ['CosEventChannelAdmin_AlreadyConnected', 'CosEventChannelAdmin_TypeError', +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + ['CosEventChannelAdmin_AlreadyConnected', + 'CosEventChannelAdmin_TypeError', 'CosEventComm_Disconnected', - 'CosEventChannelAdmin_ConsumerAdmin', 'CosEventChannelAdmin_EventChannel', - 'CosEventChannelAdmin_ProxyPullConsumer', 'CosEventChannelAdmin_ProxyPullSupplier', - 'CosEventChannelAdmin_ProxyPushConsumer', 'CosEventChannelAdmin_ProxyPushSupplier', - 'CosEventChannelAdmin_SupplierAdmin', oe_CosEventComm_CAdmin, - oe_CosEventComm_Channel, oe_CosEventComm_Event, oe_CosEventComm_PullerS, - oe_CosEventComm_PusherS, 'CosEventComm_PullConsumer', - 'CosEventComm_PullSupplier', 'CosEventComm_PushConsumer', + 'CosEventChannelAdmin_ConsumerAdmin', + 'CosEventChannelAdmin_EventChannel', + 'CosEventChannelAdmin_ProxyPullConsumer', + 'CosEventChannelAdmin_ProxyPullSupplier', + 'CosEventChannelAdmin_ProxyPushConsumer', + 'CosEventChannelAdmin_ProxyPushSupplier', + 'CosEventChannelAdmin_SupplierAdmin', + oe_CosEventComm_CAdmin, oe_CosEventComm_Channel, + oe_CosEventComm_Event, oe_CosEventComm_PullerS, + oe_CosEventComm_PusherS, 'CosEventComm_PullConsumer', + 'CosEventComm_PullSupplier', + 'CosEventComm_PushConsumer', 'CosEventComm_PushSupplier']. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -105,7 +128,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/cosEventDomain/test/Makefile b/lib/cosEventDomain/test/Makefile index 9893b05b8c..5b53690c6b 100644 --- a/lib/cosEventDomain/test/Makefile +++ b/lib/cosEventDomain/test/Makefile @@ -34,6 +34,7 @@ RELSYSDIR = $(RELEASE_PATH)/cosEventDomain_test # Target Specs # ---------------------------------------------------- TEST_SPEC_FILE = cosEventDomain.spec +COVER_FILE = cosEventDomain.cover MODULES = \ @@ -99,6 +100,6 @@ release_docs_spec: release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(TEST_SPEC_FILE) \ - $(ERL_FILES) $(RELSYSDIR) + $(COVER_FILE) $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(SUITE_TARGET_FILES) $(RELSYSDIR) diff --git a/lib/cosEventDomain/test/cosEventDomain.cover b/lib/cosEventDomain/test/cosEventDomain.cover new file mode 100644 index 0000000000..f87f6d97bf --- /dev/null +++ b/lib/cosEventDomain/test/cosEventDomain.cover @@ -0,0 +1,2 @@ +{incl_app,cosEventDomain,details}. + diff --git a/lib/cosEventDomain/test/cosEventDomain.spec b/lib/cosEventDomain/test/cosEventDomain.spec index 0d3e307071..bcee74c5f1 100644 --- a/lib/cosEventDomain/test/cosEventDomain.spec +++ b/lib/cosEventDomain/test/cosEventDomain.spec @@ -1,19 +1 @@ -%% -%% %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% -%% -{topcase, {dir, "../cosEventDomain_test"}}. +{suites,"../cosEventDomain_test",all}. diff --git a/lib/cosEventDomain/test/event_domain_SUITE.erl b/lib/cosEventDomain/test/event_domain_SUITE.erl index ddf0af3489..2793f94639 100644 --- a/lib/cosEventDomain/test/event_domain_SUITE.erl +++ b/lib/cosEventDomain/test/event_domain_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -module(event_domain_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). -include_lib("cosNotification/include/CosNotification.hrl"). @@ -56,20 +56,31 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, event_domain_api/1, event_domain_factory_api/1, - cases/0, init_all/1, finish_all/1, - init_per_testcase/2, fin_per_testcase/2, app_test/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + event_domain_api/1, event_domain_factory_api/1, + cases/0, init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, app_test/1]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- -all(doc) -> ["API tests for the cosEventDomain interfaces", ""]; -all(suite) -> {req, - [mnesia, orber, cosNotification], - {conf, init_all, cases(), finish_all}}. - -cases() -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> [event_domain_api, event_domain_factory_api, app_test]. %%----------------------------------------------------------------- @@ -81,12 +92,12 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> mnesia:delete_schema([node()]), mnesia:create_schema([node()]), ok = corba:orb_init([{flags, 16#02}, @@ -102,7 +113,7 @@ init_all(Config) when is_list(Config) -> cosEventDomainApp:start(), Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> cosEventDomainApp:stop(), cosEventDomainApp:uninstall(), cosNotificationApp:stop(), diff --git a/lib/cosEventDomain/test/generated_SUITE.erl b/lib/cosEventDomain/test/generated_SUITE.erl index 6c6996ca79..575568a7b9 100644 --- a/lib/cosEventDomain/test/generated_SUITE.erl +++ b/lib/cosEventDomain/test/generated_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ -module(generated_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -71,12 +71,11 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -84,17 +83,41 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing IC generated files"]; -all(suite) -> - ['CosEventDomainAdmin', 'CosEventDomainAdmin_DiamondSeq', - 'CosEventDomainAdmin_AlreadyExists', 'CosEventDomainAdmin_DomainIDSeq', - 'CosEventDomainAdmin_Connection', 'CosEventDomainAdmin_ConnectionIDSeq', - 'CosEventDomainAdmin_ConnectionNotFound', 'CosEventDomainAdmin_CycleCreationForbidden', - 'CosEventDomainAdmin_CycleSeq', 'CosEventDomainAdmin_DiamondCreationForbidden', - 'CosEventDomainAdmin_DomainNotFound', 'CosEventDomainAdmin_MemberIDSeq', - 'CosEventDomainAdmin_RouteSeq', 'CosEventDomainAdmin_EventDomainFactory', +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + ['CosEventDomainAdmin', + 'CosEventDomainAdmin_DiamondSeq', + 'CosEventDomainAdmin_AlreadyExists', + 'CosEventDomainAdmin_DomainIDSeq', + 'CosEventDomainAdmin_Connection', + 'CosEventDomainAdmin_ConnectionIDSeq', + 'CosEventDomainAdmin_ConnectionNotFound', + 'CosEventDomainAdmin_CycleCreationForbidden', + 'CosEventDomainAdmin_CycleSeq', + 'CosEventDomainAdmin_DiamondCreationForbidden', + 'CosEventDomainAdmin_DomainNotFound', + 'CosEventDomainAdmin_MemberIDSeq', + 'CosEventDomainAdmin_RouteSeq', + 'CosEventDomainAdmin_EventDomainFactory', 'CosEventDomainAdmin_EventDomain']. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -103,7 +126,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/cosFileTransfer/test/Makefile b/lib/cosFileTransfer/test/Makefile index 60f72644bd..cb181bdb66 100644 --- a/lib/cosFileTransfer/test/Makefile +++ b/lib/cosFileTransfer/test/Makefile @@ -34,6 +34,7 @@ RELSYSDIR = $(RELEASE_PATH)/cosFileTransfer_test # Target Specs # ---------------------------------------------------- TEST_SPEC_FILE = cosFileTransfer.spec +COVER_FILE = cosFileTransfer.cover IDL_FILES = @@ -127,6 +128,6 @@ release_docs_spec: release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(ERL_FILES) $(RELSYSDIR) + $(COVER_FILE) $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(SUITE_TARGET_FILES) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) diff --git a/lib/cosFileTransfer/test/cosFileTransfer.cover b/lib/cosFileTransfer/test/cosFileTransfer.cover new file mode 100644 index 0000000000..063dd66990 --- /dev/null +++ b/lib/cosFileTransfer/test/cosFileTransfer.cover @@ -0,0 +1,2 @@ +{incl_app,cosFileTransfer,details}. + diff --git a/lib/cosFileTransfer/test/cosFileTransfer.spec b/lib/cosFileTransfer/test/cosFileTransfer.spec index 80fe919f2a..290b27d048 100644 --- a/lib/cosFileTransfer/test/cosFileTransfer.spec +++ b/lib/cosFileTransfer/test/cosFileTransfer.spec @@ -1 +1 @@ -{topcase, {dir, "../cosFileTransfer_test"}}. +{suites,"../cosFileTransfer_test", all}. diff --git a/lib/cosFileTransfer/test/fileTransfer_SUITE.erl b/lib/cosFileTransfer/test/fileTransfer_SUITE.erl index f877e3ceda..1e27139ed1 100644 --- a/lib/cosFileTransfer/test/fileTransfer_SUITE.erl +++ b/lib/cosFileTransfer/test/fileTransfer_SUITE.erl @@ -25,12 +25,10 @@ -module(fileTransfer_SUITE). - - %%--------------- INCLUDES ----------------------------------- -include_lib("cosFileTransfer/src/cosFileTransferApp.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%--------------- DEFINES ------------------------------------ -define(default_timeout, ?t:minutes(20)). @@ -70,10 +68,11 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, +-export([all/0,suite/0,groups/0, + init_per_group/2,end_per_group/2, cases/0, - init_all/1, - finish_all/1, + init_per_suite/1, + end_per_suite/1, fileIterator_api/1, fts_ftp_file_api/1, fts_ftp_file_ssl_api/1, @@ -82,7 +81,7 @@ fts_native_file_ssl_api/1, fts_native_dir_api/1, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, install_data/2, uninstall_data/1, slave_sup/0, @@ -93,16 +92,30 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for the cosFileTransfer interfaces", ""]; -all(suite) -> {req, - [mnesia, orber], - {conf, init_all, cases(), finish_all}}. - -cases() -> - [fts_ftp_dir_api, fts_ftp_file_api, fts_ftp_file_ssl_api, - fts_native_dir_api, fts_native_file_api, fts_native_file_ssl_api, +suite() -> + [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + + + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [fts_ftp_dir_api, fts_ftp_file_api, + fts_ftp_file_ssl_api, fts_native_dir_api, + fts_native_file_api, fts_native_file_ssl_api, fileIterator_api, app_test]. - + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -112,42 +125,47 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> - orber:jump_start(), - cosProperty:install(), - cosProperty:start(), - Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), - %% Client - cosFileTransferApp:configure(ssl_client_certfile, - filename:join([Dir, "client", "cert.pem"])), - cosFileTransferApp:configure(ssl_client_cacertfile, - filename:join([Dir, "client", "cacerts.pem"])), - cosFileTransferApp:configure(ssl_client_verify, 1), - cosFileTransferApp:configure(ssl_client_depth, 0), - %% Server - cosFileTransferApp:configure(ssl_server_certfile, - filename:join([Dir, "server", "cert.pem"])), - cosFileTransferApp:configure(ssl_server_cacertfile, - filename:join([Dir, "server", "cacerts.pem"])), - cosFileTransferApp:configure(ssl_server_verify, 1), - cosFileTransferApp:configure(ssl_server_depth, 0), - crypto:start(), - ssl:start(), - cosFileTransferApp:install(), - cosFileTransferApp:start(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") +init_per_suite(Config) -> + case code:which(crypto) of + Res when is_atom(Res) -> + {skip,"Could not start crypto!"}; + _Else -> + orber:jump_start(), + cosProperty:install(), + cosProperty:start(), + Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), + %% Client + cosFileTransferApp:configure(ssl_client_certfile, + filename:join([Dir, "client", "cert.pem"])), + cosFileTransferApp:configure(ssl_client_cacertfile, + filename:join([Dir, "client", "cacerts.pem"])), + cosFileTransferApp:configure(ssl_client_verify, 1), + cosFileTransferApp:configure(ssl_client_depth, 0), + %% Server + cosFileTransferApp:configure(ssl_server_certfile, + filename:join([Dir, "server", "cert.pem"])), + cosFileTransferApp:configure(ssl_server_cacertfile, + filename:join([Dir, "server", "cacerts.pem"])), + cosFileTransferApp:configure(ssl_server_verify, 1), + cosFileTransferApp:configure(ssl_server_depth, 0), + crypto:start(), + ssl:start(), + cosFileTransferApp:install(), + cosFileTransferApp:start(), + if + is_list(Config) -> + Config; + true -> + exit("Config not a list") + end end. -finish_all(Config) -> +end_per_suite(Config) -> ssl:stop(), crypto:stop(), cosFileTransferApp:stop(), diff --git a/lib/cosNotification/test/Makefile b/lib/cosNotification/test/Makefile index df8f9e919b..d29c9c3245 100644 --- a/lib/cosNotification/test/Makefile +++ b/lib/cosNotification/test/Makefile @@ -34,6 +34,7 @@ RELSYSDIR = $(RELEASE_PATH)/cosNotification_test # Target Specs # ---------------------------------------------------- TEST_SPEC_FILE = cosNotification.spec +COVER_FILE = cosNotification.cover IDL_FILES = @@ -182,7 +183,7 @@ release_docs_spec: release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(ERL_FILES) $(RELSYSDIR) + $(COVER_FILE) $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DIR) $(RELSYSDIR)/$(IDLOUTDIR) $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ $(RELSYSDIR)/$(IDLOUTDIR) diff --git a/lib/cosNotification/test/cosNotification.cover b/lib/cosNotification/test/cosNotification.cover new file mode 100644 index 0000000000..604f313521 --- /dev/null +++ b/lib/cosNotification/test/cosNotification.cover @@ -0,0 +1,2 @@ +{incl_app,cosNotification,details}. + diff --git a/lib/cosNotification/test/cosNotification.spec b/lib/cosNotification/test/cosNotification.spec index 8df89e7908..8ec1baca33 100644 --- a/lib/cosNotification/test/cosNotification.spec +++ b/lib/cosNotification/test/cosNotification.spec @@ -1,19 +1 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-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% -%% -{topcase, {dir, "../cosNotification_test"}}. +{suites,"../cosNotification_test",all}. diff --git a/lib/cosNotification/test/eventDB_SUITE.erl b/lib/cosNotification/test/eventDB_SUITE.erl index 9ddfb3d902..ee521d4111 100644 --- a/lib/cosNotification/test/eventDB_SUITE.erl +++ b/lib/cosNotification/test/eventDB_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -41,7 +41,7 @@ -include("idl_output/notify_test.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%--------------- DEFINES ------------------------------------ -define(default_timeout, ?t:minutes(20)). @@ -259,25 +259,37 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, reorder_api/1, lookup_api/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + cases/0, init_per_suite/1, end_per_suite/1, reorder_api/1, + lookup_api/1, discard_api/1, max_events_api/1, gc_api/1, auto_gc_api/1, start_stop_time_api/1, mapping_filter_api/1, persisten_event_api/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). %%----------------------------------------------------------------- %% Func: all/1 %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for the cosNotification interfaces", ""]; -all(suite) -> {req, - [mnesia, orber], - {conf, init_all, cases(), finish_all}}. - -cases() -> - [persisten_event_api, start_stop_time_api, mapping_filter_api, - max_events_api, discard_api, reorder_api, lookup_api, gc_api, - auto_gc_api]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [persisten_event_api, start_stop_time_api, + mapping_filter_api, max_events_api, discard_api, + reorder_api, lookup_api, gc_api, auto_gc_api]. @@ -290,12 +302,12 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> Path = code:which(?MODULE), code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), orber:jump_start(), @@ -308,7 +320,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), cosTime:stop(), diff --git a/lib/cosNotification/test/generated_SUITE.erl b/lib/cosNotification/test/generated_SUITE.erl index 34b84041f0..20abfde018 100644 --- a/lib/cosNotification/test/generated_SUITE.erl +++ b/lib/cosNotification/test/generated_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ -module(generated_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -71,12 +71,12 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -84,52 +84,110 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing IC generated files"]; -all(suite) -> - ['CosNotification', 'CosNotification_AdminPropertiesAdmin', - 'CosNotification_EventHeader', 'CosNotification_EventType', - 'CosNotification_FixedEventHeader', 'CosNotification_NamedPropertyRange', - 'CosNotification_Property', 'CosNotification_PropertyError', - 'CosNotification_PropertyRange', 'CosNotification_QoSAdmin', - 'CosNotification_StructuredEvent', 'CosNotification_UnsupportedAdmin', - 'CosNotification_UnsupportedQoS', 'CosNotification_EventBatch', - 'CosNotification_EventTypeSeq', 'CosNotification_NamedPropertyRangeSeq', - 'CosNotification_PropertyErrorSeq', 'CosNotifyChannelAdmin_AdminLimit', - 'CosNotifyChannelAdmin_AdminNotFound', 'CosNotifyChannelAdmin_ChannelNotFound', - 'CosNotifyChannelAdmin_ConnectionAlreadyActive', 'CosNotifyChannelAdmin_ConnectionAlreadyInactive', - 'CosNotifyChannelAdmin_NotConnected', 'CosNotifyChannelAdmin_AdminIDSeq', - 'CosNotifyChannelAdmin_ChannelIDSeq', 'CosNotifyChannelAdmin_ProxyIDSeq', - 'CosNotifyFilter_CallbackNotFound', 'CosNotifyFilter_ConstraintExp', - 'CosNotifyFilter_ConstraintInfo', 'CosNotifyFilter_ConstraintNotFound', - 'CosNotifyFilter_DuplicateConstraintID', 'CosNotifyFilter_FilterNotFound', - 'CosNotifyFilter_InvalidConstraint', 'CosNotifyFilter_InvalidGrammar', - 'CosNotifyFilter_InvalidValue', 'CosNotifyFilter_MappingConstraintInfo', - 'CosNotifyFilter_MappingConstraintPair', 'CosNotifyFilter_UnsupportedFilterableData', - 'CosNotifyFilter_CallbackIDSeq', 'CosNotifyFilter_ConstraintExpSeq', - 'CosNotifyFilter_ConstraintIDSeq', 'CosNotifyFilter_ConstraintInfoSeq', - 'CosNotifyFilter_FilterIDSeq', 'CosNotifyFilter_MappingConstraintInfoSeq', - 'CosNotifyFilter_MappingConstraintPairSeq', 'CosNotifyComm_InvalidEventType', - 'CosNotifyChannelAdmin_ConsumerAdmin', 'CosNotifyChannelAdmin_EventChannel', - 'CosNotifyChannelAdmin_EventChannelFactory', 'CosNotifyChannelAdmin_ProxyConsumer', - 'CosNotifyChannelAdmin_ProxyNotFound', 'CosNotifyChannelAdmin_ProxyPullConsumer', - 'CosNotifyChannelAdmin_ProxyPullSupplier', 'CosNotifyChannelAdmin_ProxyPushConsumer', - 'CosNotifyChannelAdmin_ProxyPushSupplier', 'CosNotifyChannelAdmin_ProxySupplier', - 'CosNotifyChannelAdmin_SequenceProxyPullConsumer', 'CosNotifyChannelAdmin_SequenceProxyPullSupplier', - 'CosNotifyChannelAdmin_SequenceProxyPushConsumer', 'CosNotifyChannelAdmin_SequenceProxyPushSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer', 'CosNotifyChannelAdmin_StructuredProxyPullSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer', 'CosNotifyChannelAdmin_StructuredProxyPushSupplier', - 'CosNotifyChannelAdmin_SupplierAdmin', 'CosNotifyFilter_Filter', - 'CosNotifyFilter_FilterAdmin', 'CosNotifyFilter_FilterFactory', - 'CosNotifyFilter_MappingFilter', 'CosNotifyComm_NotifyPublish', - 'CosNotifyComm_NotifySubscribe', 'CosNotifyComm_PullConsumer', - 'CosNotifyComm_PullSupplier', 'CosNotifyComm_PushConsumer', - 'CosNotifyComm_PushSupplier', 'CosNotifyComm_SequencePullConsumer', - 'CosNotifyComm_SequencePullSupplier', 'CosNotifyComm_SequencePushConsumer', - 'CosNotifyComm_SequencePushSupplier', 'CosNotifyComm_StructuredPullConsumer', - 'CosNotifyComm_StructuredPullSupplier', 'CosNotifyComm_StructuredPushConsumer', - 'CosNotifyComm_StructuredPushSupplier', 'oe_CosNotificationComm_Event', +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + ['CosNotification', + 'CosNotification_AdminPropertiesAdmin', + 'CosNotification_EventHeader', + 'CosNotification_EventType', + 'CosNotification_FixedEventHeader', + 'CosNotification_NamedPropertyRange', + 'CosNotification_Property', + 'CosNotification_PropertyError', + 'CosNotification_PropertyRange', + 'CosNotification_QoSAdmin', + 'CosNotification_StructuredEvent', + 'CosNotification_UnsupportedAdmin', + 'CosNotification_UnsupportedQoS', + 'CosNotification_EventBatch', + 'CosNotification_EventTypeSeq', + 'CosNotification_NamedPropertyRangeSeq', + 'CosNotification_PropertyErrorSeq', + 'CosNotifyChannelAdmin_AdminLimit', + 'CosNotifyChannelAdmin_AdminNotFound', + 'CosNotifyChannelAdmin_ChannelNotFound', + 'CosNotifyChannelAdmin_ConnectionAlreadyActive', + 'CosNotifyChannelAdmin_ConnectionAlreadyInactive', + 'CosNotifyChannelAdmin_NotConnected', + 'CosNotifyChannelAdmin_AdminIDSeq', + 'CosNotifyChannelAdmin_ChannelIDSeq', + 'CosNotifyChannelAdmin_ProxyIDSeq', + 'CosNotifyFilter_CallbackNotFound', + 'CosNotifyFilter_ConstraintExp', + 'CosNotifyFilter_ConstraintInfo', + 'CosNotifyFilter_ConstraintNotFound', + 'CosNotifyFilter_DuplicateConstraintID', + 'CosNotifyFilter_FilterNotFound', + 'CosNotifyFilter_InvalidConstraint', + 'CosNotifyFilter_InvalidGrammar', + 'CosNotifyFilter_InvalidValue', + 'CosNotifyFilter_MappingConstraintInfo', + 'CosNotifyFilter_MappingConstraintPair', + 'CosNotifyFilter_UnsupportedFilterableData', + 'CosNotifyFilter_CallbackIDSeq', + 'CosNotifyFilter_ConstraintExpSeq', + 'CosNotifyFilter_ConstraintIDSeq', + 'CosNotifyFilter_ConstraintInfoSeq', + 'CosNotifyFilter_FilterIDSeq', + 'CosNotifyFilter_MappingConstraintInfoSeq', + 'CosNotifyFilter_MappingConstraintPairSeq', + 'CosNotifyComm_InvalidEventType', + 'CosNotifyChannelAdmin_ConsumerAdmin', + 'CosNotifyChannelAdmin_EventChannel', + 'CosNotifyChannelAdmin_EventChannelFactory', + 'CosNotifyChannelAdmin_ProxyConsumer', + 'CosNotifyChannelAdmin_ProxyNotFound', + 'CosNotifyChannelAdmin_ProxyPullConsumer', + 'CosNotifyChannelAdmin_ProxyPullSupplier', + 'CosNotifyChannelAdmin_ProxyPushConsumer', + 'CosNotifyChannelAdmin_ProxyPushSupplier', + 'CosNotifyChannelAdmin_ProxySupplier', + 'CosNotifyChannelAdmin_SequenceProxyPullConsumer', + 'CosNotifyChannelAdmin_SequenceProxyPullSupplier', + 'CosNotifyChannelAdmin_SequenceProxyPushConsumer', + 'CosNotifyChannelAdmin_SequenceProxyPushSupplier', + 'CosNotifyChannelAdmin_StructuredProxyPullConsumer', + 'CosNotifyChannelAdmin_StructuredProxyPullSupplier', + 'CosNotifyChannelAdmin_StructuredProxyPushConsumer', + 'CosNotifyChannelAdmin_StructuredProxyPushSupplier', + 'CosNotifyChannelAdmin_SupplierAdmin', + 'CosNotifyFilter_Filter', 'CosNotifyFilter_FilterAdmin', + 'CosNotifyFilter_FilterFactory', + 'CosNotifyFilter_MappingFilter', + 'CosNotifyComm_NotifyPublish', + 'CosNotifyComm_NotifySubscribe', + 'CosNotifyComm_PullConsumer', + 'CosNotifyComm_PullSupplier', + 'CosNotifyComm_PushConsumer', + 'CosNotifyComm_PushSupplier', + 'CosNotifyComm_SequencePullConsumer', + 'CosNotifyComm_SequencePullSupplier', + 'CosNotifyComm_SequencePushConsumer', + 'CosNotifyComm_SequencePushSupplier', + 'CosNotifyComm_StructuredPullConsumer', + 'CosNotifyComm_StructuredPullSupplier', + 'CosNotifyComm_StructuredPushConsumer', + 'CosNotifyComm_StructuredPushSupplier', + oe_CosNotificationComm_Event, 'CosNotification_PropertySeq']. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -138,7 +196,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/cosNotification/test/grammar_SUITE.erl b/lib/cosNotification/test/grammar_SUITE.erl index 30aec89e5f..6dbd353dbe 100644 --- a/lib/cosNotification/test/grammar_SUITE.erl +++ b/lib/cosNotification/test/grammar_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -42,7 +42,7 @@ -include("idl_output/notify_test.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%--------------- DEFINES ------------------------------------ -define(default_timeout, ?t:minutes(20)). @@ -64,10 +64,11 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + cases/0, init_per_suite/1, end_per_suite/1, union_api/1, enum_api/1, simple_types_api/1, components_api/1, positional_api/1, variable_api/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). -import(cosNotification_Filter, [create_filter/1, eval/2]). @@ -76,15 +77,25 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for the cosNotification interfaces", ""]; -all(suite) -> {req, - [], - {conf, init_all, cases(), finish_all}}. - -cases() -> - [variable_api, union_api, enum_api, simple_types_api, components_api, - positional_api]. - +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [variable_api, union_api, enum_api, simple_types_api, + components_api, positional_api]. + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -96,14 +107,14 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> Path = code:which(?MODULE), code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), if @@ -113,7 +124,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Config. diff --git a/lib/cosNotification/test/notification_SUITE.erl b/lib/cosNotification/test/notification_SUITE.erl index e2c560e4de..99a3f62bc2 100644 --- a/lib/cosNotification/test/notification_SUITE.erl +++ b/lib/cosNotification/test/notification_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -40,7 +40,7 @@ -include("idl_output/notify_test.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%--------------- DEFINES ------------------------------------ -define(default_timeout, ?t:minutes(20)). @@ -123,10 +123,11 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, qos_api/1, adm_api/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, qos_api/1, adm_api/1, cosevent_api/1, filter_adm_api/1, events_api/1, events2_api/1, event_qos_api/1, filter_api/1, mapping_filter_api/1, subscription_api/1, - init_per_testcase/2, fin_per_testcase/2, persistent_max_events_api/1, + init_per_testcase/2, end_per_testcase/2, persistent_max_events_api/1, persistent_timeout_events_api/1, persistent_recover_events_api/1, app_test/1]). @@ -137,19 +138,28 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for the cosNotification interfaces", ""]; -all(suite) -> {req, - [mnesia, orber], - {conf, init_all, cases(), finish_all}}. - -cases() -> - [persistent_max_events_api, persistent_timeout_events_api, - persistent_recover_events_api, mapping_filter_api, filter_api, filter_adm_api, - event_qos_api, qos_api, adm_api, cosevent_api, subscription_api, - events_api, events2_api, app_test]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. +cases() -> + [persistent_max_events_api, + persistent_timeout_events_api, + persistent_recover_events_api, mapping_filter_api, + filter_api, filter_adm_api, event_qos_api, qos_api, + adm_api, cosevent_api, subscription_api, events_api, + events2_api, app_test]. - %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -161,14 +171,14 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> Path = code:which(?MODULE), code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), ok = corba:orb_init([{flags, 16#02}, {orber_debug_level, 10}]), @@ -184,7 +194,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> cosNotificationApp:stop(), Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), diff --git a/lib/cosNotification/test/notify_test_impl.erl b/lib/cosNotification/test/notify_test_impl.erl index 483610befd..dae7777089 100644 --- a/lib/cosNotification/test/notify_test_impl.erl +++ b/lib/cosNotification/test/notify_test_impl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 diff --git a/lib/cosProperty/test/Makefile b/lib/cosProperty/test/Makefile index ac0f4e298d..d4ae5cad3d 100644 --- a/lib/cosProperty/test/Makefile +++ b/lib/cosProperty/test/Makefile @@ -34,6 +34,7 @@ RELSYSDIR = $(RELEASE_PATH)/cosProperty_test # Target Specs # ---------------------------------------------------- TEST_SPEC_FILE = cosProperty.spec +COVER_FILE = cosProperty.cover IDL_FILES = @@ -121,7 +122,7 @@ release_docs_spec: release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(ERL_FILES) $(RELSYSDIR) + $(COVER_FILE) $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(SUITE_TARGET_FILES) $(RELSYSDIR) # $(INSTALL_DIR) $(RELSYSDIR)/$(IDLOUTDIR) # $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ diff --git a/lib/cosProperty/test/cosProperty.cover b/lib/cosProperty/test/cosProperty.cover new file mode 100644 index 0000000000..a0f5f17671 --- /dev/null +++ b/lib/cosProperty/test/cosProperty.cover @@ -0,0 +1,2 @@ +{incl_app,cosProperty,details}. + diff --git a/lib/cosProperty/test/cosProperty.spec b/lib/cosProperty/test/cosProperty.spec index d3e0001eef..d3d44321c8 100644 --- a/lib/cosProperty/test/cosProperty.spec +++ b/lib/cosProperty/test/cosProperty.spec @@ -1,20 +1 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-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% -%% -{topcase, {dir, "../cosProperty_test"}}. - +{suites,"../cosProperty_test",all}. diff --git a/lib/cosProperty/test/generated_SUITE.erl b/lib/cosProperty/test/generated_SUITE.erl index 80a7953949..63c0c0dd6a 100644 --- a/lib/cosProperty/test/generated_SUITE.erl +++ b/lib/cosProperty/test/generated_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ -module(generated_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -71,12 +71,12 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -84,21 +84,51 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing IC generated files"]; -all(suite) -> - ['CosPropertyService_ConflictingProperty', 'CosPropertyService_ConstraintNotSupported', - 'CosPropertyService_FixedProperty', 'CosPropertyService_InvalidPropertyName', - 'CosPropertyService_MultipleExceptions', 'CosPropertyService_Properties', - 'CosPropertyService_Property', 'CosPropertyService_PropertyDef', - 'CosPropertyService_PropertyDefs', 'CosPropertyService_PropertyException', - 'CosPropertyService_PropertyExceptions', 'CosPropertyService_PropertyMode', - 'CosPropertyService_PropertyModes', 'CosPropertyService_PropertyNames', - 'CosPropertyService_PropertyNotFound', 'CosPropertyService_PropertyTypes', - 'CosPropertyService_ReadOnlyProperty', 'CosPropertyService_UnsupportedMode', - 'CosPropertyService_UnsupportedProperty', 'CosPropertyService_UnsupportedTypeCode', - 'CosPropertyService_PropertyNamesIterator', 'CosPropertyService_PropertiesIterator', - 'CosPropertyService_PropertySet', 'CosPropertyService_PropertySetDef', - 'CosPropertyService_PropertySetDefFactory', 'CosPropertyService_PropertySetFactory']. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + ['CosPropertyService_ConflictingProperty', + 'CosPropertyService_ConstraintNotSupported', + 'CosPropertyService_FixedProperty', + 'CosPropertyService_InvalidPropertyName', + 'CosPropertyService_MultipleExceptions', + 'CosPropertyService_Properties', + 'CosPropertyService_Property', + 'CosPropertyService_PropertyDef', + 'CosPropertyService_PropertyDefs', + 'CosPropertyService_PropertyException', + 'CosPropertyService_PropertyExceptions', + 'CosPropertyService_PropertyMode', + 'CosPropertyService_PropertyModes', + 'CosPropertyService_PropertyNames', + 'CosPropertyService_PropertyNotFound', + 'CosPropertyService_PropertyTypes', + 'CosPropertyService_ReadOnlyProperty', + 'CosPropertyService_UnsupportedMode', + 'CosPropertyService_UnsupportedProperty', + 'CosPropertyService_UnsupportedTypeCode', + 'CosPropertyService_PropertyNamesIterator', + 'CosPropertyService_PropertiesIterator', + 'CosPropertyService_PropertySet', + 'CosPropertyService_PropertySetDef', + 'CosPropertyService_PropertySetDefFactory', + 'CosPropertyService_PropertySetFactory']. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%----------------------------------------------------------------- @@ -109,7 +139,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/cosProperty/test/property_SUITE.erl b/lib/cosProperty/test/property_SUITE.erl index 8fed3128ef..df6b56113e 100644 --- a/lib/cosProperty/test/property_SUITE.erl +++ b/lib/cosProperty/test/property_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -32,7 +32,7 @@ -include_lib("cosProperty/src/cosProperty.hrl"). -include_lib("cosProperty/include/CosPropertyService.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%--------------- DEFINES ------------------------------------ -define(default_timeout, ?t:minutes(20)). @@ -86,8 +86,9 @@ %% External exports %%----------------------------------------------------------------- %% Fixed exports --export([all/1, cases/0, init_all/1, finish_all/1, - init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). %% Test cases -export([create_setdef_api/1, create_set_api/1, define_with_mode_api/1, define_api/1, names_iterator_api/1, properties_iterator_api/1, @@ -98,16 +99,24 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for the cosProperty interfaces", ""]; -all(suite) -> {req, - [mnesia, orber], - {conf, init_all, cases(), finish_all}}. - -cases() -> - [create_setdef_api, create_set_api, define_with_mode_api, define_api, - names_iterator_api, properties_iterator_api, app_test]. - - +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +cases() -> + [create_setdef_api, create_set_api, + define_with_mode_api, define_api, names_iterator_api, + properties_iterator_api, app_test]. %%----------------------------------------------------------------- %% Init and cleanup functions. @@ -120,14 +129,14 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> Path = code:which(?MODULE), code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), orber:jump_start(), @@ -141,7 +150,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), application:stop(cosProperty), diff --git a/lib/cosTime/test/Makefile b/lib/cosTime/test/Makefile index fde5c4facc..96f469afcd 100644 --- a/lib/cosTime/test/Makefile +++ b/lib/cosTime/test/Makefile @@ -34,6 +34,7 @@ RELSYSDIR = $(RELEASE_PATH)/cosTime_test # Target Specs # ---------------------------------------------------- TEST_SPEC_FILE = cosTime.spec +COVER_FILE = cosTime.cover IDL_FILES = @@ -127,7 +128,7 @@ release_docs_spec: release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(ERL_FILES) $(RELSYSDIR) + $(COVER_FILE) $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(SUITE_TARGET_FILES) $(RELSYSDIR) # $(INSTALL_DIR) $(RELSYSDIR)/$(IDLOUTDIR) # $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ diff --git a/lib/cosTime/test/cosTime.cover b/lib/cosTime/test/cosTime.cover new file mode 100644 index 0000000000..81a05b8cfd --- /dev/null +++ b/lib/cosTime/test/cosTime.cover @@ -0,0 +1,2 @@ +{incl_app,cosTime,details}. + diff --git a/lib/cosTime/test/cosTime.spec b/lib/cosTime/test/cosTime.spec index 3f50946043..8bf6f740fe 100644 --- a/lib/cosTime/test/cosTime.spec +++ b/lib/cosTime/test/cosTime.spec @@ -1,19 +1 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-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% -%% -{topcase, {dir, "../cosTime_test"}}. +{suites,"../cosTime_test",all}. diff --git a/lib/cosTime/test/generated_SUITE.erl b/lib/cosTime/test/generated_SUITE.erl index 3a2153528f..465d02288f 100644 --- a/lib/cosTime/test/generated_SUITE.erl +++ b/lib/cosTime/test/generated_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ -module(generated_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -71,12 +71,12 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -84,13 +84,31 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing IC generated files"]; -all(suite) -> - ['TimeBase_IntervalT', 'TimeBase_UtcT', 'CosTime_TimeUnavailable', - 'CosTimerEvent_TimerEventT', 'CosTime_TIO', 'CosTime_TimeService', - 'CosTime_UTO', 'CosTimerEvent_TimerEventHandler', +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + ['TimeBase_IntervalT', 'TimeBase_UtcT', + 'CosTime_TimeUnavailable', 'CosTimerEvent_TimerEventT', + 'CosTime_TIO', 'CosTime_TimeService', 'CosTime_UTO', + 'CosTimerEvent_TimerEventHandler', 'CosTimerEvent_TimerEventService']. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -99,7 +117,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/cosTime/test/time_SUITE.erl b/lib/cosTime/test/time_SUITE.erl index bb00395885..646097a086 100644 --- a/lib/cosTime/test/time_SUITE.erl +++ b/lib/cosTime/test/time_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -27,9 +27,9 @@ %%--------------- INCLUDES ----------------------------------- --include("../src/cosTimeApp.hrl"). +-include_lib("cosTime/src/cosTimeApp.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%--------------- DEFINES ------------------------------------ -define(default_timeout, ?t:minutes(20)). @@ -67,8 +67,9 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, time_api/1, timerevent_api/1, - init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, time_api/1, timerevent_api/1, + init_per_testcase/2, end_per_testcase/2, app_test/1]). %%----------------------------------------------------------------- @@ -76,12 +77,22 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for the cosTime interfaces", ""]; -all(suite) -> {req, - [mnesia, orber], - {conf, init_all, cases(), finish_all}}. - -cases() -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> [time_api, timerevent_api, app_test]. @@ -97,14 +108,14 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> Path = code:which(?MODULE), code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), mnesia:delete_schema([node()]), @@ -123,7 +134,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), cosTime:uninstall_time(), diff --git a/lib/cosTransactions/test/Makefile b/lib/cosTransactions/test/Makefile index 8b1264d404..6bc532aa82 100644 --- a/lib/cosTransactions/test/Makefile +++ b/lib/cosTransactions/test/Makefile @@ -38,6 +38,7 @@ RELSYSDIR = $(RELEASE_PATH)/cosTransactions_test # Target Specs # ---------------------------------------------------- TEST_SPEC_FILE = cosTransactions.spec +COVER_FILE = cosTransactions.cover IDL_FILES = \ @@ -142,7 +143,7 @@ release_docs_spec: release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) + $(COVER_FILE) $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(SUITE_TARGET_FILES) $(RELSYSDIR) $(INSTALL_DIR) $(RELSYSDIR)/$(IDLOUTDIR) $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ diff --git a/lib/cosTransactions/test/cosTransactions.cover b/lib/cosTransactions/test/cosTransactions.cover new file mode 100644 index 0000000000..b27bae999d --- /dev/null +++ b/lib/cosTransactions/test/cosTransactions.cover @@ -0,0 +1,2 @@ +{incl_app,cosTransactions,details}. + diff --git a/lib/cosTransactions/test/cosTransactions.spec b/lib/cosTransactions/test/cosTransactions.spec index 8ad9259964..9918c8ca16 100644 --- a/lib/cosTransactions/test/cosTransactions.spec +++ b/lib/cosTransactions/test/cosTransactions.spec @@ -1,19 +1 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-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% -%% -{topcase, {dir, "../cosTransactions_test"}}. +{suites,"../cosTransactions_test",all}. diff --git a/lib/cosTransactions/test/etrap_test_lib.erl b/lib/cosTransactions/test/etrap_test_lib.erl index 913a94510f..18a1cda35b 100644 --- a/lib/cosTransactions/test/etrap_test_lib.erl +++ b/lib/cosTransactions/test/etrap_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 diff --git a/lib/cosTransactions/test/generated_SUITE.erl b/lib/cosTransactions/test/generated_SUITE.erl index cc54eb168e..65a94266ab 100644 --- a/lib/cosTransactions/test/generated_SUITE.erl +++ b/lib/cosTransactions/test/generated_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -26,7 +26,7 @@ -module(generated_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -72,12 +72,12 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -85,21 +85,49 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing IC generated files"]; -all(suite) -> - ['CosTransactions_Control', 'CosTransactions_Coordinator', - 'CosTransactions_HeuristicCommit', 'CosTransactions_HeuristicHazard', - 'CosTransactions_HeuristicMixed', 'CosTransactions_HeuristicRollback', - 'CosTransactions_Inactive', 'CosTransactions_InvalidControl', - 'CosTransactions_NoTransaction', 'CosTransactions_NotPrepared', - 'CosTransactions_NotSubtransaction', 'CosTransactions_RecoveryCoordinator', - 'CosTransactions_Resource', 'CosTransactions_SubtransactionAwareResource', - 'CosTransactions_SubtransactionsUnavailable', 'CosTransactions_Terminator', - 'CosTransactions_TransactionFactory', 'CosTransactions_Unavailable', - 'CosTransactions_SynchronizationUnavailable', 'CosTransactions_TransIdentity', - 'CosTransactions_PropagationContext', 'CosTransactions_otid_t', +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + ['CosTransactions_Control', + 'CosTransactions_Coordinator', + 'CosTransactions_HeuristicCommit', + 'CosTransactions_HeuristicHazard', + 'CosTransactions_HeuristicMixed', + 'CosTransactions_HeuristicRollback', + 'CosTransactions_Inactive', + 'CosTransactions_InvalidControl', + 'CosTransactions_NoTransaction', + 'CosTransactions_NotPrepared', + 'CosTransactions_NotSubtransaction', + 'CosTransactions_RecoveryCoordinator', + 'CosTransactions_Resource', + 'CosTransactions_SubtransactionAwareResource', + 'CosTransactions_SubtransactionsUnavailable', + 'CosTransactions_Terminator', + 'CosTransactions_TransactionFactory', + 'CosTransactions_Unavailable', + 'CosTransactions_SynchronizationUnavailable', + 'CosTransactions_TransIdentity', + 'CosTransactions_PropagationContext', + 'CosTransactions_otid_t', 'CosTransactions_WrongTransaction', 'ETraP_Server']. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -108,7 +136,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/cosTransactions/test/transactions_SUITE.erl b/lib/cosTransactions/test/transactions_SUITE.erl index 8385d5a0fb..27272eeb40 100644 --- a/lib/cosTransactions/test/transactions_SUITE.erl +++ b/lib/cosTransactions/test/transactions_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -28,7 +28,7 @@ -include_lib("cosTransactions/include/CosTransactions.hrl"). -include("etrap_test_lib.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(20)). @@ -36,20 +36,31 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, resource_api/1, etrap_api/1, - init_per_testcase/2, fin_per_testcase/2, app_test/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, resource_api/1, etrap_api/1, + init_per_testcase/2, end_per_testcase/2, app_test/1]). %%----------------------------------------------------------------- %% Func: all/1 %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for the cosTransactions interfaces", ""]; -all(suite) -> {req, - [mnesia, orber], - {conf, init_all, cases(), finish_all}}. - -cases() -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> [etrap_api, resource_api, app_test]. @@ -67,7 +78,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> 'oe_etrap_test':'oe_unregister'(), 'oe_CosTransactions':'oe_unregister'(), Path = code:which(?MODULE), @@ -76,7 +87,7 @@ fin_per_testcase(_Case, Config) -> test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> mnesia:delete_schema([node()]), mnesia:create_schema([node()]), orber:install([node()]), @@ -89,7 +100,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> application:stop(orber), application:stop(mnesia), mnesia:delete_schema([node()]), diff --git a/lib/crypto/doc/src/notes.xml b/lib/crypto/doc/src/notes.xml index 3c571eb2a3..54dd0cb01f 100644 --- a/lib/crypto/doc/src/notes.xml +++ b/lib/crypto/doc/src/notes.xml @@ -30,6 +30,21 @@ </header> <p>This document describes the changes made to the Crypto application.</p> +<section><title>Crypto 2.0.2</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + AES CTR encryption support in <c>crypto</c>.</p> + <p> + Own Id: OTP-8752 Aux Id: seq11642 </p> + </item> + </list> + </section> + +</section> + <section><title>Crypto 2.0.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/crypto/test/Makefile b/lib/crypto/test/Makefile index e728875027..f4689a23df 100644 --- a/lib/crypto/test/Makefile +++ b/lib/crypto/test/Makefile @@ -76,7 +76,7 @@ release_spec: release_tests_spec: $(TEST_TARGET) $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) crypto.spec $(RELTEST_FILES) $(RELSYSDIR) + $(INSTALL_DATA) crypto.spec crypto.cover $(RELTEST_FILES) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) release_docs_spec: diff --git a/lib/crypto/test/blowfish_SUITE.erl b/lib/crypto/test/blowfish_SUITE.erl index d117e7cc3d..735433cd47 100644 --- a/lib/crypto/test/blowfish_SUITE.erl +++ b/lib/crypto/test/blowfish_SUITE.erl @@ -23,7 +23,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("test_server_line.hrl"). -define(TIMEOUT, 120000). % 2 min @@ -45,8 +45,12 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - crypto:start(), - Config. + case catch crypto:start() of + ok -> + Config; + _Else -> + {skip,"Could not start crypto!"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ @@ -100,15 +104,20 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test Blowfish functionality"]; - -all(suite) -> - [ecb, - cbc, - cfb64, - ofb64 - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> +[ecb, cbc, cfb64, ofb64]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Test cases start here. %%-------------------------------------------------------------------- diff --git a/lib/crypto/test/crypto.cover b/lib/crypto/test/crypto.cover new file mode 100644 index 0000000000..61ee372ec5 --- /dev/null +++ b/lib/crypto/test/crypto.cover @@ -0,0 +1,2 @@ +{incl_app,crypto,details}. + diff --git a/lib/crypto/test/crypto.spec b/lib/crypto/test/crypto.spec index 7ba5696189..cc09970cb3 100644 --- a/lib/crypto/test/crypto.spec +++ b/lib/crypto/test/crypto.spec @@ -1,2 +1 @@ -{topcase, {dir, "../crypto_test"}}. - +{suites,"../crypto_test",all}. diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index 19e10081d8..b29b067967 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -18,12 +18,11 @@ %% -module(crypto_SUITE). --include("test_server.hrl"). --include("test_server_line.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, info/1, link_test/1, md5/1, @@ -44,7 +43,7 @@ aes_cfb/1, aes_cbc/1, aes_cbc_iter/1, - aes_ctr/1, + aes_ctr/1, mod_exp_test/1, rand_uniform_test/1, rsa_verify_test/1, @@ -62,49 +61,41 @@ -export([hexstr2bin/1]). -all(suite) -> - [link_test, - {conf,info,[md5, - md5_update, - md4, - md4_update, - md5_mac, - md5_mac_io, - sha, - sha_update, -%% sha256, -%% sha256_update, -%% sha512, -%% sha512_update, - des_cbc, - aes_cfb, - aes_cbc, - aes_cbc_iter, - aes_ctr, - des_cbc_iter, - des_ecb, - rand_uniform_test, - rsa_verify_test, - dsa_verify_test, - rsa_sign_test, - dsa_sign_test, - rsa_encrypt_decrypt, - dh, - exor_test, - rc4_test, - rc4_stream_test, - mod_exp_test, - blowfish_cfb64, - smp], - cleanup}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [link_test, md5, md5_update, md4, md4_update, md5_mac, + md5_mac_io, sha, sha_update, + %% sha256, sha256_update, sha512,sha512_update, + des_cbc, aes_cfb, aes_cbc, + aes_cbc_iter, aes_ctr, des_cbc_iter, des_ecb, rand_uniform_test, + rsa_verify_test, dsa_verify_test, rsa_sign_test, + dsa_sign_test, rsa_encrypt_decrypt, dh, exor_test, + rc4_test, rc4_stream_test, mod_exp_test, blowfish_cfb64, + smp]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. init_per_testcase(_Name,Config) -> io:format("init_per_testcase\n"), ?line crypto:start(), Config. -fin_per_testcase(_Name,Config) -> - io:format("fin_per_testcase\n"), +end_per_testcase(_Name,Config) -> + io:format("end_per_testcase\n"), ?line crypto:stop(), Config. diff --git a/lib/crypto/vsn.mk b/lib/crypto/vsn.mk index e3549f0c50..4b35c7c0b4 100644 --- a/lib/crypto/vsn.mk +++ b/lib/crypto/vsn.mk @@ -1 +1 @@ -CRYPTO_VSN = 2.0.1 +CRYPTO_VSN = 2.0.2 diff --git a/lib/debugger/doc/src/notes.xml b/lib/debugger/doc/src/notes.xml index c72a5271ba..2f8bdc36a1 100644 --- a/lib/debugger/doc/src/notes.xml +++ b/lib/debugger/doc/src/notes.xml @@ -32,6 +32,20 @@ <p>This document describes the changes made to the Debugger application.</p> +<section><title>Debugger 3.2.5</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>Miscellaneous updates</p> + <p> + Own Id: OTP-8976</p> + </item> + </list> + </section> + +</section> + <section><title>Debugger 3.2.4</title> <section><title>Improvements and New Features</title> diff --git a/lib/debugger/test/Makefile b/lib/debugger/test/Makefile index ac929038f7..47e307fcf9 100644 --- a/lib/debugger/test/Makefile +++ b/lib/debugger/test/Makefile @@ -99,7 +99,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) - $(INSTALL_DATA) debugger.spec $(RELSYSDIR) + $(INSTALL_DATA) debugger.spec debugger.cover $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/debugger/test/andor_SUITE.erl b/lib/debugger/test/andor_SUITE.erl index 3482a22a34..68b2f521d6 100644 --- a/lib/debugger/test/andor_SUITE.erl +++ b/lib/debugger/test/andor_SUITE.erl @@ -20,35 +20,50 @@ %% -module(andor_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, t_andalso/1,t_orelse/1,inside/1,overlap/1, combined/1,in_case/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [{conf,init_all,cases(),finish_all}]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), ?line Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. -cases() -> - [t_andalso,t_orelse,inside,overlap,combined,in_case]. +cases() -> + [t_andalso, t_orelse, inside, overlap, combined, + in_case]. t_andalso(Config) when is_list(Config) -> Bs = [true,false], diff --git a/lib/debugger/test/bs_bincomp_SUITE.erl b/lib/debugger/test/bs_bincomp_SUITE.erl index 8ca2b36f1c..f341700c3b 100644 --- a/lib/debugger/test/bs_bincomp_SUITE.erl +++ b/lib/debugger/test/bs_bincomp_SUITE.erl @@ -23,25 +23,45 @@ -module(bs_bincomp_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, byte_aligned/1,bit_aligned/1,extended_byte_aligned/1, extended_bit_aligned/1,mixed/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -all(suite) -> - [byte_aligned,bit_aligned,extended_byte_aligned, - extended_bit_aligned,mixed]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [byte_aligned, bit_aligned, extended_byte_aligned, + extended_bit_aligned, mixed]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + byte_aligned(Config) when is_list(Config) -> diff --git a/lib/debugger/test/bs_construct_SUITE.erl b/lib/debugger/test/bs_construct_SUITE.erl index efc125c582..c51e7fbf4c 100644 --- a/lib/debugger/test/bs_construct_SUITE.erl +++ b/lib/debugger/test/bs_construct_SUITE.erl @@ -19,35 +19,49 @@ -module(bs_construct_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, test1/1, test2/1, test3/1, test4/1, test5/1, testf/1, not_used/1, in_guard/1, coerce_to_float/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [test1, test2, test3, test4, test5, testf, - not_used, in_guard, coerce_to_float]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [test1, test2, test3, test4, test5, testf, not_used, + in_guard, coerce_to_float]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. big(1) -> diff --git a/lib/debugger/test/bs_match_bin_SUITE.erl b/lib/debugger/test/bs_match_bin_SUITE.erl index 3966dc41ef..fe2a8d6698 100644 --- a/lib/debugger/test/bs_match_bin_SUITE.erl +++ b/lib/debugger/test/bs_match_bin_SUITE.erl @@ -21,33 +21,47 @@ -module(bs_match_bin_SUITE). -author('[email protected]'). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, byte_split_binary/1,bit_split_binary/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [byte_split_binary,bit_split_binary]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [byte_split_binary, bit_split_binary]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. byte_split_binary(doc) -> "Tries to split a binary at all byte-aligned positions."; diff --git a/lib/debugger/test/bs_match_int_SUITE.erl b/lib/debugger/test/bs_match_int_SUITE.erl index 1159ac9ef8..c667e7cbce 100644 --- a/lib/debugger/test/bs_match_int_SUITE.erl +++ b/lib/debugger/test/bs_match_int_SUITE.erl @@ -20,35 +20,49 @@ -module(bs_match_int_SUITE). -author('[email protected]'). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, integer/1,signed_integer/1,dynamic/1,more_dynamic/1,mml/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -import(lists, [seq/2]). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [integer,signed_integer,dynamic,more_dynamic,mml]. +all() -> + [cases()]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [integer, signed_integer, dynamic, more_dynamic, mml]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), Dog = test_server:timetrap(?t:minutes(4)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. integer(suite) -> []; diff --git a/lib/debugger/test/bs_match_misc_SUITE.erl b/lib/debugger/test/bs_match_misc_SUITE.erl index 5e1160a8e9..e7ea355c9d 100644 --- a/lib/debugger/test/bs_match_misc_SUITE.erl +++ b/lib/debugger/test/bs_match_misc_SUITE.erl @@ -20,33 +20,47 @@ -module(bs_match_misc_SUITE). -author('[email protected]'). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, bound_var/1,bound_tail/1,t_float/1,little_float/1,sean/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [bound_var,bound_tail,t_float,little_float,sean]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [bound_var, bound_tail, t_float, little_float, sean]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. bound_var(doc) -> "Test matching of bound variables."; diff --git a/lib/debugger/test/bs_match_tail_SUITE.erl b/lib/debugger/test/bs_match_tail_SUITE.erl index 7fa16b3c6a..282eebcd25 100644 --- a/lib/debugger/test/bs_match_tail_SUITE.erl +++ b/lib/debugger/test/bs_match_tail_SUITE.erl @@ -20,33 +20,47 @@ -module(bs_match_tail_SUITE). -author('[email protected]'). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, aligned/1,unaligned/1,zero_tail/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [aligned,unaligned,zero_tail]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [aligned, unaligned, zero_tail]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. aligned(doc) -> "Test aligned tails."; diff --git a/lib/debugger/test/bs_utf_SUITE.erl b/lib/debugger/test/bs_utf_SUITE.erl index 3d69d2a101..b61638fa25 100644 --- a/lib/debugger/test/bs_utf_SUITE.erl +++ b/lib/debugger/test/bs_utf_SUITE.erl @@ -21,37 +21,50 @@ -module(bs_utf_SUITE). --export([all/1,init_all/1,finish_all/1, - init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1,end_per_suite/1, + init_per_testcase/2,end_per_testcase/2, utf8_roundtrip/1,unused_utf_char/1,utf16_roundtrip/1, utf32_roundtrip/1,guard/1,extreme_tripping/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -compile([no_jopt,time]). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [utf8_roundtrip,unused_utf_char,utf16_roundtrip, - utf32_roundtrip,guard,extreme_tripping]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [utf8_roundtrip, unused_utf_char, utf16_roundtrip, + utf32_roundtrip, guard, extreme_tripping]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. utf8_roundtrip(Config) when is_list(Config) -> diff --git a/lib/debugger/test/bug_SUITE.erl b/lib/debugger/test/bug_SUITE.erl index cf732c8115..d881b9ab08 100644 --- a/lib/debugger/test/bug_SUITE.erl +++ b/lib/debugger/test/bug_SUITE.erl @@ -20,18 +20,34 @@ %% -module(bug_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). - --export([ticket_tests/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([otp2163/1, otp4845/1]). -all(suite) -> [ticket_tests]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, ticket_tests}]. + +groups() -> + [{ticket_tests, [], [otp2163, otp4845]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -ticket_tests(doc) -> ["Tests tickets regarding bugs"]; -ticket_tests(suite) -> [otp2163, otp4845]. otp2163(doc) -> ["BIF exit reason"]; otp2163(suite) -> []; diff --git a/lib/debugger/test/cleanup.erl b/lib/debugger/test/cleanup.erl index 59b4c35ac7..5f1ea71d2e 100644 --- a/lib/debugger/test/cleanup.erl +++ b/lib/debugger/test/cleanup.erl @@ -20,11 +20,22 @@ %% -module(cleanup). --export([all/1, cleanup/1]). +-export([all/0,groups/0,init_per_group/2,end_per_group/2, cleanup/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +all() -> +[cleanup]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> {req, [interpreter], [cleanup]}. cleanup(suite) -> []; cleanup(_) -> diff --git a/lib/debugger/test/dbg_ui_SUITE.erl b/lib/debugger/test/dbg_ui_SUITE.erl index 629aac9fd6..e59c23442a 100644 --- a/lib/debugger/test/dbg_ui_SUITE.erl +++ b/lib/debugger/test/dbg_ui_SUITE.erl @@ -21,23 +21,17 @@ -module(dbg_ui_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Test server specific exports --export([all/1]). --export([function_tests/1]). - +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). % Test cases must be exported. -export ([dbg_ui/1]). - - - - % Manual test suites/cases exports --export([manual_tests/1]). -export([start1/1, interpret1/1, quit1/1, start2/1, interpret2/1, break2/1, options2/1, quit2/1, interpret3/1, all_step3/1,all_next3/1,save3/1,restore3/1,finish3/1, @@ -46,33 +40,42 @@ attach5/1, normal5/1, exit5/1, options5/1, distsetup6/1, all_step6/1, all_next6/1]). - - - --export([init_per_testcase/2, fin_per_testcase/2]). - - +-export([init_per_testcase/2, end_per_testcase/2]). init_per_testcase(_Func, Config) -> Dog=test_server:timetrap(60*1000), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog). -all (suite)-> - {req, [debugger], [function_tests, manual_tests]}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [dbg_ui, {group, manual_tests}]. +groups() -> + [{manual_tests, [], + [start1, interpret1, quit1, start2, interpret2, break2, + options2, interpret3, all_step3, all_next3, save3, + restore3, finish3, killinit3, killone3, killall3, + deleteone3, deleteall3, viewbreak4, delete4, attach5, + normal5, exit5, options5, distsetup6, all_step6, + all_next6]}]. -function_tests (doc) -> - ["Tests documented functions"]; +init_per_suite(Config) -> + Config. -function_tests (suite) -> - [dbg_ui]. +end_per_suite(_Config) -> + ok. +init_per_group(_GroupName, Config) -> + Config. +end_per_group(_GroupName, Config) -> + Config. dbg_ui (doc) -> ["Debugger GUI"]; @@ -84,7 +87,7 @@ dbg_ui (_Config) -> case os:getenv("DISPLAY") of false -> {skipped,"No display"}; - Other when list(Other) -> + Other when is_list(Other) -> % ?line {ok, Pid} = debugger:start (), % ?line ok = is_pid (Pid), % ?line true = erlang:is_process_alive(Pid), @@ -93,11 +96,6 @@ dbg_ui (_Config) -> {skipped,"Gunilla: Workaround"} end. - - - - - %% check/2 - returns the result for the specified testcase. %% pass - means the user has run the case, and it passed %% fail - means the user has run the case, and it failed @@ -162,23 +160,6 @@ check(Case, Config) -> ). - - -manual_tests(doc) -> ["Manual tests"]; -manual_tests(suite) -> [start1, interpret1, quit1, - start2, interpret2, break2, options2, - interpret3, all_step3,all_next3,save3,restore3,finish3, - killinit3, killone3, killall3, deleteone3, deleteall3, - viewbreak4, delete4, - attach5, normal5, exit5, options5, - distsetup6, all_step6, all_next6 - ]. - - - - - - %% SET 1 ?MAN_CASE(start1, "Start the debugger from the toolbar", "Before proceeding with the test cases, please move or remove diff --git a/lib/debugger/test/debugger.cover b/lib/debugger/test/debugger.cover new file mode 100644 index 0000000000..509ddc0ec1 --- /dev/null +++ b/lib/debugger/test/debugger.cover @@ -0,0 +1,2 @@ +{incl_app,debugger,details}. + diff --git a/lib/debugger/test/debugger.spec b/lib/debugger/test/debugger.spec index cc8a5aff37..7aef026e77 100644 --- a/lib/debugger/test/debugger.spec +++ b/lib/debugger/test/debugger.spec @@ -1 +1 @@ -{topcase, {dir, "../debugger_test"}}. +{suites,"../debugger_test",all}. diff --git a/lib/debugger/test/debugger_SUITE.erl b/lib/debugger/test/debugger_SUITE.erl index 4bd9057f98..747d9e343d 100644 --- a/lib/debugger/test/debugger_SUITE.erl +++ b/lib/debugger/test/debugger_SUITE.erl @@ -22,19 +22,40 @@ %% Test break points. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, app_test/1,erts_debug/1,encrypted_debug_info/1, no_abstract_code/1]). -all(suite) -> - [app_test,erts_debug,no_abstract_code,encrypted_debug_info]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [app_test, erts_debug, no_abstract_code, + encrypted_debug_info]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> Dog=test_server:timetrap(?t:minutes(0.5)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/debugger/test/erl_eval_SUITE.erl b/lib/debugger/test/erl_eval_SUITE.erl index fd4d28b2c7..67ca3d4867 100644 --- a/lib/debugger/test/erl_eval_SUITE.erl +++ b/lib/debugger/test/erl_eval_SUITE.erl @@ -17,7 +17,8 @@ %% %CopyrightEnd% -module(erl_eval_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([guard_1/1, guard_2/1, match_pattern/1, @@ -57,26 +58,43 @@ config(priv_dir,_) -> ".". -else. --include("test_server.hrl"). --export([init_per_testcase/2, fin_per_testcase/2]). +-include_lib("test_server/include/test_server.hrl"). +-export([init_per_testcase/2, end_per_testcase/2]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -endif. -all(doc) -> - ["Test cases for the 'erl_eval' module."]; -all(suite) -> - [guard_1, guard_2, match_pattern, string_plusplus, pattern_expr, - match_bin, guard_3, guard_4, - lc, simple_cases, unary_plus, apply_atom, otp_5269, otp_6539, otp_6543, - otp_6787, otp_6977, otp_7550, otp_8133, funs, try_catch, eval_expr_5]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [guard_1, guard_2, match_pattern, string_plusplus, + pattern_expr, match_bin, guard_3, guard_4, lc, + simple_cases, unary_plus, apply_atom, otp_5269, + otp_6539, otp_6543, otp_6787, otp_6977, otp_7550, + otp_8133, funs, try_catch, eval_expr_5]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + guard_1(doc) -> ["(OTP-2405)"]; diff --git a/lib/debugger/test/exception_SUITE.erl b/lib/debugger/test/exception_SUITE.erl index a74a93fd22..e6d627b40e 100644 --- a/lib/debugger/test/exception_SUITE.erl +++ b/lib/debugger/test/exception_SUITE.erl @@ -20,17 +20,31 @@ %% -module(exception_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, badmatch/1,pending_errors/1,nil_arith/1]). -export([bad_guy/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> [badmatch, pending_errors, nil_arith]. -define(try_match(E), @@ -42,17 +56,17 @@ init_per_testcase(_Case, Config) -> Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. badmatch(doc) -> "Test that deliberately bad matches are reported correctly."; diff --git a/lib/debugger/test/fun_SUITE.erl b/lib/debugger/test/fun_SUITE.erl index 721048b6b6..f56c6fe4bf 100644 --- a/lib/debugger/test/fun_SUITE.erl +++ b/lib/debugger/test/fun_SUITE.erl @@ -20,20 +20,33 @@ %% -module(fun_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, init_per_testcase/2,end_per_testcase/2, - init_all/1,finish_all/1, + init_per_suite/1,end_per_suite/1, good_call/1,bad_apply/1,bad_fun_call/1,badarity/1, ext_badarity/1,otp_6061/1]). -export([nothing/0]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [good_call,bad_apply,bad_fun_call,badarity,ext_badarity,otp_6061]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [good_call, bad_apply, bad_fun_call, badarity, + ext_badarity, otp_6061]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), @@ -45,12 +58,12 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. good_call(Config) when is_list(Config) -> diff --git a/lib/debugger/test/guard_SUITE.erl b/lib/debugger/test/guard_SUITE.erl index b5269989c8..dd8a2fe4d5 100644 --- a/lib/debugger/test/guard_SUITE.erl +++ b/lib/debugger/test/guard_SUITE.erl @@ -20,7 +20,9 @@ %% -module(guard_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, bad_arith/1,bad_tuple/1,test_heap_guards/1,guard_bifs/1, type_tests/1,const_guard/1, const_cond/1,basic_not/1,complex_not/1, @@ -35,41 +37,52 @@ basic_andalso_orelse/1,traverse_dcd/1, check_qlc_hrl/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -export([init/4]). -import(lists, [member/2]). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [bad_arith,bad_tuple,test_heap_guards,guard_bifs,type_tests,const_guard, - const_cond,basic_not,complex_not, - semicolon,complex_semicolon, - comma,or_guard,more_or_guards, - complex_or_guards,and_guard, - xor_guard,more_xor_guards, - build_in_guard,old_guard_tests,gbif, - t_is_boolean,is_function_2,tricky,rel_ops, - basic_andalso_orelse,traverse_dcd,check_qlc_hrl]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [bad_arith, bad_tuple, test_heap_guards, guard_bifs, + type_tests, const_guard, const_cond, basic_not, + complex_not, semicolon, complex_semicolon, comma, + or_guard, more_or_guards, complex_or_guards, and_guard, + xor_guard, more_xor_guards, build_in_guard, + old_guard_tests, gbif, t_is_boolean, is_function_2, + tricky, rel_ops, basic_andalso_orelse, traverse_dcd, + check_qlc_hrl]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), ?line Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. bad_arith(doc) -> "Test that a bad arithmetic operation in a guard works correctly."; diff --git a/lib/debugger/test/int_SUITE.erl b/lib/debugger/test/int_SUITE.erl index 0326325888..fb3a828fa1 100644 --- a/lib/debugger/test/int_SUITE.erl +++ b/lib/debugger/test/int_SUITE.erl @@ -19,15 +19,16 @@ %% -module(int_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([init_per_testcase/2, end_per_testcase/2]). %% Test cases --export([interpret/1, guards/1, list_suite/1, interpretable/1]). --export([append/1, append_1/1, append_2/1, member/1, reverse/1]). +-export([interpret/1, guards/1, interpretable/1]). +-export([ append_1/1, append_2/1, member/1, reverse/1]). %% Default timetrap timeout (set in init_per_testcase) -define(default_timeout, ?t:minutes(1)). @@ -59,8 +60,27 @@ end_per_testcase(_Case, Config) -> ?line test_server:timetrap_cancel(Dog), ?line ok. -all(suite)-> - [interpret, guards, list_suite, interpretable]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [interpret, guards, {group, list_suite}, interpretable]. + +groups() -> + [{list_suite, [], [{group, append}, reverse, member]}, + {append, [], [append_1, append_2]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + interpret(suite) -> []; @@ -97,13 +117,7 @@ guards(Config) when is_list(Config) -> ok = guards:guards(). -list_suite(suite) -> - [append, reverse, member]. -append(doc) -> - ["Tests lists1:append/1 & lists1:append/2"]; -append(suite) -> - [append_1, append_2]. append_1(suite) -> []; diff --git a/lib/debugger/test/int_break_SUITE.erl b/lib/debugger/test/int_break_SUITE.erl index b7b3c5598a..d2ffd2938d 100644 --- a/lib/debugger/test/int_break_SUITE.erl +++ b/lib/debugger/test/int_break_SUITE.erl @@ -22,15 +22,35 @@ %% Test break points. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, basic/1,cleanup/1]). -export([auto_attach/1]). -all(suite) -> - [basic,cleanup]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic, cleanup]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line DataDir = ?config(data_dir, Config), @@ -40,7 +60,7 @@ init_per_testcase(_Case, Config) -> ?line Dog = test_server:timetrap(?t:minutes(0.5)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> ?line ok = io:format("Interpreted modules: ~p", [int:interpreted()]), ?line Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), diff --git a/lib/debugger/test/int_eval_SUITE.erl b/lib/debugger/test/int_eval_SUITE.erl index 1628ca69b1..6051bfc5ed 100644 --- a/lib/debugger/test/int_eval_SUITE.erl +++ b/lib/debugger/test/int_eval_SUITE.erl @@ -22,7 +22,9 @@ %% Purpose: Deeper test of the evaluator. --export([all/1,init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, bifs_outside_erlang/1, spawning/1, applying/1, catch_and_throw/1, external_call/1, test_module_info/1, apply_interpreted_fun/1, apply_uninterpreted_fun/1, @@ -33,26 +35,41 @@ -define(IM, my_int_eval_module). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [bifs_outside_erlang,spawning,applying,catch_and_throw, - external_call,test_module_info, - apply_interpreted_fun,apply_uninterpreted_fun, +suite() -> [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. + +all() -> + [bifs_outside_erlang, spawning, applying, + catch_and_throw, external_call, test_module_info, + apply_interpreted_fun, apply_uninterpreted_fun, interpreted_exit, otp_8310]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + init_per_testcase(_Case, Config) -> ?line DataDir = ?config(data_dir, Config), ?line {module,?IM} = int:i(filename:join(DataDir, ?IM)), ?line ok = io:format("Interpreted modules: ~p",[int:interpreted()]), - {ok, Dog} = timer:apply_after(timer:minutes(1), - erlang, exit, [self(), kill]), - [{watchdog,Dog}|Config]. + Config. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, _Config) -> ok = io:format("Interpreted modules: ~p", [int:interpreted()]), - Dog = ?config(watchdog, Config), - timer:cancel(Dog), ok. bifs_outside_erlang(doc) -> diff --git a/lib/debugger/test/lc_SUITE.erl b/lib/debugger/test/lc_SUITE.erl index a22a689ec8..f8ab9311e9 100644 --- a/lib/debugger/test/lc_SUITE.erl +++ b/lib/debugger/test/lc_SUITE.erl @@ -21,15 +21,29 @@ -module(lc_SUITE). -author('[email protected]'). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, basic/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> [basic]. init_per_testcase(_Case, Config) -> @@ -37,17 +51,17 @@ init_per_testcase(_Case, Config) -> Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. basic(Config) when list(Config) -> diff --git a/lib/debugger/test/record_SUITE.erl b/lib/debugger/test/record_SUITE.erl index 06fd01555e..83351231d7 100644 --- a/lib/debugger/test/record_SUITE.erl +++ b/lib/debugger/test/record_SUITE.erl @@ -22,33 +22,47 @@ -module(record_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, errors/1,record_test/1,eval_once/1]). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [errors,record_test,eval_once]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [errors, record_test, eval_once]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. -record(foo, {a,b,c,d}). diff --git a/lib/debugger/test/trycatch_SUITE.erl b/lib/debugger/test/trycatch_SUITE.erl index 5901cdc9e5..aa9d898c02 100644 --- a/lib/debugger/test/trycatch_SUITE.erl +++ b/lib/debugger/test/trycatch_SUITE.erl @@ -20,37 +20,51 @@ %% -module(trycatch_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2,init_all/1,finish_all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + init_per_suite/1,end_per_suite/1, basic/1,lean_throw/1,try_of/1,try_after/1,%after_bind/1, catch_oops/1,after_oops/1,eclectic/1,rethrow/1, nested_of/1,nested_catch/1,nested_after/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [{conf,init_all,cases(),finish_all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [basic,lean_throw,try_of,try_after,%after_bind, - catch_oops,after_oops,eclectic,rethrow, - nested_of,nested_catch,nested_after]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [basic, lean_throw, try_of, try_after, catch_oops, + after_oops, eclectic, rethrow, nested_of, nested_catch, + nested_after]. init_per_testcase(_Case, Config) -> test_lib:interpret(?MODULE), Dog = test_server:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> ?line test_lib:interpret(?MODULE), ?line true = lists:member(?MODULE, int:interpreted()), - ok. + Config. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> ok. basic(Conf) when is_list(Conf) -> diff --git a/lib/debugger/vsn.mk b/lib/debugger/vsn.mk index 654dc11e20..b9786b4a75 100644 --- a/lib/debugger/vsn.mk +++ b/lib/debugger/vsn.mk @@ -1 +1 @@ -DEBUGGER_VSN = 3.2.4 +DEBUGGER_VSN = 3.2.5 diff --git a/lib/dialyzer/RELEASE_NOTES b/lib/dialyzer/RELEASE_NOTES index 08f274a996..3fd5e9cc7d 100644 --- a/lib/dialyzer/RELEASE_NOTES +++ b/lib/dialyzer/RELEASE_NOTES @@ -3,8 +3,13 @@ (in reversed chronological order) ============================================================================== -Version 2.x.x (in Erlang/OTP R14B01) +Version 2.4.0 (in Erlang/OTP R14B01) ------------------------------------ + - Added ability to supply multiple PLTs for the analysis (option --plts). + Currently these PLTs must be independent (i.e., no module appears in more + than one PLT) and there must not include files with module name clashes. + - Strengthened and streamlined hard-coded type information for some BIFs + and key library functions. - Fixed pretty rare infinite loop when refining the types of an SCC whose functions all returned none() (thanks to Stavros Aronis). - Fixed pretty rare crash when taking the infimum of two tuple_sets. diff --git a/lib/dialyzer/doc/manual.txt b/lib/dialyzer/doc/manual.txt index d9cb52f722..cc6f9130c7 100644 --- a/lib/dialyzer/doc/manual.txt +++ b/lib/dialyzer/doc/manual.txt @@ -123,9 +123,9 @@ The exit status of the command line version is: Usage: dialyzer [--help] [--version] [--shell] [--quiet] [--verbose] - [-pa dir]* [--plt plt] [--plts plts] [-Ddefine]* + [-pa dir]* [--plt plt] [--plts plt*] [-Ddefine]* [-I include_dir]* [--output_plt file] [-Wwarn]* - [--src] [--gui | --wx] [files_or_dirs] [-r dirs] + [--src] [--gui | --wx] [files_or_dirs] [-r dirs] [--apps applications] [-o outfile] [--build_plt] [--add_to_plt] [--remove_from_plt] [--check_plt] [--no_check_plt] [--plt_info] [--get_warnings] @@ -135,63 +135,75 @@ Options: files_or_dirs (for backwards compatibility also as: -c files_or_dirs) Use Dialyzer from the command line to detect defects in the specified files or directories containing .erl or .beam files, - depending on the type of the analysis + depending on the type of the analysis. -r dirs Same as the previous but the specified directories are searched recursively for subdirectories containing .erl or .beam files in - them, depending on the type of analysis + them, depending on the type of analysis. --apps applications - Option typically used when building or modifying PLT as in: + Option typically used when building or modifying a plt as in: dialyzer --build_plt --apps erts kernel stdlib mnesia ... to conveniently refer to library applications corresponding to the Erlang/OTP installation. However, the option is general and can also be used during analysis in order to refer to Erlang/OTP applications. In addition, file or directory names can also be included, as in: dialyzer --apps inets ssl ./ebin ../other_lib/ebin/my_module.beam + -o outfile (or --output outfile) + When using Dialyzer from the command line, send the analysis + results to the specified outfile rather than to stdout. --raw When using Dialyzer from the command line, output the raw analysis results (Erlang terms) instead of the formatted result. The raw format is easier to post-process (for instance, to filter - warnings or to output HTML pages) + warnings or to output HTML pages). --src - Override the default, which is to analyze BEAM bytecode, and - analyze starting from Erlang source code instead + Override the default, which is to analyze BEAM files, and + analyze starting from Erlang source code instead. -Dname (or -Dname=value) - When analyzing from source, pass the define to Dialyzer (**) + When analyzing from source, pass the define to Dialyzer. (**) -I include_dir - When analyzing from source, pass the include_dir to Dialyzer (**) + When analyzing from source, pass the include_dir to Dialyzer. (**) -pa dir Include dir in the path for Erlang (useful when analyzing files - that have '-include_lib()' directives) + that have '-include_lib()' directives). --output_plt file - Store the plt at the specified file after building it + Store the plt at the specified file after building it. --plt plt Use the specified plt as the initial plt (if the plt was built - during setup the files will be checked for consistency) - --plts plts - Merges the specified plts to create the initial plt -- requires - that the plts are disjoint (i.e., do not have any module - appearing in more than one plt) + during setup the files will be checked for consistency). + --plts plt* + Merge the specified plts to create the initial plt -- requires + that the plts are disjoint (i.e., do not have any module + appearing in more than one plt). + The plts are created in the usual way: + dialyzer --build_plt --output_plt plt_1 files_to_include + ... + dialyzer --build_plt --output_plt plt_n files_to_include + and then can be used in either of the following ways: + dialyzer files_to_analyze --plts plt_1 ... plt_n + or: + dialyzer --plts plt_1 ... plt_n -- files_to_analyze + (Note the -- delimiter in the second case) -Wwarn A family of options which selectively turn on/off warnings - (for help on the names of warnings use dialyzer -Whelp) + (for help on the names of warnings use dialyzer -Whelp). --shell - Do not disable the Erlang shell while running the GUI + Do not disable the Erlang shell while running the GUI. --version (or -v) - Prints the Dialyzer version and some more information and exits + Print the Dialyzer version and some more information and exit. --help (or -h) - Prints this message and exits + Print this message and exit. --quiet (or -q) - Makes Dialyzer a bit more quiet + Make Dialyzer a bit more quiet. --verbose - Makes Dialyzer a bit more verbose + Make Dialyzer a bit more verbose. --build_plt The analysis starts from an empty plt and creates a new one from the files specified with -c and -r. Only works for beam files. Use --plt or --output_plt to override the default plt location. --add_to_plt The plt is extended to also include the files specified with -c and -r. - Use --plt to specify wich plt to start from, and --output_plt to + Use --plt to specify which plt to start from, and --output_plt to specify where to put the plt. Note that the analysis might include files from the plt if they depend on the new files. This option only works with beam files. @@ -200,23 +212,23 @@ Options: from the plt. Note that this may cause a re-analysis of the remaining dependent files. --check_plt - Checks the plt for consistency and rebuilds it if it is not up-to-date. + Check the plt for consistency and rebuild it if it is not up-to-date. --no_check_plt Skip the plt check when running Dialyzer. Useful when working with installed plts that never change. --plt_info - Makes Dialyzer print information about the plt and then quit. The plt - can be specified with --plt. + Make Dialyzer print information about the plt and then quit. The plt + can be specified with --plt(s). --get_warnings - Makes Dialyzer emit warnings even when manipulating the plt. Only - emits warnings for files that are actually analyzed. + Make Dialyzer emit warnings even when manipulating the plt. Warnings + are only emitted for files that are actually analyzed. --dump_callgraph file Dump the call graph into the specified file whose format is determined by the file name extension. Supported extensions are: raw, dot, and ps. If something else is used as file name extension, default format '.raw' will be used. --no_native (or -nn) - Bypass the native code compilation of some key files that dialyzer + Bypass the native code compilation of some key files that Dialyzer heuristically performs when dialyzing many files; this avoids the compilation time but it may result in (much) longer analysis time. --gui @@ -236,12 +248,17 @@ Warning options: Suppress warnings for unused functions. -Wno_improper_lists Suppress warnings for construction of improper lists. + -Wno_tuple_as_fun + Suppress warnings for using tuples instead of funs. -Wno_fun_app Suppress warnings for fun applications that will fail. -Wno_match Suppress warnings for patterns that are unused or cannot match. + -Wno_opaque + Suppress warnings for violations of opaqueness of data types. -Wunmatched_returns *** - Include warnings for function calls which ignore the return value(s). + Include warnings for function calls which ignore a structured return + value or do not match against one of many possible return value(s). -Werror_handling *** Include warnings for functions that only return by means of an exception. -Wrace_conditions *** @@ -262,7 +279,7 @@ The following options are also available but their use is not recommended: Warn when the -spec is different than the success typing. Note: - *** These are options that turn on warnings rather than turning them off. + *** Identifies options that turn on warnings rather than turning them off. ----------------------------------------------- diff --git a/lib/dialyzer/doc/src/dialyzer.xml b/lib/dialyzer/doc/src/dialyzer.xml index 29308885fd..01a7e478bc 100644 --- a/lib/dialyzer/doc/src/dialyzer.xml +++ b/lib/dialyzer/doc/src/dialyzer.xml @@ -64,81 +64,144 @@ ]]></code> <p>Usage:</p> <code type="none"><![CDATA[ - dialyzer [--help] [--version] [--shell] [--quiet] [--verbose] - [-pa dir]* [--plt plt] [-Ddefine]* [-I include_dir]* - [--output_plt file] [-Wwarn]* [--src] - [-c applications] [-r applications] [-o outfile] + dialyzer [--help] [--version] [--shell] [--quiet] [--verbose] + [-pa dir]* [--plt plt] [--plts plt*] [-Ddefine]* + [-I include_dir]* [--output_plt file] [-Wwarn]* + [--src] [--gui | --wx] [files_or_dirs] [-r dirs] + [--apps applications] [-o outfile] [--build_plt] [--add_to_plt] [--remove_from_plt] [--check_plt] [--no_check_plt] [--plt_info] [--get_warnings] + [--no_native] ]]></code> <p>Options:</p> <taglist> - <tag><c><![CDATA[-c applications]]></c>(or <c><![CDATA[--command-line applications]]></c>)</tag> - <item>use Dialyzer from the command line (no GUI) to detect defects in the - specified applications (directories or <c><![CDATA[.erl]]></c> or <c><![CDATA[.beam]]></c> files)</item> - <tag><c><![CDATA[-r applications]]></c></tag> - <item>same as <c><![CDATA[-c]]></c> only that directories are searched recursively for - subdirectories containing <c><![CDATA[.erl]]></c> or <c><![CDATA[.beam]]></c> files (depending on the - type of analysis)</item> - <tag><c><![CDATA[-o outfile]]></c>(or <c><![CDATA[--output outfile]]></c>)</tag> - <item>when using Dialyzer from the command line, send the analysis - results in the specified <c><![CDATA[outfile]]></c> rather than in stdout</item> - <tag><c><![CDATA[--src]]></c></tag> - <item>override the default, which is to analyze debug compiled BEAM - bytecode, and analyze starting from Erlang source code instead</item> + <tag><c><![CDATA[files_or_dirs]]></c> (for backwards compatibility also + as: <c><![CDATA[-c files_or_dirs]]></c></tag> + <item>Use Dialyzer from the command line to detect defects in the + specified files or directories containing <c><![CDATA[.erl]]></c> or + <c><![CDATA[.beam]]></c> files, depending on the type of the + analysis.</item> + <tag><c><![CDATA[-r dirs]]></c></tag> + <item>Same as the previous but the specified directories are searched + recursively for subdirectories containing <c><![CDATA[.erl]]></c> or + <c><![CDATA[.beam]]></c> files in them, depending on the type of + analysis.</item> + <tag><c><![CDATA[--apps applications]]></c></tag> + <item>Option typically used when building or modifying a plt as in: + <code type="none"><![CDATA[ + dialyzer --build_plt --apps erts kernel stdlib mnesia ... + ]]></code> + to conveniently refer to library applications corresponding to the + Erlang/OTP installation. However, the option is general and can also + be used during analysis in order to refer to Erlang/OTP applications. + In addition, file or directory names can also be included, as in: + <code type="none"><![CDATA[ + dialyzer --apps inets ssl ./ebin ../other_lib/ebin/my_module.beam + ]]></code></item> + <tag><c><![CDATA[-o outfile]]></c> (or + <c><![CDATA[--output outfile]]></c>)</tag> + <item>When using Dialyzer from the command line, send the analysis + results to the specified outfile rather than to stdout.</item> <tag><c><![CDATA[--raw]]></c></tag> <item>When using Dialyzer from the command line, output the raw analysis - results (Erlang terms) instead of the formatted result. - The raw format is easier to post-process (for instance, to filter - warnings or to output HTML pages).</item> - <tag><c><![CDATA[-Dname]]></c>(or <c><![CDATA[-Dname=value]]></c>)</tag> - <item>when analyzing from source, pass the define to Dialyzer (**)</item> + results (Erlang terms) instead of the formatted result. The raw format + is easier to post-process (for instance, to filter warnings or to + output HTML pages).</item> + <tag><c><![CDATA[--src]]></c></tag> + <item>Override the default, which is to analyze BEAM files, and + analyze starting from Erlang source code instead.</item> + <tag><c><![CDATA[-Dname]]></c> (or <c><![CDATA[-Dname=value]]></c>)</tag> + <item>When analyzing from source, pass the define to Dialyzer. (**)</item> <tag><c><![CDATA[-I include_dir]]></c></tag> - <item>when analyzing from source, pass the <c><![CDATA[include_dir]]></c> to Dialyzer (**)</item> + <item>When analyzing from source, pass the <c><![CDATA[include_dir]]></c> + to Dialyzer. (**)</item> <tag><c><![CDATA[-pa dir]]></c></tag> - <item>Include <c><![CDATA[dir]]></c> in the path for Erlang. Useful when analyzing files - that have <c><![CDATA[-include_lib()]]></c> directives.</item> + <item>Include <c><![CDATA[dir]]></c> in the path for Erlang (useful when + analyzing files that have <c><![CDATA['-include_lib()']]></c> + directives).</item> <tag><c><![CDATA[--output_plt file]]></c></tag> - <item>Store the PLT at the specified location after building it.</item> + <item>Store the plt at the specified file after building it.</item> <tag><c><![CDATA[--plt plt]]></c></tag> - <item>Use the specified PLT as the initial persistent lookup table.</item> + <item>Use the specified plt as the initial plt (if the plt was built + during setup the files will be checked for consistency).</item> + <tag><c><![CDATA[--plts plt*]]></c></tag> + <item>Merge the specified plts to create the initial plt -- requires + that the plts are disjoint (i.e., do not have any module + appearing in more than one plt). + The plts are created in the usual way: + <code type="none"><![CDATA[ + dialyzer --build_plt --output_plt plt_1 files_to_include + ... + dialyzer --build_plt --output_plt plt_n files_to_include + ]]></code> + and then can be used in either of the following ways: + <code type="none"><![CDATA[ + dialyzer files_to_analyze --plts plt_1 ... plt_n + ]]></code> + or: + <code type="none"><![CDATA[ + dialyzer --plts plt_1 ... plt_n -- files_to_analyze + ]]></code> + (Note the -- delimiter in the second case)</item> <tag><c><![CDATA[-Wwarn]]></c></tag> - <item>a family of options which selectively turn on/off warnings. - (for help on the names of warnings use <c><![CDATA[dialyzer -Whelp]]></c>)</item> + <item>A family of options which selectively turn on/off warnings + (for help on the names of warnings use + <c><![CDATA[dialyzer -Whelp]]></c>).</item> <tag><c><![CDATA[--shell]]></c></tag> - <item>do not disable the Erlang shell while running the GUI</item> - <tag><c><![CDATA[--version (or -v)]]></c></tag> - <item>prints the Dialyzer version and some more information and exits</item> - <tag><c><![CDATA[--help (or -h)]]></c></tag> - <item>prints this message and exits</item> - <tag><c><![CDATA[--quiet (or -q)]]></c></tag> - <item>makes Dialyzer a bit more quiet</item> + <item>Do not disable the Erlang shell while running the GUI.</item> + <tag><c><![CDATA[--version]]></c> (or <c><![CDATA[-v]]></c>)</tag> + <item>Print the Dialyzer version and some more information and + exit.</item> + <tag><c><![CDATA[--help]]></c> (or <c><![CDATA[-h]]></c>)</tag> + <item>Print this message and exit.</item> + <tag><c><![CDATA[--quiet]]></c> (or <c><![CDATA[-q]]></c>)</tag> + <item>Make Dialyzer a bit more quiet.</item> <tag><c><![CDATA[--verbose]]></c></tag> - <item>makes Dialyzer a bit more verbose</item> - <tag><c><![CDATA[--check_plt]]></c></tag> - <item>Only checks if the initial PLT is up to date and rebuilds it if this is not the case</item> - <tag><c><![CDATA[--no_check_plt (or -n)]]></c></tag> - <item>Skip the PLT integrity check when running Dialyzer. - Useful when working with installed PLTs that never change.</item> + <item>Make Dialyzer a bit more verbose.</item> <tag><c><![CDATA[--build_plt]]></c></tag> - <item>The analysis starts from an empty PLT and creates a new one from - the files specified with -c and -r. Only works for beam files. - Use --plt or --output_plt to override the default PLT location.</item> - <tag><c><![CDATA[--add_to_plt]]></c></tag> - <item> The PLT is extended to also include the files specified with - -c and -r. Use --plt to specify which PLT to start from, and --output_plt - to specify where to put the PLT. Note that the analysis might include - files from the PLT if they depend on the new files. - This option only works with beam files.</item> + <item>The analysis starts from an empty plt and creates a new one from + the files specified with <c><![CDATA[-c]]></c> and + <c><![CDATA[-r]]></c>. Only works for beam files. Use + <c><![CDATA[--plt]]></c> or <c><![CDATA[--output_plt]]></c> to + override the default plt location.</item> + <tag><c><![CDATA[--add_to_plt]]></c></tag> + <item>The plt is extended to also include the files specified with + <c><![CDATA[-c]]></c> and <c><![CDATA[-r]]></c>. Use + <c><![CDATA[--plt]]></c> to specify which plt to start from, + and <c><![CDATA[--output_plt]]></c> to specify where to put the plt. + Note that the analysis might include files from the plt if they depend + on the new files. This option only works with beam files.</item> <tag><c><![CDATA[--remove_from_plt]]></c></tag> - <item>The information from the files specified with -c and -r is removed - from the PLT. Note that this may cause a re-analysis of the remaining - dependent files.</item> + <item>The information from the files specified with + <c><![CDATA[-c]]></c> and <c><![CDATA[-r]]></c> is removed + from the plt. Note that this may cause a re-analysis of the remaining + dependent files.</item> + <tag><c><![CDATA[--check_plt]]></c></tag> + <item>Check the plt for consistency and rebuild it if it is not + up-to-date.</item> + <tag><c><![CDATA[--no_check_plt]]></c></tag> + <item>Skip the plt check when running Dialyzer. Useful when working with + installed plts that never change.</item> + <tag><c><![CDATA[--plt_info]]></c></tag> + <item>Make Dialyzer print information about the plt and then quit. The + plt can be specified with <c><![CDATA[--plt(s)]]></c>.</item> <tag><c><![CDATA[--get_warnings]]></c></tag> - <item>Makes Dialyzer emit warnings even when manipulating the PLT. Only - emits warnings for files that are actually analyzed. The default is to - not emit any warnings when manipulating the PLT. This option has no - effect when performing a normal analysis.</item> + <item>Make Dialyzer emit warnings even when manipulating the plt. + Warnings are only emitted for files that are actually analyzed.</item> + <tag><c><![CDATA[--dump_callgraph file]]></c></tag> + <item>Dump the call graph into the specified file whose format is + determined by the file name extension. Supported extensions are: raw, + dot, and ps. If something else is used as file name extension, default + format '.raw' will be used.</item> + <tag><c><![CDATA[--no_native]]></c> (or <c><![CDATA[-nn]]></c>)</tag> + <item>Bypass the native code compilation of some key files that Dialyzer + heuristically performs when dialyzing many files; this avoids the + compilation time but it may result in (much) longer analysis + time.</item> + <tag><c><![CDATA[--gui]]></c></tag> + <item>Use the gs-based GUI.</item> + <tag><c><![CDATA[--wx]]></c></tag> + <item>Use the wx-based GUI..</item> </taglist> <note> <p>* denotes that multiple occurrences of these options are possible.</p> @@ -148,11 +211,14 @@ <p>Warning options:</p> <taglist> <tag><c><![CDATA[-Wno_return]]></c></tag> - <item>Suppress warnings for functions of no return.</item> + <item>Suppress warnings for functions that will never return a + value.</item> <tag><c><![CDATA[-Wno_unused]]></c></tag> <item>Suppress warnings for unused functions.</item> <tag><c><![CDATA[-Wno_improper_lists]]></c></tag> <item>Suppress warnings for construction of improper lists.</item> + <tag><c><![CDATA[-Wno_tuple_as_fun]]></c></tag> + <item>Suppress warnings for using tuples instead of funs.</item> <tag><c><![CDATA[-Wno_fun_app]]></c></tag> <item>Suppress warnings for fun applications that will fail.</item> <tag><c><![CDATA[-Wno_match]]></c></tag> @@ -160,6 +226,10 @@ match.</item> <tag><c><![CDATA[-Wno_opaque]]></c></tag> <item>Suppress warnings for violations of opaqueness of data types.</item> + <tag><c><![CDATA[-Wunmatched_returns]]></c>***</tag> + <item>Include warnings for function calls which ignore a structured return + value or do not match against one of many possible return + value(s).</item> <tag><c><![CDATA[-Werror_handling]]></c>***</tag> <item>Include warnings for functions that only return by means of an exception.</item> @@ -168,20 +238,22 @@ <tag><c><![CDATA[-Wbehaviours]]></c>***</tag> <item>Include warnings about behaviour callbacks which drift from the published recommended interfaces.</item> - <tag><c><![CDATA[-Wunmatched_returns]]></c>***</tag> - <item>Include warnings for function calls which ignore a structured return - value or do not match against one of many possible return value(s).</item> <tag><c><![CDATA[-Wunderspecs]]></c>***</tag> <item>Warn about underspecified functions - (the -spec is strictly more allowing than the success typing)</item> + (the -spec is strictly more allowing than the success typing).</item> + </taglist> + <p>The following options are also available but their use is not + recommended: (they are mostly for Dialyzer developers and internal + debugging)</p> + <taglist> <tag><c><![CDATA[-Woverspecs]]></c>***</tag> <item>Warn about overspecified functions - (the -spec is strictly less allowing than the success typing)</item> + (the -spec is strictly less allowing than the success typing).</item> <tag><c><![CDATA[-Wspecdiffs]]></c>***</tag> - <item>Warn when the -spec is different than the success typing</item> + <item>Warn when the -spec is different than the success typing.</item> </taglist> <note> - <p>*** These are options that turn on warnings rather than + <p>*** Identifies options that turn on warnings rather than turning them off.</p> </note> </section> @@ -210,6 +282,7 @@ Option : {files, [Filename : string()]} | {defines, [{Macro: atom(), Value : term()}]} | {from, src_code | byte_code} %% Defaults to byte_code | {init_plt, FileName : string()} %% If changed from default + | {plts, [FileName :: string()]} %% If changed from default | {include_dirs, [DirName : string()]} | {output_file, FileName : string()} | {output_plt, FileName :: string()} diff --git a/lib/dialyzer/doc/src/notes.xml b/lib/dialyzer/doc/src/notes.xml index ac3857b9ef..3678291be7 100755 --- a/lib/dialyzer/doc/src/notes.xml +++ b/lib/dialyzer/doc/src/notes.xml @@ -31,6 +31,40 @@ <p>This document describes the changes made to the Dialyzer application.</p> +<section><title>Dialyzer 2.4.0</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> - Fixed pretty rare infinite loop when refining the + types of an SCC whose functions all returned none() + (thanks to Stavros Aronis). </p><p> - Fixed pretty rare + crash when taking the infimum of two tuple_sets. </p> + <p> + Own Id: OTP-8979</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> - Added ability to supply multiple PLTs for the + analysis (option --plts). Currently these PLTs must be + independent (i.e., no module appears in more than one + PLT) and there must not include files with module name + clashes.</p><p> - Strengthened and streamlined hard-coded + type information for some BIFs and key library + functions.</p> + <p> + Own Id: OTP-8962</p> + </item> + </list> + </section> + +</section> + <section><title>Dialyzer 2.3.1</title> <section><title>Improvements and New Features</title> diff --git a/lib/dialyzer/src/dialyzer_cl_parse.erl b/lib/dialyzer/src/dialyzer_cl_parse.erl index 2f9e577544..5ca7599b35 100644 --- a/lib/dialyzer/src/dialyzer_cl_parse.erl +++ b/lib/dialyzer/src/dialyzer_cl_parse.erl @@ -329,7 +329,7 @@ help_warnings() -> help_message() -> S = "Usage: dialyzer [--help] [--version] [--shell] [--quiet] [--verbose] - [-pa dir]* [--plt plt] [--plts plts] [-Ddefine]* + [-pa dir]* [--plt plt] [--plts plt*] [-Ddefine]* [-I include_dir]* [--output_plt file] [-Wwarn]* [--src] [--gui | --wx] [files_or_dirs] [-r dirs] [--apps applications] [-o outfile] @@ -340,13 +340,13 @@ Options: files_or_dirs (for backwards compatibility also as: -c files_or_dirs) Use Dialyzer from the command line to detect defects in the specified files or directories containing .erl or .beam files, - depending on the type of the analysis + depending on the type of the analysis. -r dirs Same as the previous but the specified directories are searched recursively for subdirectories containing .erl or .beam files in - them, depending on the type of analysis + them, depending on the type of analysis. --apps applications - Option typically used when building or modifying a PLT as in: + Option typically used when building or modifying a plt as in: dialyzer --build_plt --apps erts kernel stdlib mnesia ... to conveniently refer to library applications corresponding to the Erlang/OTP installation. However, the option is general and can also @@ -355,51 +355,60 @@ Options: dialyzer --apps inets ssl ./ebin ../other_lib/ebin/my_module.beam -o outfile (or --output outfile) When using Dialyzer from the command line, send the analysis - results to the specified \"outfile\" rather than to stdout + results to the specified outfile rather than to stdout. --raw When using Dialyzer from the command line, output the raw analysis results (Erlang terms) instead of the formatted result. The raw format is easier to post-process (for instance, to filter - warnings or to output HTML pages) + warnings or to output HTML pages). --src Override the default, which is to analyze BEAM files, and - analyze starting from Erlang source code instead + analyze starting from Erlang source code instead. -Dname (or -Dname=value) - When analyzing from source, pass the define to Dialyzer (**) + When analyzing from source, pass the define to Dialyzer. (**) -I include_dir - When analyzing from source, pass the include_dir to Dialyzer (**) + When analyzing from source, pass the include_dir to Dialyzer. (**) -pa dir Include dir in the path for Erlang (useful when analyzing files - that have '-include_lib()' directives) + that have '-include_lib()' directives). --output_plt file - Store the plt at the specified file after building it + Store the plt at the specified file after building it. --plt plt Use the specified plt as the initial plt (if the plt was built - during setup the files will be checked for consistency) - --plts plts - Merges the specified plts to create the initial plt -- requires + during setup the files will be checked for consistency). + --plts plt* + Merge the specified plts to create the initial plt -- requires that the plts are disjoint (i.e., do not have any module - appearing in more than one plt) + appearing in more than one plt). + The plts are created in the usual way: + dialyzer --build_plt --output_plt plt_1 files_to_include + ... + dialyzer --build_plt --output_plt plt_n files_to_include + and then can be used in either of the following ways: + dialyzer files_to_analyze --plts plt_1 ... plt_n + or: + dialyzer --plts plt_1 ... plt_n -- files_to_analyze + (Note the -- delimiter in the second case) -Wwarn A family of options which selectively turn on/off warnings - (for help on the names of warnings use dialyzer -Whelp) + (for help on the names of warnings use dialyzer -Whelp). --shell - Do not disable the Erlang shell while running the GUI + Do not disable the Erlang shell while running the GUI. --version (or -v) - Prints the Dialyzer version and some more information and exits + Print the Dialyzer version and some more information and exit. --help (or -h) - Prints this message and exits + Print this message and exit. --quiet (or -q) - Makes Dialyzer a bit more quiet + Make Dialyzer a bit more quiet. --verbose - Makes Dialyzer a bit more verbose + Make Dialyzer a bit more verbose. --build_plt The analysis starts from an empty plt and creates a new one from the files specified with -c and -r. Only works for beam files. Use --plt(s) or --output_plt to override the default plt location. --add_to_plt The plt is extended to also include the files specified with -c and -r. - Use --plt(s) to specify wich plt to start from, and --output_plt to + Use --plt(s) to specify which plt to start from, and --output_plt to specify where to put the plt. Note that the analysis might include files from the plt if they depend on the new files. This option only works with beam files. @@ -408,24 +417,24 @@ Options: from the plt. Note that this may cause a re-analysis of the remaining dependent files. --check_plt - Checks the plt for consistency and rebuilds it if it is not up-to-date. + Check the plt for consistency and rebuild it if it is not up-to-date. Actually, this option is of rare use as it is on by default. --no_check_plt (or -n) Skip the plt check when running Dialyzer. Useful when working with installed plts that never change. --plt_info - Makes Dialyzer print information about the plt and then quit. The plt + Make Dialyzer print information about the plt and then quit. The plt can be specified with --plt(s). --get_warnings - Makes Dialyzer emit warnings even when manipulating the plt. Only - emits warnings for files that are actually analyzed. + Make Dialyzer emit warnings even when manipulating the plt. Warnings + are only emitted for files that are actually analyzed. --dump_callgraph file Dump the call graph into the specified file whose format is determined by the file name extension. Supported extensions are: raw, dot, and ps. If something else is used as file name extension, default format '.raw' will be used. --no_native (or -nn) - Bypass the native code compilation of some key files that dialyzer + Bypass the native code compilation of some key files that Dialyzer heuristically performs when dialyzing many files; this avoids the compilation time but it may result in (much) longer analysis time. --gui diff --git a/lib/dialyzer/src/dialyzer_typesig.erl b/lib/dialyzer/src/dialyzer_typesig.erl index f68472d2fc..c45615d670 100644 --- a/lib/dialyzer/src/dialyzer_typesig.erl +++ b/lib/dialyzer/src/dialyzer_typesig.erl @@ -1406,9 +1406,13 @@ get_bif_constr({erlang, 'or', 2}, Dst, [Arg1, Arg2] = Args, _State) -> ArgV1 = mk_fun_var(ArgFun(Arg2), [Arg2, Dst]), ArgV2 = mk_fun_var(ArgFun(Arg1), [Arg1, Dst]), DstV = mk_fun_var(DstFun, Args), - Disj = mk_disj_constraint_list([mk_constraint(Arg1, sub, True), - mk_constraint(Arg2, sub, True), - mk_constraint(Dst, sub, False)]), + F = fun(A) -> + try [mk_constraint(A, sub, True)] + catch throw:error -> [] + end + end, + Constrs = F(Arg1) ++ F(Arg2), + Disj = mk_disj_constraint_list([mk_constraint(Dst, sub, False)|Constrs]), mk_conj_constraint_list([mk_constraint(Dst, sub, DstV), mk_constraint(Arg1, sub, ArgV1), mk_constraint(Arg2, sub, ArgV2), diff --git a/lib/dialyzer/vsn.mk b/lib/dialyzer/vsn.mk index d3574e0a71..b2902e95ed 100644 --- a/lib/dialyzer/vsn.mk +++ b/lib/dialyzer/vsn.mk @@ -1 +1 @@ -DIALYZER_VSN = 2.3.1 +DIALYZER_VSN = 2.4.0 diff --git a/lib/docbuilder/doc/src/notes.xml b/lib/docbuilder/doc/src/notes.xml index 019cf1b083..4b8c04f323 100644 --- a/lib/docbuilder/doc/src/notes.xml +++ b/lib/docbuilder/doc/src/notes.xml @@ -31,6 +31,21 @@ <p>This document describes the changes made to the DocBuilder application.</p> +<section><title>Docbuilder 0.9.8.9</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> Fix compatibility issues with docbuilder for R11 + documentation patches. </p> + <p> + Own Id: OTP-8946</p> + </item> + </list> + </section> + +</section> + <section><title>Docbuilder 0.9.8.8</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/docbuilder/test/Makefile b/lib/docbuilder/test/Makefile index 080479ee71..96b940033e 100644 --- a/lib/docbuilder/test/Makefile +++ b/lib/docbuilder/test/Makefile @@ -71,7 +71,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) $(SPEC_FILES) $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) $(SPEC_FILES) docb.cover $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/docbuilder/test/docb.cover b/lib/docbuilder/test/docb.cover new file mode 100644 index 0000000000..80bab6eba7 --- /dev/null +++ b/lib/docbuilder/test/docb.cover @@ -0,0 +1,2 @@ +{incl_app,docbuilder,details} + diff --git a/lib/docbuilder/test/docb_SUITE.erl b/lib/docbuilder/test/docb_SUITE.erl index c871130521..d286824539 100644 --- a/lib/docbuilder/test/docb_SUITE.erl +++ b/lib/docbuilder/test/docb_SUITE.erl @@ -17,13 +17,32 @@ %% -module(docb_SUITE). --export([all/1,html/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2,html/1]). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("kernel/include/file.hrl"). -all(suite) -> [html]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> +[html]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + html(suite) -> []; html(Config) when is_list(Config) -> diff --git a/lib/docbuilder/vsn.mk b/lib/docbuilder/vsn.mk index b23ee521c7..1209b80d94 100644 --- a/lib/docbuilder/vsn.mk +++ b/lib/docbuilder/vsn.mk @@ -1 +1 @@ -DOCB_VSN = 0.9.8.8 +DOCB_VSN = 0.9.8.9 diff --git a/lib/edoc/doc/src/notes.xml b/lib/edoc/doc/src/notes.xml index 83ad27ed31..afcccf22b5 100644 --- a/lib/edoc/doc/src/notes.xml +++ b/lib/edoc/doc/src/notes.xml @@ -31,6 +31,21 @@ <p>This document describes the changes made to the EDoc application.</p> +<section><title>Edoc 0.7.6.8</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Compiler warnings were eliminated.</p> + <p> + Own Id: OTP-8855</p> + </item> + </list> + </section> + +</section> + <section><title>Edoc 0.7.6.7</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/edoc/test/Makefile b/lib/edoc/test/Makefile index 4ce9799f6d..f77bbaa09b 100644 --- a/lib/edoc/test/Makefile +++ b/lib/edoc/test/Makefile @@ -59,7 +59,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) - $(INSTALL_DATA) edoc.spec $(RELSYSDIR) + $(INSTALL_DATA) edoc.spec edoc.cover $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/edoc/test/edoc.cover b/lib/edoc/test/edoc.cover new file mode 100644 index 0000000000..50140fafde --- /dev/null +++ b/lib/edoc/test/edoc.cover @@ -0,0 +1,2 @@ +{incl_app,edoc,details}. + diff --git a/lib/edoc/test/edoc.spec b/lib/edoc/test/edoc.spec index 8443a28028..8371427270 100644 --- a/lib/edoc/test/edoc.spec +++ b/lib/edoc/test/edoc.spec @@ -1 +1 @@ -{topcase, {dir, "../edoc_test"}}. +{suites,"../edoc_test",all}. diff --git a/lib/edoc/test/edoc_SUITE.erl b/lib/edoc/test/edoc_SUITE.erl index ea833f89b2..0d57591e3e 100644 --- a/lib/edoc/test/edoc_SUITE.erl +++ b/lib/edoc/test/edoc_SUITE.erl @@ -17,17 +17,36 @@ %% -module(edoc_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %% Test cases -export([build_std/1]). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [build_std]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + build_std(suite) -> []; build_std(doc) -> diff --git a/lib/edoc/vsn.mk b/lib/edoc/vsn.mk index 75e9a5c971..e030174862 100644 --- a/lib/edoc/vsn.mk +++ b/lib/edoc/vsn.mk @@ -1 +1 @@ -EDOC_VSN = 0.7.6.7 +EDOC_VSN = 0.7.6.8 diff --git a/lib/erl_docgen/doc/src/notes.xml b/lib/erl_docgen/doc/src/notes.xml index 5b5398fec6..c7a7926c40 100644 --- a/lib/erl_docgen/doc/src/notes.xml +++ b/lib/erl_docgen/doc/src/notes.xml @@ -29,7 +29,36 @@ <file>notes.xml</file> </header> <p>This document describes the changes made to the erl_docgen application.</p> - <section><title>Erl_Docgen 0.2.2</title> + <section><title>Erl_Docgen 0.2.3</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> Fix format_man_pages so it handles all man sections + and remove warnings/errors in various man pages. </p> + <p> + Own Id: OTP-8600</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> Support for using Dialyzer specifications and types + has been added. This is an experimental release; changes + are expected before the new functionality is used when + building the OTP documentation. </p> + <p> + Own Id: OTP-8720</p> + </item> + </list> + </section> + +</section> + +<section><title>Erl_Docgen 0.2.2</title> <section><title>Fixed Bugs and Malfunctions</title> <list> diff --git a/lib/erl_docgen/vsn.mk b/lib/erl_docgen/vsn.mk index 0bc01f7d49..fb0f5ca0cd 100644 --- a/lib/erl_docgen/vsn.mk +++ b/lib/erl_docgen/vsn.mk @@ -1 +1 @@ -ERL_DOCGEN_VSN = 0.2.2 +ERL_DOCGEN_VSN = 0.2.3 diff --git a/lib/erl_interface/doc/src/ei.xml b/lib/erl_interface/doc/src/ei.xml index d7af7a1b67..de4e4b4301 100644 --- a/lib/erl_interface/doc/src/ei.xml +++ b/lib/erl_interface/doc/src/ei.xml @@ -641,12 +641,14 @@ ei_x_encode_empty_list(&x); <p></p> <pre> ~a - an atom, char* +~c - a character, char ~s - a string, char* ~i - an integer, int ~l - a long integer, long int ~u - a unsigned long integer, unsigned long int ~f - a float, float ~d - a double float, double float +~p - an Erlang PID, erlang_pid* </pre> <p>For instance, to encode a tuple with some stuff:</p> <pre> diff --git a/lib/erl_interface/doc/src/notes.xml b/lib/erl_interface/doc/src/notes.xml index ff89802599..de5ba61938 100644 --- a/lib/erl_interface/doc/src/notes.xml +++ b/lib/erl_interface/doc/src/notes.xml @@ -30,6 +30,56 @@ </header> <p>This document describes the changes made to the Erl_interface application.</p> +<section><title>Erl_Interface 3.7.2</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + erl_call: remove get_hostent</p> + <p> + get_hostent does not properly handle IPv4 addresses on + little endian platforms and fails with hostnames + beginning with a number. Remove get_hostent and use + ei_gethostbyname directly since gethostbyname supports + IPv4 addresses.</p> + <p> + (Thanks to Michael Santos)</p> + <p> + Own Id: OTP-8890</p> + </item> + <item> + <p> teach ei_x_format to handle unary - and + (Thanks to + Steve Vinoski)</p> + <p> + Own Id: OTP-8891</p> + </item> + <item> + <p>Fix zero byte allocation in registry. (Thanks to + Michael Santos)</p> + <p> + Own Id: OTP-8893</p> + </item> + <item> + <p> Check the length of the node name to prevent an + overflow. Memory error control of ei_alloc_big. (Thanks + to Michael Santos) </p> + <p> + Own Id: OTP-8943</p> + </item> + <item> + <p> + erl_term_len() in erl_interface could returned too large + values for integers (since R14B) and too small values for + refs (since R9B).</p> + <p> + Own Id: OTP-8945</p> + </item> + </list> + </section> + +</section> + <section><title>Erl_Interface 3.7.1.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> diff --git a/lib/erl_interface/include/ei.h b/lib/erl_interface/include/ei.h index 466d84bb99..ae815b414a 100644 --- a/lib/erl_interface/include/ei.h +++ b/lib/erl_interface/include/ei.h @@ -80,21 +80,24 @@ #define ERL_NO_TIMEOUT -1 /* these are the control message types */ -#define ERL_LINK 1 -#define ERL_SEND 2 -#define ERL_EXIT 3 -#define ERL_UNLINK 4 -#define ERL_NODE_LINK 5 -#define ERL_REG_SEND 6 -#define ERL_GROUP_LEADER 7 -#define ERL_EXIT2 8 -#define ERL_PASS_THROUGH 'p' +#define ERL_LINK 1 +#define ERL_SEND 2 +#define ERL_EXIT 3 +#define ERL_UNLINK 4 +#define ERL_NODE_LINK 5 +#define ERL_REG_SEND 6 +#define ERL_GROUP_LEADER 7 +#define ERL_EXIT2 8 +#define ERL_PASS_THROUGH 'p' /* new ones for tracing, from Kenneth */ -#define ERL_SEND_TT 12 -#define ERL_EXIT_TT 13 -#define ERL_REG_SEND_TT 16 -#define ERL_EXIT2_TT 18 +#define ERL_SEND_TT 12 +#define ERL_EXIT_TT 13 +#define ERL_REG_SEND_TT 16 +#define ERL_EXIT2_TT 18 +#define ERL_MONITOR_P 19 +#define ERL_DEMONITOR_P 20 +#define ERL_MONITOR_P_EXIT 21 /* -------------------------------------------------------------------- */ diff --git a/lib/erl_interface/src/connect/ei_connect.c b/lib/erl_interface/src/connect/ei_connect.c index 99ccba0686..6dc6ebb348 100644 --- a/lib/erl_interface/src/connect/ei_connect.c +++ b/lib/erl_interface/src/connect/ei_connect.c @@ -938,7 +938,7 @@ int ei_do_receive_msg(int fd, int staticbuffer_p, return ERL_ERROR; } x->index = x->buffsz; - switch (msg->msgtype) { /* FIXME are these all? */ + switch (msg->msgtype) { /* FIXME does not handle trace tokens and monitors */ case ERL_SEND: case ERL_REG_SEND: case ERL_LINK: @@ -946,7 +946,6 @@ int ei_do_receive_msg(int fd, int staticbuffer_p, case ERL_GROUP_LEADER: case ERL_EXIT: case ERL_EXIT2: - case ERL_NODE_LINK: return ERL_MSG; default: @@ -1329,6 +1328,7 @@ static int send_name_or_challenge(int fd, char *nodename, put8(s, 'n'); put16be(s, version); put32be(s, (DFLAG_EXTENDED_REFERENCES + | DFLAG_DIST_MONITOR | DFLAG_EXTENDED_PIDS_PORTS | DFLAG_FUN_TAGS | DFLAG_NEW_FUN_TAGS diff --git a/lib/erl_interface/src/connect/eirecv.c b/lib/erl_interface/src/connect/eirecv.c index 7d72ddeeae..86852f947d 100644 --- a/lib/erl_interface/src/connect/eirecv.c +++ b/lib/erl_interface/src/connect/eirecv.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 1998-2009. All Rights Reserved. + * Copyright Ericsson AB 1998-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 @@ -196,10 +196,6 @@ ei_recv_internal (int fd, ei_trace(1,&msg->token); /* turn on tracing */ break; - case ERL_NODE_LINK: /* { NODE_LINK } */ - if (ei_tracelevel >= 4) show_this_msg = 1; - break; - default: /* unknown type, just put any remaining bytes into buffer */ break; diff --git a/lib/erl_interface/src/decode/decode_atom.c b/lib/erl_interface/src/decode/decode_atom.c index b247bd4e17..ef28838b79 100644 --- a/lib/erl_interface/src/decode/decode_atom.c +++ b/lib/erl_interface/src/decode/decode_atom.c @@ -31,6 +31,8 @@ int ei_decode_atom(const char *buf, int *index, char *p) len = get16be(s); + if (len > MAXATOMLEN) return -1; + if (p) { memmove(p,s,len); p[len] = (char)0; diff --git a/lib/erl_interface/src/decode/decode_pid.c b/lib/erl_interface/src/decode/decode_pid.c index 5f2aec3b44..48a0c68240 100644 --- a/lib/erl_interface/src/decode/decode_pid.c +++ b/lib/erl_interface/src/decode/decode_pid.c @@ -33,6 +33,8 @@ int ei_decode_pid(const char *buf, int *index, erlang_pid *p) if (get8(s) != ERL_ATOM_EXT) return -1; len = get16be(s); + + if (len > MAXATOMLEN) return -1; if (p) { memmove(p->node, s, len); diff --git a/lib/erl_interface/src/decode/decode_port.c b/lib/erl_interface/src/decode/decode_port.c index 7fb7d8d414..296ebae024 100644 --- a/lib/erl_interface/src/decode/decode_port.c +++ b/lib/erl_interface/src/decode/decode_port.c @@ -34,6 +34,8 @@ int ei_decode_port(const char *buf, int *index, erlang_port *p) len = get16be(s); + if (len > MAXATOMLEN) return -1; + if (p) { memmove(p->node, s, len); p->node[len] = (char)0; diff --git a/lib/erl_interface/src/decode/decode_ref.c b/lib/erl_interface/src/decode/decode_ref.c index 6fc2cd6533..691b51fe2d 100644 --- a/lib/erl_interface/src/decode/decode_ref.c +++ b/lib/erl_interface/src/decode/decode_ref.c @@ -35,6 +35,8 @@ int ei_decode_ref(const char *buf, int *index, erlang_ref *p) len = get16be(s); + if (len > MAXATOMLEN) return -1; + if (p) { memmove(p->node, s, len); p->node[len] = (char)0; @@ -62,6 +64,7 @@ int ei_decode_ref(const char *buf, int *index, erlang_ref *p) /* then the nodename */ if (get8(s) != ERL_ATOM_EXT) return -1; len = get16be(s); + if (len > MAXATOMLEN) return -1; if (p) { memmove(p->node, s, len); diff --git a/lib/erl_interface/src/legacy/erl_connect.c b/lib/erl_interface/src/legacy/erl_connect.c index 3c8c946506..e77bd5db37 100644 --- a/lib/erl_interface/src/legacy/erl_connect.c +++ b/lib/erl_interface/src/legacy/erl_connect.c @@ -180,9 +180,7 @@ int erl_xconnect(Erl_IpAddr addr, char *alivename) * * Close a connection. FIXME call ei_close_connection() later. * - * Returns valid file descriptor on success and < 0 on failure. - * Set erl_errno to EHOSTUNREACH, ENOMEM, EIO or errno from socket(2) - * or connect(2). + * Returns 0 on success and -1 on failure. * ***************************************************************************/ @@ -250,7 +248,8 @@ int erl_send(int fd, ETERM *to ,ETERM *msg) return -1; } - strcpy(topid.node, (char *)ERL_PID_NODE(to)); + strncpy(topid.node, (char *)ERL_PID_NODE(to), sizeof(topid.node)); + topid.node[sizeof(topid.node)-1] = '\0'; topid.num = ERL_PID_NUMBER(to); topid.serial = ERL_PID_SERIAL(to); topid.creation = ERL_PID_CREATION(to); diff --git a/lib/erl_interface/src/legacy/erl_format.c b/lib/erl_interface/src/legacy/erl_format.c index 9848e9296a..b17269213f 100644 --- a/lib/erl_interface/src/legacy/erl_format.c +++ b/lib/erl_interface/src/legacy/erl_format.c @@ -116,7 +116,7 @@ static lvar *lvar_alloc(void) lvar *tmp; if ((tmp = ef.idle) == NULL) { - tmp = (lvar *) malloc(sizeof(lvar)); /* FIXME check result */ + tmp = (lvar *) erl_malloc(sizeof(lvar)); } else { tmp = ef.idle; diff --git a/lib/erl_interface/src/legacy/erl_marshal.c b/lib/erl_interface/src/legacy/erl_marshal.c index a6c2f64dd0..5cfb5e2124 100644 --- a/lib/erl_interface/src/legacy/erl_marshal.c +++ b/lib/erl_interface/src/legacy/erl_marshal.c @@ -662,7 +662,7 @@ len = i #define STATIC_NODE_BUF_SZ 30 #define SET_NODE(node,node_buf,cp,len) \ -if (len >= STATIC_NODE_BUF_SZ) node = malloc(len+1); \ +if (len >= STATIC_NODE_BUF_SZ) node = erl_malloc(len+1); \ else node = node_buf; \ memcpy(node, cp, len); \ node[len] = '\0' @@ -1534,7 +1534,7 @@ static int cmp_string_list(unsigned char **e1, unsigned char **e2) { if ( e1_len < 256 ) { bp = buf; } else { - bp = malloc(5+(2*e1_len)+1); + bp = erl_malloc(5+(2*e1_len)+1); } bp[0] = ERL_LIST_EXT; @@ -1646,11 +1646,14 @@ static int cmp_exe2(unsigned char **e1, unsigned char **e2) min = (i < j) ? i : j; k = 0; while (1) { - if (k++ == min) - return compare_top_ext(e1 , e2); - if ((ret = compare_top_ext(e1 , e2)) == 0) - continue; - return ret; + if (k++ == min){ + if (i == j) return 0; + if (i < j) return -1; + return 1; + } + if ((ret = compare_top_ext(e1 , e2)) == 0) + continue; + return ret; } case ERL_STRING_EXT: i = (**e1 << 8) | ((*e1)[1]); diff --git a/lib/erl_interface/src/legacy/erl_timeout.c b/lib/erl_interface/src/legacy/erl_timeout.c index af1a4a1f3a..6ef5d258ed 100644 --- a/lib/erl_interface/src/legacy/erl_timeout.c +++ b/lib/erl_interface/src/legacy/erl_timeout.c @@ -74,7 +74,7 @@ jmp_buf *timeout_setup(int ms) t.it_value.tv_usec = (ms % 1000) * 1000; /* get a jump buffer and save it */ - j = malloc(sizeof(*j)); /* FIXME check result */ + j = erl_malloc(sizeof(*j)); j->siginfo = s; push(j); diff --git a/lib/erl_interface/src/legacy/global_register.c b/lib/erl_interface/src/legacy/global_register.c index 3a4de8b08e..f12eb6b448 100644 --- a/lib/erl_interface/src/legacy/global_register.c +++ b/lib/erl_interface/src/legacy/global_register.c @@ -31,7 +31,7 @@ int erl_global_register(int fd, const char *name, ETERM *pid) int index = 0; erlang_pid self; erlang_msg msg; - int needlink, needatom; + int needlink, needatom, needmonitor; int arity; int version; int msglen; @@ -65,7 +65,7 @@ int erl_global_register(int fd, const char *name, ETERM *pid) if (ei_send_reg_encoded(fd,&self,"rex",buf,index)) return -1; /* get the reply: expect link and an atom, or just an atom */ - needlink = needatom = 1; + needlink = needatom = needmonitor = 1; while (1) { /* get message */ while (1) { @@ -78,9 +78,15 @@ int erl_global_register(int fd, const char *name, ETERM *pid) case ERL_LINK: /* got link */ if (!needlink) return -1; - needlink = 0; + needlink = 0; break; + case ERL_MONITOR_P-10: + /* got monitor */ + if (!needmonitor) { return -1;} + needmonitor = 0; + break; + case ERL_SEND: /* got message - does it contain our atom? */ if (!needatom) return -1; diff --git a/lib/erl_interface/src/legacy/global_unregister.c b/lib/erl_interface/src/legacy/global_unregister.c index 514dbc3c68..97a1c2d03c 100644 --- a/lib/erl_interface/src/legacy/global_unregister.c +++ b/lib/erl_interface/src/legacy/global_unregister.c @@ -37,7 +37,7 @@ int erl_global_unregister(int fd, const char *name) erlang_msg msg; int i; int version,arity,msglen; - int needunlink, needatom; + int needunlink, needatom, needdemonitor; /* make a self pid */ self->num = fd; @@ -57,7 +57,7 @@ int erl_global_unregister(int fd, const char *name) if (ei_send_reg_encoded(fd,self,"rex",buf,index)) return -1; /* get the reply: expect unlink and an atom, or just an atom */ - needunlink = needatom = 1; + needunlink = needatom = needdemonitor = 1; while (1) { /* get message */ while (1) { @@ -68,11 +68,17 @@ int erl_global_unregister(int fd, const char *name) switch (i) { case ERL_UNLINK: - /* got link */ + /* got unlink */ if (!needunlink) return -1; needunlink = 0; break; + case ERL_DEMONITOR_P-10: + /* got demonitor */ + if (!needdemonitor) return -1; + needdemonitor = 0; + break; + case ERL_SEND: /* got message - does it contain our atom? */ if (!needatom) return -1; diff --git a/lib/erl_interface/src/misc/ei_decode_term.c b/lib/erl_interface/src/misc/ei_decode_term.c index 75c5dc9460..9b238c1e90 100644 --- a/lib/erl_interface/src/misc/ei_decode_term.c +++ b/lib/erl_interface/src/misc/ei_decode_term.c @@ -49,6 +49,7 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) return ei_decode_double(buf, index, &term->value.d_val); case ERL_ATOM_EXT: len = get16be(s); + if (len > MAXATOMLEN) return -1; memcpy(term->value.atom_name, s, len); term->value.atom_name[len] = '\0'; s += len; @@ -57,6 +58,7 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) /* first the nodename */ if (get8(s) != ERL_ATOM_EXT) return -1; len = get16be(s); + if (len > MAXATOMLEN) return -1; memcpy(term->value.ref.node, s, len); term->value.ref.node[len] = '\0'; s += len; @@ -71,6 +73,7 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) /* then the nodename */ if (get8(s) != ERL_ATOM_EXT) return -1; len = get16be(s); + if (len > MAXATOMLEN) return -1; memcpy(term->value.ref.node, s, len); term->value.ref.node[len] = '\0'; s += len; @@ -87,6 +90,7 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) case ERL_PORT_EXT: if (get8(s) != ERL_ATOM_EXT) return -1; len = get16be(s); + if (len > MAXATOMLEN) return -1; memcpy(term->value.port.node, s, len); term->value.port.node[len] = '\0'; term->value.port.id = get32be(s) & 0x0fffffff; /* 28 bits */; @@ -96,6 +100,7 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term) if (get8(s) != ERL_ATOM_EXT) return -1; /* name first */ len = get16be(s); + if (len > MAXATOMLEN) return -1; memcpy(term->value.pid.node, s, len); term->value.pid.node[len] = '\0'; s += len; diff --git a/lib/erl_interface/src/misc/ei_format.c b/lib/erl_interface/src/misc/ei_format.c index b35421d4b2..dbd7a4479a 100644 --- a/lib/erl_interface/src/misc/ei_format.c +++ b/lib/erl_interface/src/misc/ei_format.c @@ -47,10 +47,12 @@ * array of unions. */ union arg { + char c; char* s; long l; unsigned long u; double d; + erlang_pid* pid; }; static int eiformat(const char** s, union arg** args, ei_x_buff* x); @@ -224,12 +226,14 @@ static int pquotedatom(const char** fmt, ei_x_buff* x) /* * The format letters are: * a - An atom + * c - A character * s - A string * i - An integer * l - A long integer * u - An unsigned long integer * f - A float * d - A double float + * p - An Erlang PID */ static int pformat(const char** fmt, union arg** args, ei_x_buff* x) { @@ -240,6 +244,10 @@ static int pformat(const char** fmt, union arg** args, ei_x_buff* x) res = ei_x_encode_atom(x, (*args)->s); (*args)++; break; + case 'c': + res = ei_x_encode_char(x, (*args)->c); + (*args)++; + break; case 's': res = ei_x_encode_string(x, (*args)->s); (*args)++; @@ -261,6 +269,10 @@ static int pformat(const char** fmt, union arg** args, ei_x_buff* x) res = ei_x_encode_double(x, (*args)->d); (*args)++; break; + case 'p': + res = ei_x_encode_pid(x, (*args)->pid); + (*args)++; + break; default: res = -1; break; @@ -396,6 +408,9 @@ static int read_args(const char* fmt, va_list ap, union arg **argp) return -1; /* Error, string not complete */ } switch (*p++) { + case 'c': + args[i++].c = (char) va_arg(ap, int); + break; case 'a': case 's': args[i++].s = va_arg(ap, char*); @@ -415,6 +430,9 @@ static int read_args(const char* fmt, va_list ap, union arg **argp) case 'd': args[i++].d = va_arg(ap, double); break; + case 'p': + args[i++].pid = va_arg(ap, erlang_pid*); + break; default: ei_free(args); /* Invalid specifier */ return -1; diff --git a/lib/erl_interface/src/misc/show_msg.c b/lib/erl_interface/src/misc/show_msg.c index 14bea5e01f..194296798b 100644 --- a/lib/erl_interface/src/misc/show_msg.c +++ b/lib/erl_interface/src/misc/show_msg.c @@ -181,11 +181,6 @@ int ei_show_sendmsg(FILE *stream, const char *header, const char *msgbuf) mbuf = header; break; - case ERL_NODE_LINK: - /* nothing to do */ - mbuf = header; - break; - default: break; } @@ -241,10 +236,6 @@ static void show_msg(FILE *stream, int direction, const erlang_msg *msg, show_pid(stream,&msg->to); break; - case ERL_NODE_LINK: - fprintf(stream,"NODE_LINK"); - break; - case ERL_REG_SEND: fprintf(stream,"REG_SEND From: "); show_pid(stream,&msg->from); diff --git a/lib/erl_interface/test/Makefile b/lib/erl_interface/test/Makefile index b7a1a4e4d8..c8aa6f5a6d 100644 --- a/lib/erl_interface/test/Makefile +++ b/lib/erl_interface/test/Makefile @@ -33,6 +33,7 @@ MODULES= \ ei_print_SUITE \ ei_tmo_SUITE \ erl_connect_SUITE \ + erl_global_SUITE \ erl_eterm_SUITE \ erl_ext_SUITE \ erl_format_SUITE \ @@ -41,9 +42,9 @@ MODULES= \ runner SPEC_FILES = \ - erl_interface.spec \ - erl_interface.dynspec \ - erl_interface.spec.vxworks + erl_interface.spec + +COVER_FILE = erl_interface.cover ERL_FILES = $(MODULES:%=%.erl) @@ -71,7 +72,7 @@ release_spec: release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) $(SPEC_FILES) $(ERL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) $(SPEC_FILES) $(COVER_FILE) $(ERL_FILES) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/erl_interface/test/ei_accept_SUITE.erl b/lib/erl_interface/test/ei_accept_SUITE.erl index a97c874e5f..d3d37fce6c 100644 --- a/lib/erl_interface/test/ei_accept_SUITE.erl +++ b/lib/erl_interface/test/ei_accept_SUITE.erl @@ -20,21 +20,42 @@ %% -module(ei_accept_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ei_accept_SUITE_data/ei_accept_test_cases.hrl"). --export([all/1, init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, ei_accept/1, ei_threaded_accept/1]). -import(runner, [get_term/1,send_term/2]). -all(suite) -> [ei_accept, ei_threaded_accept]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [ei_accept, ei_threaded_accept]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> Dog = ?t:timetrap(?t:seconds(30)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/erl_interface/test/ei_connect_SUITE.erl b/lib/erl_interface/test/ei_connect_SUITE.erl index fe82a73ef9..47247dd891 100644 --- a/lib/erl_interface/test/ei_connect_SUITE.erl +++ b/lib/erl_interface/test/ei_connect_SUITE.erl @@ -20,37 +20,53 @@ %% -module(ei_connect_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ei_connect_SUITE_data/ei_connect_test_cases.hrl"). -export([ - all/1, - init_per_testcase/2, - fin_per_testcase/2, - - ei_send/1, - ei_reg_send/1, - ei_rpc/1, - rpc_test/1, - ei_send_funs/1, - ei_threaded_send/1, - ei_set_get_tracelevel/1 + all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, + end_per_testcase/2, + + ei_send/1, + ei_reg_send/1, + ei_format_pid/1, + ei_rpc/1, + rpc_test/1, + ei_send_funs/1, + ei_threaded_send/1, + ei_set_get_tracelevel/1 ]). -import(runner, [get_term/1,send_term/2]). -all(suite) -> [ ei_send, - ei_reg_send, - ei_rpc, - ei_send_funs, - ei_threaded_send, - ei_set_get_tracelevel]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [ei_send, ei_reg_send, ei_rpc, ei_format_pid, ei_send_funs, + ei_threaded_send, ei_set_get_tracelevel]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. init_per_testcase(_Case, Config) -> Dog = ?t:timetrap(?t:minutes(0.25)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -67,6 +83,19 @@ ei_send(Config) when is_list(Config) -> ?line runner:recv_eot(P), ok. +ei_format_pid(Config) when is_list(Config) -> + ?line S = self(), + ?line P = runner:start(?interpret), + ?line 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0), + ?line {ok,Fd} = ei_connect(P, node()), + + ?line ok = ei_format_pid(P, Fd, S), + ?line receive S -> ok end, + + ?line runner:send_eot(P), + ?line runner:recv_eot(P), + ok. + ei_send_funs(Config) when is_list(Config) -> ?line P = runner:start(?interpret), ?line 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0), @@ -189,6 +218,10 @@ ei_send(P, Fd, To, Msg) -> send_command(P, ei_send, [Fd,To,Msg]), get_send_result(P). +ei_format_pid(P, Fd, To) -> + send_command(P, ei_format_pid, [Fd, To]), + get_send_result(P). + ei_send_funs(P, Fd, To, Msg) -> send_command(P, ei_send_funs, [Fd,To,Msg]), get_send_result(P). diff --git a/lib/erl_interface/test/ei_connect_SUITE_data/ei_connect_test.c b/lib/erl_interface/test/ei_connect_SUITE_data/ei_connect_test.c index debd3e789b..8183ac9dd8 100644 --- a/lib/erl_interface/test/ei_connect_SUITE_data/ei_connect_test.c +++ b/lib/erl_interface/test/ei_connect_SUITE_data/ei_connect_test.c @@ -35,6 +35,7 @@ static void cmd_ei_connect_init(char* buf, int len); static void cmd_ei_connect(char* buf, int len); static void cmd_ei_send(char* buf, int len); +static void cmd_ei_format_pid(char* buf, int len); static void cmd_ei_send_funs(char* buf, int len); static void cmd_ei_reg_send(char* buf, int len); static void cmd_ei_rpc(char* buf, int len); @@ -57,6 +58,7 @@ static struct { "ei_reg_send", 3, cmd_ei_reg_send, "ei_rpc", 4, cmd_ei_rpc, "ei_set_get_tracelevel", 1, cmd_ei_set_get_tracelevel, + "ei_format_pid", 2, cmd_ei_format_pid, }; @@ -111,7 +113,7 @@ static void cmd_ei_connect_init(char* buf, int len) ei_x_buff res; if (ei_decode_long(buf, &index, &l) < 0) fail("expected int"); - sprintf(b, "c%d", l); + sprintf(b, "c%ld", l); /* FIXME don't use internal and maybe use skip?! */ ei_get_type_internal(buf, &index, &type, &size); if (ei_decode_atom(buf, &index, cookie) < 0) @@ -183,6 +185,25 @@ static void cmd_ei_send(char* buf, int len) ei_x_free(&x); } +static void cmd_ei_format_pid(char* buf, int len) +{ + int index = 0; + long fd; + erlang_pid pid; + ei_x_buff x; + + if (ei_decode_long(buf, &index, &fd) < 0) + fail("expected long"); + if (ei_decode_pid(buf, &index, &pid) < 0) + fail("expected pid (node)"); + if (ei_x_new_with_version(&x) < 0) + fail("ei_x_new_with_version"); + if (ei_x_format_wo_ver(&x, "~p", &pid) < 0) + fail("ei_x_format_wo_ver"); + send_errno_result(ei_send(fd, &pid, x.buff, x.index)); + ei_x_free(&x); +} + static void cmd_ei_send_funs(char* buf, int len) { int index = 0, n; diff --git a/lib/erl_interface/test/ei_decode_SUITE.erl b/lib/erl_interface/test/ei_decode_SUITE.erl index 524a04a3b4..8a653078a7 100644 --- a/lib/erl_interface/test/ei_decode_SUITE.erl +++ b/lib/erl_interface/test/ei_decode_SUITE.erl @@ -20,12 +20,13 @@ %% -module(ei_decode_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ei_decode_SUITE_data/ei_decode_test_cases.hrl"). -export( [ - all/1, + all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, test_ei_decode_long/1, test_ei_decode_ulong/1, test_ei_decode_longlong/1, @@ -35,16 +36,29 @@ test_ei_decode_misc/1 ]). -all(suite) -> - [ - test_ei_decode_long, - test_ei_decode_ulong, - test_ei_decode_longlong, - test_ei_decode_ulonglong, - test_ei_decode_char, - test_ei_decode_nonoptimal, - test_ei_decode_misc - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [test_ei_decode_long, test_ei_decode_ulong, + test_ei_decode_longlong, test_ei_decode_ulonglong, + test_ei_decode_char, test_ei_decode_nonoptimal, + test_ei_decode_misc]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% --------------------------------------------------------------------------- diff --git a/lib/erl_interface/test/ei_decode_encode_SUITE.erl b/lib/erl_interface/test/ei_decode_encode_SUITE.erl index c19c1d0887..0a1eda41e1 100644 --- a/lib/erl_interface/test/ei_decode_encode_SUITE.erl +++ b/lib/erl_interface/test/ei_decode_encode_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -20,19 +20,36 @@ %% -module(ei_decode_encode_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ei_decode_encode_SUITE_data/ei_decode_encode_test_cases.hrl"). -export( [ - all/1, + all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, test_ei_decode_encode/1 ]). -all(suite) -> - [ - test_ei_decode_encode - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [test_ei_decode_encode]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% --------------------------------------------------------------------------- diff --git a/lib/erl_interface/test/ei_encode_SUITE.erl b/lib/erl_interface/test/ei_encode_SUITE.erl index 6b9de4f093..1674274bc9 100644 --- a/lib/erl_interface/test/ei_encode_SUITE.erl +++ b/lib/erl_interface/test/ei_encode_SUITE.erl @@ -20,12 +20,13 @@ %% -module(ei_encode_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ei_encode_SUITE_data/ei_encode_test_cases.hrl"). -export( [ - all/1, + all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, test_ei_encode_long/1, test_ei_encode_ulong/1, test_ei_encode_longlong/1, @@ -35,16 +36,29 @@ test_ei_encode_fails/1 ]). -all(suite) -> - [ - test_ei_encode_long, - test_ei_encode_ulong, - test_ei_encode_longlong, - test_ei_encode_ulonglong, - test_ei_encode_char, - test_ei_encode_misc, - test_ei_encode_fails - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [test_ei_encode_long, test_ei_encode_ulong, + test_ei_encode_longlong, test_ei_encode_ulonglong, + test_ei_encode_char, test_ei_encode_misc, + test_ei_encode_fails]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% --------------------------------------------------------------------------- diff --git a/lib/erl_interface/test/ei_format_SUITE.erl b/lib/erl_interface/test/ei_format_SUITE.erl index cbe9fa52d7..a6eafc79cf 100644 --- a/lib/erl_interface/test/ei_format_SUITE.erl +++ b/lib/erl_interface/test/ei_format_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -20,15 +20,17 @@ %% -module(ei_format_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ei_format_SUITE_data/ei_format_test_cases.hrl"). -export([ - format_wo_ver/1, - all/1, - atoms/1, - tuples/1, - lists/1 + format_wo_ver/1, + all/0, suite/0,groups/0, + init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + atoms/1, + tuples/1, + lists/1 ]). -import(runner, [get_term/1]). @@ -36,12 +38,26 @@ %% This test suite test the erl_format() function. %% It uses the port program "ei_format_test". -all(suite) -> [ - format_wo_ver, - atoms, - tuples, - lists - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [format_wo_ver, atoms, tuples, lists]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Tests formatting various atoms. @@ -155,7 +171,7 @@ format_wo_ver(suite) -> []; format_wo_ver(Config) when is_list(Config) -> ?line P = runner:start(?format_wo_ver), - ?line {term, [-1, 2, {a, "b"}, {c, 10}]} = get_term(P), + ?line {term, [-1, 2, $c, {a, "b"}, {c, 10}]} = get_term(P), ?line runner:recv_eot(P), ok. diff --git a/lib/erl_interface/test/ei_format_SUITE_data/ei_format_test.c b/lib/erl_interface/test/ei_format_SUITE_data/ei_format_test.c index ecdce402f5..a6eeb25abc 100644 --- a/lib/erl_interface/test/ei_format_SUITE_data/ei_format_test.c +++ b/lib/erl_interface/test/ei_format_SUITE_data/ei_format_test.c @@ -176,7 +176,7 @@ TESTCASE(format_wo_ver) { ei_x_buff x; ei_x_new (&x); - ei_x_format(&x, "[-1, +2, {~a,~s},{~a,~i}]", "a", "b", "c", 10); + ei_x_format(&x, "[-1, +2, ~c, {~a,~s},{~a,~i}]", 'c', "a", "b", "c", 10); send_bin_term(&x); free(x.buff); diff --git a/lib/erl_interface/test/ei_print_SUITE.erl b/lib/erl_interface/test/ei_print_SUITE.erl index a0f15338c6..7e656650a8 100644 --- a/lib/erl_interface/test/ei_print_SUITE.erl +++ b/lib/erl_interface/test/ei_print_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -20,17 +20,38 @@ %% -module(ei_print_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ei_print_SUITE_data/ei_print_test_cases.hrl"). --export([all/1, atoms/1, tuples/1, lists/1, strings/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + atoms/1, tuples/1, lists/1, strings/1]). -import(runner, [get_term/1]). %% This test suite test the ei_print() function. %% It uses the port program "ei_format_test". -all(suite) -> [atoms, tuples, lists, strings]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [atoms, tuples, lists, strings]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Tests formatting various atoms. diff --git a/lib/erl_interface/test/ei_tmo_SUITE.erl b/lib/erl_interface/test/ei_tmo_SUITE.erl index e7a2465421..52cf2b160d 100644 --- a/lib/erl_interface/test/ei_tmo_SUITE.erl +++ b/lib/erl_interface/test/ei_tmo_SUITE.erl @@ -20,18 +20,39 @@ %% -module(ei_tmo_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet.hrl"). -include("ei_tmo_SUITE_data/ei_tmo_test_cases.hrl"). -define(dummy_host,test01). --export([all/1, init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, framework_check/1, ei_accept_tmo/1, ei_connect_tmo/1, ei_send_tmo/1, ei_recv_tmo/1]). -all(suite) -> [framework_check,ei_accept_tmo,ei_connect_tmo, - ei_send_tmo,ei_recv_tmo]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [framework_check, ei_accept_tmo, ei_connect_tmo, + ei_send_tmo, ei_recv_tmo]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> Dog = ?t:timetrap(?t:minutes(1)), @@ -43,7 +64,7 @@ init_per_testcase(_Case, Config) -> end, [{vxsim,Bool},{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/erl_interface/test/erl_connect_SUITE.erl b/lib/erl_interface/test/erl_connect_SUITE.erl index 0d6539d98f..0483a393d4 100644 --- a/lib/erl_interface/test/erl_connect_SUITE.erl +++ b/lib/erl_interface/test/erl_connect_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -20,22 +20,42 @@ %% -module(erl_connect_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("erl_connect_SUITE_data/erl_connect_test_cases.hrl"). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, erl_send/1,erl_reg_send/1, erl_send_cookie_file/1]). -import(runner, [get_term/1,send_term/2]). -all(suite) -> - [erl_send,erl_reg_send,erl_send_cookie_file]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [erl_send, erl_reg_send, erl_send_cookie_file]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> Dog = ?t:timetrap(?t:minutes(0.25)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/erl_interface/test/erl_eterm_SUITE.erl b/lib/erl_interface/test/erl_eterm_SUITE.erl index 634e2f9aa0..21de1efa2e 100644 --- a/lib/erl_interface/test/erl_eterm_SUITE.erl +++ b/lib/erl_interface/test/erl_eterm_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -20,7 +20,7 @@ %% -module(erl_eterm_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("erl_eterm_SUITE_data/eterm_test_cases.hrl"). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -33,7 +33,9 @@ %%% 5. Miscellanous functions. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --export([all/1, build_terms/1, round_trip_conversion/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + build_terms/1, round_trip_conversion/1, decode_terms/1, decode_float/1, t_erl_mk_int/1, t_erl_mk_list/1, basic_copy/1, @@ -73,38 +75,38 @@ %% This test suite controls the running of the C language functions %% in eterm_test.c and print_term.c. -all(suite) -> [build_terms, round_trip_conversion, - decode_terms, decode_float, - t_erl_mk_int, t_erl_mk_list, - basic_copy, - t_erl_mk_atom, - t_erl_mk_binary, - t_erl_mk_empty_list, - t_erl_mk_float, - t_erl_mk_pid, - t_erl_mk_xpid, - t_erl_mk_port, - t_erl_mk_xport, - t_erl_mk_ref, - t_erl_mk_long_ref, - t_erl_mk_string, - t_erl_mk_estring, - t_erl_mk_tuple, - t_erl_mk_uint, - t_erl_mk_var, - t_erl_size, - t_erl_var_content, - t_erl_element, - t_erl_cons, - t_erl_length, t_erl_hd, t_erl_tl, - type_checks, extractor_macros, - t_erl_iolist_length, t_erl_iolist_to_binary, - t_erl_iolist_to_string, - erl_print_term, print_string, - t_erl_free_compound, - high_chaparal, - broken_data, - cnode_1]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [build_terms, round_trip_conversion, decode_terms, + decode_float, t_erl_mk_int, t_erl_mk_list, basic_copy, + t_erl_mk_atom, t_erl_mk_binary, t_erl_mk_empty_list, + t_erl_mk_float, t_erl_mk_pid, t_erl_mk_xpid, + t_erl_mk_port, t_erl_mk_xport, t_erl_mk_ref, + t_erl_mk_long_ref, t_erl_mk_string, t_erl_mk_estring, + t_erl_mk_tuple, t_erl_mk_uint, t_erl_mk_var, t_erl_size, + t_erl_var_content, t_erl_element, t_erl_cons, + t_erl_length, t_erl_hd, t_erl_tl, type_checks, + extractor_macros, t_erl_iolist_length, + t_erl_iolist_to_binary, t_erl_iolist_to_string, + erl_print_term, print_string, t_erl_free_compound, + high_chaparal, broken_data, cnode_1]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/erl_interface/test/erl_ext_SUITE.erl b/lib/erl_interface/test/erl_ext_SUITE.erl index dbafea0e39..38b01e73cf 100644 --- a/lib/erl_interface/test/erl_ext_SUITE.erl +++ b/lib/erl_interface/test/erl_ext_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% 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 @@ -20,27 +20,42 @@ %% -module(erl_ext_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("erl_ext_SUITE_data/ext_test_cases.hrl"). -export([ - all/1, - compare_tuple/1, - compare_list/1, - compare_string/1, - compare_list_string/1, - compare_nc_ext/1 + all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + compare_tuple/1, + compare_list/1, + compare_string/1, + compare_list_string/1, + compare_nc_ext/1 ]). -import(runner, [get_term/1]). -all(suite) -> [ - compare_tuple, - compare_list, - compare_string, - compare_list_string, - compare_nc_ext - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [compare_tuple, compare_list, compare_string, + compare_list_string, compare_nc_ext]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + compare_tuple(suite) -> []; compare_tuple(doc) -> []; diff --git a/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c b/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c index ba1a6c66da..59e0e0cce7 100644 --- a/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c +++ b/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c @@ -82,6 +82,11 @@ TESTCASE(compare_list) { // erlang:term_to_binary([34,{a,n},a,erlang]) unsigned char term2[] = {131,108,0,0,0,4,97,34,104,2,100,0,1,97,100,0,1,110,100,0,1,97,100,0,6,101,114,108,97,110,103,106}; + // erlang:term_to_binary([0]) + unsigned char term3[] = {131,107,0,1,0}; + // erlang:term_to_binary([0, 1000]) + unsigned char term4[] = {131,108,0,0,0,2,97,0,98,0,0,3,232,106}; + erl_init(NULL, 0); start_a = term1; start_b = term2; @@ -90,6 +95,13 @@ TESTCASE(compare_list) { test_compare_ext("lists", start_a, end_a, start_b, end_b, 1); + start_a = term3; + start_b = term4; + end_a = term3 + sizeof(term3); + end_b = term4 + sizeof(term4); + + test_compare_ext("lists1", start_a, end_a, start_b, end_b, -1); + report(1); } diff --git a/lib/erl_interface/test/erl_format_SUITE.erl b/lib/erl_interface/test/erl_format_SUITE.erl index 81a0bca80f..9905669ef9 100644 --- a/lib/erl_interface/test/erl_format_SUITE.erl +++ b/lib/erl_interface/test/erl_format_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -20,17 +20,37 @@ %% -module(erl_format_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("erl_format_SUITE_data/format_test_cases.hrl"). --export([all/1, atoms/1, tuples/1, lists/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, atoms/1, tuples/1, lists/1]). -import(runner, [get_term/1]). %% This test suite test the erl_format() function. %% It uses the port program "format_test". -all(suite) -> [atoms, tuples, lists]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [atoms, tuples, lists]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Tests formatting various atoms. diff --git a/lib/erl_interface/test/erl_global_SUITE.erl b/lib/erl_interface/test/erl_global_SUITE.erl new file mode 100644 index 0000000000..604d72dd24 --- /dev/null +++ b/lib/erl_interface/test/erl_global_SUITE.erl @@ -0,0 +1,142 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2000-2009. 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(erl_global_SUITE). + +-include_lib("test_server/include/test_server.hrl"). +-include("erl_global_SUITE_data/erl_global_test_cases.hrl"). + +-export([all/0,suite/0,init_per_suite/1,end_per_suite/1, + init_per_testcase/2,end_per_testcase/2, + erl_global_registration/1, erl_global_whereis/1, erl_global_names/1]). + +-import(runner, [get_term/1,send_term/2]). + +-define(GLOBAL_NAME, global_register_node_test). + +all() -> + [erl_global_registration, erl_global_whereis, erl_global_names]. + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_testcase(_Case, Config) -> + Dog = ?t:timetrap(?t:minutes(0.25)), + [{watchdog, Dog}|Config]. + +end_per_testcase(_Case, Config) -> + Dog = ?config(watchdog, Config), + test_server:timetrap_cancel(Dog), + ok. + +erl_global_registration(Config) when is_list(Config) -> + ?line P = runner:start(?interpret), + ?line {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0), + + ?line ok = erl_global_register(P, Fd, ?GLOBAL_NAME), + ?line ok = erl_global_unregister(P, Fd, ?GLOBAL_NAME), + + ?line 0 = erl_close_connection(P,Fd), + ?line runner:send_eot(P), + ?line runner:recv_eot(P), + ok. + +erl_global_whereis(Config) when is_list(Config) -> + ?line P = runner:start(?interpret), + ?line {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0), + + ?line Self = self(), + ?line yes = global:register_name(?GLOBAL_NAME, Self), + ?line Self = erl_global_whereis(P, Fd, ?GLOBAL_NAME), + ?line global:unregister_name(?GLOBAL_NAME), + ?line 0 = erl_close_connection(P, Fd), + ?line runner:send_eot(P), + ?line runner:recv_eot(P), + ok. + +erl_global_names(Config) when is_list(Config) -> + ?line P = runner:start(?interpret), + ?line {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0), + + ?line Self = self(), + ?line global:register_name(?GLOBAL_NAME, Self), + ?line {Names1, _N1} = erl_global_names(P, Fd), + ?line true = lists:member(atom_to_list(?GLOBAL_NAME), Names1), + ?line global:unregister_name(?GLOBAL_NAME), + ?line {Names2, _N2} = erl_global_names(P, Fd), + ?line false = lists:member(atom_to_list(?GLOBAL_NAME), Names2), + ?line 0 = erl_close_connection(P, Fd), + ?line runner:send_eot(P), + ?line runner:recv_eot(P), + ok. + +%%% Interface functions for erl_interface functions. + +erl_connect(P, Node, Num, Cookie, Creation) -> + send_command(P, erl_connect, [Num, Node, Cookie, Creation]), + case get_term(P) of + {term,{Fd,_}} when Fd >= 0 -> {ok,Fd}; + {term,{-1,Errno}} -> {error,Errno} + end. + +erl_close_connection(P, FD) -> + send_command(P, erl_close_connection, [FD]), + case get_term(P) of + {term,Int} when is_integer(Int) -> Int + end. + +erl_global_register(P, Fd, Name) -> + send_command(P, erl_global_register, [Fd,Name]), + get_send_result(P). + +erl_global_whereis(P, Fd, Name) -> + send_command(P, erl_global_whereis, [Fd,Name]), + case get_term(P) of + {term, What} -> + What + end. + +erl_global_names(P, Fd) -> + send_command(P, erl_global_names, [Fd]), + case get_term(P) of + {term, What} -> + What + end. + +erl_global_unregister(P, Fd, Name) -> + send_command(P, erl_global_unregister, [Fd,Name]), + get_send_result(P). + +get_send_result(P) -> + case get_term(P) of + {term,{1,_}} -> ok; + {term,{0, 0}} -> ok; + {term,{-1, Errno}} -> {error,Errno}; + {term,{_,_}}-> + ?t:fail(bad_return_value) + end. + +send_command(P, Name, Args) -> + runner:send_term(P, {Name,list_to_tuple(Args)}). diff --git a/lib/erl_interface/test/erl_global_SUITE_data/Makefile.first b/lib/erl_interface/test/erl_global_SUITE_data/Makefile.first new file mode 100644 index 0000000000..8e3fcb924e --- /dev/null +++ b/lib/erl_interface/test/erl_global_SUITE_data/Makefile.first @@ -0,0 +1,21 @@ +# +# %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% +# + +erl_global_test_decl.c: erl_global_test.c + erl -noinput -pa ../all_SUITE_data -s init_tc run erl_global_test -s erlang halt diff --git a/lib/erl_interface/test/erl_global_SUITE_data/Makefile.src b/lib/erl_interface/test/erl_global_SUITE_data/Makefile.src new file mode 100644 index 0000000000..ef846bc440 --- /dev/null +++ b/lib/erl_interface/test/erl_global_SUITE_data/Makefile.src @@ -0,0 +1,41 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2000-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% +# + +include @erl_interface_mk_include@@[email protected] + +CC0 = @CC@ +CC = ..@DS@all_SUITE_data@DS@gccifier@exe@ -CC"$(CC0)" +LD = @LD@ +LIBPATH = @erl_interface_libpath@ +LIBERL = $(LIBPATH)/@erl_interface_lib@ +LIBEI = $(LIBPATH)/@erl_interface_eilib@ +LIBFLAGS = ../all_SUITE_data/runner@obj@ \ + $(LIBERL) $(LIBEI) @LIBS@ @erl_interface_sock_libs@ \ + @erl_interface_threadlib@ +CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data +OBJS = erl_global_test@obj@ erl_global_test_decl@obj@ + +all: erl_global_test@exe@ + +erl_global_test@exe@: $(OBJS) $(LIBERL) $(LIBEI) + $(LD) @CROSSLDFLAGS@ -o $@ $(OBJS) $(LIBFLAGS) + +clean: + $(RM) $(OBJS) + $(RM) erl_global_test@exe@ diff --git a/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c b/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c new file mode 100644 index 0000000000..dc0d8a0091 --- /dev/null +++ b/lib/erl_interface/test/erl_global_SUITE_data/erl_global_test.c @@ -0,0 +1,263 @@ +/* + * %CopyrightBegin% + * + * Copyright Ericsson AB 2000-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% + */ + +/* + * Purpose: Tests the functions in erl_global.c. + * + * See the erl_global_SUITE.erl file for a "table of contents". + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "runner.h" + +static void cmd_erl_connect(ETERM* args); +static void cmd_erl_global_register(ETERM *args); +static void cmd_erl_global_whereis(ETERM *args); +static void cmd_erl_global_names(ETERM *args); +static void cmd_erl_global_unregister(ETERM *args); +static void cmd_erl_close_connection(ETERM *args); + +static void send_errno_result(int value); + +static struct { + char* name; + int num_args; /* Number of arguments. */ + void (*func)(ETERM* args); +} commands[] = { + "erl_connect", 4, cmd_erl_connect, + "erl_close_connection", 1, cmd_erl_close_connection, + "erl_global_register", 2, cmd_erl_global_register, + "erl_global_whereis", 2, cmd_erl_global_whereis, + "erl_global_names", 1, cmd_erl_global_names, + "erl_global_unregister", 2, cmd_erl_global_unregister, +}; + + +/* + * Sends a list contaning all data types to the Erlang side. + */ + +TESTCASE(interpret) +{ + ETERM* term; + + erl_init(NULL, 0); + + outer_loop: + + term = get_term(); + + if (term == NULL) { + report(1); + return; + } else { + ETERM* Func; + ETERM* Args; + int i; + + if (!ERL_IS_TUPLE(term) || ERL_TUPLE_SIZE(term) != 2) { + fail("term should be a tuple of size 2"); + } + + Func = erl_element(1, term); + if (!ERL_IS_ATOM(Func)) { + fail("function name should be an atom"); + } + Args = erl_element(2, term); + if (!ERL_IS_TUPLE(Args)) { + fail("function arguments should be a tuple"); + } + erl_free_term(term); + for (i = 0; i < sizeof(commands)/sizeof(commands[0]); i++) { + int n = strlen(commands[i].name); + if (ERL_ATOM_SIZE(Func) != n) { + continue; + } + if (memcmp(ERL_ATOM_PTR(Func), commands[i].name, n) == 0) { + erl_free_term(Func); + if (ERL_TUPLE_SIZE(Args) != commands[i].num_args) { + fail("wrong number of arguments"); + } + commands[i].func(Args); + erl_free_term(Args); + goto outer_loop; + } + } + fail("bad command"); + } +} + +#define VERIFY_TYPE(Test, Term) \ +if (!Test(Term)) { \ + fail("wrong type for " #Term); \ +} else { \ +} + +static void +cmd_erl_connect(ETERM* args) +{ + ETERM* number; + ETERM* node; + ETERM* cookie; + + int res; + char buffer[256]; + + number = ERL_TUPLE_ELEMENT(args, 0); + VERIFY_TYPE(ERL_IS_INTEGER, number); + node = ERL_TUPLE_ELEMENT(args, 1); + VERIFY_TYPE(ERL_IS_ATOM, node); + cookie = ERL_TUPLE_ELEMENT(args, 2); + VERIFY_TYPE(ERL_IS_ATOM, cookie); + + if (ERL_ATOM_SIZE(cookie) == 0) { + res = erl_connect_init(ERL_INT_VALUE(number), 0, 0); + } else { + memcpy(buffer, ERL_ATOM_PTR(cookie), ERL_ATOM_SIZE(cookie)); + buffer[ERL_ATOM_SIZE(cookie)] = '\0'; + res = erl_connect_init(ERL_INT_VALUE(number), buffer, 0); + } + + if(!res) { + send_errno_result(res); + return; + } + + memcpy(buffer, ERL_ATOM_PTR(node), ERL_ATOM_SIZE(node)); + buffer[ERL_ATOM_SIZE(node)] = '\0'; + send_errno_result(erl_connect(buffer)); +} + +static void +cmd_erl_close_connection(ETERM* args) +{ + ETERM* number; + ETERM* res; + + number = ERL_TUPLE_ELEMENT(args, 0); + VERIFY_TYPE(ERL_IS_INTEGER, number); + res = erl_mk_int(erl_close_connection(ERL_INT_VALUE(number))); + send_term(res); + erl_free_term(res); +} + +static void +cmd_erl_global_register(ETERM* args) +{ + ETERM* fd_term = ERL_TUPLE_ELEMENT(args, 0); + ETERM* name = ERL_TUPLE_ELEMENT(args, 1); + ETERM* pid = erl_mk_pid(erl_thisnodename(), 14, 0, 0); + + char buffer[256]; + + VERIFY_TYPE(ERL_IS_INTEGER, fd_term); + VERIFY_TYPE(ERL_IS_ATOM, name); + + memcpy(buffer, ERL_ATOM_PTR(name), ERL_ATOM_SIZE(name)); + buffer[ERL_ATOM_SIZE(name)] = '\0'; + + send_errno_result(erl_global_register(ERL_INT_VALUE(fd_term), buffer, pid)); + erl_free_term(pid); +} + +static void +cmd_erl_global_whereis(ETERM* args) +{ + ETERM* fd_term = ERL_TUPLE_ELEMENT(args, 0); + ETERM* name = ERL_TUPLE_ELEMENT(args, 1); + ETERM* pid = NULL; + + char buffer[256]; + + VERIFY_TYPE(ERL_IS_INTEGER, fd_term); + VERIFY_TYPE(ERL_IS_ATOM, name); + + memcpy(buffer, ERL_ATOM_PTR(name), ERL_ATOM_SIZE(name)); + buffer[ERL_ATOM_SIZE(name)] = '\0'; + + pid = erl_global_whereis(ERL_INT_VALUE(fd_term), buffer, NULL); + send_term(pid); + erl_free_term(pid); +} + +static void +cmd_erl_global_names(ETERM* args) +{ + ETERM* fd_term = ERL_TUPLE_ELEMENT(args, 0); + + ETERM* res_array[2], *res_tuple, *name; + char** names = NULL; + int count = 0, i; + + VERIFY_TYPE(ERL_IS_INTEGER, fd_term); + + names = erl_global_names(ERL_INT_VALUE(fd_term), &count); + + res_array[0] = erl_mk_empty_list(); + for(i=0; i<count; i++) { + name = erl_mk_string(names[i]); + res_array[0] = erl_cons(name, res_array[0]); + } + + free(names); + + res_array[1] = erl_mk_int(count); + res_tuple = erl_mk_tuple(res_array, 2); + + send_term(res_tuple); + + erl_free_compound(res_array[0]); + erl_free_term(res_array[1]); + erl_free_term(res_tuple); +} + +static void +cmd_erl_global_unregister(ETERM* args) +{ + ETERM* fd_term = ERL_TUPLE_ELEMENT(args, 0); + ETERM* name = ERL_TUPLE_ELEMENT(args, 1); + + char buffer[256]; + + VERIFY_TYPE(ERL_IS_INTEGER, fd_term); + VERIFY_TYPE(ERL_IS_ATOM, name); + + memcpy(buffer, ERL_ATOM_PTR(name), ERL_ATOM_SIZE(name)); + buffer[ERL_ATOM_SIZE(name)] = '\0'; + + send_errno_result(erl_global_unregister(ERL_INT_VALUE(fd_term), buffer)); +} + +static void +send_errno_result(int value) +{ + ETERM* res_array[2]; + ETERM* res_tuple; + + res_array[0] = erl_mk_int(value); + res_array[1] = erl_mk_int(erl_errno); + res_tuple = erl_mk_tuple(res_array, 2); + send_term(res_tuple); + erl_free_term(res_array[0]); + erl_free_term(res_array[1]); + erl_free_term(res_tuple); +} diff --git a/lib/erl_interface/test/erl_interface.cover b/lib/erl_interface/test/erl_interface.cover new file mode 100644 index 0000000000..879201a3cd --- /dev/null +++ b/lib/erl_interface/test/erl_interface.cover @@ -0,0 +1,2 @@ +{incl_app,erl_interface,details}. + diff --git a/lib/erl_interface/test/erl_interface.spec b/lib/erl_interface/test/erl_interface.spec index 2789bd3e2c..a0a7acfa50 100644 --- a/lib/erl_interface/test/erl_interface.spec +++ b/lib/erl_interface/test/erl_interface.spec @@ -1,2 +1 @@ -{topcase, {dir, "../erl_interface_test"}}. - +{suites,"../erl_interface_test",all}. diff --git a/lib/erl_interface/test/erl_match_SUITE.erl b/lib/erl_interface/test/erl_match_SUITE.erl index f506638544..da5788722c 100644 --- a/lib/erl_interface/test/erl_match_SUITE.erl +++ b/lib/erl_interface/test/erl_match_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -20,10 +20,12 @@ %% -module(erl_match_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("erl_match_SUITE_data/match_test_cases.hrl"). --export([all/1, atoms/1, lists/1, tuples/1, references/1, pids/1, ports/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + atoms/1, lists/1, tuples/1, references/1, pids/1, ports/1, bind/1, integers/1, floats/1, binaries/1, strings/1]). %% For interactive running of matcher. @@ -31,8 +33,27 @@ %% This test suite tests the erl_match() function. -all(suite) -> [atoms, lists, tuples, references, pids, ports, bind, - integers, floats, binaries, strings]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [atoms, lists, tuples, references, pids, ports, bind, + integers, floats, binaries, strings]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + atoms(suite) -> []; atoms(Config) when is_list(Config) -> diff --git a/lib/erl_interface/test/port_call_SUITE.erl b/lib/erl_interface/test/port_call_SUITE.erl index 895e29ad2e..33755c3431 100644 --- a/lib/erl_interface/test/port_call_SUITE.erl +++ b/lib/erl_interface/test/port_call_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -31,17 +31,37 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --export([all/1, basic/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, basic/1]). % Private exports --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [basic]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> +[basic]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + basic(suite) -> []; basic(Config) when is_list(Config) -> case os:type() of + {unix, linux} -> + do_basic(Config); {unix, sunos} -> do_basic(Config); {win32,_} -> diff --git a/lib/erl_interface/test/runner.erl b/lib/erl_interface/test/runner.erl index b72723c6a5..e41440708a 100644 --- a/lib/erl_interface/test/runner.erl +++ b/lib/erl_interface/test/runner.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 diff --git a/lib/erl_interface/vsn.mk b/lib/erl_interface/vsn.mk index 6c664959a3..ffda886553 100644 --- a/lib/erl_interface/vsn.mk +++ b/lib/erl_interface/vsn.mk @@ -1 +1 @@ -EI_VSN = 3.7.1.1 +EI_VSN = 3.7.2 diff --git a/lib/et/doc/src/notes.xml b/lib/et/doc/src/notes.xml index 4ce7548414..cd4787c5e7 100644 --- a/lib/et/doc/src/notes.xml +++ b/lib/et/doc/src/notes.xml @@ -36,6 +36,21 @@ one section in this document. The title of each section is the version number of <c>Event Tracer (ET)</c>.</p> +<section><title>ET 1.4.2</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> Fix error when module et was used in et_selector + trace patterns. </p> + <p> + Own Id: OTP-8904</p> + </item> + </list> + </section> + +</section> + <section><title>ET 1.4.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/et/test/Makefile b/lib/et/test/Makefile index 7227ae8fd8..2125f9622a 100644 --- a/lib/et/test/Makefile +++ b/lib/et/test/Makefile @@ -71,7 +71,7 @@ release_spec: opt release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) et.spec $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) et.spec et.cover $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) $(INSTALL_SCRIPT) ett $(RELSYSDIR) $(INSTALL_DATA) $(INSTALL_PROGS) $(RELSYSDIR) # chmod -f -R u+w $(RELSYSDIR) diff --git a/lib/et/test/et.cover b/lib/et/test/et.cover new file mode 100644 index 0000000000..471e6d985d --- /dev/null +++ b/lib/et/test/et.cover @@ -0,0 +1,2 @@ +{incl_app,et,details}. + diff --git a/lib/et/test/et.spec b/lib/et/test/et.spec index 69cd8d7582..09993a217a 100644 --- a/lib/et/test/et.spec +++ b/lib/et/test/et.spec @@ -1,2 +1 @@ -{topcase, {dir, "../et_test"}}. - +{suites,"../et_test",all}. diff --git a/lib/et/test/et_test_lib.erl b/lib/et/test/et_test_lib.erl index b91b63786c..c1bfeb9fc0 100644 --- a/lib/et/test/et_test_lib.erl +++ b/lib/et/test/et_test_lib.erl @@ -95,7 +95,7 @@ wx_init_per_suite(Config) -> exit({skipped, "Can not test on MacOSX"}); {unix, _} -> io:format("DISPLAY ~s~n", [os:getenv("DISPLAY")]), - case proplists:get_value(xserver, Config, none) of + case ct:get_config(xserver, none) of none -> ignore; Server -> os:putenv("DISPLAY", Server) end; @@ -295,7 +295,7 @@ eval_test_case(Mod, Fun, Config) -> test_case_evaluator(Mod, Fun, [Config]) -> NewConfig = Mod:init_per_testcase(Fun, Config), R = apply(Mod, Fun, [NewConfig]), - Mod:fin_per_testcase(Fun, NewConfig), + Mod:end_per_testcase(Fun, NewConfig), exit({test_case_ok, R}). wait_for_evaluator(Pid, Mod, Fun, Config) -> @@ -311,12 +311,12 @@ wait_for_evaluator(Pid, Mod, Fun, Config) -> {'EXIT', Pid, {skipped, Reason}} -> log("<WARNING> Test case ~w skipped, because ~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {skip, {Mod, Fun}, Reason}; {'EXIT', Pid, Reason} -> log("<ERROR> Eval process ~w exited, because\n\t~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {crash, {Mod, Fun}, Reason} end. diff --git a/lib/et/test/et_wx_SUITE.erl b/lib/et/test/et_wx_SUITE.erl index 1a16ca69a3..6109ed4e04 100644 --- a/lib/et/test/et_wx_SUITE.erl +++ b/lib/et/test/et_wx_SUITE.erl @@ -18,8 +18,9 @@ -module(et_wx_SUITE). --export([all/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -compile(export_all). @@ -36,16 +37,22 @@ init_per_testcase(Func,Config) -> et_test_lib:init_per_testcase(Func,Config). end_per_testcase(Func,Config) -> et_test_lib:end_per_testcase(Func,Config). -fin_per_testcase(Func,Config) -> %% For test_server - et_test_lib:end_per_testcase(Func,Config). %% SUITE specification -all() -> - all(suite). -all(suite) -> - [ - start_all_windows - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [start_all_windows]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% The test cases diff --git a/lib/et/vsn.mk b/lib/et/vsn.mk index b5b7fa52f4..d7cfd7bc84 100644 --- a/lib/et/vsn.mk +++ b/lib/et/vsn.mk @@ -1 +1 @@ -ET_VSN = 1.4.1 +ET_VSN = 1.4.2 diff --git a/lib/eunit/doc/src/notes.xml b/lib/eunit/doc/src/notes.xml index 974ba1db4e..1717dd7988 100644 --- a/lib/eunit/doc/src/notes.xml +++ b/lib/eunit/doc/src/notes.xml @@ -32,6 +32,21 @@ </header> <p>This document describes the changes made to the EUnit application.</p> +<section><title>Eunit 2.1.6</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> Fix format_man_pages so it handles all man sections + and remove warnings/errors in various man pages. </p> + <p> + Own Id: OTP-8600</p> + </item> + </list> + </section> + +</section> + <section><title>Eunit 2.1.5</title> <section><title>Improvements and New Features</title> diff --git a/lib/eunit/test/Makefile b/lib/eunit/test/Makefile index 74d485d1cc..a2d276f619 100644 --- a/lib/eunit/test/Makefile +++ b/lib/eunit/test/Makefile @@ -75,7 +75,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) eunit.dynspec $(EMAKEFILE) \ + $(INSTALL_DATA) eunit.spec $(EMAKEFILE) \ $(COVERFILE) $(ERL_FILES) \ $(RELSYSDIR) diff --git a/lib/eunit/test/eunit.cover b/lib/eunit/test/eunit.cover index d1eaf770b6..00c09127a8 100644 --- a/lib/eunit/test/eunit.cover +++ b/lib/eunit/test/eunit.cover @@ -1,3 +1,5 @@ +{incl_app,eunit,details}. + %% -*- erlang -*- -{exclude,[eunit_test]}. +{excl_mods,eunit,[eunit_test]}. diff --git a/lib/eunit/test/eunit.dynspec b/lib/eunit/test/eunit.dynspec deleted file mode 100644 index c1d345ac14..0000000000 --- a/lib/eunit/test/eunit.dynspec +++ /dev/null @@ -1,6 +0,0 @@ -%% -*- erlang -*- -%% You can test this file using this command. -%% file:script("eunit.dynspec", [{'Os',"Unix"}]). - -[]. - diff --git a/lib/eunit/test/eunit.spec b/lib/eunit/test/eunit.spec new file mode 100644 index 0000000000..2db7731a7e --- /dev/null +++ b/lib/eunit/test/eunit.spec @@ -0,0 +1,3 @@ +%% -*- erlang -*- +{suites,"../eunit_test",all}. + diff --git a/lib/eunit/test/eunit_SUITE.erl b/lib/eunit/test/eunit_SUITE.erl index 4ebcec6f5d..0f57905d17 100644 --- a/lib/eunit/test/eunit_SUITE.erl +++ b/lib/eunit/test/eunit_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 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 @@ -18,13 +18,32 @@ %% -module(eunit_SUITE). --export([all/1,eunit_test/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,eunit_test/1]). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [eunit_test]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + eunit_test(Config) when is_list(Config) -> ok = file:set_cwd(code:lib_dir(eunit)), ok = eunit:test(eunit). diff --git a/lib/eunit/vsn.mk b/lib/eunit/vsn.mk index 3bfa9c8000..e1965630e3 100644 --- a/lib/eunit/vsn.mk +++ b/lib/eunit/vsn.mk @@ -1 +1 @@ -EUNIT_VSN = 2.1.5 +EUNIT_VSN = 2.1.6 diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index 1cba89c621..309c118107 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -48,6 +48,7 @@ t_boolean/0, t_byte/0, t_char/0, + t_charlist/0, t_cons/0, t_cons/2, t_cons_hd/1, @@ -124,7 +125,8 @@ t_tuple/1, t_tuple_args/1, t_tuple_size/1, - t_tuple_subtypes/1 + t_tuple_subtypes/1, + t_unicode_string/0 ]). -ifdef(DO_ERL_BIF_TYPES_TEST). @@ -192,7 +194,7 @@ type(binary, referenced_byte_size, 1, Xs) -> type(code, add_path, 1, Xs) -> strict(arg_types(code, add_path, 1), Xs, fun (_) -> - t_sup(t_boolean(), + t_sup(t_atom('true'), t_tuple([t_atom('error'), t_atom('bad_directory')])) end); type(code, add_patha, 1, Xs) -> @@ -1865,6 +1867,8 @@ type(erts_debug, flat_size, 1, Xs) -> strict(arg_types(erts_debug, flat_size, 1), Xs, fun (_) -> t_integer() end); type(erts_debug, get_internal_state, 1, _) -> t_any(); +type(erts_debug, instructions, 0, _) -> + t_list(t_list(t_byte())); type(erts_debug, lock_counters, 1, Xs) -> strict(arg_types(erts_debug, lock_counters, 1), Xs, fun ([Arg]) -> @@ -1992,28 +1996,18 @@ type(ets, update_counter, 3, Xs) -> type(ets, update_element, 3, Xs) -> strict(arg_types(ets, update_element, 3), Xs, fun (_) -> t_boolean() end); %%-- file --------------------------------------------------------------------- -type(file, close, 1, Xs) -> - strict(arg_types(file, close, 1), Xs, fun (_) -> t_file_return() end); -type(file, delete, 1, Xs) -> - strict(arg_types(file, delete, 1), Xs, fun (_) -> t_file_return() end); -type(file, get_cwd, 0, _) -> - t_sup(t_tuple([t_atom('ok'), t_string()]), - t_tuple([t_atom('error'), t_file_posix_error()])); -type(file, make_dir, 1, Xs) -> - strict(arg_types(file, make_dir, 1), Xs, fun (_) -> t_file_return() end); -type(file, read_file, 1, Xs) -> - strict(arg_types(file, read_file, 1), Xs, - fun (_) -> - t_sup([t_tuple([t_atom('ok'), t_binary()]), - t_tuple([t_atom('error'), t_file_posix_error()])]) - end); -type(file, set_cwd, 1, Xs) -> - strict(arg_types(file, set_cwd, 1), Xs, - fun (_) -> t_sup(t_atom('ok'), - t_tuple([t_atom('error'), t_file_posix_error()])) - end); -type(file, write_file, 2, Xs) -> - strict(arg_types(file, write_file, 2), Xs, fun (_) -> t_file_return() end); +type(file, native_name_encoding, 0, _) -> + t_file_encoding(); +%%-- prim_file ---------------------------------------------------------------- +type(prim_file, internal_name2native, 1, Xs) -> + strict(arg_types(prim_file, internal_name2native, 1), Xs, + fun (_) -> t_binary() end); +type(prim_file, internal_native2name, 1, Xs) -> + strict(arg_types(prim_file, internal_native2name, 1), Xs, + fun (_) -> t_prim_file_name() end); +type(prim_file, internal_normalize_utf8, 1, Xs) -> + strict(arg_types(prim_file, internal_normalize_utf8, 1), Xs, + fun (_) -> t_binary() end); %%-- gen_tcp ------------------------------------------------------------------ %% NOTE: All type information for this module added to avoid loss of precision type(gen_tcp, accept, 1, Xs) -> @@ -3357,7 +3351,7 @@ arg_types(code, all_loaded, 0) -> arg_types(code, compiler_dir, 0) -> []; arg_types(code, del_path, 1) -> - [t_sup(t_string(), t_atom())]; % OBS: doc differs from add_path/1 - why? + [t_sup(t_string(), t_atom())]; % OBS: differs from add_path/1 arg_types(code, delete, 1) -> [t_atom()]; arg_types(code, ensure_loaded, 1) -> @@ -3405,7 +3399,7 @@ arg_types(code, replace_path, 2) -> arg_types(code, root_dir, 0) -> []; arg_types(code, set_path, 1) -> - [t_string()]; + [t_list(t_string())]; arg_types(code, soft_purge, 1) -> arg_types(code, delete, 1); arg_types(code, stick_mod, 1) -> @@ -3809,7 +3803,7 @@ arg_types(erlang, now, 0) -> arg_types(erlang, open_port, 2) -> [t_sup(t_atom(), t_sup([t_tuple([t_atom('spawn'), t_string()]), t_tuple([t_atom('spawn_driver'), t_string()]), - t_tuple([t_atom('spawn_executable'), t_string()]), + t_tuple([t_atom('spawn_executable'), t_sup(t_unicode_string(),t_binary())]), t_tuple([t_atom('fd'), t_integer(), t_integer()])])), t_list(t_sup(t_sup([t_atom('stream'), t_atom('exit_status'), @@ -3825,8 +3819,8 @@ arg_types(erlang, open_port, 2) -> t_tuple([t_atom('line'), t_integer()]), t_tuple([t_atom('cd'), t_string()]), t_tuple([t_atom('env'), t_list(t_tuple(2))]), % XXX: More - t_tuple([t_atom('args'), t_list(t_string())]), - t_tuple([t_atom('arg0'), t_string()])])))]; + t_tuple([t_atom('args'), t_list(t_sup(t_unicode_string(),t_binary()))]), + t_tuple([t_atom('arg0'),t_sup(t_unicode_string(),t_binary())])])))]; arg_types(erlang, phash, 2) -> [t_any(), t_pos_integer()]; arg_types(erlang, phash2, 1) -> @@ -4101,6 +4095,8 @@ arg_types(erts_debug, flat_size, 1) -> [t_any()]; arg_types(erts_debug, get_internal_state, 1) -> [t_any()]; +arg_types(erts_debug, instructions, 0) -> + []; arg_types(erts_debug, lock_counters, 1) -> [t_sup([t_atom(enabled), t_atom(info), @@ -4200,22 +4196,15 @@ arg_types(ets, update_element, 3) -> PosValue = t_tuple([t_integer(), t_any()]), [t_tab(), t_any(), t_sup(PosValue, t_list(PosValue))]; %%------- file ---------------------------------------------------------------- -arg_types(file, close, 1) -> - [t_file_io_device()]; -arg_types(file, delete, 1) -> - [t_file_name()]; -arg_types(file, get_cwd, 0) -> +arg_types(file, native_name_encoding, 0) -> []; -arg_types(file, make_dir, 1) -> - [t_file_name()]; -arg_types(file, read_file, 1) -> - [t_file_name()]; -arg_types(file, set_cwd, 1) -> - [t_file_name()]; -arg_types(file, write, 2) -> - [t_file_io_device(), t_iodata()]; -arg_types(file, write_file, 2) -> - [t_file_name(), t_sup(t_binary(), t_list())]; +%%-- prim_file ---------------------------------------------------------------- +arg_types(prim_file, internal_name2native, 1) -> + [t_prim_file_name()]; +arg_types(prim_file, internal_native2name, 1) -> + [t_binary()]; +arg_types(prim_file, internal_normalize_utf8, 1) -> + [t_binary()]; %%------- gen_tcp ------------------------------------------------------------- arg_types(gen_tcp, accept, 1) -> [t_socket()]; @@ -4534,11 +4523,11 @@ arg_types(os, timestamp, 0) -> arg_types(re, compile, 1) -> [t_iodata()]; arg_types(re, compile, 2) -> - [t_iodata(), t_list(t_re_compile_option())]; + [t_sup(t_iodata(), t_charlist()), t_list(t_re_compile_option())]; arg_types(re, run, 2) -> - [t_iodata(), t_re_RE()]; + [t_sup(t_iodata(), t_charlist()), t_re_RE()]; arg_types(re, run, 3) -> - [t_iodata(), t_re_RE(), t_list(t_re_run_option())]; + [t_sup(t_iodata(), t_charlist()), t_re_RE(), t_list(t_re_run_option())]; %%------- string -------------------------------------------------------------- arg_types(string, chars, 2) -> [t_char(), t_non_neg_integer()]; @@ -4647,7 +4636,7 @@ t_httppacket() -> t_HttpHeader(), t_atom('http_eoh'), t_HttpError()]). t_endian() -> - t_sup([t_atom('big'), t_atom('little')]). + t_sup(t_atom('big'), t_atom('little')). %% ===================================================================== %% Types for the binary module @@ -4957,10 +4946,11 @@ t_matchres() -> %% From the 'ets' documentation %%----------------------------- %% Option = Type | Access | named_table | {keypos,Pos} -%% | {heir,pid(),HeirData} | {heir,none} -%% | {write_concurrency,boolean()} +%% | {heir,pid(),HeirData} | {heir,none} | Tweaks %% Type = set | ordered_set | bag | duplicate_bag %% Access = public | protected | private +%% Tweaks = {write_concurrency,boolean()} +%% | {read_concurrency,boolean()} | compressed %% Pos = integer() %% HeirData = term() t_ets_new_options() -> @@ -4972,10 +4962,12 @@ t_ets_new_options() -> t_atom('protected'), t_atom('private'), t_atom('named_table'), + t_tuple([t_atom('keypos'), t_integer()]), t_tuple([t_atom('heir'), t_pid(), t_any()]), t_tuple([t_atom('heir'), t_atom('none')]), - t_tuple([t_atom('keypos'), t_integer()]), - t_tuple([t_atom('write_concurrency'), t_boolean()])])). + t_tuple([t_atom('write_concurrency'), t_boolean()]), + t_tuple([t_atom('read_concurrency'), t_boolean()]), + t_atom('compressed')])). t_ets_info_items() -> t_sup([t_atom('fixed'), @@ -4991,68 +4983,11 @@ t_ets_info_items() -> t_atom('type')]). %% ===================================================================== -%% These are used for the built-in functions of 'file' +%% These are used for the built-in functions of 'prim_file' %% ===================================================================== -t_file_io_device() -> - t_sup(t_pid(), t_tuple([t_atom('file_descriptor'), t_atom(), t_any()])). - -t_file_name() -> - t_sup([t_atom(), - t_string(), - %% DeepList = [char() | atom() | DeepList] -- approximation below - t_list(t_sup([t_atom(), t_string(), t_list()]))]). - -t_file_open_option() -> - t_sup([t_atom('read'), - t_atom('write'), - t_atom('append'), - t_atom('raw'), - t_atom('binary'), - t_atom('delayed_write'), - t_atom('read_ahead'), - t_atom('compressed'), - t_tuple([t_atom('delayed_write'), - t_pos_integer(), t_non_neg_integer()]), - t_tuple([t_atom('read_ahead'), t_pos_integer()])]). - -%% This lists all Posix errors that can occur in file:*/* functions -t_file_posix_error() -> - t_sup([t_atom('eacces'), - t_atom('eagain'), - t_atom('ebadf'), - t_atom('ebusy'), - t_atom('edquot'), - t_atom('eexist'), - t_atom('efault'), - t_atom('efbig'), - t_atom('eintr'), - t_atom('einval'), - t_atom('eio'), - t_atom('eisdir'), - t_atom('eloop'), - t_atom('emfile'), - t_atom('emlink'), - t_atom('enametoolong'), - t_atom('enfile'), - t_atom('enodev'), - t_atom('enoent'), - t_atom('enomem'), - t_atom('enospc'), - t_atom('enotblk'), - t_atom('enotdir'), - t_atom('enotsup'), - t_atom('enxio'), - t_atom('eperm'), - t_atom('epipe'), - t_atom('erofs'), - t_atom('espipe'), - t_atom('esrch'), - t_atom('estale'), - t_atom('exdev')]). - -t_file_return() -> - t_sup(t_atom('ok'), t_tuple([t_atom('error'), t_file_posix_error()])). +t_prim_file_name() -> + t_sup(t_unicode_string(), t_binary()). %% ===================================================================== %% These are used for the built-in functions of 'gen_tcp' @@ -5209,13 +5144,14 @@ t_re_MP() -> %% it's supposed to be an opaque data type t_tuple([t_atom('re_pattern'), t_integer(), t_integer(), t_binary()]). t_re_RE() -> - t_sup(t_re_MP(), t_iodata()). + t_sup([t_re_MP(), t_iodata(), t_charlist()]). t_re_compile_option() -> - t_sup([t_atoms(['anchored', 'caseless', 'dollar_endonly', 'dotall', - 'extended', 'firstline', 'multiline', 'no_auto_capture', - 'dupnames', 'ungreedy']), - t_tuple([t_atom('newline'), t_re_NLSpec()])]). + t_sup([t_atoms(['unicode', 'anchored', 'caseless', 'dollar_endonly', + 'dotall', 'extended', 'firstline', 'multiline', + 'no_auto_capture', 'dupnames', 'ungreedy']), + t_tuple([t_atom('newline'), t_re_NLSpec()]), + t_atoms(['bsr_anycrlf', 'bsr_unicode'])]). t_re_run_option() -> t_sup([t_atoms(['anchored', 'global', 'notbol', 'noteol', 'notempty']), @@ -5232,7 +5168,7 @@ t_re_Type() -> t_atoms(['index', 'list', 'binary']). t_re_NLSpec() -> - t_atoms(['cr', 'crlf', 'lf', 'anycrlf']). + t_atoms(['cr', 'crlf', 'lf', 'anycrlf', 'any']). t_re_ValueSpec() -> t_sup(t_atoms(['all', 'all_but_first', 'first', 'none']), t_re_ValueList()). @@ -5254,7 +5190,12 @@ t_ML() -> % a binary or a possibly deep list of integers or binaries t_sup(t_list(t_sup([t_integer(), t_binary(), t_list()])), t_binary()). t_encoding() -> - t_atoms(['latin1', 'unicode', 'utf8', 'utf16', 'utf32']). + t_sup([t_atoms(['latin1', 'unicode', 'utf8', 'utf16', 'utf32']), + t_tuple([t_atom('utf16'), t_endian()]), + t_tuple([t_atom('utf32'), t_endian()])]). + +t_file_encoding() -> + t_atoms(['latin1', 'utf8']). t_encoding_a2b() -> % for the 2nd arg of atom_to_binary/2 and binary_to_atom/2 t_atoms(['latin1', 'unicode', 'utf8']). diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index 1ed85af172..080d6936b2 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -62,6 +62,7 @@ t_boolean/0, t_byte/0, t_char/0, + t_charlist/0, t_collect_vars/1, t_cons/0, t_cons/2, @@ -195,6 +196,7 @@ t_tuple_size/1, t_tuple_sizes/1, t_tuple_subtypes/1, + t_unicode_string/0, t_unify/2, t_unify/3, t_unit/0, @@ -1455,6 +1457,26 @@ t_is_tuple(_) -> false. %% Non-primitive types, including some handy syntactic sugar types %% +-spec t_unicode_string() -> erl_type(). + +t_unicode_string() -> + t_list(t_unicode_char()). + +-spec t_charlist() -> erl_type(). + +t_charlist() -> + t_charlist(1). + +-spec t_charlist(non_neg_integer()) -> erl_type(). + +t_charlist(N) when N > 0 -> + t_maybe_improper_list(t_sup([t_unicode_char(), + t_unicode_binary(), + t_charlist(N-1)]), + t_sup(t_unicode_binary(), t_nil())); +t_charlist(0) -> + t_maybe_improper_list(t_any(), t_sup(t_unicode_binary(), t_nil())). + -spec t_constant() -> erl_type(). t_constant() -> @@ -1549,6 +1571,16 @@ t_parameterized_module() -> t_timeout() -> t_sup(t_non_neg_integer(), t_atom('infinity')). +-spec t_unicode_binary() -> erl_type(). + +t_unicode_binary() -> + t_binary(). % with characters encoded in UTF-8 coding standard + +-spec t_unicode_char() -> erl_type(). + +t_unicode_char() -> + t_integer(). % representing a valid unicode codepoint + %%----------------------------------------------------------------------------- %% Some built-in opaque types %% @@ -2825,7 +2857,7 @@ t_subtract(?list(Contents1, Termination1, Size1) = T, true -> case {Size1, Size2} of {?nonempty_qual, ?unknown_qual} -> ?none; - {?unknown_qual, ?nonempty_qual} -> Termination1; + {?unknown_qual, ?nonempty_qual} -> ?nil; {S, S} -> ?none end; false -> diff --git a/lib/hipe/doc/src/notes.xml b/lib/hipe/doc/src/notes.xml index cf30db0482..8c9dbc0c18 100644 --- a/lib/hipe/doc/src/notes.xml +++ b/lib/hipe/doc/src/notes.xml @@ -30,6 +30,39 @@ </header> <p>This document describes the changes made to HiPE.</p> +<section><title>Hipe 3.7.8.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Several type specifications for standard libraries were + wrong in the R14B01 release. This is now corrected. The + corrections concern types in re,io,filename and the + module erlang itself.</p> + <p> + Own Id: OTP-9008</p> + </item> + </list> + </section> + +</section> + +<section><title>Hipe 3.7.8</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Compiler warnings were eliminated.</p> + <p> + Own Id: OTP-8855</p> + </item> + </list> + </section> + +</section> + <section><title>Hipe 3.7.7</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/hipe/icode/hipe_beam_to_icode.erl b/lib/hipe/icode/hipe_beam_to_icode.erl index 920c94d85c..d7eb035551 100644 --- a/lib/hipe/icode/hipe_beam_to_icode.erl +++ b/lib/hipe/icode/hipe_beam_to_icode.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% 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 @@ -918,7 +918,7 @@ trans_fun([{bs_add, {f,Lbl}, [Old,New,Unit], Res}|Instructions], Env) -> Succ = mk_label(new), [hipe_icode:mk_primop([Temp], '*', [NewVar, hipe_icode:mk_const(Unit)], - hipe_icode:label_name(Succ), Lbl), + hipe_icode:label_name(Succ), map_label(Lbl)), Succ] end end, @@ -930,7 +930,7 @@ trans_fun([{bs_add, {f,Lbl}, [Old,New,Unit], Res}|Instructions], Env) -> [FailLbl, hipe_icode:mk_fail([hipe_icode:mk_const(badarg)], error)]}; true -> - {Lbl, []} + {map_label(Lbl), []} end, IsPos = [hipe_icode:mk_if('>=', [Temp, hipe_icode:mk_const(0)], diff --git a/lib/hipe/icode/hipe_icode_primops.erl b/lib/hipe/icode/hipe_icode_primops.erl index b0fe7eb708..a413531c07 100644 --- a/lib/hipe/icode/hipe_icode_primops.erl +++ b/lib/hipe/icode/hipe_icode_primops.erl @@ -2,19 +2,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. -%% +%% 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% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -26,9 +26,6 @@ %% Notes : %% History : * 2001-06-13 Erik Johansson ([email protected]): %% Created. -%% -%% $Id$ -%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -module(hipe_icode_primops). @@ -197,7 +194,7 @@ fails(#element{}) -> true; %% fails(#gc_test{}) -> ??? fails({hipe_bs_primop, {bs_start_match, _}}) -> true; fails({hipe_bs_primop, {{bs_start_match, bitstr}, _}}) -> true; -fails({hipe_bs_primop, {{bs_start_match, ok_matchstate}, _}}) -> false; +fails({hipe_bs_primop, {{bs_start_match, ok_matchstate}, _}}) -> true; fails({hipe_bs_primop, {bs_get_binary, _, _}}) -> true; fails({hipe_bs_primop, {bs_get_binary_all, _, _}}) -> true; fails({hipe_bs_primop, {bs_get_binary_all_2, _, _}}) -> true; diff --git a/lib/hipe/vsn.mk b/lib/hipe/vsn.mk index 8e421ce9b2..513b1f4943 100644 --- a/lib/hipe/vsn.mk +++ b/lib/hipe/vsn.mk @@ -1 +1 @@ -HIPE_VSN = 3.7.7 +HIPE_VSN = 3.7.8.1 diff --git a/lib/ic/doc/src/notes.xml b/lib/ic/doc/src/notes.xml index 6684547572..5f6c31069c 100644 --- a/lib/ic/doc/src/notes.xml +++ b/lib/ic/doc/src/notes.xml @@ -31,6 +31,26 @@ </header> <section> + <title>IC 4.2.26</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p> + Partial support for recursive structs and unions. Only available + for the erl_corba backend and requires that Light IFR is used. + I.e. the IC option {light_ifr, true} and that Orber is configured + in such a way that Light IFR is activated. Recursive TypeCode is + currently not supported.</p> + <p> + Own Id: OTP-8868 Aux Id: seq11633</p> + </item> + </list> + </section> + </section> + + <section> <title>IC 4.2.25</title> <section> diff --git a/lib/ic/src/ic_forms.erl b/lib/ic/src/ic_forms.erl index 7409ddeb7b..fc46a2ed40 100644 --- a/lib/ic/src/ic_forms.erl +++ b/lib/ic/src/ic_forms.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -65,6 +65,7 @@ get_line(X) when is_record(X, scoped_id) -> X#scoped_id.line; get_line(X) when is_record(X, module) -> get_line(X#module.id); get_line(X) when is_record(X, interface) -> get_line(X#interface.id); get_line(X) when is_record(X, forward) -> get_line(X#forward.id); +get_line(X) when is_record(X, constr_forward) -> get_line(X#constr_forward.id); get_line(X) when is_record(X, const) -> get_line(X#const.id); get_line(X) when is_record(X, typedef) -> get_line(X#typedef.id); get_line(X) when is_record(X, struct) -> get_line(X#struct.id); @@ -114,6 +115,7 @@ get_line(_) -> -1. get_id2(X) when is_record(X, module) -> get_id(X#module.id); get_id2(X) when is_record(X, interface) -> get_id(X#interface.id); get_id2(X) when is_record(X, forward) -> get_id(X#forward.id); +get_id2(X) when is_record(X, constr_forward) -> get_id(X#constr_forward.id); get_id2(X) when is_record(X, const) -> get_id(X#const.id); get_id2(X) when is_record(X, typedef) -> get_id(hd(X#typedef.id)); get_id2(X) when is_record(X, struct) -> get_id(X#struct.id); @@ -156,6 +158,7 @@ get_type(X) when is_record(X, param) -> X#param.type. %% Temporary place get_tk(X) when is_record(X, interface) -> X#interface.tk; get_tk(X) when is_record(X, forward) -> X#forward.tk; +get_tk(X) when is_record(X, constr_forward) -> X#constr_forward.tk; get_tk(X) when is_record(X, const) -> X#const.tk; get_tk(X) when is_record(X, type_dcl) -> X#type_dcl.tk; get_tk(X) when is_record(X, typedef) -> X#typedef.tk; @@ -228,6 +231,7 @@ clean_up_scope([N|Ns],Found) -> get_type_code2(_, _, X) when is_record(X, interface) -> X#interface.tk; get_type_code2(_, _, X) when is_record(X, forward) -> X#forward.tk; +get_type_code2(_, _, X) when is_record(X, constr_forward) -> X#constr_forward.tk; get_type_code2(_, _, X) when is_record(X, const) -> X#const.tk; get_type_code2(_, _, X) when is_record(X, type_dcl) -> X#type_dcl.tk; get_type_code2(_, _, X) when is_record(X, typedef) -> diff --git a/lib/ic/src/ic_pragma.erl b/lib/ic/src/ic_pragma.erl index 9165e3b03b..45cb64c9c8 100644 --- a/lib/ic/src/ic_pragma.erl +++ b/lib/ic/src/ic_pragma.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -60,7 +60,7 @@ pragma_reg(G,X) -> init_pragma_status(S), registerOptions(G,S), pragma_reg_all(G, S, [], X), - denote_specific_code_opts(G), %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + denote_specific_code_opts(G), case get_pragma_compilation_status(S) of true -> %% Remove ugly pragmas from form @@ -132,6 +132,7 @@ applyCodeOpt(G) -> %% This removes all pragma records from the form. %% When debugged, it can be enbodied in pragma_reg_all. +cleanup(undefined,C) -> C; cleanup([],C) -> C; cleanup([X|Xs],CSF) -> cleanup(Xs, CSF++cleanup(X)). @@ -279,7 +280,12 @@ pragma_reg(G, S, N, X) when is_record(X, union) -> pragma_reg(G, S, N, X) when is_record(X, struct) -> mk_ref(G,[get_id2(X) | N],struct_ref), mk_file_data(G,X,N,struct), - pragma_reg_all(G, S, N, X#struct.body); + case X#struct.body of + undefined -> + ok; + _ -> + pragma_reg_all(G, S, N, X#struct.body) + end; pragma_reg(G, _S, N, X) when is_record(X, attr) -> XX = #id_of{type=X}, diff --git a/lib/ic/src/ic_symtab.erl b/lib/ic/src/ic_symtab.erl index 889c75e3a2..d710154a5d 100644 --- a/lib/ic/src/ic_symtab.erl +++ b/lib/ic/src/ic_symtab.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -69,6 +69,8 @@ store(G, N, X) -> ets:insert(G#genobj.symtab, {Name, X}); {ok, Y} when is_record(Y, forward) -> ets:insert(G#genobj.symtab, {Name, X}); + {ok, Y} when is_record(Y, constr_forward) -> + ets:insert(G#genobj.symtab, {Name, X}); {ok, _Y} -> ic_error:error(G, {multiply_defined, X}) end. diff --git a/lib/ic/src/icforms.hrl b/lib/ic/src/icforms.hrl index d1869e6330..1b394a11b4 100644 --- a/lib/ic/src/icforms.hrl +++ b/lib/ic/src/icforms.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -34,6 +34,7 @@ -record(module, {id, body}). -record(interface, {id, inherit, body, inherit_body, tk}). -record(forward, {id, tk}). +-record(constr_forward, {id, tk}). -record(const, {type, id, val, tk}). -record(type_dcl, {type, tk}). -record(typedef, {type, id, tk}). diff --git a/lib/ic/src/icparse.yrl b/lib/ic/src/icparse.yrl index 25b0f452e7..d0dd6cde4c 100644 --- a/lib/ic/src/icparse.yrl +++ b/lib/ic/src/icparse.yrl @@ -1,21 +1,20 @@ -%%<copyright> -%% <year>1997-2007</year> -%% <holder>Ericsson AB, All Rights Reserved</holder> -%%</copyright> -%%<legalnotice> +%% +%% %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. -%% -%% The Initial Developer of the Original Code is Ericsson AB. -%%</legalnotice> +%% +%% %CopyrightEnd% %% %%------------------------------------------------------------ %% Yecc spec for IDL @@ -150,6 +149,7 @@ Nonterminals 'ZorM_<integer_literal>' '<fixed_pt_type>' '<fixed_pt_const_type>' + '<constr_forward_decl>' . @@ -473,6 +473,7 @@ OE_preproc -> '#' '<integer_literal>' '<string_literal>' '<type_dcl>' -> '<struct_type>' : '$1' . '<type_dcl>' -> '<union_type>' : '$1' . '<type_dcl>' -> '<enum_type>' : '$1' . +'<type_dcl>' -> '<constr_forward_decl>' : '$1' . %% (28) NIY multiple declarators (FIXED) '<type_declarator>' -> '<type_spec>' '<declarators>' @@ -832,6 +833,9 @@ OE_preproc -> '#' '<integer_literal>' '<string_literal>' '<fixed_pt_type>' -> 'fixed' '<' '<positive_int_const>' ',' '<positive_int_const>' '>' : #fixed{digits='$3',scale='$5'} . +%% (99) +'<constr_forward_decl>' -> 'struct' '<identifier>' : #constr_forward{id='$2', tk=tk_struct} . +'<constr_forward_decl>' -> 'union' '<identifier>' : #constr_forward{id='$2', tk=tk_union} . %% Added clause 'ZorM_<string_literal>' -> '$empty' : [] . diff --git a/lib/ic/src/ictype.erl b/lib/ic/src/ictype.erl index 4704191bee..9e20801464 100644 --- a/lib/ic/src/ictype.erl +++ b/lib/ic/src/ictype.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -407,6 +407,18 @@ check(G, S, N, X) when is_record(X, forward) -> tktab_add(G, S, N, X, {tk_objref, ictk:get_IR_ID(G, N, X), ic_forms:get_id2(X)}), X; +check(G, S, N, #constr_forward{tk = tk_struct} = X) -> + ?STDDBG, + ID = ic_forms:get_id2(X), + Module = list_to_atom(string:join(lists:reverse([ID|N]), "_")), + tktab_add(G, S, N, X, {tk_struct, ictk:get_IR_ID(G, N, X), ID, Module}), + X; +check(G, S, N, #constr_forward{tk = tk_union} = X) -> + ?STDDBG, + ID = ic_forms:get_id2(X), + Module = list_to_atom(string:join(lists:reverse([ID|N]), "_")), + tktab_add(G, S, N, X, {tk_union, ictk:get_IR_ID(G, N, X), ID, [], [], Module}), + X; check(G, S, N, X) when is_record(X, const) -> ?STDDBG, @@ -427,21 +439,6 @@ check(G, S, N, X) when is_record(X, const) -> end end; -check(G, S, N, X) when is_record(X, const) -> - ?STDDBG, - case tk_base(G, S, N, ic_forms:get_type(X)) of - Err when element(1, Err) == error -> X; - TK -> - check_const_tk(G, S, N, X, TK), - case iceval:eval_const(G, S, N, TK, X#const.val) of - Err when element(1, Err) == error -> X; - Val -> - V = iceval:get_val(Val), - tktab_add(G, S, N, X, TK, V), - X#const{val=V, tk=TK} - end - end; - check(G, S, N, X) when is_record(X, except) -> ?STDDBG, TK = tk(G, S, N, X), @@ -795,9 +792,15 @@ tktab_add_id(G, S, N, X, Id, TK, Aux) -> Name = [Id | N], UName = mk_uppercase(Name), case ets:lookup(S, Name) of - [{_, forward, _, _}] when is_record(X, interface) -> ok; - [XX] when is_record(X, forward) andalso element(2, XX)==interface -> ok; - [_] -> ic_error:error(G, {multiply_defined, X}); + [{_, forward, _, _}] when is_record(X, interface) -> + ok; + [{_, constr_forward, _, _}] when is_record(X, union) orelse + is_record(X, struct) -> + ok; + [XX] when is_record(X, forward) andalso element(2, XX)==interface -> + ok; + [_] -> + ic_error:error(G, {multiply_defined, X}); [] -> case ets:lookup(S, UName) of [] -> ok; diff --git a/lib/ic/test/Makefile b/lib/ic/test/Makefile index 1142159d19..988e7e7985 100644 --- a/lib/ic/test/Makefile +++ b/lib/ic/test/Makefile @@ -33,7 +33,7 @@ RELSYSDIR = $(RELEASE_PATH)/ic_test # ---------------------------------------------------- # Target Specs # ---------------------------------------------------- -TEST_SPEC_FILE = ic.spec ic.spec.vxworks +TEST_SPEC_FILE = ic.spec IDL_FILES = @@ -251,7 +251,7 @@ release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR)/erl_client_c_server_SUITE_data $(INSTALL_DIR) $(RELSYSDIR)/erl_client_c_server_proto_SUITE_data $(INSTALL_DIR) $(RELSYSDIR)/java_client_erl_server_SUITE_data - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) $(ERL_FILES) \ + $(INSTALL_DATA) $(IDL_FILES) ic.cover $(TEST_SPEC_FILE) $(ERL_FILES) \ $(RELSYSDIR) $(INSTALL_DATA) $(COMPILER_TEST_FILES) $(RELSYSDIR)/ic_SUITE_data $(INSTALL_DATA) $(COMPILER_TEST_FILES2) \ diff --git a/lib/ic/test/c_client_erl_server_SUITE.erl b/lib/ic/test/c_client_erl_server_SUITE.erl index 40c1395d10..038172c311 100644 --- a/lib/ic/test/c_client_erl_server_SUITE.erl +++ b/lib/ic/test/c_client_erl_server_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -24,10 +24,12 @@ -module(c_client_erl_server_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). --export([init_per_testcase/2, fin_per_testcase/2, - all/1, void_test/1, long_test/1, long_long_test/1, +-export([init_per_testcase/2, end_per_testcase/2, + all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + void_test/1, long_test/1, long_long_test/1, unsigned_short_test/1, unsigned_long_test/1, unsigned_long_long_test/1, double_test/1, char_test/1, wchar_test/1, octet_test/1, bool_test/1, struct_test/1, @@ -57,25 +59,40 @@ init_per_testcase(_Case, Config) -> WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> DataDir = ?config(data_dir, Config), code:del_path(DataDir), WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of IC with a C-client and an Erlang generic server. " - "The communication is via Erlang distribution."; -all(suite) -> - [void_test, long_test, long_long_test, unsigned_short_test, - unsigned_long_test, unsigned_long_long_test, double_test, - char_test, wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, seq4_test, - seq5_test, array1_test, array2_test, enum_test, string1_test, - string2_test, string3_test, string4_test, pid_test, port_test, - ref_test, term_test, typedef_test, inline_sequence_test, - term_sequence_test, term_struct_test, wstring1_test]. +suite() -> [{ct_hooks,[ts_install_cth]}]. +all() -> + [void_test, long_test, long_long_test, + unsigned_short_test, unsigned_long_test, + unsigned_long_long_test, double_test, char_test, + wchar_test, octet_test, bool_test, struct_test, + struct2_test, seq1_test, seq2_test, seq3_test, + seq4_test, seq5_test, array1_test, array2_test, + enum_test, string1_test, string2_test, string3_test, + string4_test, pid_test, port_test, ref_test, term_test, + typedef_test, inline_sequence_test, term_sequence_test, + term_struct_test, wstring1_test]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. array1_test(doc) -> ""; array1_test(suite) -> []; diff --git a/lib/ic/test/c_client_erl_server_proto_SUITE.erl b/lib/ic/test/c_client_erl_server_proto_SUITE.erl index 58309a2221..172e4de6d1 100644 --- a/lib/ic/test/c_client_erl_server_proto_SUITE.erl +++ b/lib/ic/test/c_client_erl_server_proto_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -23,10 +23,12 @@ %%---------------------------------------------------------------------- -module(c_client_erl_server_proto_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). --export([init_per_testcase/2, fin_per_testcase/2, - all/1, void_test/1, long_test/1, long_long_test/1, +-export([init_per_testcase/2, end_per_testcase/2, + all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + void_test/1, long_test/1, long_long_test/1, unsigned_short_test/1, unsigned_long_test/1, unsigned_long_long_test/1, double_test/1, char_test/1, wchar_test/1, octet_test/1, bool_test/1, struct_test/1, @@ -56,25 +58,40 @@ init_per_testcase(_Case, Config) -> WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> DataDir = ?config(data_dir, Config), code:del_path(DataDir), WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of IC with a C-client and an Erlang generic server. " - "The communication is via Erlang distribution."; -all(suite) -> - [void_test, long_test, long_long_test, unsigned_short_test, - unsigned_long_test, unsigned_long_long_test, double_test, - char_test, wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, seq4_test, - seq5_test, array1_test, array2_test, enum_test, string1_test, - string2_test, string3_test, string4_test, pid_test, port_test, - ref_test, term_test, typedef_test, inline_sequence_test, - term_sequence_test, term_struct_test, wstring1_test]. +suite() -> [{ct_hooks,[ts_install_cth]}]. +all() -> + [void_test, long_test, long_long_test, + unsigned_short_test, unsigned_long_test, + unsigned_long_long_test, double_test, char_test, + wchar_test, octet_test, bool_test, struct_test, + struct2_test, seq1_test, seq2_test, seq3_test, + seq4_test, seq5_test, array1_test, array2_test, + enum_test, string1_test, string2_test, string3_test, + string4_test, pid_test, port_test, ref_test, term_test, + typedef_test, inline_sequence_test, term_sequence_test, + term_struct_test, wstring1_test]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. array1_test(doc) -> ""; array1_test(suite) -> []; diff --git a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE.erl b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE.erl index 595c5bf483..53bf99c917 100644 --- a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE.erl +++ b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -23,10 +23,12 @@ %%---------------------------------------------------------------------- -module(c_client_erl_server_proto_tmo_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). --export([init_per_testcase/2, fin_per_testcase/2, - all/1, void_test/1, long_test/1, long_long_test/1, +-export([init_per_testcase/2, end_per_testcase/2, + all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + void_test/1, long_test/1, long_long_test/1, unsigned_short_test/1, unsigned_long_test/1, unsigned_long_long_test/1, double_test/1, char_test/1, wchar_test/1, octet_test/1, bool_test/1, struct_test/1, @@ -56,24 +58,41 @@ init_per_testcase(_Case, Config) -> WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> DataDir = ?config(data_dir, Config), code:del_path(DataDir), WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of IC with a C-client and an Erlang generic server. " - "The communication is via Erlang distribution."; -all(suite) -> - [void_test, long_test, long_long_test, unsigned_short_test, - unsigned_long_test, unsigned_long_long_test, double_test, - char_test, wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, seq4_test, - seq5_test, array1_test, array2_test, enum_test, string1_test, - string2_test, string3_test, string4_test, pid_test, port_test, - ref_test, term_test, typedef_test, inline_sequence_test, - term_sequence_test, term_struct_test, wstring1_test]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [void_test, long_test, long_long_test, + unsigned_short_test, unsigned_long_test, + unsigned_long_long_test, double_test, char_test, + wchar_test, octet_test, bool_test, struct_test, + struct2_test, seq1_test, seq2_test, seq3_test, + seq4_test, seq5_test, array1_test, array2_test, + enum_test, string1_test, string2_test, string3_test, + string4_test, pid_test, port_test, ref_test, term_test, + typedef_test, inline_sequence_test, term_sequence_test, + term_struct_test, wstring1_test]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + array1_test(doc) -> ""; diff --git a/lib/ic/test/erl_client_c_server_SUITE.erl b/lib/ic/test/erl_client_c_server_SUITE.erl index c5f5b6a218..a42dbb9604 100644 --- a/lib/ic/test/erl_client_c_server_SUITE.erl +++ b/lib/ic/test/erl_client_c_server_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% 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 @@ -24,9 +24,9 @@ -module(erl_client_c_server_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). --export([init_per_testcase/2, fin_per_testcase/2, all/1, void_test/1, +-export([init_per_testcase/2, end_per_testcase/2,all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, void_test/1, long_test/1, longlong_test/1, ushort_test/1, ulong_test/1, ulonglong_test/1, double_test/1, char_test/1, wchar_test/1, octet_test/1, bool_test/1, struct_test/1, struct2_test/1, @@ -57,24 +57,40 @@ init_per_testcase(_Case, Config) -> WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> DataDir = ?config(data_dir, Config), code:del_path(DataDir), WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of IC with an Erlang client and a C server. " - "The communication is via Erlang distribution."; -all(suite) -> - [void_test, long_test, longlong_test, ushort_test, - ulong_test, ulonglong_test, double_test, - char_test, wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, seq4_test, - seq5_test, array1_test, array2_test, enum_test, string1_test, - string2_test, string3_test, string4_test, pid_test, port_test, - ref_test, term_test, typedef_test, inline_sequence_test, - term_sequence_test, term_struct_test, wstring1_test]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> +[void_test, long_test, longlong_test, ushort_test, + ulong_test, ulonglong_test, double_test, char_test, + wchar_test, octet_test, bool_test, struct_test, + struct2_test, seq1_test, seq2_test, seq3_test, + seq4_test, seq5_test, array1_test, array2_test, + enum_test, string1_test, string2_test, string3_test, + string4_test, pid_test, port_test, ref_test, term_test, + typedef_test, inline_sequence_test, term_sequence_test, + term_struct_test, wstring1_test]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + array1_test(doc) -> ""; diff --git a/lib/ic/test/erl_client_c_server_proto_SUITE.erl b/lib/ic/test/erl_client_c_server_proto_SUITE.erl index d75feb621a..c8ad4042e4 100644 --- a/lib/ic/test/erl_client_c_server_proto_SUITE.erl +++ b/lib/ic/test/erl_client_c_server_proto_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -24,9 +24,9 @@ -module(erl_client_c_server_proto_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). --export([init_per_testcase/2, fin_per_testcase/2, all/1, void_test/1, +-export([init_per_testcase/2, end_per_testcase/2,all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, void_test/1, long_test/1, longlong_test/1, ushort_test/1, ulong_test/1, ulonglong_test/1, double_test/1, char_test/1, wchar_test/1, octet_test/1, bool_test/1, struct_test/1, struct2_test/1, @@ -57,24 +57,40 @@ init_per_testcase(_Case, Config) -> WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> DataDir = ?config(data_dir, Config), code:del_path(DataDir), WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of IC with an Erlang client and a C server. " - "The communication is via Erlang distribution."; -all(suite) -> - [void_test, long_test, longlong_test, ushort_test, - ulong_test, ulonglong_test, double_test, - char_test, wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, seq4_test, - seq5_test, array1_test, array2_test, enum_test, string1_test, - string2_test, string3_test, string4_test, pid_test, port_test, - ref_test, term_test, typedef_test, inline_sequence_test, - term_sequence_test, term_struct_test, wstring1_test]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> +[void_test, long_test, longlong_test, ushort_test, + ulong_test, ulonglong_test, double_test, char_test, + wchar_test, octet_test, bool_test, struct_test, + struct2_test, seq1_test, seq2_test, seq3_test, + seq4_test, seq5_test, array1_test, array2_test, + enum_test, string1_test, string2_test, string3_test, + string4_test, pid_test, port_test, ref_test, term_test, + typedef_test, inline_sequence_test, term_sequence_test, + term_struct_test, wstring1_test]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + array1_test(doc) -> ""; diff --git a/lib/ic/test/ic.cover b/lib/ic/test/ic.cover new file mode 100644 index 0000000000..5a679c8b6f --- /dev/null +++ b/lib/ic/test/ic.cover @@ -0,0 +1,2 @@ +{incl_app,ic,details}. + diff --git a/lib/ic/test/ic.spec b/lib/ic/test/ic.spec index 280c2aba47..22905dcee4 100644 --- a/lib/ic/test/ic.spec +++ b/lib/ic/test/ic.spec @@ -1 +1 @@ -{topcase, {dir, "../ic_test"}}. +{suites,"../ic_test",all}. diff --git a/lib/ic/test/ic_SUITE.erl b/lib/ic/test/ic_SUITE.erl index 6682c82f01..6a9d1325e1 100644 --- a/lib/ic/test/ic_SUITE.erl +++ b/lib/ic/test/ic_SUITE.erl @@ -22,9 +22,10 @@ %%%---------------------------------------------------------------------- -module(ic_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -include_lib("orber/src/orber_ifr.hrl"). @@ -33,36 +34,36 @@ %% The type cases --export([type/1, type_norm/1]). +-export([ type_norm/1]). %% The syntax case --export([syntax/1]). +-export([]). -export([syntax1/1, syntax2/1, syntax3/1, syntax4/1, syntax5/1, syntax6/1]). %% The constant cases --export([const/1]). +-export([]). -export([const_norm/1, const_bad_tk/1, const_bad_type/1]). -export([const_bad_comb/1]). %% The union cases --export([union/1]). +-export([]). -export([union_norm/1, union_type/1, union_mult_err/1, union_case_mult/1]). -export([union_default/1]). %% The enum cases --export([enum/1]). +-export([]). -export([enum_norm/1]). %% The struct cases --export([struct/1]). +-export([]). -export([struct_norm/1]). %% The oneway cases --export([oneway/1]). +-export([]). -export([oneway_norm/1, oneway_raises/1, oneway_out/1, oneway_void/1, oneway_followed/1]). %% The attributes cases --export([attr/1]). +-export([]). -export([attr_norm/1]). %% The raises registration case @@ -72,12 +73,12 @@ %% The typeID case %% general stuff --export([general/1]). +-export([]). -export([typeid/1, undef_id/1, dir/1, nasty_names/1, coss/1, mult_ids/1]). -export([forward/1, include/1, app_test/1]). %% inheritance stuff --export([inherit/1, inherit_norm/1, inherit_warn/1, inherit_err/1]). +-export([ inherit_norm/1, inherit_warn/1, inherit_err/1]). %% Standard options to the ic compiler, NOTE unholy use of OutDir @@ -86,10 +87,46 @@ %% Top of cases -all(doc) -> - []; -all(suite) -> [app_test, const, union, enum, attr, type, struct, general, inherit, - oneway, syntax, raises_reg]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [app_test, {group, const}, {group, union}, + {group, enum}, {group, attr}, {group, type}, + {group, struct}, {group, general}, {group, inherit}, + {group, oneway}, {group, syntax}, raises_reg]. + +groups() -> + [{const, [], + [const_norm, const_bad_tk, const_bad_type, + const_bad_comb]}, + {union, [], + [union_norm, union_type, union_mult_err, + union_case_mult, union_default]}, + {enum, [], [enum_norm]}, {struct, [], [struct_norm]}, + {general, [], + [typeid, undef_id, mult_ids, forward, include, + nasty_names]}, + {inherit, [], + [inherit_norm, inherit_warn, inherit_err]}, + {oneway, [], + [oneway_norm, oneway_out, oneway_raises, oneway_void, + oneway_followed]}, + {attr, [], [attr_norm]}, {type, [], [type_norm]}, + {syntax, [], + [syntax1, syntax2, syntax3, syntax4, syntax5, syntax6]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + app_test(doc) -> []; @@ -103,7 +140,6 @@ app_test(_Config) -> %% Test of constant expressions. %% -const(suite) -> [const_norm, const_bad_tk, const_bad_type, const_bad_comb]. const_norm(doc) -> @@ -159,10 +195,6 @@ const_bad_comb(Config) when is_list(Config) -> -union(suite) -> [union_norm, union_type, union_mult_err, union_case_mult, - union_default]; -union(doc) -> - ["Checks allowed usage of the union as well as the illegal cases"]. union_norm(doc) -> @@ -277,9 +309,6 @@ union_case_mult(Config) when is_list(Config) -> %% Enum cases %% -enum(suite) -> [enum_norm]; -enum(doc) -> - ["Checks allowed usage of the enum as well as the illegal cases"]. enum_norm(doc) -> ["Checks that normal enum declarations works."]; @@ -300,9 +329,6 @@ enum_norm(Config) when is_list(Config) -> %% Struct cases %% -struct(suite) -> [struct_norm]; -struct(doc) -> - ["Checks allowed usage of the struct as well as the illegal cases"]. struct_norm(doc) -> ["Checks that normal struct declarations works."]; @@ -331,10 +357,6 @@ struct_norm(Config) when is_list(Config) -> %% General cases %% -general(doc) -> - ["Check general things like directories and type identifier", - "detection."]; -general(suite) -> [typeid, undef_id, mult_ids, forward, include, nasty_names]. %% coss (add sometimes, takes 440 seconds!) typeid(doc) -> @@ -490,9 +512,6 @@ include(Config) when is_list(Config) -> %% Inhertit cases %% -inherit(doc) -> - ["Check the inheritance mechanism."]; -inherit(suite) -> [inherit_norm, inherit_warn, inherit_err]. inherit_norm(doc) -> ["Checks that normal inheritance works."]; @@ -547,9 +566,6 @@ inherit_err(Config) when is_list(Config) -> ok. -oneway(doc) -> - ["Check the oneway operation mechanism."]; -oneway(suite) -> [oneway_norm, oneway_out, oneway_raises, oneway_void, oneway_followed ]. oneway_norm(doc) -> ["Checks that normal oneway operations works."]; @@ -618,9 +634,6 @@ oneway_followed(Config) when is_list(Config) -> ?line ok = compile(OutDir, oneway_followed_files(), [load]), ok. -attr(doc) -> - ["Check that attributes work."]; -attr(suite) -> [attr_norm]. attr_norm(doc) -> ["Checks that normal attr operations works."]; @@ -636,9 +649,6 @@ attr_norm(Config) when is_list(Config) -> ?line ok = compile(OutDir, attr_norm_files(), [load]), ok. -type(doc) -> - ["Check that typeibutes work."]; -type(suite) -> [type_norm]. type_norm(doc) -> ["Checks all types are handled."]; @@ -655,9 +665,6 @@ type_norm(Config) when is_list(Config) -> ok. -syntax(doc) -> - ["Check that syntax errors are discovered."]; -syntax(suite) -> [syntax1, syntax2, syntax3, syntax4, syntax5, syntax6]. syntax1(suite) -> []; syntax1(Config) when is_list(Config) -> diff --git a/lib/ic/test/ic_be_SUITE.erl b/lib/ic/test/ic_be_SUITE.erl index e3caf7bdff..3693d22cd2 100644 --- a/lib/ic/test/ic_be_SUITE.erl +++ b/lib/ic/test/ic_be_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -22,10 +22,11 @@ %%%---------------------------------------------------------------------- -module(ic_be_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1,plain/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,plain/1]). -define(OUT(X), filename:join([?config(priv_dir, Config), gen, to_list(X)])). @@ -33,7 +34,26 @@ %% Top of cases -all(suite) -> [plain]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [plain]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + diff --git a/lib/ic/test/ic_pp_SUITE.erl b/lib/ic/test/ic_pp_SUITE.erl index d68242bf3a..27d404239f 100644 --- a/lib/ic/test/ic_pp_SUITE.erl +++ b/lib/ic/test/ic_pp_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -22,7 +22,7 @@ %%---------------------------------------------------------------------- -module(ic_pp_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). @@ -32,50 +32,57 @@ -define(GCC, "g++"). -define(GCC_VER, "2.95.3"). --export([all/1]). --export([arg/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([arg_norm/1]). --export([cascade/1]). -export([cascade_norm/1]). --export([comment/1]). -export([comment_norm/1]). --export([concat/1]). -export([concat_norm/1]). --export([define/1]). -export([define_norm/1]). --export(['if'/1]). -export([if_norm/1]). -export([if_zero/1]). --export([misc/1]). -export([misc_norm/1]). --export([improp_nest_constr/1]). -export([improp_nest_constr_norm/1]). --export([inc/1]). -export([inc_norm/1]). --export([line/1]). -export([line_norm/1]). --export([nopara/1]). -export([nopara_norm/1]). --export([predef/1]). -export([predef_norm/1]). --export([predef_time/1]). -export([predef_time_norm/1]). --export([self_ref/1]). -export([self_ref_norm/1]). --export([separate/1]). -export([separate_norm/1]). --export([swallow_sc/1]). -export([swallow_sc_norm/1]). --export([unintended_grp/1]). -export([unintended_grp_norm/1]). --export([cases/0, init_all/1, finish_all/1]). +-export([cases/0, init_per_suite/1, end_per_suite/1]). -all(doc) -> ["Preprocessing tests for IC"]; -all(suite) -> - {req, [], {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -init_all(Config) -> +all() -> + cases(). + +groups() -> + [{arg, [], [arg_norm]}, {cascade, [], [cascade_norm]}, + {comment, [], [comment_norm]}, + {concat, [], [concat_norm]}, + {define, [], [define_norm]}, {inc, [], [inc_norm]}, + {improp_nest_constr, [], [improp_nest_constr_norm]}, + {misc, [], [misc_norm]}, {line, [], [line_norm]}, + {nopara, [], [nopara_norm]}, + {predef, [], [predef_norm]}, + {predef_time, [], [predef_time_norm]}, + {self_ref, [], [self_ref_norm]}, + {separate, [], [separate_norm]}, + {swallow_sc, [], [swallow_sc_norm]}, + {unintended_grp, [], [unintended_grp_norm]}, + {'if', [],[if_norm, if_zero]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) -> if is_list(Config) -> case os:type() of @@ -120,14 +127,18 @@ skip_white([$\t|T]) -> skip_white(T); skip_white(L) -> L. -finish_all(Config) -> +end_per_suite(Config) -> Config. -cases() -> - [arg, cascade, comment, concat, define, misc, 'if', improp_nest_constr, inc, - line, nopara, predef, predef_time, self_ref, separate, swallow_sc, - unintended_grp]. +cases() -> + [{group, arg}, {group, cascade}, {group, comment}, + {group, concat}, {group, define}, {group, misc}, {group, 'if'}, + {group, improp_nest_constr}, {group, inc}, + {group, line}, {group, nopara}, {group, predef}, + {group, predef_time}, {group, self_ref}, + {group, separate}, {group, swallow_sc}, + {group, unintended_grp}]. @@ -135,8 +146,6 @@ cases() -> %% arg %%-------------------------------------------------------------------- -arg(suite) -> [arg_norm]; -arg(doc) -> ["Check #define with some arguments"]. arg_norm(doc) -> ["Checks arguments for #define."]; arg_norm(suite) -> []; @@ -153,8 +162,6 @@ arg_norm(Config) when is_list(Config) -> %% cascade %%-------------------------------------------------------------------- -cascade(suite) -> [cascade_norm]; -cascade(doc) -> ["Check cascade #define"]. cascade_norm(doc) -> ["Check cascade #define."]; cascade_norm(suite) -> []; @@ -171,8 +178,6 @@ cascade_norm(Config) when is_list(Config) -> %% comment %%-------------------------------------------------------------------- -comment(suite) -> [comment_norm]; -comment(doc) -> ["Check comments"]. comment_norm(doc) -> ["Check comments."]; comment_norm(suite) -> []; @@ -189,8 +194,6 @@ comment_norm(Config) when is_list(Config) -> %% concat %%-------------------------------------------------------------------- -concat(suite) -> [concat_norm]; -concat(doc) -> ["Check concatinations, i.e ## "]. concat_norm(doc) -> ["Check concatinations, i.e ## ."]; concat_norm(suite) -> []; @@ -207,8 +210,6 @@ concat_norm(Config) when is_list(Config) -> %% define %%-------------------------------------------------------------------- -define(suite) -> [define_norm]; -define(doc) -> ["Check misceleaneous #define"]. define_norm(doc) -> ["Check misceleaneous #define."]; define_norm(suite) -> []; @@ -225,10 +226,6 @@ define_norm(Config) when is_list(Config) -> %% if %%-------------------------------------------------------------------- -'if'(suite) -> [if_norm, if_zero]; -'if'(doc) -> ["Check #if, #elif, and #endif. Note these are not implementen and will ~n - result in an error message from internal_pp"]. - if_norm(doc) -> ["Check #if, #elif, and #endif. ."]; if_norm(suite) -> []; if_norm(Config) when is_list(Config) -> @@ -254,8 +251,6 @@ if_zero(Config) when is_list(Config) -> %% inc %%-------------------------------------------------------------------- -inc(suite) -> [inc_norm]; -inc(doc) -> ["Check #include"]. inc_norm(doc) -> ["Check #include."]; inc_norm(suite) -> []; @@ -273,8 +268,6 @@ inc_norm(Config) when is_list(Config) -> %% improp_nest_constr %%-------------------------------------------------------------------- -improp_nest_constr(suite) -> [improp_nest_constr_norm]; -improp_nest_constr(doc) -> ["Check improperly nested constructs"]. improp_nest_constr_norm(doc) -> ["Check improperly nested constructs."]; improp_nest_constr_norm(suite) -> []; @@ -291,8 +284,6 @@ improp_nest_constr_norm(Config) when is_list(Config) -> %% misc %%-------------------------------------------------------------------- -misc(suite) -> [misc_norm]; -misc(doc) -> ["Misceleaneous checks"]. misc_norm(doc) -> ["Misceleaneous checks."]; misc_norm(suite) -> []; @@ -309,8 +300,6 @@ misc_norm(Config) when is_list(Config) -> %% line %%-------------------------------------------------------------------- -line(suite) -> [line_norm]; -line(doc) -> ["Checks #line"]. line_norm(doc) -> ["Checks #line."]; line_norm(suite) -> []; @@ -327,8 +316,6 @@ line_norm(Config) when is_list(Config) -> %% nopara %%-------------------------------------------------------------------- -nopara(suite) -> [nopara_norm]; -nopara(doc) -> ["Checks #define with no parameters"]. nopara_norm(doc) -> ["Checks #define with no parameters."]; nopara_norm(suite) -> []; @@ -345,8 +332,6 @@ nopara_norm(Config) when is_list(Config) -> %% predef %%-------------------------------------------------------------------- -predef(suite) -> [predef_norm]; -predef(doc) -> ["Checks predefined macros. Note: not __TIME__ and __DATE__"]. predef_norm(doc) -> ["Checks predefined macros. Note: not __TIME__ and __DATE__."]; predef_norm(suite) -> []; @@ -363,8 +348,6 @@ predef_norm(Config) when is_list(Config) -> %% predef_time %%-------------------------------------------------------------------- -predef_time(suite) -> [predef_time_norm]; -predef_time(doc) -> ["Checks the predefined macros __TIME__ and __DATE__"]. predef_time_norm(doc) -> ["Checks the predefined macros __TIME__ and __DATE__."]; predef_time_norm(suite) -> []; @@ -381,8 +364,6 @@ predef_time_norm(Config) when is_list(Config) -> %% self_ref %%-------------------------------------------------------------------- -self_ref(suite) -> [self_ref_norm]; -self_ref(doc) -> ["Checks self referring macros"]. self_ref_norm(doc) -> ["Checks self referring macros."]; self_ref_norm(suite) -> []; @@ -399,8 +380,6 @@ self_ref_norm(Config) when is_list(Config) -> %% separate %%-------------------------------------------------------------------- -separate(suite) -> [separate_norm]; -separate(doc) -> ["Checks separete expansion of macro arguments"]. separate_norm(doc) -> ["Checks separete expansion of macro arguments."]; separate_norm(suite) -> []; @@ -417,8 +396,6 @@ separate_norm(Config) when is_list(Config) -> %% swallow_sc %%-------------------------------------------------------------------- -swallow_sc(suite) -> [swallow_sc_norm]; -swallow_sc(doc) -> ["Checks swallowing an undesirable semicolon"]. swallow_sc_norm(doc) -> ["Checks swallowing an undesirable semicolon."]; swallow_sc_norm(suite) -> []; @@ -435,8 +412,6 @@ swallow_sc_norm(Config) when is_list(Config) -> %% unintended_grp %%-------------------------------------------------------------------- -unintended_grp(suite) -> [unintended_grp_norm]; -unintended_grp(doc) -> ["Checks unintended grouping of arithmetic"]. unintended_grp_norm(doc) -> ["Checks unintended grouping of arithmetic."]; unintended_grp_norm(suite) -> []; diff --git a/lib/ic/test/ic_pragma_SUITE.erl b/lib/ic/test/ic_pragma_SUITE.erl index 0edb5d4717..65fda2e3b9 100644 --- a/lib/ic/test/ic_pragma_SUITE.erl +++ b/lib/ic/test/ic_pragma_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -27,12 +27,13 @@ %%----------------------------------------------------------------- -module(ic_pragma_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, init_all/1, finish_all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1]). -export([ifr_pragma_reg/1, pragma_error/1, uggly_pragmas/1]). @@ -53,18 +54,28 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [ifr_pragma_reg,pragma_error,uggly_pragmas]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [ifr_pragma_reg, pragma_error, uggly_pragmas]. %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- -init_all(Config) -> +init_per_suite(Config) -> io:format("Setting up.....~n"), mnesia:stop(), mnesia:delete_schema([node()]), @@ -79,7 +90,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> io:format("Setting down.....~n"), orber:stop(), orber:uninstall(), diff --git a/lib/ic/test/ic_register_SUITE.erl b/lib/ic/test/ic_register_SUITE.erl index ae7578199a..6a9dea5a3d 100644 --- a/lib/ic/test/ic_register_SUITE.erl +++ b/lib/ic/test/ic_register_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -26,12 +26,13 @@ %%----------------------------------------------------------------- -module(ic_register_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, init_all/1, finish_all/1, ifr_reg_unreg/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, ifr_reg_unreg/1]). -export([ifr_inheritence_reg/1,ifr_reg_unreg_with_inheritence/1]). -export([ifr_reg_unreg_with_inheritence_bad_order/1]). @@ -57,20 +58,31 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [ifr_reg_unreg,ifr_reg_unreg_with_inheritence, - ifr_reg_unreg_with_inheritence_bad_order,ifr_inheritence_reg]. +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [ifr_reg_unreg, ifr_reg_unreg_with_inheritence, + ifr_reg_unreg_with_inheritence_bad_order, + ifr_inheritence_reg]. %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- -init_all(Config) -> +init_per_suite(Config) -> io:format("Setting up.....~n"), mnesia:stop(), mnesia:delete_schema([node()]), @@ -85,7 +97,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> io:format("Setting down.....~n"), orber:stop(), orber:uninstall(), diff --git a/lib/ic/test/java_client_erl_server_SUITE.erl b/lib/ic/test/java_client_erl_server_SUITE.erl index ee77ef0c4e..bd87ce24d9 100644 --- a/lib/ic/test/java_client_erl_server_SUITE.erl +++ b/lib/ic/test/java_client_erl_server_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -22,10 +22,12 @@ %%%---------------------------------------------------------------------- -module(java_client_erl_server_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1,init_all/1,finish_all/1,init_per_testcase/2,fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1,end_per_suite/1, + init_per_testcase/2,end_per_testcase/2]). -export([marshal_ll/1,marshal_ull/1, marshal_l/1,marshal_ul/1, marshal_s/1,marshal_us/1, @@ -36,19 +38,27 @@ %% Top of cases -all(doc) -> - "Test of IC with a Java-client and an Erlang generic server. " - "The communication is via Erlang distribution."; -all(suite) -> {conf,init_all,cases(),finish_all}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> [marshal_ll,marshal_ull, - marshal_l,marshal_ul, - marshal_s,marshal_us, - marshal_c,marshal_wc, - marshal_str, - marshal_any_3,marshal_any_2]. +all() -> + cases(). -init_all(Config) when is_list(Config) -> +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [marshal_ll, marshal_ull, marshal_l, marshal_ul, + marshal_s, marshal_us, marshal_c, marshal_wc, + marshal_str, marshal_any_3, marshal_any_2]. + +init_per_suite(Config) when is_list(Config) -> case case code:priv_dir(jinterface) of {error,bad_name} -> false; @@ -76,7 +86,7 @@ find_executable([E|T]) -> Path -> Path end. -finish_all(Config) -> Config. +end_per_suite(Config) -> Config. @@ -98,7 +108,7 @@ init_per_testcase(_Case, Config) -> WatchDog = test_server:timetrap(test_server:seconds(20)), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> DataDir = ?config(data_dir, Config), code:del_path(DataDir), WatchDog = ?config(watchdog, Config), diff --git a/lib/ic/vsn.mk b/lib/ic/vsn.mk index 074d0b3d39..6d6c7fa625 100644 --- a/lib/ic/vsn.mk +++ b/lib/ic/vsn.mk @@ -1 +1 @@ -IC_VSN = 4.2.25 +IC_VSN = 4.2.26 diff --git a/lib/inets/doc/src/http_server.xml b/lib/inets/doc/src/http_server.xml index 68dfd1add0..47ed9cd229 100644 --- a/lib/inets/doc/src/http_server.xml +++ b/lib/inets/doc/src/http_server.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> @@ -766,7 +766,7 @@ http://your.server.org/eval?httpd_example:print(atom_to_list(apply(erlang,halt,[ <code> -module(mnesia_test). -export([start/0,load_data/0]). --include("mod_auth.hrl"). +-include_lib("mod_auth.hrl"). first_start() -> mnesia:create_schema([node()]), diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml index 7b16189860..11b0af4310 100644 --- a/lib/inets/doc/src/notes.xml +++ b/lib/inets/doc/src/notes.xml @@ -32,7 +32,50 @@ <file>notes.xml</file> </header> - <section><title>Inets 5.5</title> + <section><title>Inets 5.5.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> Fix format_man_pages so it handles all man sections + and remove warnings/errors in various man pages. </p> + <p> + Own Id: OTP-8600</p> + </item> + <item> + <p> + [httpc] Pipelined and queued requests not processed when + connection closed remotelly.</p> + <p> + Own Id: OTP-8906</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Miscellaneous inet6 related problems.</p> + <p> + Own Id: OTP-8927</p> + </item> + <item> + <p> + Updated http-server to make sure URLs in error-messages + are URL-encoded. Added support in http-client to use + URL-encoding. Also added the missing include directory + for the inets application.</p> + <p> + Own Id: OTP-8940 Aux Id: seq11735 </p> + </item> + </list> + </section> + +</section> + +<section><title>Inets 5.5</title> <section><title>Fixed Bugs and Malfunctions</title> <list> diff --git a/lib/inets/include/mod_auth.hrl b/lib/inets/include/mod_auth.hrl new file mode 100644 index 0000000000..cf931e681a --- /dev/null +++ b/lib/inets/include/mod_auth.hrl @@ -0,0 +1,33 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1998-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% +%% +%% + +-ifndef(mod_auth_hrl). +-define(mod_auth_hrl, true). + +-record(httpd_user, + {username, + password, + user_data}). + +-record(httpd_group, + {name, + userlist}). + +-endif. % -ifdef(mod_auth_hrl). diff --git a/lib/inets/src/http_server/Makefile b/lib/inets/src/http_server/Makefile index bdd8c5ee3c..55cc68dede 100644 --- a/lib/inets/src/http_server/Makefile +++ b/lib/inets/src/http_server/Makefile @@ -82,9 +82,7 @@ MODULES = \ mod_security \ mod_security_server -INCLUDE = ../../include - -HRL_FILES = $(INCLUDE)/httpd.hrl httpd_internal.hrl mod_auth.hrl +HRL_FILES = httpd.hrl httpd_internal.hrl mod_auth.hrl ERL_FILES = $(MODULES:%=%.erl) @@ -100,7 +98,6 @@ include ../inets_app/inets.mk ERL_COMPILE_FLAGS += \ $(INETS_FLAGS) \ $(INETS_ERL_COMPILE_FLAGS) \ - -I$(INCLUDE) \ -I../inets_app \ -I../http_lib \ diff --git a/lib/inets/src/http_server/httpd.hrl b/lib/inets/src/http_server/httpd.hrl new file mode 100644 index 0000000000..4eba833e2c --- /dev/null +++ b/lib/inets/src/http_server/httpd.hrl @@ -0,0 +1,27 @@ +%% +%% %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% +%% +%% This is a simple wrapper for code that has not been updated to +%% handle the move of this file to the include dir. + +-ifndef(src_httpd_hrl). +-define(src_httpd_hrl, true). + +-include_lib("inets/include/httpd.hrl"). + +-endif. % -ifdef(src_httpd_hrl). diff --git a/lib/inets/src/http_server/mod_auth.hrl b/lib/inets/src/http_server/mod_auth.hrl index 9b316cecc4..674e6d1652 100644 --- a/lib/inets/src/http_server/mod_auth.hrl +++ b/lib/inets/src/http_server/mod_auth.hrl @@ -1,29 +1,27 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. -%% +%% +%% 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% %% +%% %CopyrightEnd% %% +%% This is a simple wrapper for code that has not been updated to +%% handle the move of this file to the include dir. + +-ifndef(src_mod_auth_hrl). +-define(src_mod_auth_hrl, true). --record(httpd_user, - {username, - password, - user_data}). +-include_lib("inets/include/mod_auth.hrl"). --record(httpd_group, - {name, - userlist}). - +-endif. % -ifdef(src_mod_auth_hrl). diff --git a/lib/inets/src/inets_app/Makefile b/lib/inets/src/inets_app/Makefile index 4632ff3b68..20e22917e2 100644 --- a/lib/inets/src/inets_app/Makefile +++ b/lib/inets/src/inets_app/Makefile @@ -47,7 +47,9 @@ MODULES = \ inets_sup \ inets_regexp -HRL_FILES = inets_internal.hrl +INTERNAL_HRL_FILES = inets_internal.hrl +EXTERNAL_HRL_FILES = ../../include/httpd.hrl \ + ../../include/mod_auth.hrl ERL_FILES = $(MODULES:%=%.erl) @@ -74,8 +76,7 @@ include inets.mk ERL_COMPILE_FLAGS += \ $(INETS_FLAGS) \ - $(INETS_ERL_COMPILE_FLAGS) \ - -I../../include + $(INETS_ERL_COMPILE_FLAGS) # ---------------------------------------------------- @@ -110,7 +111,9 @@ include $(ERL_TOP)/make/otp_release_targets.mk release_spec: opt $(INSTALL_DIR) $(RELSYSDIR)/src $(INSTALL_DIR) $(RELSYSDIR)/src/inets_app - $(INSTALL_DATA) $(HRL_FILES) $(ERL_FILES) $(RELSYSDIR)/src/inets_app + $(INSTALL_DATA) $(INTERNAL_HRL_FILES) $(ERL_FILES) $(RELSYSDIR)/src/inets_app + $(INSTALL_DIR) $(RELSYSDIR)/include + $(INSTALL_DATA) $(EXTERNAL_HRL_FILES) $(RELSYSDIR)/include $(INSTALL_DIR) $(RELSYSDIR)/ebin $(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin diff --git a/lib/inets/test/Makefile b/lib/inets/test/Makefile index 0492d33eab..4b803cfbe2 100644 --- a/lib/inets/test/Makefile +++ b/lib/inets/test/Makefile @@ -200,7 +200,8 @@ SOURCE = $(ERL_FILES) $(HRL_FILES) TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) -INETS_SPECS = inets.spec inets.spec.vxworks +INETS_SPECS = inets.spec +COVER_FILE = inets.cover INETS_FILES = inets.config $(INETS_SPECS) # SUB_SUITES = \ @@ -222,10 +223,10 @@ MAKE_EMAKE = $(wildcard $(ERL_TOP)/make/make_emakefile) ifeq ($(MAKE_EMAKE),) BUILDTARGET = $(TARGET_FILES) -RELTEST_FILES = $(INETS_SPECS) $(SOURCE) +RELTEST_FILES = $(COVER_FILE) $(INETS_SPECS) $(SOURCE) else BUILDTARGET = emakebuild -RELTEST_FILES = $(EMAKEFILE) $(INETS_SPECS) $(SOURCE) +RELTEST_FILES = $(EMAKEFILE) $(COVER_FILE) $(INETS_SPECS) $(SOURCE) endif diff --git a/lib/inets/test/ftp_SUITE.erl b/lib/inets/test/ftp_SUITE.erl index e7404f945b..7059bb12cf 100644 --- a/lib/inets/test/ftp_SUITE.erl +++ b/lib/inets/test/ftp_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -20,29 +20,14 @@ -module(ftp_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). % -export([init_per_testcase/2, end_per_testcase/2]). -export([init_per_suite/1, end_per_suite/1]). -%% Test cases must be exported. --export([solaris8_test/1, - solaris9_test/1, - solaris10_test/1, - linux_x86_test/1, - linux_ppc_test/1, - macosx_x86_test/1, - macosx_ppc_test/1, - openbsd_test/1, - freebsd_test/1, - netbsd_test/1, - windows_xp_test/1, - windows_2003_server_test/1, - ticket_tests/1]). - -define(FTP_USER, "anonymous"). -define(FTP_PASS, passwd()). -define(FTP_PORT, 21). @@ -72,52 +57,44 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Test the ftp client in the inets application."]; -all(suite) -> - [ - solaris8_test, - solaris9_test, - solaris10_test, - linux_x86_test, - linux_ppc_test, - macosx_x86_test, - macosx_ppc_test, - openbsd_test, - freebsd_test, - netbsd_test, - windows_xp_test, - windows_2003_server_test, - ticket_tests - ]. - -solaris8_test(suite) -> - [{ftp_solaris8_sparc_test,all}]. -solaris9_test(suite) -> - [{ftp_solaris9_sparc_test,all}]. -solaris10_test(suite) -> - [{ftp_solaris10_sparc_test,all}, {ftp_solaris10_x86_test,all}]. -linux_x86_test(suite) -> - [{ftp_linux_x86_test,all}]. -linux_ppc_test(suite) -> - [{ftp_linux_ppc_test,all}]. -macosx_x86_test(suite) -> - [{ftp_macosx_x86_test,all}]. -macosx_ppc_test(suite) -> - [{ftp_macosx_ppc_test,all}]. -openbsd_test(suite) -> - [{ftp_openbsd_x86_test,all}]. -freebsd_test(suite) -> - [{ftp_freebsd_x86_test,all}]. -netbsd_test(suite) -> - [{ftp_netbsd_x86_test,all}]. -windows_xp_test(suite) -> - [{ftp_windows_xp_test,all}]. -windows_2003_server_test(suite) -> - [{ftp_windows_2003_server_test,all}]. - -ticket_tests(suite) -> - [{ftp_ticket_test, all}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, solaris8_test}, {group, solaris9_test}, + {group, solaris10_test}, {group, linux_x86_test}, + {group, linux_ppc_test}, {group, macosx_x86_test}, + {group, macosx_ppc_test}, {group, openbsd_test}, + {group, freebsd_test}, {group, netbsd_test}, + {group, windows_xp_test}, + {group, windows_2003_server_test}, + {group, ticket_tests}]. + +groups() -> + [{solaris8_test, [], [{ftp_solaris8_sparc_test, all}]}, + {solaris9_test, [], [{ftp_solaris9_sparc_test, all}]}, + {solaris10_test, [], + [{ftp_solaris10_sparc_test, all}, + {ftp_solaris10_x86_test, all}]}, + {linux_x86_test, [], [{ftp_linux_x86_test, all}]}, + {linux_ppc_test, [], [{ftp_linux_ppc_test, all}]}, + {macosx_x86_test, [], [{ftp_macosx_x86_test, all}]}, + {macosx_ppc_test, [], [{ftp_macosx_ppc_test, all}]}, + {openbsd_test, [], [{ftp_openbsd_x86_test, all}]}, + {freebsd_test, [], [{ftp_freebsd_x86_test, all}]}, + {netbsd_test, [], [{ftp_netbsd_x86_test, all}]}, + {windows_xp_test, [], [{ftp_windows_xp_test, all}]}, + {windows_2003_server_test, [], + [{ftp_windows_2003_server_test, all}]}, + {ticket_tests, [], [{ftp_ticket_test, all}]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config diff --git a/lib/inets/test/ftp_format_SUITE.erl b/lib/inets/test/ftp_format_SUITE.erl index 9ca6575b2d..3a8cb9a3d0 100644 --- a/lib/inets/test/ftp_format_SUITE.erl +++ b/lib/inets/test/ftp_format_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -20,23 +20,44 @@ -module(ftp_format_SUITE). -author('[email protected]'). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("ftp_internal.hrl"). %% Test server specific exports --export([all/1, init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). %% Test cases must be exported. --export([ftp_response/1, ftp_150/1, - ftp_200/1, ftp_220/1, ftp_226/1, ftp_257/1, ftp_331/1, ftp_425/1, - ftp_other_status_codes/1, ftp_multiple_lines/1, - ftp_multipel_ctrl_messages/1, format_error/1]). +-export([ ftp_150/1, + ftp_200/1, ftp_220/1, ftp_226/1, ftp_257/1, ftp_331/1, ftp_425/1, + ftp_other_status_codes/1, ftp_multiple_lines/1, + ftp_multipel_ctrl_messages/1, format_error/1]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, ftp_response}, format_error]. + +groups() -> + [{ftp_response, [], + [ftp_150, ftp_200, ftp_220, ftp_226, ftp_257, ftp_331, + ftp_425, ftp_other_status_codes, ftp_multiple_lines, + ftp_multipel_ctrl_messages]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(doc) -> - ["Test library functions for the ftp client."]; -all(suite) -> - [ftp_response, format_error]. init_per_testcase(_, Config) -> Dog = test_server:timetrap(?t:minutes(1)), @@ -51,14 +72,6 @@ end_per_testcase(_, Config) -> %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -ftp_response(doc) -> - ["Test ftp_response:parse_lines/3 and ftp_response:interpret/1." - " This test case will simulate that the " - "message will be recived a little at the time on a socket and the " - "package may be broken up into smaller parts at arbitrary point."]; -ftp_response(suite) -> - [ftp_150, ftp_200, ftp_220, ftp_226, ftp_257, ftp_331, ftp_425, - ftp_other_status_codes, ftp_multiple_lines, ftp_multipel_ctrl_messages]. ftp_150(doc) -> ["Especially check that respons can be devided in a random place."]; diff --git a/lib/inets/test/ftp_freebsd_x86_test.erl b/lib/inets/test/ftp_freebsd_x86_test.erl index 457e18ffbe..1d66779882 100644 --- a/lib/inets/test/ftp_freebsd_x86_test.erl +++ b/lib/inets/test/ftp_freebsd_x86_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -86,23 +86,30 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. %%-------------------------------------------------------------------- open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_linux_ppc_test.erl b/lib/inets/test/ftp_linux_ppc_test.erl index ad38137678..bba97237f1 100644 --- a/lib/inets/test/ftp_linux_ppc_test.erl +++ b/lib/inets/test/ftp_linux_ppc_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -23,7 +23,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -87,23 +87,30 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. %%-------------------------------------------------------------------- open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_linux_x86_test.erl b/lib/inets/test/ftp_linux_x86_test.erl index b9c88d121a..bbefd8231e 100644 --- a/lib/inets/test/ftp_linux_x86_test.erl +++ b/lib/inets/test/ftp_linux_x86_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -86,30 +86,30 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; - -all(suite) -> - [ - open, - open_port, - passive, - active, - api_missuse, - not_owner, - progress_report - ]. +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Test cases starts here. %%-------------------------------------------------------------------- open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_macosx_ppc_test.erl b/lib/inets/test/ftp_macosx_ppc_test.erl index cf548a73c0..c9f33b8beb 100644 --- a/lib/inets/test/ftp_macosx_ppc_test.erl +++ b/lib/inets/test/ftp_macosx_ppc_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -87,21 +87,28 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> +[open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_macosx_x86_test.erl b/lib/inets/test/ftp_macosx_x86_test.erl index 5566d4feaa..17b7160b95 100644 --- a/lib/inets/test/ftp_macosx_x86_test.erl +++ b/lib/inets/test/ftp_macosx_x86_test.erl @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -86,22 +86,29 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> +[open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. %%-------------------------------------------------------------------- open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_netbsd_x86_test.erl b/lib/inets/test/ftp_netbsd_x86_test.erl index a5711b7bde..bb474852c5 100644 --- a/lib/inets/test/ftp_netbsd_x86_test.erl +++ b/lib/inets/test/ftp_netbsd_x86_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -86,22 +86,29 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. %%-------------------------------------------------------------------- open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_openbsd_x86_test.erl b/lib/inets/test/ftp_openbsd_x86_test.erl index 4833b6332b..54fce702a0 100644 --- a/lib/inets/test/ftp_openbsd_x86_test.erl +++ b/lib/inets/test/ftp_openbsd_x86_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -23,7 +23,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -87,23 +87,30 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. %%-------------------------------------------------------------------- open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_solaris10_sparc_test.erl b/lib/inets/test/ftp_solaris10_sparc_test.erl index 6066195f9b..0da50dc91b 100644 --- a/lib/inets/test/ftp_solaris10_sparc_test.erl +++ b/lib/inets/test/ftp_solaris10_sparc_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -87,23 +87,30 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. %%-------------------------------------------------------------------- open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_solaris10_x86_test.erl b/lib/inets/test/ftp_solaris10_x86_test.erl index 3bd99fc3f2..3e7045bb4d 100644 --- a/lib/inets/test/ftp_solaris10_x86_test.erl +++ b/lib/inets/test/ftp_solaris10_x86_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD, ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_), ?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -88,23 +88,30 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. %%-------------------------------------------------------------------- open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_solaris8_sparc_test.erl b/lib/inets/test/ftp_solaris8_sparc_test.erl index 9764071cd9..23dbfc8fe3 100644 --- a/lib/inets/test/ftp_solaris8_sparc_test.erl +++ b/lib/inets/test/ftp_solaris8_sparc_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -86,22 +86,29 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_solaris9_sparc_test.erl b/lib/inets/test/ftp_solaris9_sparc_test.erl index a9f77bbdac..896e2f497f 100644 --- a/lib/inets/test/ftp_solaris9_sparc_test.erl +++ b/lib/inets/test/ftp_solaris9_sparc_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -85,22 +85,29 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_suite_lib.erl b/lib/inets/test/ftp_suite_lib.erl index c539b7c17c..5ae0298b29 100644 --- a/lib/inets/test/ftp_suite_lib.erl +++ b/lib/inets/test/ftp_suite_lib.erl @@ -21,8 +21,8 @@ -module(ftp_suite_lib). --include("test_server.hrl"). --include("test_server_line.hrl"). +-include_lib("test_server/include/test_server.hrl"). +-include_lib("test_server/include/test_server_line.hrl"). -include("inets_test_lib.hrl"). %% Test server specific exports @@ -74,7 +74,7 @@ tickets(suite) -> ftpd_init(FtpdTag, Config) -> %% Get the host name(s) of FTP server Hosts = - case ?config(ftpd_hosts, Config) of + case ct:get_config(ftpd_hosts) of undefined -> ftpd_hosts(data_dir(Config)); H -> @@ -129,7 +129,7 @@ get_ftpd_host([Host|Hosts]) -> dirty_select_ftpd_host(Config) -> Hosts = - case ?config(ftpd_hosts, Config) of + case ct:get_config(ftpd_hosts) of undefined -> ftpd_hosts(data_dir(Config)); H -> diff --git a/lib/inets/test/ftp_ticket_test.erl b/lib/inets/test/ftp_ticket_test.erl index 6748df03bb..fe4ab35728 100644 --- a/lib/inets/test/ftp_ticket_test.erl +++ b/lib/inets/test/ftp_ticket_test.erl @@ -35,17 +35,27 @@ end_per_testcase(Case, Config) -> ftp_suite_lib:end_per_testcase(Case, Config). -all(suite) -> - {conf,init,tickets(),fin}. +all() -> + tickets(). -init(Config) -> +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) -> ?LIB_MOD:ftpd_init(ticket_test, Config). -tickets() -> +tickets() -> [ticket_6035]. -fin(Config) -> +end_per_suite(Config) -> ?LIB_MOD:ftpd_fin(Config). ticket_6035(X) -> ?LIB_MOD:ticket_6035(X). diff --git a/lib/inets/test/ftp_windows_2003_server_test.erl b/lib/inets/test/ftp_windows_2003_server_test.erl index d24318d04f..57f1ae8358 100644 --- a/lib/inets/test/ftp_windows_2003_server_test.erl +++ b/lib/inets/test/ftp_windows_2003_server_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -86,22 +86,29 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. %% Test cases starts here. open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/ftp_windows_xp_test.erl b/lib/inets/test/ftp_windows_xp_test.erl index bc161e4f6a..06d919ba00 100644 --- a/lib/inets/test/ftp_windows_xp_test.erl +++ b/lib/inets/test/ftp_windows_xp_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -22,7 +22,7 @@ -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(LIB_MOD,ftp_suite_lib). -define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). @@ -86,20 +86,27 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ftp client"]; +all() -> + [open, open_port, {group, passive}, {group, active}, + api_missuse, not_owner, {group, progress_report}]. + +groups() -> + [{passive, [], ftp_suite_lib:passive(suite)}, + {active, [], ftp_suite_lib:active(suite)}, + {progress_report, [], + ftp_suite_lib:progress_report(suite)}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open, open_port, passive, active, api_missuse, - not_owner, progress_report]. open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -passive(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:passive/1). -active(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:active/1). api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). -progress_report(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:progress_report/1). passive_user(X) -> ?LIB_MOD:passive_user(X). passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). diff --git a/lib/inets/test/http_format_SUITE.erl b/lib/inets/test/http_format_SUITE.erl index 79945f0f4d..f05dfd78bc 100644 --- a/lib/inets/test/http_format_SUITE.erl +++ b/lib/inets/test/http_format_SUITE.erl @@ -21,28 +21,49 @@ -module(http_format_SUITE). -author('[email protected]'). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("http_internal.hrl"). %% Test server specific exports --export([all/1, init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2, end_per_testcase/2]). %% Test cases must be exported. --export([chunk/1, chunk_decode/1, chunk_encode/1, - chunk_extensions_otp_6005/1, chunk_decode_otp_6264/1, - chunk_decode_empty_chunk_otp_6511/1, - chunk_decode_trailer/1, - http_response/1, http_request/1, validate_request_line/1, script/1, - esi_parse_headers/1, cgi_parse_headers/1, - is_absolut_uri/1, convert_netscapecookie_date/1]). - -all(doc) -> - ["Test library functions to the http client and server."]; -all(suite) -> - [chunk, - http_response, http_request, validate_request_line, - script, is_absolut_uri, convert_netscapecookie_date]. +-export([ chunk_decode/1, chunk_encode/1, + chunk_extensions_otp_6005/1, chunk_decode_otp_6264/1, + chunk_decode_empty_chunk_otp_6511/1, + chunk_decode_trailer/1, + http_response/1, http_request/1, validate_request_line/1, + esi_parse_headers/1, cgi_parse_headers/1, + is_absolut_uri/1, convert_netscapecookie_date/1]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, chunk}, http_response, http_request, + validate_request_line, {group, script}, is_absolut_uri, + convert_netscapecookie_date]. + +groups() -> + [{script, [], [esi_parse_headers, cgi_parse_headers]}, + {chunk, [], + [chunk_decode, chunk_encode, chunk_extensions_otp_6005, + chunk_decode_otp_6264, + chunk_decode_empty_chunk_otp_6511, + chunk_decode_trailer]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_, Config) -> Dog = test_server:timetrap(?t:minutes(1)), @@ -57,17 +78,7 @@ end_per_testcase(_, Config) -> %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -script(doc) -> - ["Test header parsing in esi/cgi functionality."]; -script(suite) -> - [esi_parse_headers, cgi_parse_headers]. - -chunk(doc) -> - ["Test chunk encoding"]; -chunk(suite) -> - [chunk_decode, chunk_encode, chunk_extensions_otp_6005, - chunk_decode_otp_6264, chunk_decode_empty_chunk_otp_6511, - chunk_decode_trailer]. + %%------------------------------------------------------------------------- chunk_decode(doc) -> diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index 94d5a48ef6..7aa11ebc27 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -24,7 +24,7 @@ -module(httpc_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include_lib("kernel/include/file.hrl"). @@ -59,64 +59,47 @@ %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Test the http client in the intes application."]; -all(suite) -> - [ - proxy_options, - proxy_head, - proxy_get, - proxy_trace, - proxy_post, - proxy_put, - proxy_delete, - proxy_auth, - proxy_headers, - proxy_emulate_lower_versions, - http_options, - http_head, - http_get, - http_post, - http_dummy_pipe, - http_inets_pipe, - http_trace, - http_async, - http_save_to_file, - http_save_to_file_async, - http_headers, - http_headers_dummy, - http_bad_response, - ssl_head, - ossl_head, - essl_head, - ssl_get, - ossl_get, - essl_get, - ssl_trace, - ossl_trace, - essl_trace, - http_redirect, - http_redirect_loop, - http_internal_server_error, - http_userinfo, - http_cookie, - http_server_does_not_exist, - http_invalid_http, - http_emulate_lower_versions, - http_relaxed, - page_does_not_exist, - proxy_page_does_not_exist, - proxy_https_not_supported, - http_stream, - http_stream_once, - proxy_stream, - parse_url, - options, - ipv6, - headers_as_is, - tickets - ]. - +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [proxy_options, proxy_head, proxy_get, proxy_trace, + proxy_post, proxy_put, proxy_delete, proxy_auth, + proxy_headers, proxy_emulate_lower_versions, + http_options, http_head, http_get, http_post, + http_dummy_pipe, http_inets_pipe, http_trace, + http_async, http_save_to_file, http_save_to_file_async, + http_headers, http_headers_dummy, http_bad_response, + ssl_head, ossl_head, essl_head, ssl_get, ossl_get, + essl_get, ssl_trace, ossl_trace, essl_trace, + http_redirect, http_redirect_loop, + http_internal_server_error, http_userinfo, http_cookie, + http_server_does_not_exist, http_invalid_http, + http_emulate_lower_versions, http_relaxed, + page_does_not_exist, proxy_page_does_not_exist, + proxy_https_not_supported, http_stream, + http_stream_once, proxy_stream, parse_url, options, + ipv6, headers_as_is, {group, tickets}]. + +groups() -> + [{tickets, [], + [hexed_query_otp_6191, empty_body_otp_6243, + empty_response_header_otp_6830, + transfer_encoding_otp_6807, proxy_not_modified_otp_6821, + no_content_204_otp_6982, missing_CR_otp_7304, + {group, otp_7883}, {group, otp_8154}, {group, otp_8106}, + otp_8056, otp_8352, otp_8371, otp_8739]}, + {otp_7883, [], [otp_7883_1, otp_7883_2]}, + {otp_8154, [], [otp_8154_1]}, + {otp_8106, [], + [otp_8106_pid, otp_8106_fun, otp_8106_mfa]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config %% Config - [tuple()] @@ -228,6 +211,8 @@ init_per_testcase(Case, Timeout, Config) -> tsp("init_per_testcase -> [proxy case] start inets"), inets:start(), tsp("init_per_testcase -> [proxy case] start ssl"), + application:start(crypto), + application:start(public_key), case (catch application:start(ssl)) of ok -> [{watchdog, Dog} | TmpConfig]; @@ -295,25 +280,6 @@ finish(Config) -> %% Test cases starts here. %%------------------------------------------------------------------------- -tickets(doc) -> - ["."]; -tickets(suite) -> - [ - hexed_query_otp_6191, - empty_body_otp_6243, - empty_response_header_otp_6830, - transfer_encoding_otp_6807, - proxy_not_modified_otp_6821, - no_content_204_otp_6982, - missing_CR_otp_7304, - otp_7883, - otp_8154, - otp_8106, - otp_8056, - otp_8352, - otp_8371, - otp_8739 - ]. %%------------------------------------------------------------------------- @@ -1771,6 +1737,8 @@ parse_url(Config) when is_list(Config) -> %%------------------------------------------------------------------------- +ipv6() -> + [{require,ipv6_hosts}]. ipv6(doc) -> ["Test ipv6."]; ipv6(suite) -> @@ -1779,7 +1747,7 @@ ipv6(Config) when is_list(Config) -> {ok, Hostname} = inet:gethostname(), case lists:member(list_to_atom(Hostname), - ?config(ipv6_hosts, Config)) of + ct:get_config(ipv6_hosts)) of true -> {DummyServerPid, Port} = dummy_server(self(), ipv6), @@ -1979,8 +1947,6 @@ missing_CR_otp_7304(Config) when is_list(Config) -> %%------------------------------------------------------------------------- -otp_7883(suite) -> - [otp_7883_1, otp_7883_2]. otp_7883_1(doc) -> ["OTP-7883-sync"]; @@ -2028,8 +1994,6 @@ otp_7883_2(Config) when is_list(Config) -> %%------------------------------------------------------------------------- -otp_8154(suite) -> - [otp_8154_1]. otp_8154_1(doc) -> ["OTP-8154"]; @@ -2309,12 +2273,6 @@ f(F, A) -> lists:flatten(io_lib:format(F,A)). %%------------------------------------------------------------------------- -otp_8106(suite) -> - [ - otp_8106_pid, - otp_8106_fun, - otp_8106_mfa - ]. otp_8106_pid(doc) -> diff --git a/lib/inets/test/httpc_cookie_SUITE.erl b/lib/inets/test/httpc_cookie_SUITE.erl index ad5df656c6..a9eddac6eb 100644 --- a/lib/inets/test/httpc_cookie_SUITE.erl +++ b/lib/inets/test/httpc_cookie_SUITE.erl @@ -19,11 +19,11 @@ %% -module(httpc_cookie_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("stdlib/include/ms_transform.hrl"). %% Test server specific exports --export([all/1, init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2, end_per_testcase/2]). %% Test cases must be exported. -export([session_cookies_only/1, netscape_cookies/1, @@ -116,22 +116,29 @@ end_per_testcase(Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Describe the main purpose of this suite"]; - -all(suite) -> - [ - session_cookies_only, - netscape_cookies, - cookie_cancel, - cookie_expires, - persistent_cookie, - domain_cookie, - secure_cookie, - update_cookie, - update_cookie_session, - cookie_attributes - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [session_cookies_only, netscape_cookies, cookie_cancel, + cookie_expires, persistent_cookie, domain_cookie, + secure_cookie, update_cookie, update_cookie_session, + cookie_attributes]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Test cases starts here. %%-------------------------------------------------------------------- diff --git a/lib/inets/test/httpd_1_1.erl b/lib/inets/test/httpd_1_1.erl index 055d034bec..2a6110e3ea 100644 --- a/lib/inets/test/httpd_1_1.erl +++ b/lib/inets/test/httpd_1_1.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 diff --git a/lib/inets/test/httpd_SUITE.erl b/lib/inets/test/httpd_SUITE.erl index 3255cbec06..95ee15d08f 100644 --- a/lib/inets/test/httpd_SUITE.erl +++ b/lib/inets/test/httpd_SUITE.erl @@ -20,28 +20,17 @@ -module(httpd_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("test_server_line.hrl"). -include("inets_test_lib.hrl"). -include_lib("kernel/include/file.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([init_per_testcase/2, end_per_testcase/2, init_per_suite/1, end_per_suite/1]). -%% Test cases must be exported. --export([ - ip/1, - ssl/1, pssl/1, ossl/1, essl/1, - http_1_1_ip/1, - http_1_0_ip/1, - http_0_9_ip/1, - ipv6/1, - tickets/1 - ]). - %% Core Server tests -export([ ip_mod_alias/1, @@ -249,19 +238,109 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Test the http server in the intes application."]; -all(suite) -> - [ - ip, - ssl, - http_1_1_ip, - http_1_0_ip, - http_0_9_ip, - %% ipv6, - tickets - ]. - +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, ip}, {group, ssl}, {group, http_1_1_ip}, + {group, http_1_0_ip}, {group, http_0_9_ip}, + {group, tickets}]. + +groups() -> + [{ip, [], + [ip_mod_alias, ip_mod_actions, ip_mod_security, + ip_mod_auth, ip_mod_auth_api, ip_mod_auth_mnesia_api, + ip_mod_htaccess, ip_mod_cgi, ip_mod_esi, ip_mod_get, + ip_mod_head, ip_mod_all, ip_load_light, ip_load_medium, + ip_load_heavy, ip_dos_hostname, ip_time_test, + ip_restart_no_block, ip_restart_disturbing_block, + ip_restart_non_disturbing_block, + ip_block_disturbing_idle, ip_block_non_disturbing_idle, + ip_block_503, ip_block_disturbing_active, + ip_block_non_disturbing_active, + ip_block_disturbing_active_timeout_not_released, + ip_block_disturbing_active_timeout_released, + ip_block_non_disturbing_active_timeout_not_released, + ip_block_non_disturbing_active_timeout_released, + ip_block_disturbing_blocker_dies, + ip_block_non_disturbing_blocker_dies]}, + {ssl, [], + [{group, pssl}, {group, ossl}, {group, essl}]}, + {pssl, [], + [pssl_mod_alias, pssl_mod_actions, pssl_mod_security, + pssl_mod_auth, pssl_mod_auth_api, + pssl_mod_auth_mnesia_api, pssl_mod_htaccess, + pssl_mod_cgi, pssl_mod_esi, pssl_mod_get, pssl_mod_head, + pssl_mod_all, pssl_load_light, pssl_load_medium, + pssl_load_heavy, pssl_dos_hostname, pssl_time_test, + pssl_restart_no_block, pssl_restart_disturbing_block, + pssl_restart_non_disturbing_block, + pssl_block_disturbing_idle, + pssl_block_non_disturbing_idle, pssl_block_503, + pssl_block_disturbing_active, + pssl_block_non_disturbing_active, + pssl_block_disturbing_active_timeout_not_released, + pssl_block_disturbing_active_timeout_released, + pssl_block_non_disturbing_active_timeout_not_released, + pssl_block_non_disturbing_active_timeout_released, + pssl_block_disturbing_blocker_dies, + pssl_block_non_disturbing_blocker_dies]}, + {ossl, [], + [ossl_mod_alias, ossl_mod_actions, ossl_mod_security, + ossl_mod_auth, ossl_mod_auth_api, + ossl_mod_auth_mnesia_api, ossl_mod_htaccess, + ossl_mod_cgi, ossl_mod_esi, ossl_mod_get, ossl_mod_head, + ossl_mod_all, ossl_load_light, ossl_load_medium, + ossl_load_heavy, ossl_dos_hostname, ossl_time_test, + ossl_restart_no_block, ossl_restart_disturbing_block, + ossl_restart_non_disturbing_block, + ossl_block_disturbing_idle, + ossl_block_non_disturbing_idle, ossl_block_503, + ossl_block_disturbing_active, + ossl_block_non_disturbing_active, + ossl_block_disturbing_active_timeout_not_released, + ossl_block_disturbing_active_timeout_released, + ossl_block_non_disturbing_active_timeout_not_released, + ossl_block_non_disturbing_active_timeout_released, + ossl_block_disturbing_blocker_dies, + ossl_block_non_disturbing_blocker_dies]}, + {essl, [], + [essl_mod_alias, essl_mod_actions, essl_mod_security, + essl_mod_auth, essl_mod_auth_api, + essl_mod_auth_mnesia_api, essl_mod_htaccess, + essl_mod_cgi, essl_mod_esi, essl_mod_get, essl_mod_head, + essl_mod_all, essl_load_light, essl_load_medium, + essl_load_heavy, essl_dos_hostname, essl_time_test, + essl_restart_no_block, essl_restart_disturbing_block, + essl_restart_non_disturbing_block, + essl_block_disturbing_idle, + essl_block_non_disturbing_idle, essl_block_503, + essl_block_disturbing_active, + essl_block_non_disturbing_active, + essl_block_disturbing_active_timeout_not_released, + essl_block_disturbing_active_timeout_released, + essl_block_non_disturbing_active_timeout_not_released, + essl_block_non_disturbing_active_timeout_released, + essl_block_disturbing_blocker_dies, + essl_block_non_disturbing_blocker_dies]}, + {http_1_1_ip, [], + [ip_host, ip_chunked, ip_expect, ip_range, ip_if_test, + ip_http_trace, ip_http1_1_head, + ip_mod_cgi_chunked_encoding_test]}, + {http_1_0_ip, [], + [ip_head_1_0, ip_get_1_0, ip_post_1_0]}, + {http_0_9_ip, [], [ip_get_0_9]}, + {ipv6, [], [ipv6_hostname, ipv6_address]}, + {tickets, [], + [ticket_5775, ticket_5865, ticket_5913, ticket_6003, + ticket_7304]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config %% Config - [tuple()] @@ -615,219 +694,23 @@ end_per_testcase2(Case, Config) -> %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -ip(doc) -> - ["HTTP tests using TCP/IP"]; -ip(suite) -> - [ - ip_mod_alias, - ip_mod_actions, - ip_mod_security, - ip_mod_auth, - ip_mod_auth_api, - ip_mod_auth_mnesia_api, - ip_mod_htaccess, - ip_mod_cgi, - ip_mod_esi, - ip_mod_get, - ip_mod_head, - ip_mod_all, - ip_load_light, - ip_load_medium, - ip_load_heavy, - ip_dos_hostname, - ip_time_test, - ip_restart_no_block, - ip_restart_disturbing_block, - ip_restart_non_disturbing_block, - ip_block_disturbing_idle, - ip_block_non_disturbing_idle, - ip_block_503, - ip_block_disturbing_active, - ip_block_non_disturbing_active, - ip_block_disturbing_active_timeout_not_released, - ip_block_disturbing_active_timeout_released, - ip_block_non_disturbing_active_timeout_not_released, - ip_block_non_disturbing_active_timeout_released, - ip_block_disturbing_blocker_dies, - ip_block_non_disturbing_blocker_dies - ]. %%------------------------------------------------------------------------- -ssl(doc) -> - ["HTTP test using SSL"]; -ssl(suite) -> - [ - pssl, - ossl, - essl - ]. -pssl(doc) -> - ["HTTP test using SSL - using old way of configuring SSL"]; -pssl(suite) -> - [ - pssl_mod_alias, - pssl_mod_actions, - pssl_mod_security, - pssl_mod_auth, - pssl_mod_auth_api, - pssl_mod_auth_mnesia_api, - pssl_mod_htaccess, - pssl_mod_cgi, - pssl_mod_esi, - pssl_mod_get, - pssl_mod_head, - pssl_mod_all, - pssl_load_light, - pssl_load_medium, - pssl_load_heavy, - pssl_dos_hostname, - pssl_time_test, - pssl_restart_no_block, - pssl_restart_disturbing_block, - pssl_restart_non_disturbing_block, - pssl_block_disturbing_idle, - pssl_block_non_disturbing_idle, - pssl_block_503, - pssl_block_disturbing_active, - pssl_block_non_disturbing_active, - pssl_block_disturbing_active_timeout_not_released, - pssl_block_disturbing_active_timeout_released, - pssl_block_non_disturbing_active_timeout_not_released, - pssl_block_non_disturbing_active_timeout_released, - pssl_block_disturbing_blocker_dies, - pssl_block_non_disturbing_blocker_dies - ]. -ossl(doc) -> - ["HTTP test using SSL - using new way of configuring usage of old SSL"]; -ossl(suite) -> - [ - ossl_mod_alias, - ossl_mod_actions, - ossl_mod_security, - ossl_mod_auth, - ossl_mod_auth_api, - ossl_mod_auth_mnesia_api, - ossl_mod_htaccess, - ossl_mod_cgi, - ossl_mod_esi, - ossl_mod_get, - ossl_mod_head, - ossl_mod_all, - ossl_load_light, - ossl_load_medium, - ossl_load_heavy, - ossl_dos_hostname, - ossl_time_test, - ossl_restart_no_block, - ossl_restart_disturbing_block, - ossl_restart_non_disturbing_block, - ossl_block_disturbing_idle, - ossl_block_non_disturbing_idle, - ossl_block_503, - ossl_block_disturbing_active, - ossl_block_non_disturbing_active, - ossl_block_disturbing_active_timeout_not_released, - ossl_block_disturbing_active_timeout_released, - ossl_block_non_disturbing_active_timeout_not_released, - ossl_block_non_disturbing_active_timeout_released, - ossl_block_disturbing_blocker_dies, - ossl_block_non_disturbing_blocker_dies - ]. -essl(doc) -> - ["HTTP test using SSL - using new way of configuring usage of new SSL"]; -essl(suite) -> - [ - essl_mod_alias, - essl_mod_actions, - essl_mod_security, - essl_mod_auth, - essl_mod_auth_api, - essl_mod_auth_mnesia_api, - essl_mod_htaccess, - essl_mod_cgi, - essl_mod_esi, - essl_mod_get, - essl_mod_head, - essl_mod_all, - essl_load_light, - essl_load_medium, - essl_load_heavy, - essl_dos_hostname, - essl_time_test, - essl_restart_no_block, - essl_restart_disturbing_block, - essl_restart_non_disturbing_block, - essl_block_disturbing_idle, - essl_block_non_disturbing_idle, - essl_block_503, - essl_block_disturbing_active, - essl_block_non_disturbing_active, - essl_block_disturbing_active_timeout_not_released, - essl_block_disturbing_active_timeout_released, - essl_block_non_disturbing_active_timeout_not_released, - essl_block_non_disturbing_active_timeout_released, - essl_block_disturbing_blocker_dies, - essl_block_non_disturbing_blocker_dies - ]. %%------------------------------------------------------------------------- -http_1_1_ip(doc) -> - ["HTTP/1.1"]; -http_1_1_ip(suite) -> - [ - ip_host, - ip_chunked, - ip_expect, - ip_range, - ip_if_test, - ip_http_trace, - ip_http1_1_head, - ip_mod_cgi_chunked_encoding_test - ]. %%------------------------------------------------------------------------- -http_1_0_ip(doc) -> - ["HTTP/1.0"]; -http_1_0_ip(suite) -> - [ - ip_head_1_0, - ip_get_1_0, - ip_post_1_0 - ]. %%------------------------------------------------------------------------- -http_0_9_ip(doc) -> - ["HTTP/0.9"]; -http_0_9_ip(suite) -> - [ - ip_get_0_9 - ]. %%------------------------------------------------------------------------- -ipv6(doc) -> - ["Tests ipv6 functionality."]; -ipv6(suite) -> - [ - ipv6_hostname, - ipv6_address - ]. %%------------------------------------------------------------------------- -tickets(doc) -> - ["Test cases for reported bugs."]; -tickets(suite) -> - [ - ticket_5775, - ticket_5865, - ticket_5913, - ticket_6003, - ticket_7304 - ]. %%------------------------------------------------------------------------- ip_mod_alias(doc) -> diff --git a/lib/inets/test/httpd_basic_SUITE.erl b/lib/inets/test/httpd_basic_SUITE.erl index 9ba2e73942..dcea200a1a 100644 --- a/lib/inets/test/httpd_basic_SUITE.erl +++ b/lib/inets/test/httpd_basic_SUITE.erl @@ -19,23 +19,26 @@ %% -module(httpd_basic_SUITE). --include("test_server.hrl"). --include("test_server_line.hrl"). +-include_lib("common_test/include/ct.hrl"). %% Note: This directive should only be used in test suites. -compile(export_all). -define(URL_START, "http://localhost:"). -all(doc) -> - ["Basic test of httpd."]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> - [ - uri_too_long_414, - header_too_long_413, - escaped_url_in_error_body - ]. +all() -> + [uri_too_long_414, header_too_long_413, escaped_url_in_error_body]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config diff --git a/lib/inets/test/httpd_load.erl b/lib/inets/test/httpd_load.erl index 9bb9f9f94e..83520033dc 100644 --- a/lib/inets/test/httpd_load.erl +++ b/lib/inets/test/httpd_load.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 diff --git a/lib/inets/test/inets.cover b/lib/inets/test/inets.cover new file mode 100644 index 0000000000..fd0ca41db3 --- /dev/null +++ b/lib/inets/test/inets.cover @@ -0,0 +1,2 @@ +{incl_app,inets,details}. + diff --git a/lib/inets/test/inets.spec b/lib/inets/test/inets.spec index a9b4524295..ed102f8219 100644 --- a/lib/inets/test/inets.spec +++ b/lib/inets/test/inets.spec @@ -1,2 +1 @@ -{topcase, {dir, "../inets_test"}}. -{hosts, ["tuor"]}. +{suites,"../inets_test",all}. diff --git a/lib/inets/test/inets_SUITE.erl b/lib/inets/test/inets_SUITE.erl index 56983caace..8e3ba226b9 100644 --- a/lib/inets/test/inets_SUITE.erl +++ b/lib/inets/test/inets_SUITE.erl @@ -19,7 +19,7 @@ %% -module(inets_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("inets_test_lib.hrl"). @@ -28,25 +28,26 @@ -define(NUM_DEFAULT_SERVICES, 1). -all(doc) -> - ["Test suites for the inets application."]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, app_test}, {group, appup_test}, + {group, services_test}, httpd_reload]. + +groups() -> + [{services_test, [], + [start_inets, start_httpc, start_httpd, start_ftpc, + start_tftpd]}, + {app_test, [], [{inets_app_test, all}]}, + {appup_test, [], [{inets_appup_test, all}]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [ - app_test, - appup_test, - services_test, - httpd_reload - ]. -services_test(suite) -> - [ - start_inets, - start_httpc, - start_httpd, - start_ftpc, - start_tftpd - ]. %%-------------------------------------------------------------------- @@ -100,11 +101,7 @@ end_per_testcase(_, Config) -> %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -app_test(suite) -> - [{inets_app_test, all}]. -appup_test(suite) -> - [{inets_appup_test, all}]. %%------------------------------------------------------------------------- diff --git a/lib/inets/test/inets_app_test.erl b/lib/inets/test/inets_app_test.erl index 6bdb9bb308..11b507fa26 100644 --- a/lib/inets/test/inets_app_test.erl +++ b/lib/inets/test/inets_app_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% 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 @@ -39,28 +39,31 @@ init_per_testcase(undef_funcs, Config) -> init_per_testcase(_, Config) -> Config. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - fields, - modules, - exportall, - app_depend, - undef_funcs - ], - {req, [], {conf, app_init, Cases, app_fin}}. +all() -> + [fields, modules, exportall, app_depend, + undef_funcs]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -app_init(suite) -> []; -app_init(doc) -> []; -app_init(Config) when is_list(Config) -> +init_per_suite(suite) -> []; +init_per_suite(doc) -> []; +init_per_suite(Config) when is_list(Config) -> case is_app(inets) of {ok, AppFile} -> io:format("AppFile: ~n~p~n", [AppFile]), @@ -81,9 +84,9 @@ is_app(App) -> end. -app_fin(suite) -> []; -app_fin(doc) -> []; -app_fin(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. diff --git a/lib/inets/test/inets_appup_test.erl b/lib/inets/test/inets_appup_test.erl index 2c9c687c91..7ed237243e 100644 --- a/lib/inets/test/inets_appup_test.erl +++ b/lib/inets/test/inets_appup_test.erl @@ -28,31 +28,37 @@ -include("inets_test_lib.hrl"). -% t() -> megaco_test_lib:t(?MODULE). -% t(Case) -> megaco_test_lib:t({?MODULE, Case}). + % t() -> megaco_test_lib:t(?MODULE). + % t(Case) -> megaco_test_lib:t({?MODULE, Case}). %% Test server callbacks init_per_testcase(_Case, Config) -> Config. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - appup - ], - {req, [], {conf, appup_init, Cases, appup_fin}}. +all() -> + [appup]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -appup_init(suite) -> []; -appup_init(doc) -> []; -appup_init(Config) when is_list(Config) -> +init_per_suite(suite) -> []; +init_per_suite(doc) -> []; +init_per_suite(Config) when is_list(Config) -> AppFile = file_name(inets, ".app"), AppupFile = file_name(inets, ".appup"), [{app_file, AppFile}, {appup_file, AppupFile}|Config]. @@ -63,9 +69,9 @@ file_name(App, Ext) -> filename:join([LibDir, "ebin", atom_to_list(App) ++ Ext]). -appup_fin(suite) -> []; -appup_fin(doc) -> []; -appup_fin(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. diff --git a/lib/inets/test/inets_sup_SUITE.erl b/lib/inets/test/inets_sup_SUITE.erl index 1e701bc074..fb29ab279f 100644 --- a/lib/inets/test/inets_sup_SUITE.erl +++ b/lib/inets/test/inets_sup_SUITE.erl @@ -20,22 +20,27 @@ -module(inets_sup_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). %% Note: This directive should only be used in test suites. -compile(export_all). -all(doc) -> - ["Test that the inets supervisorstructur is the expected one."]; -all(suite) -> - [ - default_tree, - ftpc_worker, - tftpd_worker, - httpd_subtree, - httpc_subtree - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [default_tree, ftpc_worker, tftpd_worker, httpd_subtree, + httpc_subtree]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config diff --git a/lib/inets/test/inets_test_lib.erl b/lib/inets/test/inets_test_lib.erl index 86fc2d1a32..c56a714f5a 100644 --- a/lib/inets/test/inets_test_lib.erl +++ b/lib/inets/test/inets_test_lib.erl @@ -329,6 +329,9 @@ connect(ip_comm, Host, Port, Opts) -> {error, eafnosupport} -> tsp("eafnosupport opts: ~p", [Opts]), connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); + {error, enetunreach} -> + tsp("eafnosupport opts: ~p", [Opts]), + connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); {error, {enfile,_}} -> tsp("Error enfile"), {error, enfile}; diff --git a/lib/inets/test/tftp_SUITE.erl b/lib/inets/test/tftp_SUITE.erl index 5768fff88b..79e9682ca4 100644 --- a/lib/inets/test/tftp_SUITE.erl +++ b/lib/inets/test/tftp_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -64,24 +64,34 @@ default_config() -> init_per_testcase(Case, Config) -> tftp_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) when is_list(Config) -> - tftp_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) when is_list(Config) -> + tftp_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Test suites for TFTP."]; - -all(suite) -> - [ - simple, - extra, - reuse_connection, - resend_client, - resend_server - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [simple, extra, reuse_connection, resend_client, + resend_server]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Simple diff --git a/lib/inets/test/tftp_test_lib.erl b/lib/inets/test/tftp_test_lib.erl index 3729309b0e..e9b691828f 100644 --- a/lib/inets/test/tftp_test_lib.erl +++ b/lib/inets/test/tftp_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -32,7 +32,7 @@ init_per_testcase(_Case, Config) when is_list(Config) -> ?IGNORE(application:stop(inets)), Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> ?IGNORE(application:stop(inets)), Config. @@ -143,7 +143,7 @@ eval(Mod, Fun, Config) -> Config2 = Mod:init_per_testcase(Fun, Config), Pid = spawn_link(?MODULE, do_eval, [self(), Mod, Fun, Config2]), R = wait_for_evaluator(Pid, Mod, Fun, Config2, []), - Mod:fin_per_testcase(Fun, Config2), + Mod:end_per_testcase(Fun, Config2), global:unregister_name(tftp_test_case_sup), process_flag(trap_exit, Flag), R. diff --git a/lib/inets/vsn.mk b/lib/inets/vsn.mk index f462290a99..67737ee552 100644 --- a/lib/inets/vsn.mk +++ b/lib/inets/vsn.mk @@ -18,7 +18,7 @@ # %CopyrightEnd% APPLICATION = inets -INETS_VSN = 5.5.1 +INETS_VSN = 5.5.2 PRE_VSN = APP_VSN = "$(APPLICATION)-$(INETS_VSN)$(PRE_VSN)" diff --git a/lib/inviso/test/Makefile b/lib/inviso/test/Makefile index 27fe99703a..cd372624b5 100644 --- a/lib/inviso/test/Makefile +++ b/lib/inviso/test/Makefile @@ -52,7 +52,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) inviso.spec $(ERL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) inviso.spec inviso.cover $(ERL_FILES) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/inviso/test/inviso.cover b/lib/inviso/test/inviso.cover new file mode 100644 index 0000000000..e23b9fa59b --- /dev/null +++ b/lib/inviso/test/inviso.cover @@ -0,0 +1,2 @@ +{incl_app,inviso,details}. + diff --git a/lib/inviso/test/inviso.spec b/lib/inviso/test/inviso.spec index d655771d64..49f9b0b460 100644 --- a/lib/inviso/test/inviso.spec +++ b/lib/inviso/test/inviso.spec @@ -1 +1 @@ -{topcase, {dir, "../inviso_test"}}. +{suites,"../inviso_test",all}. diff --git a/lib/inviso/test/inviso_tool_SUITE.erl b/lib/inviso/test/inviso_tool_SUITE.erl index 206e117c86..d59e3b5fa8 100644 --- a/lib/inviso/test/inviso_tool_SUITE.erl +++ b/lib/inviso/test/inviso_tool_SUITE.erl @@ -1,19 +1,21 @@ -% ``The contents of this file are subject to the Erlang Public License,
+%%
+%% %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 via the world wide web at http://www.erlang.org/.
-%%
+%% 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.
-%%
-%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
-%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
-%% AB. All Rights Reserved.''
-%%
-%% $Id$
+%%
+%% %CopyrightEnd%
+%%
%%
%% Description:
%% Test suite for the inviso_tool. It is here assumed that inviso works
@@ -26,20 +28,27 @@ -module(inviso_tool_SUITE).
-compile(export_all).
--include("test_server.hrl").
+-include_lib("common_test/include/ct.hrl").
-include_lib("kernel/include/file.hrl").
-define(l,?line).
-all(suite) ->
- [
- dist_basic_1,
- dist_rtc,
- dist_reconnect,
- dist_adopt,
- dist_history,
- dist_start_session_special
- ].
+suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [dist_basic_1, dist_rtc, dist_reconnect, dist_adopt, + dist_history, dist_start_session_special]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %% -----------------------------------------------------------------------------
init_per_suite(Config) ->
@@ -89,7 +98,7 @@ init_per_testcase(_Case,Config) -> insert_timetraphandle_config(TH,NewConfig2).
%% -----------------------------------------------------------------------------
-fin_per_testcase(_Case,Config) ->
+end_per_testcase(_Case,Config) ->
?l test_server:stop_node(get_remotenode_config(inviso1,Config)),
?l test_server:stop_node(get_remotenode_config(inviso2,Config)),
?l test_server:timetrap_cancel(get_timetraphandle_config(Config)),
@@ -220,6 +229,10 @@ dist_basic_1(Config) when list(Config) -> Nodes),
%% Start a test process at every node with a runtime component.
?l lists:foreach(fun(N)->spawn(N,?MODULE,test_proc_init,[]) end,Nodes),
+ + %% Let the processes start + timer:sleep(100), + %% Find the pids of the test processes.
?l TestProcs=lists:map(fun(N)->rpc:call(N,erlang,whereis,[inviso_tool_test_proc]) end,
Nodes),
@@ -500,6 +513,10 @@ dist_rtc(Config) when is_list(Config) -> Nodes),
%% Start a test process at every node with a runtime component.
?l lists:foreach(fun(N)->spawn(N,?MODULE,test_proc_init,[]) end,Nodes),
+ + %% Let the processes start + timer:sleep(100), + %% Find the pids of the test processes.
?l TestProcs=lists:map(fun(N)->rpc:call(N,erlang,whereis,[inviso_tool_test_proc]) end,
Nodes),
@@ -553,6 +570,10 @@ dist_reconnect(Config) when list(Config) -> ?l start_inviso_tool_session(CNode,[],1,Nodes),
%% Start a test process at every node with a runtime component.
?l lists:foreach(fun(N)->spawn(N,?MODULE,test_proc_init,[]) end,Nodes),
+ + %% Let the processes start + timer:sleep(100), + %% Find the pids of the test processes.
?l TestProcs=lists:map(fun(N)->rpc:call(N,erlang,whereis,[inviso_tool_test_proc]) end,
Nodes),
diff --git a/lib/jinterface/doc/src/notes.xml b/lib/jinterface/doc/src/notes.xml index a571de6916..879634561b 100644 --- a/lib/jinterface/doc/src/notes.xml +++ b/lib/jinterface/doc/src/notes.xml @@ -30,6 +30,22 @@ </header> <p>This document describes the changes made to the Jinterface application.</p> +<section><title>Jinterface 1.5.3.2</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + The OtpMbox class did not have a hash() method, which it + should have because it overrides equals().</p> + <p> + Own Id: OTP-8854</p> + </item> + </list> + </section> + +</section> + <section><title>Jinterface 1.5.3.1</title> <section><title>Improvements and New Features</title> diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java index ab0b299bf9..9ba6a4a0ab 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2000-2009. All Rights Reserved. + * Copyright Ericsson AB 2000-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 @@ -68,7 +68,6 @@ public abstract class AbstractConnection extends Thread { protected static final int sendTag = 2; protected static final int exitTag = 3; protected static final int unlinkTag = 4; - protected static final int nodeLinkTag = 5; protected static final int regSendTag = 6; protected static final int groupLeaderTag = 7; protected static final int exit2Tag = 8; @@ -697,7 +696,6 @@ public abstract class AbstractConnection extends Thread { // absolutely no idea what to do with these, so we ignore // them... case groupLeaderTag: // { GROUPLEADER, FromPid, ToPid} - case nodeLinkTag: // { NODELINK } // (just show trace) if (traceLevel >= ctrlThreshold) { System.out.println("<- " + headerType(head) + " " @@ -880,9 +878,6 @@ public abstract class AbstractConnection extends Thread { case unlinkTag: return "UNLINK"; - case nodeLinkTag: - return "NODELINK"; - case regSendTag: return "REG_SEND"; diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java index 80d8a5ccae..6f507bf4bb 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2000-2009. All Rights Reserved. + * Copyright Ericsson AB 2000-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 @@ -54,7 +54,6 @@ public class OtpMsg { public static final int sendTag = 2; public static final int exitTag = 3; public static final int unlinkTag = 4; - /* public static final int nodeLinkTag = 5; */ public static final int regSendTag = 6; /* public static final int groupLeaderTag = 7; */ public static final int exit2Tag = 8; diff --git a/lib/jinterface/test/Makefile b/lib/jinterface/test/Makefile index 36955d1e91..ac9556c2f7 100644 --- a/lib/jinterface/test/Makefile +++ b/lib/jinterface/test/Makefile @@ -32,7 +32,8 @@ RELSYSDIR = $(RELEASE_PATH)/jinterface_test # ---------------------------------------------------- # Target Specs # ---------------------------------------------------- -TEST_SPEC_FILE = jinterface.dynspec +TEST_SPEC_FILE = jinterface.spec +COVER_FILE = jinterface.cover MODULES = nc_SUITE \ jinterface_SUITE @@ -80,5 +81,5 @@ release_docs_spec: release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) $(TEST_SPEC_FILE) $(ERL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) $(TEST_SPEC_FILE) $(COVER_FILE) $(ERL_FILES) $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/jinterface/test/jinterface.cover b/lib/jinterface/test/jinterface.cover new file mode 100644 index 0000000000..d4edcd99d2 --- /dev/null +++ b/lib/jinterface/test/jinterface.cover @@ -0,0 +1,2 @@ +{incl_app,jinterface,details}. + diff --git a/lib/jinterface/test/jinterface.dynspec b/lib/jinterface/test/jinterface.spec index 44712521df..99bc0f4005 100644 --- a/lib/jinterface/test/jinterface.dynspec +++ b/lib/jinterface/test/jinterface.spec @@ -17,16 +17,4 @@ %% %% %CopyrightEnd% %% -%% You can test this file using this command. -%% file:script("jinterface.dynspec", [{'Os',"Unix"}]). - -case case code:priv_dir(jinterface) of - {error,bad_name} -> false; - P -> filelib:is_dir(P) end of - true -> - []; - false -> - NoApp = "No jinterface application", - [{skip,{nc_SUITE,NoApp}}, - {skip,{jinterface_SUITE,NoApp}}] -end. +{suites,"../jinterface_test",all}. diff --git a/lib/jinterface/test/jinterface_SUITE.erl b/lib/jinterface/test/jinterface_SUITE.erl index ea097680dd..e608bcb093 100644 --- a/lib/jinterface/test/jinterface_SUITE.erl +++ b/lib/jinterface/test/jinterface_SUITE.erl @@ -18,7 +18,8 @@ %% -module(jinterface_SUITE). --export([all/1, init_per_suite/1, end_per_suite/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2]). -export([nodename/1, register_and_whereis/1, get_names/1, boolean_atom/1, @@ -31,13 +32,14 @@ erl_link_java_exit/1, java_link_erl_exit/1, internal_link_linking_exits/1, internal_link_linked_exits/1, internal_unlink_linking_exits/1, internal_unlink_linked_exits/1, - normal_exit/1, kill_mbox/1, kill_erl_proc_from_java/1, - kill_mbox_from_erlang/1, erl_exit_with_reason_any_term/1, + normal_exit/1, kill_mbox/1,kill_erl_proc_from_java/1, + kill_mbox_from_erlang/1, + erl_exit_with_reason_any_term/1, java_exit_with_reason_any_term/1, status_handler_localStatus/1, status_handler_remoteStatus/1, status_handler_connAttempt/1]). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -define(debug,true). @@ -80,14 +82,21 @@ %%%----------------------------------------------------------------- %%% INIT/END %%%----------------------------------------------------------------- -all(suite) -> - lists:append([ - fundamental(), - ping(), - send_receive(), - link_unlink(), - status_handler() - ]). +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + lists:append([fundamental(), ping(), send_receive(), + link_unlink(), status_handler()]). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + fundamental() -> [ @@ -154,11 +163,22 @@ status_handler() -> init_per_suite(Config) when is_list(Config) -> - jitu:init_all(Config). + case case code:priv_dir(jinterface) of + {error,bad_name} -> false; + P -> filelib:is_dir(P) end of + true -> + jitu:init_all(Config); + false -> + {skip,"No jinterface application"} + end. end_per_suite(Config) when is_list(Config) -> jitu:finish_all(Config). +init_per_testcase(Case, _Config) + when Case =:= kill_mbox; + Case =:= kill_mbox_from_erlang -> + {skip, "Not yet implemented"}; init_per_testcase(_Case,Config) -> Dog = ?t:timetrap({seconds,10}), [{watch_dog,Dog}|Config]. diff --git a/lib/jinterface/test/nc_SUITE.erl b/lib/jinterface/test/nc_SUITE.erl index 82dd3c2535..03f6f2036c 100644 --- a/lib/jinterface/test/nc_SUITE.erl +++ b/lib/jinterface/test/nc_SUITE.erl @@ -19,11 +19,11 @@ -module(nc_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, init_per_suite/1, end_per_suite/1, init_per_testcase/2, @@ -50,30 +50,34 @@ %% Top of cases -all(doc) -> []; -all(suite) -> [pid_roundtrip, - port_roundtrip, - ref_roundtrip, - new_float, - old_stuff, - binary_roundtrip, - decompress_roundtrip, - compress_roundtrip, - integer_roundtrip, - fun_roundtrip, - lists_roundtrip, - lists_roundtrip_2, - lists_iterator, - unicode, - unicode_list_to_string, - unicode_string_to_list, - connect]. +suite() -> [{ct_hooks,[ts_install_cth]}]. +all() -> + [pid_roundtrip, port_roundtrip, ref_roundtrip, + new_float, old_stuff, binary_roundtrip, + decompress_roundtrip, compress_roundtrip, + integer_roundtrip, fun_roundtrip, lists_roundtrip, + lists_roundtrip_2, lists_iterator, unicode, + unicode_list_to_string, unicode_string_to_list, connect]. +groups() -> + []. +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. init_per_suite(Config) when is_list(Config) -> - jitu:init_all(Config). + case case code:priv_dir(jinterface) of + {error,bad_name} -> false; + P -> filelib:is_dir(P) end of + true -> + jitu:init_all(Config); + false -> + {skip,"No jinterface application"} + end. end_per_suite(Config) -> jitu:finish_all(Config). diff --git a/lib/jinterface/vsn.mk b/lib/jinterface/vsn.mk index ed085b5d4d..24ffe7c5e6 100644 --- a/lib/jinterface/vsn.mk +++ b/lib/jinterface/vsn.mk @@ -1 +1 @@ -JINTERFACE_VSN = 1.5.3.1 +JINTERFACE_VSN = 1.5.3.2 diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml index 64cdd3a8ea..36fce464c5 100644 --- a/lib/kernel/doc/src/file.xml +++ b/lib/kernel/doc/src/file.xml @@ -36,6 +36,61 @@ other Erlang processes to continue executing in parallel with the file operations. See the command line flag <c>+A</c> in <seealso marker="erts:erl">erl(1)</seealso>.</p> + + <p>The Erlang VM supports file names in Unicode to a limited + extent. Depending on how the VM is started (with the parameter + <c>+fnu</c> or <c>+fnl</c>), file names given can contain + characters > 255 and the VM system will convert file names + back and forth to the native file name encoding.</p> + + <p>The default behavior for Unicode character translation depends + on to what extent the underlying OS/filesystem enforces consistent + naming. On OSes where all file names are ensured to be in one or + another encoding, Unicode is the default (currently this holds for + Windows and MacOSX). On OSes with completely transparent file + naming (i.e. all Unixes except MacOSX), ISO-latin-1 file naming is + the default. The reason for the ISO-latin-1 default is that + file names are not guaranteed to be possible to interpret according to + the Unicode encoding expected (i.e. UTF-8), and file names that + cannot be decoded will only be accessible by using "raw + file names", in other word file names given as binaries.</p> + + <p>As file names are traditionally not binaries in Erlang, + applications that need to handle raw file names need to be + converted, why the Unicode mode for file names is not default on + systems having completely transparent file naming.</p> + + <note>As of R14B01, the most basic file handling modules + (<c>file</c>, <c>prim_file</c>, <c>filelib</c> and + <c>filename</c>) accept raw file names, but the rest of OTP is not + guaranteed to handle them, why Unicode file naming on systems + where it is not default is still considered experimental.</note> + + <p>Raw file names is a new feature in OTP R14B01, which allows the + user to supply completely uninterpreted file names to the + underlying OS/filesystem. They are supplied as binaries, where it + is up to the user to supply a correct encoding for the + environment. The function <c>file:native_name_encoding()</c> can + be used to check what encoding the VM is working in. If the + function returns <c>latin1</c> file names are not in any way + converted to Unicode, if it is <c>utf8</c>, raw file names should + be encoded as UTF-8 if they are to follow the convention of the VM + (and usually the convention of the OS as well). Using raw + file names is useful if you have a filesystem with inconsistent + file naming, where some files are named in UTF-8 encoding while + others are not. A file:list_dir on such mixed file name systems + when the VM is in Unicode file name mode might return file names as + raw binaries as they cannot be interpreted as Unicode + file names. Raw file names can also be used to give UTF-8 encoded + file names even though the VM is not started in Unicode file name + translation mode.</p> + + <p>Note that on Windows, <c>file:native_name_encoding()</c> + returns <c>utf8</c> per default, which is the format for raw + file names even on Windows, although the underlying OS specific + code works in a limited version of little endian UTF16. As far as + the Erlang programmer is concerned, Windows native Unicode format + is UTF-8...</p> </description> <section> @@ -47,8 +102,14 @@ iodata() = iolist() | binary() io_device() as returned by file:open/2, a process handling IO protocols -name() = string() | atom() | DeepList +name() = string() | atom() | DeepList | RawFilename DeepList = [char() | atom() | DeepList] + RawFilename = binary() + If VM is in unicode filename mode, string() and char() are allowed to be > 255. + RawFilename is a filename not subject to Unicode translation, meaning that it + can contain characters not conforming to the Unicode encoding expected from the + filesystem (i.e. non-UTF-8 characters although the VM is started in Unicode + filename mode). posix() an atom which is named from the POSIX error codes used in @@ -598,6 +659,15 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> + <name>native_name_encoding() -> latin1 | utf8</name> + <fsummary>Return the VM's configured filename encoding.</fsummary> + <desc> + <p>This function returns the configured default file name encoding to use for raw file names. Generally an application supplying file names raw (as binaries), should obey the character encoding returned by this function.</p> + <p>By default, the VM uses ISO-latin-1 file name encoding on filesystems and/or OSes that use completely transparent file naming. This includes all Unix versions except MacOSX, where the vfs layer enforces UTF-8 file naming. By giving the experimental option <c>+fnu</c> when starting Erlang, UTF-8 translation of file names can be turned on even for those systems. If Unicode file name translation is in effect, the system behaves as usual as long as file names conform to the encoding, but will return file names that are not properly encoded in UTF-8 as raw file names (i.e. binaries).</p> + <p>On Windows, this function also returns <c>utf8</c> by default. The OS uses a pure Unicode naming scheme and file names are always possible to interpret as valid Unicode. The fact that the underlying Windows OS actually encodes file names using little endian UTF-16 can be ignored by the Erlang programmer. Windows and MacOSX are the only operating systems where the VM operates in Unicode file name mode by default.</p> + </desc> + </func> + <func> <name>open(Filename, Modes) -> {ok, IoDevice} | {error, Reason}</name> <fsummary>Open a file</fsummary> <type> diff --git a/lib/kernel/doc/src/notes.xml b/lib/kernel/doc/src/notes.xml index edd6ea52b0..29580a4cd1 100644 --- a/lib/kernel/doc/src/notes.xml +++ b/lib/kernel/doc/src/notes.xml @@ -30,6 +30,45 @@ </header> <p>This document describes the changes made to the Kernel application.</p> +<section><title>Kernel 2.14.2</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + The Erlang VM now supports Unicode filenames. The feature + is turned on by default on systems where Unicode + filenames are mandatory (Windows and MacOSX), but can be + enabled on other systems with the '+fnu' emulator option. + Enabling the Unicode filename feature on systems where it + is not default is however considered experimental and not + to be used for production. Together with the Unicode file + name support, the concept of "raw filenames" is + introduced, which means filenames provided without + implicit unicode encoding translation. Raw filenames are + provided as binaries, not lists. For further information, + see stdlib users guide and the chapter about using + Unicode in Erlang. Also see the file module manual page.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-8887</p> + </item> + <item> + <p> + There is now a new function inet:getifaddrs/0 modeled + after C library function getifaddrs() on BSD and LInux + that reports existing interfaces and their addresses on + the host. This replaces the undocumented and unsupported + inet:getiflist/0 and inet:ifget/2.</p> + <p> + Own Id: OTP-8926</p> + </item> + </list> + </section> + +</section> + <section><title>Kernel 2.14.1.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl index ec256d5806..feb5131aad 100644 --- a/lib/kernel/src/code.erl +++ b/lib/kernel/src/code.erl @@ -213,19 +213,20 @@ unstick_mod(Mod) when is_atom(Mod) -> call({unstick_mod,Mod}). -spec is_sticky(Module :: atom()) -> boolean(). is_sticky(Mod) when is_atom(Mod) -> call({is_sticky,Mod}). --spec set_path(Directories :: [file:filename()]) -> 'true' | {'error', term()}. +-spec set_path(Directories :: [file:filename()]) -> + 'true' | {'error', 'bad_directory' | 'bad_path'}. set_path(PathList) when is_list(PathList) -> call({set_path,PathList}). -spec get_path() -> [file:filename()]. get_path() -> call(get_path). --spec add_path(Directory :: file:filename()) -> 'true' | {'error', term()}. +-spec add_path(Directory :: file:filename()) -> 'true' | {'error', 'bad_directory'}. add_path(Dir) when is_list(Dir) -> call({add_path,last,Dir}). --spec add_pathz(Directory :: file:filename()) -> 'true' | {'error', term()}. +-spec add_pathz(Directory :: file:filename()) -> 'true' | {'error', 'bad_directory'}. add_pathz(Dir) when is_list(Dir) -> call({add_path,last,Dir}). --spec add_patha(Directory :: file:filename()) -> 'true' | {'error', term()}. +-spec add_patha(Directory :: file:filename()) -> 'true' | {'error', 'bad_directory'}. add_patha(Dir) when is_list(Dir) -> call({add_path,first,Dir}). -spec add_paths(Directories :: [file:filename()]) -> 'ok'. @@ -237,7 +238,6 @@ add_pathsz(Dirs) when is_list(Dirs) -> call({add_paths,last,Dirs}). -spec add_pathsa(Directories :: [file:filename()]) -> 'ok'. add_pathsa(Dirs) when is_list(Dirs) -> call({add_paths,first,Dirs}). -%% XXX Contract's input argument differs from add_path/1 -- why? -spec del_path(Name :: file:filename() | atom()) -> boolean() | {'error', 'bad_name'}. del_path(Name) when is_list(Name) ; is_atom(Name) -> call({del_path,Name}). @@ -286,6 +286,8 @@ do_start(Flags) -> ets:module_info(module), os:module_info(module), + binary:module_info(module), + unicode:module_info(module), filename:module_info(module), lists:module_info(module), diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index 97d914b043..3aca9b4b0d 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -75,7 +75,7 @@ -define(RAM_FILE, ram_file). % Module %% data types --type filename() :: string(). +-type filename() :: string() | binary(). -type file_info() :: #file_info{}. -type fd() :: #file_descriptor{}. -type io_device() :: pid() | fd(). @@ -87,7 +87,7 @@ | 'delayed_write' | {'read_ahead', pos_integer()} | 'read_ahead' | 'compressed' | {'encoding', unicode:encoding()}. --type name() :: string() | atom() | [name()]. +-type name() :: string() | atom() | [name()] | binary(). -type posix() :: 'eacces' | 'eagain' | 'ebadf' | 'ebusy' | 'edquot' | 'eexist' | 'efault' | 'efbig' | 'eintr' | 'einval' | 'eio' | 'eisdir' | 'eloop' | 'emfile' | 'emlink' @@ -183,7 +183,7 @@ make_dir(Name) -> del_dir(Name) -> check_and_call(del_dir, [file_name(Name)]). --spec read_file_info(Name :: name()) -> {'ok', #file_info{}} | {'error', posix()}. +-spec read_file_info(Name :: name()) -> {'ok', file_info()} | {'error', posix()}. read_file_info(Name) -> check_and_call(read_file_info, [file_name(Name)]). @@ -193,7 +193,7 @@ read_file_info(Name) -> altname(Name) -> check_and_call(altname, [file_name(Name)]). --spec read_link_info(Name :: name()) -> {'ok', #file_info{}} | {'error', posix()}. +-spec read_link_info(Name :: name()) -> {'ok', file_info()} | {'error', posix()}. read_link_info(Name) -> check_and_call(read_link_info, [file_name(Name)]). @@ -203,7 +203,7 @@ read_link_info(Name) -> read_link(Name) -> check_and_call(read_link, [file_name(Name)]). --spec write_file_info(Name :: name(), Info :: #file_info{}) -> +-spec write_file_info(Name :: name(), Info :: file_info()) -> 'ok' | {'error', posix()}. write_file_info(Name, Info = #file_info{}) -> @@ -214,7 +214,8 @@ write_file_info(Name, Info = #file_info{}) -> list_dir(Name) -> check_and_call(list_dir, [file_name(Name)]). --spec read_file(Name :: name()) -> {'ok', binary()} | {'error', posix()}. +-spec read_file(Name :: name()) -> + {'ok', binary()} | {'error', posix() | 'terminated' | 'system_limit'}. read_file(Name) -> check_and_call(read_file, [file_name(Name)]). @@ -229,17 +230,17 @@ make_link(Old, New) -> make_symlink(Old, New) -> check_and_call(make_symlink, [file_name(Old), file_name(New)]). --spec write_file(Name :: name(), Bin :: binary()) -> 'ok' | {'error', posix()}. +-spec write_file(Name :: name(), Bin :: iodata()) -> + 'ok' | {'error', posix() | 'terminated' | 'system_limit'}. write_file(Name, Bin) -> check_and_call(write_file, [file_name(Name), make_binary(Bin)]). %% This whole operation should be moved to the file_server and prim_file %% when it is time to change file server protocol again. -%% Meanwhile, it is implemented here, slihtly less efficient. -%% +%% Meanwhile, it is implemented here, slightly less efficient. --spec write_file(Name :: name(), Bin :: binary(), Modes :: [mode()]) -> +-spec write_file(Name :: name(), Bin :: iodata(), Modes :: [mode()]) -> 'ok' | {'error', posix()}. write_file(Name, Bin, ModeList) when is_list(ModeList) -> @@ -348,7 +349,7 @@ open(Item, Mode) -> %%% The File argument must be either a Pid or a handle %%% returned from ?PRIM_FILE:open. --spec close(File :: io_device()) -> 'ok' | {'error', posix()}. +-spec close(File :: io_device()) -> 'ok' | {'error', posix() | 'terminated'}. close(File) when is_pid(File) -> R = file_request(File, close), @@ -367,7 +368,7 @@ close(_) -> {error, badarg}. -spec advise(File :: io_device(), Offset :: integer(), - Length :: integer(), Advise :: posix_file_advise()) -> + Length :: integer(), Advise :: posix_file_advise()) -> 'ok' | {'error', posix()}. advise(File, Offset, Length, Advise) when is_pid(File) -> @@ -449,7 +450,7 @@ pread(_, _, _) -> {error, badarg}. -spec write(File :: io_device() | atom(), Byte :: iodata()) -> - 'ok' | {'error', posix()}. + 'ok' | {'error', posix() | 'terminated'}. write(File, Bytes) when (is_pid(File) orelse is_atom(File)) -> case make_binary(Bytes) of @@ -1033,22 +1034,26 @@ path_open_first([], _Name, _Mode, LastError) -> %% Generates a flat file name from a deep list of atoms and %% characters (integers). +file_name(N) when is_binary(N) -> + N; file_name(N) -> try - file_name_1(N) + file_name_1(N,file:native_name_encoding()) catch Reason -> {error, Reason} end. -file_name_1([C|T]) when is_integer(C), C > 0, C =< 255 -> - [C|file_name_1(T)]; -file_name_1([H|T]) -> - file_name_1(H) ++ file_name_1(T); -file_name_1([]) -> +file_name_1([C|T],latin1) when is_integer(C), C < 256-> + [C|file_name_1(T,latin1)]; +file_name_1([C|T],utf8) when is_integer(C) -> + [C|file_name_1(T,utf8)]; +file_name_1([H|T],E) -> + file_name_1(H,E) ++ file_name_1(T,E); +file_name_1([],_) -> []; -file_name_1(N) when is_atom(N) -> +file_name_1(N,_) when is_atom(N) -> atom_to_list(N); -file_name_1(_) -> +file_name_1(_,_) -> throw(badarg). make_binary(Bin) when is_binary(Bin) -> diff --git a/lib/kernel/src/file_io_server.erl b/lib/kernel/src/file_io_server.erl index 39dc32bb79..14da9c1a55 100644 --- a/lib/kernel/src/file_io_server.erl +++ b/lib/kernel/src/file_io_server.erl @@ -44,11 +44,11 @@ format_error(ErrorId) -> erl_posix_msg:message(ErrorId). start(Owner, FileName, ModeList) - when is_pid(Owner), is_list(FileName), is_list(ModeList) -> + when is_pid(Owner), (is_list(FileName) orelse is_binary(FileName)), is_list(ModeList) -> do_start(spawn, Owner, FileName, ModeList). start_link(Owner, FileName, ModeList) - when is_pid(Owner), is_list(FileName), is_list(ModeList) -> + when is_pid(Owner), (is_list(FileName) orelse is_binary(FileName)), is_list(ModeList) -> do_start(spawn_link, Owner, FileName, ModeList). %%%----------------------------------------------------------------- diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl index 75a11a8afd..ce8c581e08 100644 --- a/lib/kernel/src/os.erl +++ b/lib/kernel/src/os.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -82,8 +82,9 @@ verify_executable(Name0, [Ext|Rest], OrigExtensions) -> end; _ -> case file:read_file_info(Name1) of - {ok, #file_info{mode=Mode}} when Mode band 8#111 =/= 0 -> - %% XXX This test for execution permission is not full-proof + {ok, #file_info{type=regular,mode=Mode}} + when Mode band 8#111 =/= 0 -> + %% XXX This test for execution permission is not fool-proof %% on Unix, since we test if any execution bit is set. {ok, Name1}; _ -> diff --git a/lib/kernel/test/Makefile b/lib/kernel/test/Makefile index 293c368e2a..5f8f3a6bf6 100644 --- a/lib/kernel/test/Makefile +++ b/lib/kernel/test/Makefile @@ -51,6 +51,7 @@ MODULES= \ error_logger_SUITE \ error_logger_warn_SUITE \ file_SUITE \ + file_name_SUITE \ prim_file_SUITE \ ram_file_SUITE \ gen_tcp_api_SUITE \ @@ -141,7 +142,7 @@ release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(APP_FILES) $(RELSYSDIR) - $(INSTALL_DATA) kernel.dynspec $(EMAKEFILE)\ + $(INSTALL_DATA) kernel.spec $(EMAKEFILE)\ $(COVERFILE) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/kernel/test/appinc1.erl b/lib/kernel/test/appinc1.erl index 8456b0eac2..343fefb25c 100644 --- a/lib/kernel/test/appinc1.erl +++ b/lib/kernel/test/appinc1.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/appinc1x.erl b/lib/kernel/test/appinc1x.erl index 2e177727f2..8c144676ac 100644 --- a/lib/kernel/test/appinc1x.erl +++ b/lib/kernel/test/appinc1x.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/appinc2.erl b/lib/kernel/test/appinc2.erl index e41d58bb71..d2e0305109 100644 --- a/lib/kernel/test/appinc2.erl +++ b/lib/kernel/test/appinc2.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/appinc2A.erl b/lib/kernel/test/appinc2A.erl index b51a1f5035..604e31e3d3 100644 --- a/lib/kernel/test/appinc2A.erl +++ b/lib/kernel/test/appinc2A.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/appinc2B.erl b/lib/kernel/test/appinc2B.erl index cafb061ae3..abb60010aa 100644 --- a/lib/kernel/test/appinc2B.erl +++ b/lib/kernel/test/appinc2B.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/appinc2top.erl b/lib/kernel/test/appinc2top.erl index 5bd19a59e7..5a8d0d6687 100644 --- a/lib/kernel/test/appinc2top.erl +++ b/lib/kernel/test/appinc2top.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/application_SUITE.erl b/lib/kernel/test/application_SUITE.erl index 313b50f976..2912735368 100644 --- a/lib/kernel/test/application_SUITE.erl +++ b/lib/kernel/test/application_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -18,9 +18,11 @@ %% -module(application_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, failover/1, failover_comp/1, permissions/1, load/1, reported_bugs/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + failover/1, failover_comp/1, permissions/1, load/1, load_use_cache/1, otp_1586/1, otp_2078/1, otp_2012/1, otp_2718/1, otp_2973/1, otp_3002/1, otp_3184/1, otp_4066/1, otp_4227/1, otp_5363/1, @@ -30,23 +32,46 @@ nodedown_start/1, init2973/0, loop2973/0, loop5606/1]). -export([config_change/1, - distr_changed/1, distr_changed_tc1/1, distr_changed_tc2/1, + distr_changed_tc1/1, distr_changed_tc2/1, shutdown_func/1, do_shutdown/1]). -define(TESTCASE, testcase_name). -define(testcase, ?config(?TESTCASE, Config)). --export([init_per_testcase/2, fin_per_testcase/2, start_type/0, +-export([init_per_testcase/2, end_per_testcase/2, start_type/0, start_phase/0, conf_change/0]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(2)). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [failover, failover_comp, permissions, load, - load_use_cache, reported_bugs, - start_phases, script_start, nodedown_start, - permit_false_start_local, permit_false_start_dist, - get_key, distr_changed, config_change, shutdown_func]. + load_use_cache, {group, reported_bugs}, start_phases, + script_start, nodedown_start, permit_false_start_local, + permit_false_start_dist, get_key, + {group, distr_changed}, config_change, shutdown_func]. + +groups() -> + [{reported_bugs, [], + [otp_1586, otp_2078, otp_2012, otp_2718, otp_2973, + otp_3002, otp_3184, otp_4066, otp_4227, otp_5363, + otp_5606]}, + {distr_changed, [], + [distr_changed_tc1, distr_changed_tc2]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(otp_2973=Case, Config) -> @@ -57,12 +82,12 @@ init_per_testcase(Case, Config) -> ?line Dog = test_server:timetrap(?default_timeout), [{?TESTCASE, Case}, {watchdog, Dog}|Config]. -fin_per_testcase(otp_2973, Config) -> +end_per_testcase(otp_2973, Config) -> code:del_path(?config(data_dir,Config)), Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok; -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -932,9 +957,6 @@ nodedown_start(Conf) when is_list(Conf) -> %%%----------------------------------------------------------------- %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> [otp_1586, otp_2078, otp_2012, otp_2718, - otp_2973, otp_3002, otp_3184, otp_4066, - otp_4227, otp_5363, otp_5606]. %%----------------------------------------------------------------- %% Ticket: OTP-1586 @@ -1589,7 +1611,6 @@ get_key(Conf) when is_list(Conf) -> %%%----------------------------------------------------------------- %%% Testing of change of distributed parameter. %%%----------------------------------------------------------------- -distr_changed(suite) -> [distr_changed_tc1, distr_changed_tc2]. distr_changed_tc1(suite) -> []; distr_changed_tc1(doc) -> ["Test change of distributed parameter."]; diff --git a/lib/kernel/test/bif_SUITE.erl b/lib/kernel/test/bif_SUITE.erl index ae2a3a08ff..173051b693 100644 --- a/lib/kernel/test/bif_SUITE.erl +++ b/lib/kernel/test/bif_SUITE.erl @@ -17,15 +17,16 @@ %% %CopyrightEnd% %% -module(bif_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([spawn_tests/1, +-export([ spawn1/1, spawn2/1, spawn3/1, spawn4/1, - spawn_link_tests/1, + spawn_link1/1, spawn_link2/1, spawn_link3/1, spawn_link4/1, - spawn_opt_tests/1, + spawn_opt2/1, spawn_opt3/1, spawn_opt4/1, spawn_opt5/1, spawn_failures/1, @@ -33,9 +34,9 @@ run_fun/1, wilderness/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -43,25 +44,36 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [spawn_tests, spawn_link_tests, spawn_opt_tests, spawn_failures, wilderness]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -spawn_tests(doc) -> ["Test spawn"]; -spawn_tests(suite) -> - [spawn1, spawn2, spawn3, spawn4]. +all() -> + [{group, spawn_tests}, {group, spawn_link_tests}, + {group, spawn_opt_tests}, spawn_failures, wilderness]. -spawn_link_tests(doc) -> ["Test spawn_link"]; -spawn_link_tests(suite) -> - [spawn_link1, spawn_link2, spawn_link3, spawn_link4]. +groups() -> + [{spawn_tests, [], [spawn1, spawn2, spawn3, spawn4]}, + {spawn_link_tests, [], + [spawn_link1, spawn_link2, spawn_link3, spawn_link4]}, + {spawn_opt_tests, [], + [spawn_opt2, spawn_opt3, spawn_opt4, spawn_opt5]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -spawn_opt_tests(doc) -> ["Test spawn_opt"]; -spawn_opt_tests(suite) -> - [spawn_opt2, spawn_opt3, spawn_opt4, spawn_opt5]. spawn1(doc) -> ["Test spawn/1"]; spawn1(suite) -> diff --git a/lib/kernel/test/ch.erl b/lib/kernel/test/ch.erl index 25d1b4354c..25d6f6d200 100644 --- a/lib/kernel/test/ch.erl +++ b/lib/kernel/test/ch.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/kernel/test/ch_sup.erl b/lib/kernel/test/ch_sup.erl index 9d03628839..4c923b2909 100644 --- a/lib/kernel/test/ch_sup.erl +++ b/lib/kernel/test/ch_sup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/kernel/test/cleanup.erl b/lib/kernel/test/cleanup.erl index 831ceba8f5..01db1e9124 100644 --- a/lib/kernel/test/cleanup.erl +++ b/lib/kernel/test/cleanup.erl @@ -18,11 +18,22 @@ %% -module(cleanup). --export([all/1, cleanup/1]). +-export([all/0,groups/0,init_per_group/2,end_per_group/2, cleanup/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +all() -> + [cleanup]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> {req, [kernel], [cleanup]}. cleanup(suite) -> []; cleanup(_) -> diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl index 6f846ebc56..7b1e4fc522 100644 --- a/lib/kernel/test/code_SUITE.erl +++ b/lib/kernel/test/code_SUITE.erl @@ -18,9 +18,9 @@ %% -module(code_SUITE). --include("test_server.hrl"). -%-compile(export_all). --export([all/1]). +-include_lib("test_server/include/test_server.hrl"). + +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([set_path/1, get_path/1, add_path/1, add_paths/1, del_path/1, replace_path/1, load_file/1, load_abs/1, ensure_loaded/1, delete/1, purge/1, soft_purge/1, is_loaded/1, all_loaded/1, @@ -34,7 +34,7 @@ big_boot_embedded/1, on_load_embedded/1, on_load_errors/1, native_early_modules/1]). --export([init_per_testcase/2, fin_per_testcase/2, +-export([init_per_testcase/2, end_per_testcase/2, init_per_suite/1, end_per_suite/1, sticky_compiler/1]). @@ -43,19 +43,29 @@ handle_event/2, handle_call/2, handle_info/2, terminate/2]). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [set_path, get_path, add_path, add_paths, del_path, replace_path, load_file, load_abs, ensure_loaded, delete, purge, soft_purge, is_loaded, all_loaded, load_binary, dir_req, object_code, set_path_file, - pa_pz_option, add_del_path, - dir_disappeared, ext_mod_dep, clash, - load_cached, start_node_with_cache, add_and_rehash, - where_is_file_no_cache, where_is_file_cached, - purge_stacktrace, mult_lib_roots, bad_erl_libs, - code_archive, code_archive2, on_load, on_load_embedded, - big_boot_embedded, - on_load_errors, native_early_modules]. + pa_pz_option, add_del_path, dir_disappeared, + ext_mod_dep, clash, load_cached, start_node_with_cache, + add_and_rehash, where_is_file_no_cache, + where_is_file_cached, purge_stacktrace, mult_lib_roots, + bad_erl_libs, code_archive, code_archive2, on_load, + on_load_embedded, big_boot_embedded, on_load_errors, + native_early_modules]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. init_per_suite(Config) -> %% The compiler will no longer create a Beam file if @@ -76,7 +86,18 @@ init_per_testcase(_Func, Config) -> P=code:get_path(), P=code:get_path(), [{watchdog, Dog}, {code_path, P}|Config]. -fin_per_testcase(_Func, Config) -> + +end_per_testcase(TC, Config) when TC == mult_lib_roots; + TC == big_boot_embedded -> + {ok, HostName} = inet:gethostname(), + NodeName = list_to_atom(atom_to_list(TC)++"@"++HostName), + ?t:stop_node(NodeName), + end_per_testcase(Config); +end_per_testcase(_Func, Config) -> + end_per_testcase(Config). + +end_per_testcase(Config) -> + code:purge(code_b_test), Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog), P=?config(code_path, Config), @@ -645,7 +666,7 @@ analyse([], [This={M,F,A}|Path], Visited, ErrCnt0) -> %% These modules should be loaded by code.erl before %% the code_server is started. OK = [erlang, os, prim_file, erl_prim_loader, init, ets, - code_server, lists, lists_sort, filename, packages, + code_server, lists, lists_sort, unicode, binary, filename, packages, gb_sets, gb_trees, hipe_unified_loader, hipe_bifs, prim_zip, zlib], ErrCnt1 = @@ -674,6 +695,22 @@ analyse2(MFA={_,_,_}, Path, Visited0) -> %%%% We need to check these manually... % fun's are ok as long as they are defined locally. check_funs({'$M_EXPR','$F_EXPR',_}, + [{unicode,characters_to_binary_int,3}, + {unicode,characters_to_binary,3}, + {filename,filename_string_to_binary,1}|_]) -> 0; +check_funs({'$M_EXPR','$F_EXPR',_}, + [{unicode,ml_map,3}, + {unicode,characters_to_binary_int,3}, + {unicode,characters_to_binary,3}, + {filename,filename_string_to_binary,1}|_]) -> 0; +check_funs({'$M_EXPR','$F_EXPR',_}, + [{unicode,do_o_binary2,2}, + {unicode,do_o_binary,2}, + {unicode,o_trans,1}, + {unicode,characters_to_binary_int,3}, + {unicode,characters_to_binary,3}, + {filename,filename_string_to_binary,1}|_]) -> 0; +check_funs({'$M_EXPR','$F_EXPR',_}, [{code_server,load_native_code,4}, {code_server,load_native_code_1,2}, {code_server,load_native_code,2}, @@ -890,6 +927,8 @@ add_and_rehash(Config) when is_list(Config) -> ?line true = rpc:call(Node, code, add_path, [OkDir]), ?line {error,_} = rpc:call(Node, code, add_path, [BadDir]), ?line ok = rpc:call(Node, code, rehash, []), + + ?t:stop_node(Node), ok. where_is_file_no_cache(suite) -> @@ -991,9 +1030,9 @@ mult_lib_roots(Config) when is_list(Config) -> ?t:start_node(mult_lib_roots, slave, [{args,"-env ERL_LIBS "++ErlLibs}]), - ?line {ok,Cwd} = file:get_cwd(), + ?line TSPath = filename:dirname(code:which(test_server)), ?line Path0 = rpc:call(Node, code, get_path, []), - ?line [Cwd,"."|Path1] = Path0, + ?line [TSPath,"."|Path1] = Path0, ?line [Kernel|Path2] = Path1, ?line [Stdlib|Path3] = Path2, ?line mult_lib_verify_lib(Kernel, "kernel"), @@ -1012,7 +1051,6 @@ mult_lib_roots(Config) when is_list(Config) -> ?line true = rpc:call(Node, code_SUITE_mult_root_module, works_fine, []), - ?line ?t:stop_node(Node), ok. mult_lib_compile(Root, Last) -> @@ -1252,7 +1290,8 @@ on_load_embedded_1(Config) -> ?line LibRoot = code:lib_dir(), ?line LinkName = filename:join(LibRoot, "on_load_app-1.0"), ?line OnLoadApp = filename:join(DataDir, "on_load_app-1.0"), - ?line file:delete(LinkName), + ?line del_link(LinkName), + io:format("LinkName :~p, OnLoadApp: ~p~n",[LinkName,OnLoadApp]), case file:make_symlink(OnLoadApp, LinkName) of {error,enotsup} -> throw({skip,"Support for symlinks required"}); @@ -1281,7 +1320,15 @@ on_load_embedded_1(Config) -> %% Clean up. ?line stop_node(Node), - ?line ok = file:delete(LinkName). + ?line ok = del_link(LinkName). + +del_link(LinkName) -> + case file:delete(LinkName) of + {error,eperm} -> + file:del_dir(LinkName); + Other -> + Other + end. create_boot(Config, Options) -> ?line {ok, OldDir} = file:get_cwd(), diff --git a/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl b/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl index b7fdd4d9ae..646921026d 100644 --- a/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl +++ b/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl @@ -8,7 +8,7 @@ run_me() -> LibDir = code:lib_dir(on_load_app), PrivDir = code:priv_dir(on_load_app), LibDir = filename:dirname(PrivDir), - ModPath = code:which(?MODULE), + ModPath = filename:join(filename:split(code:which(?MODULE))), LibDir = filename:dirname(filename:dirname(ModPath)), %% Start a process to remember that the on_load was called. diff --git a/lib/kernel/test/code_a_test.erl b/lib/kernel/test/code_a_test.erl index 745bbf032c..22830fff53 100644 --- a/lib/kernel/test/code_a_test.erl +++ b/lib/kernel/test/code_a_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/kernel/test/code_b_test.erl b/lib/kernel/test/code_b_test.erl index 0f0107a2b4..a8ff570e2e 100644 --- a/lib/kernel/test/code_b_test.erl +++ b/lib/kernel/test/code_b_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/kernel/test/disk_log_SUITE.erl b/lib/kernel/test/disk_log_SUITE.erl index 1bfe76f5ea..389a911d0b 100644 --- a/lib/kernel/test/disk_log_SUITE.erl +++ b/lib/kernel/test/disk_log_SUITE.erl @@ -28,46 +28,47 @@ -define(config(X,Y), foo). -define(t,test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -define(privdir(Conf), ?config(priv_dir, Conf)). -define(datadir(Conf), ?config(data_dir, Conf)). -endif. --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, - halt_int/1, halt_int_inf/1, halt_int_sz/1, + halt_int_inf/1, halt_int_sz_1/1, halt_int_sz_2/1, - read_mode/1, halt_int_ro/1, halt_ext_ro/1, wrap_int_ro/1, + halt_int_ro/1, halt_ext_ro/1, wrap_int_ro/1, wrap_ext_ro/1, halt_trunc/1, halt_misc/1, halt_ro_alog/1, halt_ro_balog/1, halt_ro_crash/1, - wrap_int/1, wrap_int_1/1, wrap_int_2/1, inc_wrap_file/1, + wrap_int_1/1, wrap_int_2/1, inc_wrap_file/1, - halt_ext/1, halt_ext_inf/1, + halt_ext_inf/1, - halt_ext_sz/1, halt_ext_sz_1/1, halt_ext_sz_2/1, + halt_ext_sz_1/1, halt_ext_sz_2/1, - wrap_ext/1, wrap_ext_1/1, wrap_ext_2/1, + wrap_ext_1/1, wrap_ext_2/1, - head/1, head_func/1, plain_head/1, one_header/1, + head_func/1, plain_head/1, one_header/1, - notif/1, wrap_notif/1, full_notif/1, trunc_notif/1, blocked_notif/1, + wrap_notif/1, full_notif/1, trunc_notif/1, blocked_notif/1, new_idx_vsn/1, reopen/1, - block/1, block_blocked/1, block_queue/1, block_queue2/1, + block_blocked/1, block_queue/1, block_queue2/1, unblock/1, - open/1, open_overwrite/1, open_size/1, open_truncate/1, open_error/1, + open_overwrite/1, open_size/1, open_truncate/1, open_error/1, - close/1, close_race/1, close_block/1, close_deadlock/1, + close_race/1, close_block/1, close_deadlock/1, - error/1, error_repair/1, error_log/1, error_index/1, + error_repair/1, error_log/1, error_index/1, chunk/1, @@ -75,15 +76,15 @@ many_users/1, - info/1, info_current/1, + info_current/1, - change_size/1, change_size_before/1, change_size_during/1, + change_size_before/1, change_size_during/1, change_size_after/1, default_size/1, change_size2/1, change_size_truncate/1, change_attribute/1, - distribution/1, dist_open/1, dist_error_open/1, dist_notify/1, + dist_open/1, dist_error_open/1, dist_notify/1, dist_terminate/1, dist_accessible/1, dist_deadlock/1, dist_open2/1, other_groups/1, @@ -94,7 +95,7 @@ -export([head_fun/1, hf/0, lserv/1, measure/0, init_m/1, xx/0, head_exit/0, slow_header/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([try_unblock/1]). @@ -142,8 +143,59 @@ change_size_after, default_size]). -all(suite) -> - ?ALL_TESTS. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, halt_int}, {group, wrap_int}, + {group, halt_ext}, {group, wrap_ext}, + {group, read_mode}, {group, head}, {group, notif}, + new_idx_vsn, reopen, {group, block}, unblock, + {group, open}, {group, close}, {group, error}, chunk, + truncate, many_users, {group, info}, + {group, change_size}, change_attribute, + {group, distribution}, evil, otp_6278]. + +groups() -> + [{halt_int, [], [halt_int_inf, {group, halt_int_sz}]}, + {halt_int_sz, [], [halt_int_sz_1, halt_int_sz_2]}, + {read_mode, [], + [halt_int_ro, halt_ext_ro, wrap_int_ro, wrap_ext_ro, + halt_trunc, halt_misc, halt_ro_alog, halt_ro_balog, + halt_ro_crash]}, + {wrap_int, [], [wrap_int_1, wrap_int_2, inc_wrap_file]}, + {halt_ext, [], [halt_ext_inf, {group, halt_ext_sz}]}, + {halt_ext_sz, [], [halt_ext_sz_1, halt_ext_sz_2]}, + {wrap_ext, [], [wrap_ext_1, wrap_ext_2]}, + {head, [], [head_func, plain_head, one_header]}, + {notif, [], + [wrap_notif, full_notif, trunc_notif, blocked_notif]}, + {block, [], [block_blocked, block_queue, block_queue2]}, + {open, [], + [open_overwrite, open_size, open_truncate, open_error]}, + {close, [], [close_race, close_block, close_deadlock]}, + {error, [], [error_repair, error_log, error_index]}, + {info, [], [info_current]}, + {change_size, [], + [change_size_before, change_size_during, + change_size_after, default_size, change_size2, + change_size_truncate]}, + {distribution, [], + [dist_open, dist_error_open, dist_notify, + dist_terminate, dist_accessible, dist_deadlock, + dist_open2, other_groups]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Case, Config) -> @@ -167,12 +219,11 @@ init_per_testcase(Case, Config) -> [{watchdog, Dog}|Config] end. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -halt_int(suite) -> [halt_int_inf, halt_int_sz]. halt_int_inf(suite) -> []; halt_int_inf(doc) -> ["Test simple halt disk log, size infinity"]; @@ -187,7 +238,6 @@ halt_int_inf(Conf) when is_list(Conf) -> ?line ok = disk_log:close(a), ?line ok = file:delete(File). -halt_int_sz(suite) -> [halt_int_sz_1, halt_int_sz_2]. halt_int_sz_1(suite) -> []; halt_int_sz_1(doc) -> ["Test simple halt disk log, size defined"]; @@ -275,10 +325,6 @@ halt_int_sz_2(Conf) when is_list(Conf) -> ?line ok = file:delete(File3), ok. -read_mode(suite) -> [halt_int_ro, halt_ext_ro, - wrap_int_ro, wrap_ext_ro, - halt_trunc, halt_misc, halt_ro_alog, halt_ro_balog, - halt_ro_crash]. halt_int_ro(suite) -> []; halt_int_ro(doc) -> ["Test simple halt disk log, read only, internal"]; @@ -480,7 +526,6 @@ halt_ro_crash(Conf) when is_list(Conf) -> -wrap_int(suite) -> [wrap_int_1, wrap_int_2, inc_wrap_file]. wrap_int_1(suite) -> []; wrap_int_1(doc) -> ["Test wrap disk log, internal"]; @@ -628,7 +673,6 @@ inc_wrap_file(Conf) when is_list(Conf) -> -halt_ext(suite) -> [halt_ext_inf, halt_ext_sz]. halt_ext_inf(suite) -> []; halt_ext_inf(doc) -> ["Test halt disk log, external, infinity"]; @@ -642,7 +686,6 @@ halt_ext_inf(Conf) when is_list(Conf) -> ?line ok = disk_log:close(a), ?line ok = file:delete(File). -halt_ext_sz(suite) -> [halt_ext_sz_1, halt_ext_sz_2]. halt_ext_sz_1(suite) -> []; halt_ext_sz_1(doc) -> ["Test halt disk log, external, size defined"]; @@ -734,7 +777,6 @@ halt_ext_sz_2(Conf) when is_list(Conf) -> ?line ok = file:delete(File3), ok. -wrap_ext(suite) -> [wrap_ext_1, wrap_ext_2]. wrap_ext_1(suite) -> []; wrap_ext_1(doc) -> ["Test wrap disk log, external, size defined"]; @@ -1147,7 +1189,6 @@ end_times({T1,W1}) -> {W2, _} = statistics(wall_clock), {T2-T1, W2-W1}. -head(suite) -> [head_func, plain_head, one_header]. head_func(suite) -> []; head_func(doc) -> ["Test head parameter"]; @@ -1327,8 +1368,6 @@ one_header(Conf) when is_list(Conf) -> ok. -notif(suite) -> [wrap_notif, full_notif, trunc_notif, - blocked_notif]. wrap_notif(suite) -> []; wrap_notif(doc) -> ["Test notify parameter, wrap"]; @@ -1553,7 +1592,6 @@ reopen(Conf) when is_list(Conf) -> ?line Q = qlen(), ok. -block(suite) -> [block_blocked, block_queue, block_queue2]. block_blocked(suite) -> []; block_blocked(doc) -> @@ -1826,8 +1864,6 @@ try_unblock(Log) -> ?line Error = {error, {not_blocked_by_pid, n}} = disk_log:unblock(Log), ?line "The disk log" ++ _ = format_error(Error). -open(suite) -> [open_overwrite, open_size, - open_truncate, open_error]. open_overwrite(suite) -> []; open_overwrite(doc) -> @@ -2075,7 +2111,6 @@ open_error(Conf) when is_list(Conf) -> ?line del(File, No). -close(suite) -> [close_race, close_block, close_deadlock]. close_race(suite) -> []; close_race(doc) -> @@ -2497,7 +2532,6 @@ lserv(Log) -> end, lserv(Log). -error(suite) -> [error_repair, error_log, error_index]. error_repair(suite) -> []; error_repair(doc) -> @@ -3215,7 +3249,6 @@ del_files(_Size, File) -> -info(suite) -> [info_current]. info_current(suite) -> []; info_current(doc) -> @@ -3420,11 +3453,6 @@ info_current(Conf) when is_list(Conf) -> ok. -change_size(suite) -> [change_size_before, - change_size_during, - change_size_after, - default_size, change_size2, - change_size_truncate]. change_size_before(suite) -> []; change_size_before(doc) -> @@ -4094,13 +4122,6 @@ change_attribute(Conf) when is_list(Conf) -> ?line Q = qlen(), ?line del(File, No). -distribution(suite) -> [dist_open, dist_error_open, - dist_notify, - dist_terminate, - dist_accessible, - dist_deadlock, - dist_open2, - other_groups]. dist_open(suite) -> []; dist_open(doc) -> diff --git a/lib/kernel/test/erl_boot_server_SUITE.erl b/lib/kernel/test/erl_boot_server_SUITE.erl index 241d68fef4..8399e8072f 100644 --- a/lib/kernel/test/erl_boot_server_SUITE.erl +++ b/lib/kernel/test/erl_boot_server_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -18,9 +18,9 @@ %% -module(erl_boot_server_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). -export([start/1, start_link/1, stop/1, add/1, delete/1, responses/1]). @@ -33,9 +33,27 @@ %% Changed for the new erl_boot_server for R3A by Bjorn Gustavsson. %%----------------------------------------------------------------- -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [start, start_link, stop, add, delete, responses]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + -define(all_ones, {255, 255, 255, 255}). start(doc) -> "Tests the erl_boot_server:start/1 function."; diff --git a/lib/kernel/test/erl_distribution_SUITE.erl b/lib/kernel/test/erl_distribution_SUITE.erl index 21a96f804a..9cccdab76b 100644 --- a/lib/kernel/test/erl_distribution_SUITE.erl +++ b/lib/kernel/test/erl_distribution_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -19,13 +19,14 @@ -module(erl_distribution_SUITE). %-define(line_trace, 1). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([tick/1, tick_change/1, illegal_nodenames/1, hidden_node/1, table_waste/1, net_setuptime/1, - monitor_nodes/1, + monitor_nodes_nodedown_reason/1, monitor_nodes_complex_nodedown_reason/1, monitor_nodes_node_type/1, @@ -41,7 +42,7 @@ tick_serv_test/2, tick_serv_test1/1, keep_conn/1, time_ping/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([start_node/2]). @@ -57,16 +58,39 @@ %% erl -sname master -rsh ctrsh %%----------------------------------------------------------------- -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [tick, tick_change, illegal_nodenames, hidden_node, - table_waste, net_setuptime, - monitor_nodes]. + table_waste, net_setuptime, {group, monitor_nodes}]. + +groups() -> + [{monitor_nodes, [], + [monitor_nodes_nodedown_reason, + monitor_nodes_complex_nodedown_reason, + monitor_nodes_node_type, monitor_nodes_misc, + monitor_nodes_otp_6481, monitor_nodes_errors, + monitor_nodes_combinations, monitor_nodes_cleanup, + monitor_nodes_many]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:minutes(4)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). @@ -530,18 +554,6 @@ check_monitor_nodes_res(Pid, Node) -> end. -monitor_nodes(doc) -> - []; -monitor_nodes(suite) -> - [monitor_nodes_nodedown_reason, - monitor_nodes_complex_nodedown_reason, - monitor_nodes_node_type, - monitor_nodes_misc, - monitor_nodes_otp_6481, - monitor_nodes_errors, - monitor_nodes_combinations, - monitor_nodes_cleanup, - monitor_nodes_many]. %% %% Testcase: @@ -845,13 +857,16 @@ monitor_nodes_otp_6481_test(Config, TestType) when is_list(Config) -> ?line {ok, Node} = start_node(Name, "", this), ?line receive {nodeup, Node} -> ok end, - ?line spawn(Node, + ?line RemotePid = spawn(Node, fun () -> - receive after 1000 -> ok end, - lists:foreach(fun (No) -> - Me ! {NodeMsg, No} - end, - Seq), + receive after 1500 -> ok end, + % infinit loop of msgs + % we want an endless stream of messages and the kill + % the node mercilessly. + % We then want to ensure that the nodedown message arrives + % last ... without garbage after it. + _ = spawn(fun() -> node_loop_send(Me, NodeMsg, 1) end), + receive {Me, kill_it} -> ok end, halt() end), @@ -860,9 +875,11 @@ monitor_nodes_otp_6481_test(Config, TestType) when is_list(Config) -> %% Verify that '{nodeup, Node}' comes before '{NodeMsg, 1}' (the message %% bringing up the connection). - %%?line no_msgs(500), % Why wait? It fails test sometimes /sverker + ?line no_msgs(500), ?line {nodeup, Node} = receive Msg1 -> Msg1 end, - ?line {NodeMsg, 1} = receive Msg2 -> Msg2 end, + ?line {NodeMsg, 1} = receive Msg2 -> Msg2 end, + % msg stream has begun, kill the node + ?line RemotePid ! {self(), kill_it}, %% Verify that '{nodedown, Node}' comes after the last '{NodeMsg, N}' %% message. @@ -883,6 +900,10 @@ flush_node_msgs(NodeMsg, No) -> OtherMsg -> OtherMsg end. +node_loop_send(Pid, Msg, No) -> + Pid ! {Msg, No}, + node_loop_send(Pid, Msg, No + 1). + monitor_nodes_errors(doc) -> []; monitor_nodes_errors(suite) -> diff --git a/lib/kernel/test/erl_distribution_wb_SUITE.erl b/lib/kernel/test/erl_distribution_wb_SUITE.erl index 627fed1fdd..f712cdea46 100644 --- a/lib/kernel/test/erl_distribution_wb_SUITE.erl +++ b/lib/kernel/test/erl_distribution_wb_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -18,12 +18,13 @@ %% -module(erl_distribution_wb_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([init_per_testcase/2, fin_per_testcase/2, whitebox/1, +-export([init_per_testcase/2, end_per_testcase/2, whitebox/1, switch_options/1, missing_compulsory_dflags/1]). %% 1) @@ -77,14 +78,32 @@ -define(u32(X3,X2,X1,X0), (((X3) bsl 24) bor ((X2) bsl 16) bor ((X1) bsl 8) bor (X0))). -all(suite) -> - [whitebox,switch_options,missing_compulsory_dflags]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [whitebox, switch_options, missing_compulsory_dflags]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:minutes(1)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl index 19c84ab34c..b990e76064 100644 --- a/lib/kernel/test/erl_prim_loader_SUITE.erl +++ b/lib/kernel/test/erl_prim_loader_SUITE.erl @@ -19,9 +19,10 @@ -module(erl_prim_loader_SUITE). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([get_path/1, set_path/1, get_file/1, inet_existing/1, inet_coming_up/1, inet_disconnects/1, @@ -29,27 +30,41 @@ local_archive/1, remote_archive/1, primary_archive/1, virtual_dir_in_archive/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). %%----------------------------------------------------------------- %% Test suite for erl_prim_loader. (Most code is run during system start/stop.) %%----------------------------------------------------------------- -all(suite) -> - [ - get_path, set_path, get_file, - inet_existing, inet_coming_up, - inet_disconnects, multiple_slaves, - file_requests, local_archive, - remote_archive, primary_archive, - virtual_dir_in_archive - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [get_path, set_path, get_file, inet_existing, + inet_coming_up, inet_disconnects, multiple_slaves, + file_requests, local_archive, remote_archive, + primary_archive, virtual_dir_in_archive]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:minutes(3)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). @@ -291,7 +306,6 @@ wait_and_shutdown([], _) -> ok. -file_requests(suite) -> {req, [{local_slave_nodes, 1}, {time, 10}]}; file_requests(doc) -> ["Start a node using the 'inet' loading method, ", "verify that the boot server responds to file requests."]; file_requests(Config) when is_list(Config) -> @@ -300,9 +314,11 @@ file_requests(Config) when is_list(Config) -> %% compare with results from file server calls (the %% boot server uses the same file sys and cwd) {ok,Files} = file:list_dir("."), + io:format("Files: ~p~n",[Files]), ?line {ok,Files} = rpc:call(Node, erl_prim_loader, list_dir, ["."]), - {ok,Info} = file:read_file_info("test_server.beam"), - ?line {ok,Info} = rpc:call(Node, erl_prim_loader, read_file_info, ["test_server.beam"]), + {ok,Info} = file:read_file_info(code:which(test_server)), + ?line {ok,Info} = rpc:call(Node, erl_prim_loader, read_file_info, + [code:which(test_server)]), {ok,Cwd} = file:get_cwd(), ?line {ok,Cwd} = rpc:call(Node, erl_prim_loader, get_cwd, []), case file:get_cwd("C:") of diff --git a/lib/kernel/test/error_logger_SUITE.erl b/lib/kernel/test/error_logger_SUITE.erl index eda86861d5..dca073cea0 100644 --- a/lib/kernel/test/error_logger_SUITE.erl +++ b/lib/kernel/test/error_logger_SUITE.erl @@ -18,7 +18,7 @@ %% -module(error_logger_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%----------------------------------------------------------------- %% We don't have to test the normal behaviour here, i.e. the tty @@ -27,7 +27,9 @@ %% error_logger deliver the expected events. %%----------------------------------------------------------------- --export([all/1, error_report/1, info_report/1, error/1, info/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + error_report/1, info_report/1, error/1, info/1, emulator/1, tty/1, logfile/1, add/1, delete/1]). -export([generate_error/0]). @@ -37,9 +39,27 @@ terminate/2]). -all(suite) -> - [error_report, info_report, error, info, - emulator, tty, logfile, add, delete]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [error_report, info_report, error, info, emulator, tty, + logfile, add, delete]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%----------------------------------------------------------------- diff --git a/lib/kernel/test/error_logger_warn_SUITE.erl b/lib/kernel/test/error_logger_warn_SUITE.erl index 6629eca1ad..5b8f0eb049 100644 --- a/lib/kernel/test/error_logger_warn_SUITE.erl +++ b/lib/kernel/test/error_logger_warn_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -18,7 +18,9 @@ %% -module(error_logger_warn_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, basic/1,warnings_info/1,warnings_warnings/1, rb_basic/1,rb_warnings_info/1,rb_warnings_warnings/1, rb_trunc/1,rb_utc/1,file_utc/1]). @@ -26,7 +28,7 @@ %% Internal exports. -export([init/1,handle_event/2,handle_info/2,handle_call/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(EXPECT(Pattern), (fun() -> @@ -43,15 +45,33 @@ -define(default_timeout, ?t:minutes(1)). -all(suite) -> - [basic, warnings_info, warnings_warnings, - rb_basic, rb_warnings_info, rb_warnings_warnings, - rb_trunc,rb_utc, file_utc]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic, warnings_info, warnings_warnings, rb_basic, + rb_warnings_info, rb_warnings_warnings, rb_trunc, + rb_utc, file_utc]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index 47592ddb14..d218589028 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -40,29 +40,29 @@ -module(?FILE_SUITE). --export([all/1, - init/1, fini/1, - init_per_testcase/2, fin_per_testcase/2, - read_write_file/1, dirs/1, files/1, names/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + read_write_file/1, names/1]). -export([cur_dir_0/1, cur_dir_1/1, make_del_dir/1, - pos/1, pos1/1, pos2/1]). --export([close/1, consult/1, consult1/1, path_consult/1, delete/1]). --export([eval/1, eval1/1, path_eval/1, script/1, script1/1, path_script/1, - open/1, open1/1, + pos1/1, pos2/1]). +-export([close/1, consult1/1, path_consult/1, delete/1]). +-export([ eval1/1, path_eval/1, script1/1, path_script/1, + open1/1, old_modes/1, new_modes/1, path_open/1, open_errors/1]). --export([file_info/1, file_info_basic_file/1, file_info_basic_directory/1, +-export([ file_info_basic_file/1, file_info_basic_directory/1, file_info_bad/1, file_info_times/1, file_write_file_info/1]). -export([rename/1, access/1, truncate/1, datasync/1, sync/1, read_write/1, pread_write/1, append/1, exclusive/1]). --export([errors/1, e_delete/1, e_rename/1, e_make_dir/1, e_del_dir/1]). +-export([ e_delete/1, e_rename/1, e_make_dir/1, e_del_dir/1]). -export([otp_5814/1]). --export([compression/1, read_not_really_compressed/1, +-export([ read_not_really_compressed/1, read_compressed_cooked/1, read_compressed_cooked_binary/1, read_cooked_tar_problem/1, write_compressed/1, compress_errors/1, catenated_gzips/1]). --export([links/1, make_link/1, read_link_info_for_non_link/1, symlinks/1]). +-export([ make_link/1, read_link_info_for_non_link/1, symlinks/1]). -export([copy/1]). @@ -93,23 +93,56 @@ --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). -all(suite) -> - {conf, init, - [altname, read_write_file, dirs, files, - delete, rename, names, errors, - compression, links, copy, - delayed_write, read_ahead, segment_read, segment_write, - ipread, pid2name, interleaved_read_write, - otp_5814, large_file, read_line_1, read_line_2, read_line_3, read_line_4, - standard_io], - fini}. - -init(Config) when is_list(Config) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [altname, read_write_file, {group, dirs}, + {group, files}, delete, rename, names, {group, errors}, + {group, compression}, {group, links}, copy, + delayed_write, read_ahead, segment_read, segment_write, + ipread, pid2name, interleaved_read_write, otp_5814, + large_file, read_line_1, read_line_2, read_line_3, + read_line_4, standard_io]. + +groups() -> + [{dirs, [], [make_del_dir, cur_dir_0, cur_dir_1]}, + {files, [], + [{group, open}, {group, pos}, {group, file_info}, + {group, consult}, {group, eval}, {group, script}, + truncate, sync, datasync, advise]}, + {open, [], + [open1, old_modes, new_modes, path_open, close, access, + read_write, pread_write, append, open_errors, + exclusive]}, + {pos, [], [pos1, pos2]}, + {file_info, [], + [file_info_basic_file, file_info_basic_directory, + file_info_bad, file_info_times, file_write_file_info]}, + {consult, [], [consult1, path_consult]}, + {eval, [], [eval1, path_eval]}, + {script, [], [script1, path_script]}, + {errors, [], + [e_delete, e_rename, e_make_dir, e_del_dir]}, + {compression, [], + [read_compressed_cooked, read_compressed_cooked_binary, + read_cooked_tar_problem, read_not_really_compressed, + write_compressed, compress_errors, catenated_gzips]}, + {links, [], + [make_link, read_link_info_for_non_link, symlinks]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) when is_list(Config) -> case os:type() of {win32, _} -> Priv = ?config(priv_dir, Config), @@ -126,7 +159,7 @@ init(Config) when is_list(Config) -> ?FILE_INIT(Config) end. -fini(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> case os:type() of {win32, _} -> os:cmd("subst z: /d"); @@ -139,7 +172,7 @@ init_per_testcase(_Func, Config) -> %%error_logger:info_msg("~p:~p *****~n", [?MODULE, _Func]), ?FILE_INIT_PER_TESTCASE(Config). -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> %% error_logger:info_msg("~p:~p END *****~n", [?MODULE, _Func]), ?FILE_FIN_PER_TESTCASE(Config). @@ -314,7 +347,6 @@ read_write_file(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dirs(suite) -> [make_del_dir, cur_dir_0, cur_dir_1]. make_del_dir(suite) -> []; make_del_dir(doc) -> []; @@ -461,12 +493,7 @@ win_cur_dir_1(_Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -files(suite) -> - [open,pos,file_info,consult,eval,script,truncate, - sync,datasync,advise]. -open(suite) -> [open1,old_modes,new_modes,path_open,close,access,read_write, - pread_write,append,open_errors,exclusive]. open1(suite) -> []; open1(doc) -> []; @@ -858,7 +885,6 @@ exclusive(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -pos(suite) -> [pos1,pos2]. pos1(suite) -> []; pos1(doc) -> []; @@ -950,8 +976,6 @@ pos2(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -file_info(suite) -> [file_info_basic_file, file_info_basic_directory, - file_info_bad, file_info_times, file_write_file_info]. file_info_basic_file(suite) -> []; file_info_basic_file(doc) -> []; @@ -1217,7 +1241,6 @@ file_write_file_info(Config) when is_list(Config) -> get_good_directory(Config) -> ?line ?config(priv_dir, Config). -consult(suite) -> [consult1, path_consult]. consult1(suite) -> []; consult1(doc) -> []; @@ -1278,7 +1301,6 @@ path_consult(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -eval(suite) -> [eval1,path_eval]. eval1(suite) -> []; eval1(doc) -> []; @@ -1351,7 +1373,6 @@ path_eval(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -script(suite) -> [script1,path_script]. script1(suite) -> []; script1(doc) -> ""; @@ -1702,7 +1723,6 @@ names(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -errors(suite) -> [e_delete, e_rename, e_make_dir, e_del_dir]. e_delete(suite) -> []; e_delete(doc) -> []; @@ -1959,12 +1979,6 @@ e_del_dir(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -compression(suite) -> - [read_compressed_cooked, read_compressed_cooked_binary, - read_cooked_tar_problem, - read_not_really_compressed, - write_compressed, compress_errors, - catenated_gzips]. %% Trying reading and positioning from a compressed file. @@ -2258,8 +2272,6 @@ altname(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), Result. -links(doc) -> "Test the link functions."; -links(suite) -> [make_link, read_link_info_for_non_link, symlinks]. make_link(doc) -> "Test creating a hard link."; make_link(suite) -> []; diff --git a/lib/kernel/test/file_name_SUITE.erl b/lib/kernel/test/file_name_SUITE.erl new file mode 100644 index 0000000000..33c8e5bbe4 --- /dev/null +++ b/lib/kernel/test/file_name_SUITE.erl @@ -0,0 +1,1756 @@ +-module(file_name_SUITE). +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1996-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% +%% + +-include_lib("test_server/include/test_server.hrl"). +-include_lib("kernel/include/file.hrl"). + +%% +%% File operations that take filenames as parameters (* not prim_file operation) (** a drive): +%% altname +%% copy (*) +%% del_dir +%% delete +%% get_cwd (**) +%% list_dir +%% make_dir +%% make_link +%% make_symlink +%% open +%% read_file +%% read_file_info +%% read_link +%% read_link_info +%% rename +%% set_cwd +%% write_file +%% write_file_info +%% +%% File operations that opens/uses separate driver port (not connected to file) +%% altname +%% del_dir +%% delete +%% get_cwd +%% list_dir +%% make_dir +%% make_link +%% make_symlink +%% read_file_info +%% read_link +%% read_link_info +%% rename +%% set_cwd +%% write_file_info +%% +%% Operations that use ?FD_DRV in prim_file +%% open +%% read_file +%% write_file +%% +%% +%% Operations that return a filename/path +%% altname +%% get_cwd +%% list_dir +%% read_link + +-export([all/0,groups/0,suite/0, + init_per_suite/1,end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). +-export([normal/1,icky/1,very_icky/1,normalize/1]). + + +init_per_testcase(_Func, Config) -> + Dog = test_server:timetrap(test_server:seconds(60)), + [{watchdog,Dog}|Config]. + +end_per_testcase(_Func, Config) -> + Dog = ?config(watchdog, Config), + test_server:timetrap_cancel(Dog). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [normal, icky, very_icky, normalize]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +normalize(suite) -> + []; +normalize(doc) -> + ["Check that filename normalization works"]; +normalize(Config) when is_list(Config) -> + random:seed({1290,431421,830412}), + try + ?line UniMode = file:native_name_encoding() =/= latin1, + if + not UniMode -> + throw(need_unicode_mode); + true -> + ok + end, + ?line Pairs = [rand_comp_decomp(200) || _ <- lists:seq(1,1000)], + case os:type() of + {unix,darwin} -> + ?line [ true = (A =:= prim_file:internal_native2name(B)) || + {A,B} <- Pairs ]; + _ -> + ok + end, + ?line [ true = (A =:= prim_file:internal_normalize_utf8(B)) || + {A,B} <- Pairs ] + + catch + throw:need_unicode_mode -> + io:format("Sorry, can only run in unicode mode.~n"), + {skipped,"VM needs to be started in Unicode filename mode"} + end. + +normal(suite) -> + []; +normal(doc) -> + "Check file operations on normal file names regardless of unicode mode"; +normal(Config) when is_list(Config) -> + {ok,Dir} = file:get_cwd(), + try + Priv = ?config(priv_dir, Config), + file:set_cwd(Priv), + put(file_module,prim_file), + ok = check_normal(prim_file), + put(file_module,file), + ok = check_normal(file) + after + file:set_cwd(Dir) + end. + + +icky(suite) -> + []; +icky(doc) -> + "Check file operations on normal file names regardless of unicode mode"; +icky(Config) when is_list(Config) -> + case hopeless_darwin() of + true -> + {skipped,"This version of darwin does not support icky names at all."}; + false -> + {ok,Dir} = file:get_cwd(), + try + Priv = ?config(priv_dir, Config), + file:set_cwd(Priv), + put(file_module,prim_file), + ok = check_icky(prim_file), + put(file_module,file), + ok = check_icky(file) + after + file:set_cwd(Dir) + end + end. +very_icky(suite) -> + []; +very_icky(doc) -> + "Check file operations on normal file names regardless of unicode mode"; +very_icky(Config) when is_list(Config) -> + case hopeless_darwin() of + true -> + {skipped,"This version of darwin does not support icky names at all."}; + false -> + {ok,Dir} = file:get_cwd(), + try + Priv = ?config(priv_dir, Config), + file:set_cwd(Priv), + put(file_module,prim_file), + case check_very_icky(prim_file) of + need_unicode_mode -> + {skipped,"VM needs to be started in Unicode filename mode"}; + ok -> + put(file_module,file), + ok = check_very_icky(file) + end + after + file:set_cwd(Dir) + end + end. + + +check_normal(Mod) -> + {ok,Dir} = Mod:get_cwd(), + try + ?line make_normal_dir(Mod), + ?line {ok, L0} = Mod:list_dir("."), + ?line L1 = lists:sort(L0), + %erlang:display(L1), + ?line L1 = lists:sort(list(normal_dir())), + ?line {ok,D2} = Mod:get_cwd(), + ?line true = is_list(D2), + ?line case Mod:altname("fil1") of + {error,enotsup} -> + ok; + {ok,LLL} when is_list(LLL) -> + ok + end, + ?line [ true = is_list(El) || El <- L1], + ?line Syms = [ {S,Targ,list_to_binary(get_data(Targ,normal_dir()))} + || {T,S,Targ} <- normal_dir(), T =:= symlink ], + ?line [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ], + ?line [ {ok, Targ} = fixlink(Mod:read_link(SymL)) || {SymL,Targ,_} <- Syms ], + ?line chk_cre_dir(Mod,[{directory,"temp_dir",normal_dir()}]), + ?line {ok,BeginAt} = Mod:get_cwd(), + ?line true = is_list(BeginAt), + ?line {error,enoent} = Mod:set_cwd("tmp_dir"), + ?line ok = Mod:set_cwd("temp_dir"), + ?line {ok, NowAt} = Mod:get_cwd(), + ?line true = BeginAt =/= NowAt, + ?line ok = Mod:set_cwd(".."), + ?line {ok,BeginAt} = Mod:get_cwd(), + ?line rm_r(Mod,"temp_dir"), + ?line true = is_list(Dir), + ?line [ true = is_list(FN) || FN <- L0 ], + case has_links() of + true -> + ?line ok = Mod:make_link("fil1","nisse"), + ?line {ok, <<"fil1">>} = Mod:read_file("nisse"), + ?line {ok, #file_info{type = regular}} = Mod:read_link_info("nisse"), + ?line ok = Mod:delete("nisse"), + ?line {ok, <<"fil1">>} = Mod:read_file("fil1"), + ?line {error,enoent} = Mod:read_file("nisse"), + ?line {error,enoent} = Mod:read_link_info("nisse"); + false -> + ok + end, + ?line [ begin + ?line {ok, FD} = Mod:open(Name,[read]), + ?line {ok, Content} = Mod:read(FD,1024), + ?line ok = file:close(FD) + end || {regular,Name,Content} <- normal_dir() ], + ?line [ begin + ?line {ok, FD} = Mod:open(Name,[read,binary]), + ?line BC = list_to_binary(Content), + ?line {ok, BC} = Mod:read(FD,1024), + ?line ok = file:close(FD) + end || {regular,Name,Content} <- normal_dir() ], + ?line Mod:rename("fil1","tmp_fil1"), + ?line {ok, <<"fil1">>} = Mod:read_file("tmp_fil1"), + ?line {error,enoent} = Mod:read_file("fil1"), + ?line Mod:rename("tmp_fil1","fil1"), + ?line {ok, <<"fil1">>} = Mod:read_file("fil1"), + ?line {error,enoent} = Mod:read_file("tmp_fil1"), + ?line {ok,FI} = Mod:read_file_info("fil1"), + ?line NewMode = FI#file_info.mode band (bnot 8#333), + ?line NewMode2 = NewMode bor 8#222, + ?line true = NewMode2 =/= NewMode, + ?line ok = Mod:write_file_info("fil1",FI#file_info{mode = NewMode}), + ?line {ok,#file_info{mode = NewMode}} = Mod:read_file_info("fil1"), + ?line ok = Mod:write_file_info("fil1",FI#file_info{mode = NewMode2}), + ?line {ok,#file_info{mode = NewMode2}} = Mod:read_file_info("fil1"), + ok + after + case Mod:read_file_info("fil1") of + {ok,FII} -> + NewModeI = FII#file_info.mode bor 8#777, + Mod:write_file_info("fil1",FII#file_info{mode = NewModeI}); + _ -> + ok + end, + Mod:set_cwd(Dir), + io:format("Wd now: ~s~n",[Dir]) + end. + +check_icky(Mod) -> + {ok,Dir} = Mod:get_cwd(), + try + ?line true=(length("���") =:= 3), + ?line UniMode = file:native_name_encoding() =/= latin1, + ?line make_icky_dir(Mod), + ?line {ok, L0} = Mod:list_dir("."), + ?line L1 = lists:sort(L0), + io:format("~p ~p~n",[L1,list(icky_dir())]), + ?line L1 = lists:sort(convlist(list(icky_dir()))), + ?line {ok,D2} = Mod:get_cwd(), + ?line true = is_list(D2), +%% Altname only on windows, and there are no non native filenames there +%% ?line case Mod:altname("fil1") of +%% {error,enotsup} -> +%% ok; +%% {ok,LLL} when is_list(LLL) -> +%% ok +%% end, + ?line [ true = ((is_list(El) or (UniMode and is_binary(El)))) || El <- L1], + ?line Syms = [ {S,conv(Targ),list_to_binary(get_data(Targ,icky_dir()))} + || {T,S,Targ} <- icky_dir(), T =:= symlink ], + ?line [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ], + ?line [ {ok, Targ} = fixlink(Mod:read_link(SymL)) || {SymL,Targ,_} <- Syms ], + ?line chk_cre_dir(Mod,[{directory,"���_dir",icky_dir()}]), + ?line {ok,BeginAt} = Mod:get_cwd(), + ?line true = is_list(BeginAt), + ?line {error,enoent} = Mod:set_cwd("��_dir"), + ?line ok = Mod:set_cwd("���_dir"), + ?line {ok, NowAt} = Mod:get_cwd(), + ?line true = is_list(NowAt), + ?line true = BeginAt =/= NowAt, + ?line ok = Mod:set_cwd(".."), + ?line {ok,BeginAt} = Mod:get_cwd(), + ?line rm_r2(Mod,"���_dir"), + {OS,TYPE} = os:type(), + % Check that treat_icky really converts to the same as the OS + case UniMode of + true -> + ?line chk_cre_dir(Mod,[{directory,"���_dir",[]}]), + ?line ok = Mod:set_cwd("���_dir"), + ?line ok = Mod:write_file(<<"���">>,<<"hello">>), + ?line Treated = treat_icky(<<"���">>), + ?line {ok,[Treated]} = Mod:list_dir("."), + ?line ok = Mod:delete(<<"���">>), + ?line {ok,[]} = Mod:list_dir("."), + ?line ok = Mod:set_cwd(".."), + ?line rm_r2(Mod,"���_dir"); + false -> + ok + end, + + ?line chk_cre_dir(Mod,[{directory,treat_icky(<<"���_dir">>),icky_dir()}]), + if + UniMode and (OS =/= win32) -> + ?line {error,enoent} = Mod:set_cwd("���_dir"); + true -> + ok + end, + ?line ok = Mod:set_cwd(treat_icky(<<"���_dir">>)), + ?line {ok, NowAt2} = Mod:get_cwd(), + io:format("~p~n",[NowAt2]), + % Cannot create raw unicode-breaking filenames on windows or macos + ?line true = ((((not UniMode) or (OS =:= win32) or (TYPE=:=darwin)) and is_list(NowAt2)) orelse ((UniMode) and is_binary(NowAt2))), + ?line true = BeginAt =/= NowAt2, + ?line ok = Mod:set_cwd(".."), + ?line {ok,BeginAt} = Mod:get_cwd(), + ?line rm_r2(Mod,conv(treat_icky(<<"���_dir">>))), + case has_links() of + true -> + ?line ok = Mod:make_link("fil1","nisse�"), + ?line {ok, <<"fil1">>} = Mod:read_file("nisse�"), + ?line {ok, #file_info{type = regular}} = Mod:read_link_info("nisse�"), + ?line ok = Mod:delete("nisse�"), + ?line ok = Mod:make_link("fil1",treat_icky(<<"nisse�">>)), + ?line {ok, <<"fil1">>} = Mod:read_file(treat_icky(<<"nisse�">>)), + ?line {ok, #file_info{type = regular}} = Mod:read_link_info(treat_icky(<<"nisse�">>)), + ?line ok = Mod:delete(treat_icky(<<"nisse�">>)), + ?line {ok, <<"fil1">>} = Mod:read_file("fil1"), + ?line {error,enoent} = Mod:read_file("nisse�"), + ?line {error,enoent} = Mod:read_link_info("nisse�"), + ?line {error,enoent} = Mod:read_file(treat_icky(<<"nisse�">>)), + ?line {error,enoent} = Mod:read_link_info(treat_icky(<<"nisse�">>)); + false -> + ok + end, + ?line [ begin + ?line {ok, FD} = Mod:open(Name,[read]), + ?line {ok, Content} = Mod:read(FD,1024), + ?line ok = file:close(FD) + end || {regular,Name,Content} <- icky_dir() ], + ?line [ begin + ?line {ok, FD} = Mod:open(Name,[read,binary]), + ?line BC = list_to_binary([Content]), + ?line {ok, BC} = Mod:read(FD,1024), + ?line ok = file:close(FD) + end || {regular,Name,Content} <- icky_dir() ], + ?line Mod:rename("���2","���_fil1"), + ?line {ok, <<"���2">>} = Mod:read_file("���_fil1"), + ?line {error,enoent} = Mod:read_file("���2"), + ?line Mod:rename("���_fil1","���2"), + ?line {ok, <<"���2">>} = Mod:read_file("���2"), + ?line {error,enoent} = Mod:read_file("���_fil1"), + + ?line Mod:rename("���2",treat_icky(<<"���_fil1">>)), + ?line {ok, <<"���2">>} = Mod:read_file(treat_icky(<<"���_fil1">>)), + if + UniMode and (OS =/= win32) -> + {error,enoent} = Mod:read_file("���_fil1"); + true -> + ok + end, + ?line {error,enoent} = Mod:read_file("���2"), + ?line Mod:rename(treat_icky(<<"���_fil1">>),"���2"), + ?line {ok, <<"���2">>} = Mod:read_file("���2"), + ?line {error,enoent} = Mod:read_file("���_fil1"), + ?line {error,enoent} = Mod:read_file(treat_icky(<<"���_fil1">>)), + + ?line {ok,FI} = Mod:read_file_info("���2"), + ?line NewMode = FI#file_info.mode band (bnot 8#333), + ?line NewMode2 = NewMode bor 8#222, + ?line true = NewMode2 =/= NewMode, + ?line ok = Mod:write_file_info("���2",FI#file_info{mode = NewMode}), + ?line {ok,#file_info{mode = NewMode}} = Mod:read_file_info("���2"), + ?line ok = Mod:write_file_info("���2",FI#file_info{mode = NewMode2}), + ?line {ok,#file_info{mode = NewMode2}} = Mod:read_file_info("���2"), + + ?line {ok,FII} = Mod:read_file_info(treat_icky(<<"���5">>)), + ?line true = NewMode2 =/= NewMode, + ?line ok = Mod:write_file_info(treat_icky(<<"���5">>),FII#file_info{mode = NewMode}), + ?line {ok,#file_info{mode = NewMode}} = Mod:read_file_info(treat_icky(<<"���5">>)), + ?line ok = Mod:write_file_info(<<"���5">>,FII#file_info{mode = NewMode2}), + ?line {ok,#file_info{mode = NewMode2}} = Mod:read_file_info(treat_icky(<<"���5">>)), + ok + after + Mod:set_cwd(Dir), + io:format("Wd now: ~s~n",[Dir]) + end. + +check_very_icky(Mod) -> + {ok,Dir} = Mod:get_cwd(), + try + ?line true=(length("���") =:= 3), + ?line UniMode = file:native_name_encoding() =/= latin1, + if + not UniMode -> + throw(need_unicode_mode); + true -> + ok + end, + ?line make_very_icky_dir(Mod), + ?line {ok, L0} = Mod:list_dir("."), + ?line L1 = lists:sort(L0), + ?line L1 = lists:sort(convlist(list(very_icky_dir()))), + ?line {ok,D2} = Mod:get_cwd(), + ?line true = is_list(D2), + ?line [ true = ((is_list(El) or is_binary(El))) || El <- L1], + ?line Syms = [ {S,conv(Targ),list_to_binary(get_data(Targ,very_icky_dir()))} + || {T,S,Targ} <- very_icky_dir(), T =:= symlink ], + ?line [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ], + ?line [ {ok, Targ} = fixlink(Mod:read_link(SymL)) || {SymL,Targ,_} <- Syms ], + ?line chk_cre_dir(Mod,[{directory,[1088,1079,1091]++"_dir",very_icky_dir()}]), + ?line {ok,BeginAt} = Mod:get_cwd(), + ?line true = is_list(BeginAt), + ?line {error,enoent} = Mod:set_cwd("��_dir"), + ?line ok = Mod:set_cwd([1088,1079,1091]++"_dir"), + ?line {ok, NowAt} = Mod:get_cwd(), + ?line true = is_list(NowAt), + ?line true = BeginAt =/= NowAt, + ?line ok = Mod:set_cwd(".."), + ?line {ok,BeginAt} = Mod:get_cwd(), + ?line rm_r2(Mod,[1088,1079,1091]++"_dir"), + + case has_links() of + true -> + ?line ok = Mod:make_link("fil1","nisse"++[1088,1079,1091]), + ?line {ok, <<"fil1">>} = + Mod:read_file("nisse"++[1088,1079,1091]), + ?line {ok, #file_info{type = regular}} = + Mod:read_link_info("nisse"++[1088,1079,1091]), + ?line ok = Mod:delete("nisse"++[1088,1079,1091]), + ?line ok = Mod:make_link("fil1",<<"nisse�">>), + ?line {ok, <<"fil1">>} = Mod:read_file(<<"nisse�">>), + ?line {ok, #file_info{type = regular}} = + Mod:read_link_info(<<"nisse�">>), + ?line ok = Mod:delete(<<"nisse�">>), + ?line {ok, <<"fil1">>} = Mod:read_file("fil1"), + ?line {error,enoent} = Mod:read_file("nisse"++[1088,1079,1091]), + ?line {error,enoent} = Mod:read_link_info("nisse"++[1088,1079,1091]), + ?line {error,enoent} = Mod:read_file(<<"nisse�">>), + ?line {error,enoent} = Mod:read_link_info(<<"nisse�">>); + false -> + ok + end, + ?line [ begin + ?line {ok, FD} = Mod:open(Name,[read]), + ?line {ok, Content} = Mod:read(FD,1024), + ?line ok = file:close(FD) + end || {regular,Name,Content} <- very_icky_dir() ], + ?line [ begin + ?line {ok, FD} = Mod:open(Name,[read,binary]), + ?line BC = list_to_binary([Content]), + ?line {ok, BC} = Mod:read(FD,1024), + ?line ok = file:close(FD) + end || {regular,Name,Content} <- very_icky_dir() ], + ?line Mod:rename([956,965,963,954,959,49], + [956,965,963,954,959]++"_fil1"), + ?line {ok, <<"���2">>} = Mod:read_file([956,965,963,954,959]++"_fil1"), + ?line {error,enoent} = Mod:read_file([956,965,963,954,959,49]), + ?line Mod:rename([956,965,963,954,959]++"_fil1",[956,965,963,954,959,49]), + ?line {ok, <<"���2">>} = Mod:read_file([956,965,963,954,959,49]), + ?line {error,enoent} = Mod:read_file([956,965,963,954,959]++"_fil1"), + + ?line {ok,FI} = Mod:read_file_info([956,965,963,954,959,49]), + ?line NewMode = FI#file_info.mode band (bnot 8#333), + ?line NewMode2 = NewMode bor 8#222, + ?line true = NewMode2 =/= NewMode, + ?line ok = Mod:write_file_info([956,965,963,954,959,49], + FI#file_info{mode = NewMode}), + ?line {ok,#file_info{mode = NewMode}} = + Mod:read_file_info([956,965,963,954,959,49]), + ?line ok = Mod:write_file_info([956,965,963,954,959,49], + FI#file_info{mode = NewMode2}), + ?line {ok,#file_info{mode = NewMode2}} = + Mod:read_file_info([956,965,963,954,959,49]), + ?line NumOK0 = case has_links() of + true -> 5; + false -> 3 + end, + ?line NumNOK0 = case has_links() of + true -> 4; + false -> 3 + end, + ?line {NumOK,NumNOK} = case is_binary(treat_icky(<<"foo">>)) of + false -> + {NumOK0+NumNOK0,0}; + true -> + {NumOK0,NumNOK0} + end, + ?line {NumOK,NumNOK} = filelib:fold_files(".",".*",true,fun(_F,{N,M}) when is_list(_F) -> io:format("~ts~n",[_F]),{N+1,M}; (_F,{N,M}) -> io:format("~p~n",[_F]),{N,M+1} end,{0,0}), + ?line ok = filelib:fold_files(".",[1076,1089,1072,124,46,42],true,fun(_F,_) -> ok end,false), + ?line SF3 = unicode:characters_to_binary("���subfil3", + file:native_name_encoding()), + ?line SF2 = case treat_icky(<<"���subfil2">>) of + LF2 when is_list(LF2) -> + unicode:characters_to_binary(LF2, + file:native_name_encoding()); + BF2 -> + BF2 + end, + ?line Sorted = lists:sort([SF3,SF2]), + ?line Sorted = lists:sort(filelib:wildcard("*",<<"���subdir2">>)), + ok + catch + throw:need_unicode_mode -> + io:format("Sorry, can only run in unicode mode.~n"), + need_unicode_mode + after + Mod:set_cwd(Dir), + io:format("Wd now: ~s~n",[Dir]) + end. + +%% +%% Utilities +%% + + +rm_rf(Mod,Dir) -> + case Mod:read_link_info(Dir) of + {ok, #file_info{type = directory}} -> + {ok, Content} = Mod:list_dir(Dir), + [ rm_rf(Mod,filename:join(Dir,C)) || C <- Content ], + Mod:del_dir(Dir), + ok; + {ok, #file_info{}} -> + Mod:delete(Dir); + _ -> + ok + end. + +rm_r(Mod,Dir) -> + %erlang:display({rm_r,Dir}), + case Mod:read_link_info(Dir) of + {ok, #file_info{type = directory}} -> + {ok,#file_info{type = directory}} = Mod:read_file_info(Dir), + {ok, Content} = Mod:list_dir(Dir), + [ true = is_list(Part) || Part <- Content ], + [ true = is_list(filename:join(Dir,Part)) || Part <- Content ], + [ rm_r(Mod,filename:join(Dir,C)) || C <- Content ], + ok = Mod:del_dir(Dir), + ok; + {ok, #file_info{type = regular}} -> + {ok,#file_info{type = regular}} = Mod:read_file_info(Dir), + ok = Mod:delete(Dir); + {ok, #file_info{type = symlink}} -> + ok = Mod:delete(Dir) + end. +%% For icky test, allow binaries sometimes +rm_r2(Mod,Dir) -> + %erlang:display({rm_r2,Dir}), + case Mod:read_link_info(Dir) of + {ok, #file_info{type = directory}} -> + {ok,#file_info{type = directory}} = Mod:read_file_info(Dir), + {ok, Content} = Mod:list_dir(Dir), + UniMode = file:native_name_encoding() =/= latin1, + [ true = (is_list(Part) orelse UniMode) || Part <- Content ], + [ true = (is_list(filename:join(Dir,Part)) orelse UniMode) || Part <- Content ], + [ rm_r2(Mod,filename:join(Dir,C)) || C <- Content ], + ok = Mod:del_dir(Dir), + ok; + {ok, #file_info{type = regular}} -> + {ok,#file_info{type = regular}} = Mod:read_file_info(Dir), + ok = Mod:delete(Dir); + {ok, #file_info{type = symlink}} -> + ok = Mod:delete(Dir) + end. +chk_cre_dir(_,[]) -> + ok; +chk_cre_dir(Mod,[{regular,Name,Content}|T]) -> + %io:format("~p~n",[Name]), + ok = Mod:write_file(Name,Content), + chk_cre_dir(Mod,T); +chk_cre_dir(Mod,[{link,Name,Target}|T]) -> + ok = Mod:make_link(Target,Name), + chk_cre_dir(Mod,T); +chk_cre_dir(Mod,[{symlink,Name,Target}|T]) -> + ok = Mod:make_symlink(Target,Name), + chk_cre_dir(Mod,T); +chk_cre_dir(Mod,[{directory,Name,Content}|T]) -> + ok = Mod:make_dir(Name), + %io:format("Content = ~p~n",[Content]), + Content2 = [{Ty,filename:join(Name,N),case Ty of link -> filename:join(Name,C); _ -> C end} || {Ty,N,C} <- Content ], + %io:format("Content2 = ~p~n",[Content2]), + chk_cre_dir(Mod,Content2), + chk_cre_dir(Mod,T). + +has_links() -> + case os:type() of + {win32,_} -> + case os:version() of + {N,NN,_} when (N > 5) andalso (NN >= 1) -> + true; + _ -> + false + end; + _ -> + true + end. + +make_normal_dir(Mod) -> + rm_rf(Mod,"normal_dir"), + Mod:make_dir("normal_dir"), + Mod:set_cwd("normal_dir"), + Mod:write_file("fil1","fil1"), + Mod:write_file("fil2","fil2"), + case has_links() of + true -> + Mod:make_link("fil2","fil3"), + Mod:make_symlink("fil2","fil4"); + _ -> + ok + end, + Mod:make_dir("subdir"), + Mod:write_file(filename:join("subdir","subfil1"),"subfil1"), + ok. + +normal_dir() -> + [{regular,"fil1","fil1"}, + {regular,"fil2","fil2"}] ++ + case has_links() of + true -> + [{regular,"fil3","fil2"}, + {symlink,"fil4","fil2"}]; + false -> + [] + end ++ + [{directory,"subdir", + [{regular,"subfil1","subfil1"}]}]. + +make_icky_dir(Mod) -> + rm_rf(Mod,"icky_dir"), + Icky=icky_dir(), + chk_cre_dir(Mod,[{directory,"icky_dir",linkify([],Icky)}]), + Mod:set_cwd("icky_dir"), + ok. + +linkify(_Passed,[]) -> + []; +linkify(Passed,[{regular,Name,Content}|T]) -> + Regulars = [ {N,C} || {regular,N,C} <- Passed, N =/= Name ], + case lists:keysearch(Content,2,Regulars) of + {value, {Linkto, Content}} -> + [{link,Name,Linkto} | linkify(Passed,T)]; + _ -> + [{regular,Name,Content} | linkify([{regular,Name,Content}|Passed],T)] + end; +linkify(Passed,[{directory, Name, Content}|T]) -> + [{directory,Name, linkify(Content,Content)}|linkify(Passed,T)]; +linkify(Passed,[H|T]) -> + [H|linkify([H|Passed],T)]. + +hopeless_darwin() -> + case {os:type(),os:version()} of + {{unix,darwin},{Major,_,_}} when Major < 9 -> + true; + _ -> + false + end. + +icky_dir() -> + [{regular,"fil1","fil1"}, + {regular,"���2","���2"}] ++ + case has_links() of + true -> + [{regular,"���3","���2"}, + {symlink,"���4","���2"}]; + false -> + [] + end ++ + [{regular,treat_icky(<<"���5">>),"���5"}] ++ + case has_links() of + true -> + [{symlink,treat_icky(<<"���6">>),treat_icky(<<"���5">>)}]; + false -> + [] + end ++ + [{directory,treat_icky(<<"���subdir2">>), + [{regular,treat_icky(<<"���subfil2">>),"���subfil12"}, + {regular,"���subfil3","���subfil13"}]}, + {directory,"���subdir", + [{regular,"���subfil1","���subfil1"}]}]. + +make_very_icky_dir(Mod) -> + rm_rf(Mod,"very_icky_dir"), + Icky=very_icky_dir(), + chk_cre_dir(Mod,[{directory,"very_icky_dir",linkify([],Icky)}]), + Mod:set_cwd("very_icky_dir"), + ok. + +very_icky_dir() -> + [{regular,"fil1","fil1"}, + {regular,[956,965,963,954,959,49],"���2"}] ++ + case has_links() of + true -> + [{regular,[956,965,963,954,959,50],"���2"}, + {symlink,[956,965,963,954,959,51],[956,965,963,954,959,49]}]; + false -> + [] + end ++ + [{regular,treat_icky(<<"���5">>),"���5"}] ++ + case has_links() of + true -> + [{symlink,treat_icky(<<"���6">>),treat_icky(<<"���5">>)}]; + false -> + [] + end ++ + [{directory,treat_icky(<<"���subdir2">>), + [{regular,treat_icky(<<"���subfil2">>),"���subfil12"}, + {regular,"���subfil3","���subfil13"}]}, + {directory,[956,965,963,954,959]++"subdir1", + [{regular,[956,965,963,954,959]++"subfil1","���subfil1"}]}]. + +%% Some OS'es simply do not allow non UTF8 filenames +treat_icky(Bin) -> + case os:type() of + {unix,darwin} -> + binary_to_list(procentify(Bin)); + {win32,_} -> + binary_to_list(Bin); + _ -> + Bin + end. + +% Handle windows having absolute soft link targets. +fixlink({ok,Link}) -> + case os:type() of + {win32,_} -> + {ok,filename:basename(Link)}; + _ -> + {ok,Link} + end; +fixlink(X) -> + X. + +procentify(<<>>) -> + <<>>; +procentify(<<X:8,Rst/binary>>) when X > 127 -> + T=procentify(Rst), + Y = list_to_binary([$% + | io_lib:format("~2.16B",[X])]), + <<Y/binary,T/binary>>; +procentify(<<X:8,Rst/binary>>) -> + T=procentify(Rst), + <<X:8,T/binary>>. + + +list([]) -> + []; +list([{_,Name,_} | T]) -> + [Name | list(T)]. + + +get_data(FN,List) -> + case lists:keysearch(FN,2,List) of + {value,{regular,FN,C}} -> + C; + {value,{symlink,FN,NewFN}} -> + get_data(NewFN,List); + _-> + [] + end. + + +convlist(L) -> + convlist(file:native_name_encoding(),L). +convlist(latin1,[Bin|T]) when is_binary(Bin) -> + %erlang:display('Convert...'), + [binary_to_list(Bin)| convlist(latin1,T)]; +convlist(Any,[H|T]) -> + [H|convlist(Any,T)]; +convlist(_,[]) -> + []. + +conv(L) -> + NoUniMode = file:native_name_encoding() =:= latin1, + if + NoUniMode, is_binary(L) -> + binary_to_list(L); + true -> + L + end. + + +rand_comp_decomp(Max) -> + N = random:uniform(Max), + L = [ rand_decomp() || _ <- lists:seq(1,N) ], + LC = [ A || {A,_} <- L], + LD = lists:flatten([B || {_,B} <- L]), + LB = unicode:characters_to_binary(LD,unicode,utf8), + {LC,LB}. + +rand_decomp() -> + BT = bigtup(), + SZ = tuple_size(BT), + element(random:uniform(SZ),BT). +bigtup() -> + {{192,[65,768]}, + {200,[69,768]}, + {204,[73,768]}, + {210,[79,768]}, + {217,[85,768]}, + {7808,[87,768]}, + {7922,[89,768]}, + {224,[97,768]}, + {232,[101,768]}, + {236,[105,768]}, + {242,[111,768]}, + {249,[117,768]}, + {7809,[119,768]}, + {7923,[121,768]}, + {8173,[168,768]}, + {7846,[65,770,768]}, + {7872,[69,770,768]}, + {7890,[79,770,768]}, + {7847,[97,770,768]}, + {7873,[101,770,768]}, + {7891,[111,770,768]}, + {7700,[69,772,768]}, + {7760,[79,772,768]}, + {7701,[101,772,768]}, + {7761,[111,772,768]}, + {7856,[65,774,768]}, + {7857,[97,774,768]}, + {475,[85,776,768]}, + {476,[117,776,768]}, + {8146,[953,776,768]}, + {8162,[965,776,768]}, + {8074,[913,837,787,768]}, + {8090,[919,837,787,768]}, + {8106,[937,837,787,768]}, + {8066,[945,837,787,768]}, + {8082,[951,837,787,768]}, + {8098,[969,837,787,768]}, + {7946,[913,787,768]}, + {7962,[917,787,768]}, + {7978,[919,787,768]}, + {7994,[921,787,768]}, + {8010,[927,787,768]}, + {8042,[937,787,768]}, + {7938,[945,787,768]}, + {7954,[949,787,768]}, + {7970,[951,787,768]}, + {7986,[953,787,768]}, + {8002,[959,787,768]}, + {8018,[965,787,768]}, + {8034,[969,787,768]}, + {8075,[913,837,788,768]}, + {8091,[919,837,788,768]}, + {8107,[937,837,788,768]}, + {8067,[945,837,788,768]}, + {8083,[951,837,788,768]}, + {8099,[969,837,788,768]}, + {7947,[913,788,768]}, + {7963,[917,788,768]}, + {7979,[919,788,768]}, + {7995,[921,788,768]}, + {8011,[927,788,768]}, + {8027,[933,788,768]}, + {8043,[937,788,768]}, + {7939,[945,788,768]}, + {7955,[949,788,768]}, + {7971,[951,788,768]}, + {7987,[953,788,768]}, + {8003,[959,788,768]}, + {8019,[965,788,768]}, + {8035,[969,788,768]}, + {7900,[79,795,768]}, + {7914,[85,795,768]}, + {7901,[111,795,768]}, + {7915,[117,795,768]}, + {8114,[945,837,768]}, + {8130,[951,837,768]}, + {8178,[969,837,768]}, + {8122,[913,768]}, + {8136,[917,768]}, + {8138,[919,768]}, + {8154,[921,768]}, + {8184,[927,768]}, + {8170,[933,768]}, + {8186,[937,768]}, + {8048,[945,768]}, + {8050,[949,768]}, + {8052,[951,768]}, + {8054,[953,768]}, + {8056,[959,768]}, + {8058,[965,768]}, + {8060,[969,768]}, + {8141,[8127,768]}, + {8157,[8190,768]}, + {193,[65,769]}, + {262,[67,769]}, + {201,[69,769]}, + {500,[71,769]}, + {205,[73,769]}, + {7728,[75,769]}, + {313,[76,769]}, + {7742,[77,769]}, + {323,[78,769]}, + {211,[79,769]}, + {7764,[80,769]}, + {340,[82,769]}, + {346,[83,769]}, + {218,[85,769]}, + {7810,[87,769]}, + {221,[89,769]}, + {377,[90,769]}, + {225,[97,769]}, + {263,[99,769]}, + {233,[101,769]}, + {501,[103,769]}, + {237,[105,769]}, + {7729,[107,769]}, + {314,[108,769]}, + {7743,[109,769]}, + {324,[110,769]}, + {243,[111,769]}, + {7765,[112,769]}, + {341,[114,769]}, + {347,[115,769]}, + {250,[117,769]}, + {7811,[119,769]}, + {253,[121,769]}, + {378,[122,769]}, + {8174,[168,769]}, + {508,[198,769]}, + {510,[216,769]}, + {509,[230,769]}, + {511,[248,769]}, + {7844,[65,770,769]}, + {7870,[69,770,769]}, + {7888,[79,770,769]}, + {7845,[97,770,769]}, + {7871,[101,770,769]}, + {7889,[111,770,769]}, + {7756,[79,771,769]}, + {7800,[85,771,769]}, + {7757,[111,771,769]}, + {7801,[117,771,769]}, + {7702,[69,772,769]}, + {7762,[79,772,769]}, + {7703,[101,772,769]}, + {7763,[111,772,769]}, + {7854,[65,774,769]}, + {7855,[97,774,769]}, + {7726,[73,776,769]}, + {471,[85,776,769]}, + {7727,[105,776,769]}, + {472,[117,776,769]}, + {8147,[953,776,769]}, + {8163,[965,776,769]}, + {506,[65,778,769]}, + {507,[97,778,769]}, + {8076,[913,837,787,769]}, + {8092,[919,837,787,769]}, + {8108,[937,837,787,769]}, + {8068,[945,837,787,769]}, + {8084,[951,837,787,769]}, + {8100,[969,837,787,769]}, + {7948,[913,787,769]}, + {7964,[917,787,769]}, + {7980,[919,787,769]}, + {7996,[921,787,769]}, + {8012,[927,787,769]}, + {8044,[937,787,769]}, + {7940,[945,787,769]}, + {7956,[949,787,769]}, + {7972,[951,787,769]}, + {7988,[953,787,769]}, + {8004,[959,787,769]}, + {8020,[965,787,769]}, + {8036,[969,787,769]}, + {8077,[913,837,788,769]}, + {8093,[919,837,788,769]}, + {8109,[937,837,788,769]}, + {8069,[945,837,788,769]}, + {8085,[951,837,788,769]}, + {8101,[969,837,788,769]}, + {7949,[913,788,769]}, + {7965,[917,788,769]}, + {7981,[919,788,769]}, + {7997,[921,788,769]}, + {8013,[927,788,769]}, + {8029,[933,788,769]}, + {8045,[937,788,769]}, + {7941,[945,788,769]}, + {7957,[949,788,769]}, + {7973,[951,788,769]}, + {7989,[953,788,769]}, + {8005,[959,788,769]}, + {8021,[965,788,769]}, + {8037,[969,788,769]}, + {7898,[79,795,769]}, + {7912,[85,795,769]}, + {7899,[111,795,769]}, + {7913,[117,795,769]}, + {7688,[67,807,769]}, + {7689,[99,807,769]}, + {8116,[945,837,769]}, + {8132,[951,837,769]}, + {8180,[959,837,769]}, + {8123,[913,769]}, + {8137,[917,769]}, + {8139,[919,769]}, + {8155,[921,769]}, + {8185,[927,769]}, + {8171,[933,769]}, + {8187,[937,769]}, + {8049,[945,769]}, + {8051,[949,769]}, + {8053,[951,769]}, + {8055,[953,769]}, + {8057,[959,769]}, + {8059,[965,769]}, + {8061,[969,769]}, + {1027,[1043,769]}, + {1036,[1050,769]}, + {1107,[1075,769]}, + {1116,[1082,769]}, + {8142,[8127,769]}, + {8158,[8190,769]}, + {194,[65,770]}, + {264,[67,770]}, + {202,[69,770]}, + {284,[71,770]}, + {292,[72,770]}, + {206,[73,770]}, + {308,[74,770]}, + {212,[79,770]}, + {348,[83,770]}, + {219,[85,770]}, + {372,[87,770]}, + {374,[89,770]}, + {7824,[90,770]}, + {226,[97,770]}, + {265,[99,770]}, + {234,[101,770]}, + {285,[103,770]}, + {293,[104,770]}, + {238,[105,770]}, + {309,[106,770]}, + {244,[111,770]}, + {349,[115,770]}, + {251,[117,770]}, + {373,[119,770]}, + {375,[121,770]}, + {7825,[122,770]}, + {7852,[65,803,770]}, + {7878,[69,803,770]}, + {7896,[79,803,770]}, + {7853,[97,803,770]}, + {7879,[101,803,770]}, + {7897,[111,803,770]}, + {195,[65,771]}, + {7868,[69,771]}, + {296,[73,771]}, + {209,[78,771]}, + {213,[79,771]}, + {360,[85,771]}, + {7804,[86,771]}, + {7928,[89,771]}, + {227,[97,771]}, + {7869,[101,771]}, + {297,[105,771]}, + {241,[110,771]}, + {245,[111,771]}, + {361,[117,771]}, + {7805,[118,771]}, + {7929,[121,771]}, + {7850,[65,770,771]}, + {7876,[69,770,771]}, + {7894,[79,770,771]}, + {7851,[97,770,771]}, + {7877,[101,770,771]}, + {7895,[111,770,771]}, + {7860,[65,774,771]}, + {7861,[97,774,771]}, + {7904,[79,795,771]}, + {7918,[85,795,771]}, + {7905,[111,795,771]}, + {7919,[117,795,771]}, + {256,[65,772]}, + {274,[69,772]}, + {7712,[71,772]}, + {298,[73,772]}, + {332,[79,772]}, + {362,[85,772]}, + {257,[97,772]}, + {275,[101,772]}, + {7713,[103,772]}, + {299,[105,772]}, + {333,[111,772]}, + {363,[117,772]}, + {482,[198,772]}, + {483,[230,772]}, + {480,[65,775,772]}, + {481,[97,775,772]}, + {478,[65,776,772]}, + {469,[85,776,772]}, + {479,[97,776,772]}, + {470,[117,776,772]}, + {7736,[76,803,772]}, + {7772,[82,803,772]}, + {7737,[108,803,772]}, + {7773,[114,803,772]}, + {492,[79,808,772]}, + {493,[111,808,772]}, + {8121,[913,772]}, + {8153,[921,772]}, + {8169,[933,772]}, + {8113,[945,772]}, + {8145,[953,772]}, + {8161,[965,772]}, + {1250,[1048,772]}, + {1262,[1059,772]}, + {1251,[1080,772]}, + {1263,[1091,772]}, + {258,[65,774]}, + {276,[69,774]}, + {286,[71,774]}, + {300,[73,774]}, + {334,[79,774]}, + {364,[85,774]}, + {259,[97,774]}, + {277,[101,774]}, + {287,[103,774]}, + {301,[105,774]}, + {335,[111,774]}, + {365,[117,774]}, + {7862,[65,803,774]}, + {7863,[97,803,774]}, + {7708,[69,807,774]}, + {7709,[101,807,774]}, + {8120,[913,774]}, + {8152,[921,774]}, + {8168,[933,774]}, + {8112,[945,774]}, + {8144,[953,774]}, + {8160,[965,774]}, + {1232,[1040,774]}, + {1238,[1045,774]}, + {1217,[1046,774]}, + {1049,[1048,774]}, + {1038,[1059,774]}, + {1233,[1072,774]}, + {1239,[1077,774]}, + {1218,[1078,774]}, + {1081,[1080,774]}, + {1118,[1091,774]}, + {7682,[66,775]}, + {266,[67,775]}, + {7690,[68,775]}, + {278,[69,775]}, + {7710,[70,775]}, + {288,[71,775]}, + {7714,[72,775]}, + {304,[73,775]}, + {7744,[77,775]}, + {7748,[78,775]}, + {7766,[80,775]}, + {7768,[82,775]}, + {7776,[83,775]}, + {7786,[84,775]}, + {7814,[87,775]}, + {7818,[88,775]}, + {7822,[89,775]}, + {379,[90,775]}, + {7683,[98,775]}, + {267,[99,775]}, + {7691,[100,775]}, + {279,[101,775]}, + {7711,[102,775]}, + {289,[103,775]}, + {7715,[104,775]}, + {7745,[109,775]}, + {7749,[110,775]}, + {7767,[112,775]}, + {7769,[114,775]}, + {7777,[115,775]}, + {7787,[116,775]}, + {7815,[119,775]}, + {7819,[120,775]}, + {7823,[121,775]}, + {380,[122,775]}, + {7835,[383,775]}, + {7780,[83,769,775]}, + {7781,[115,769,775]}, + {784,[774,775]}, + {7782,[83,780,775]}, + {7783,[115,780,775]}, + {7784,[83,803,775]}, + {7785,[115,803,775]}, + {196,[65,776]}, + {203,[69,776]}, + {7718,[72,776]}, + {207,[73,776]}, + {214,[79,776]}, + {220,[85,776]}, + {7812,[87,776]}, + {7820,[88,776]}, + {376,[89,776]}, + {228,[97,776]}, + {235,[101,776]}, + {7719,[104,776]}, + {239,[105,776]}, + {246,[111,776]}, + {7831,[116,776]}, + {252,[117,776]}, + {7813,[119,776]}, + {7821,[120,776]}, + {255,[121,776]}, + {1242,[399,776]}, + {1258,[415,776]}, + {1243,[601,776]}, + {1259,[629,776]}, + {7758,[79,771,776]}, + {7759,[111,771,776]}, + {7802,[85,772,776]}, + {7803,[117,772,776]}, + {938,[921,776]}, + {939,[933,776]}, + {970,[953,776]}, + {971,[965,776]}, + {980,[978,776]}, + {1031,[1030,776]}, + {1234,[1040,776]}, + {1025,[1045,776]}, + {1244,[1046,776]}, + {1246,[1047,776]}, + {1252,[1048,776]}, + {1254,[1054,776]}, + {1264,[1059,776]}, + {1268,[1063,776]}, + {1272,[1067,776]}, + {1235,[1072,776]}, + {1105,[1077,776]}, + {1245,[1078,776]}, + {1247,[1079,776]}, + {1253,[1080,776]}, + {1255,[1086,776]}, + {1265,[1091,776]}, + {1269,[1095,776]}, + {1273,[1099,776]}, + {1111,[1110,776]}, + {7842,[65,777]}, + {7866,[69,777]}, + {7880,[73,777]}, + {7886,[79,777]}, + {7910,[85,777]}, + {7926,[89,777]}, + {7843,[97,777]}, + {7867,[101,777]}, + {7881,[105,777]}, + {7887,[111,777]}, + {7911,[117,777]}, + {7927,[121,777]}, + {7848,[65,770,777]}, + {7874,[69,770,777]}, + {7892,[79,770,777]}, + {7849,[97,770,777]}, + {7875,[101,770,777]}, + {7893,[111,770,777]}, + {7858,[65,774,777]}, + {7859,[97,774,777]}, + {7902,[79,795,777]}, + {7916,[85,795,777]}, + {7903,[111,795,777]}, + {7917,[117,795,777]}, + {197,[65,778]}, + {366,[85,778]}, + {229,[97,778]}, + {367,[117,778]}, + {7832,[119,778]}, + {7833,[121,778]}, + {336,[79,779]}, + {368,[85,779]}, + {337,[111,779]}, + {369,[117,779]}, + {1266,[1059,779]}, + {1267,[1091,779]}, + {461,[65,780]}, + {268,[67,780]}, + {270,[68,780]}, + {282,[69,780]}, + {486,[71,780]}, + {463,[73,780]}, + {488,[75,780]}, + {317,[76,780]}, + {327,[78,780]}, + {465,[79,780]}, + {344,[82,780]}, + {352,[83,780]}, + {356,[84,780]}, + {467,[85,780]}, + {381,[90,780]}, + {462,[97,780]}, + {269,[99,780]}, + {271,[100,780]}, + {283,[101,780]}, + {487,[103,780]}, + {464,[105,780]}, + {496,[106,780]}, + {489,[107,780]}, + {318,[108,780]}, + {328,[110,780]}, + {466,[111,780]}, + {345,[114,780]}, + {353,[115,780]}, + {357,[116,780]}, + {468,[117,780]}, + {382,[122,780]}, + {494,[439,780]}, + {495,[658,780]}, + {473,[85,776,780]}, + {474,[117,776,780]}, + {901,[168,781]}, + {912,[953,776,781]}, + {944,[965,776,781]}, + {902,[913,781]}, + {904,[917,781]}, + {905,[919,781]}, + {906,[921,781]}, + {908,[927,781]}, + {910,[933,781]}, + {911,[937,781]}, + {940,[945,781]}, + {941,[949,781]}, + {942,[951,781]}, + {943,[953,781]}, + {972,[959,781]}, + {973,[965,781]}, + {974,[969,781]}, + {979,[978,781]}, + {512,[65,783]}, + {516,[69,783]}, + {520,[73,783]}, + {524,[79,783]}, + {528,[82,783]}, + {532,[85,783]}, + {513,[97,783]}, + {517,[101,783]}, + {521,[105,783]}, + {525,[111,783]}, + {529,[114,783]}, + {533,[117,783]}, + {1142,[1140,783]}, + {1143,[1141,783]}, + {514,[65,785]}, + {518,[69,785]}, + {522,[73,785]}, + {526,[79,785]}, + {530,[82,785]}, + {534,[85,785]}, + {515,[97,785]}, + {519,[101,785]}, + {523,[105,785]}, + {527,[111,785]}, + {531,[114,785]}, + {535,[117,785]}, + {8072,[913,837,787]}, + {8088,[919,837,787]}, + {8104,[937,837,787]}, + {8064,[945,837,787]}, + {8080,[951,837,787]}, + {8096,[969,837,787]}, + {7944,[913,787]}, + {7960,[917,787]}, + {7976,[919,787]}, + {7992,[921,787]}, + {8008,[927,787]}, + {8040,[937,787]}, + {7936,[945,787]}, + {7952,[949,787]}, + {7968,[951,787]}, + {7984,[953,787]}, + {8000,[959,787]}, + {8164,[961,787]}, + {8016,[965,787]}, + {8032,[969,787]}, + {8073,[913,837,788]}, + {8089,[919,837,788]}, + {8105,[937,837,788]}, + {8065,[945,837,788]}, + {8081,[951,837,788]}, + {8097,[969,837,788]}, + {7945,[913,788]}, + {7961,[917,788]}, + {7977,[919,788]}, + {7993,[921,788]}, + {8009,[927,788]}, + {8172,[929,788]}, + {8025,[933,788]}, + {8041,[937,788]}, + {7937,[945,788]}, + {7953,[949,788]}, + {7969,[951,788]}, + {7985,[953,788]}, + {8001,[959,788]}, + {8165,[961,788]}, + {8017,[965,788]}, + {8033,[969,788]}, + {416,[79,795]}, + {431,[85,795]}, + {417,[111,795]}, + {432,[117,795]}, + {7840,[65,803]}, + {7684,[66,803]}, + {7692,[68,803]}, + {7864,[69,803]}, + {7716,[72,803]}, + {7882,[73,803]}, + {7730,[75,803]}, + {7734,[76,803]}, + {7746,[77,803]}, + {7750,[78,803]}, + {7884,[79,803]}, + {7770,[82,803]}, + {7778,[83,803]}, + {7788,[84,803]}, + {7908,[85,803]}, + {7806,[86,803]}, + {7816,[87,803]}, + {7924,[89,803]}, + {7826,[90,803]}, + {7841,[97,803]}, + {7685,[98,803]}, + {7693,[100,803]}, + {7865,[101,803]}, + {7717,[104,803]}, + {7883,[105,803]}, + {7731,[107,803]}, + {7735,[108,803]}, + {7747,[109,803]}, + {7751,[110,803]}, + {7885,[111,803]}, + {7771,[114,803]}, + {7779,[115,803]}, + {7789,[116,803]}, + {7909,[117,803]}, + {7807,[118,803]}, + {7817,[119,803]}, + {7925,[121,803]}, + {7827,[122,803]}, + {7906,[79,795,803]}, + {7920,[85,795,803]}, + {7907,[111,795,803]}, + {7921,[117,795,803]}, + {7794,[85,804]}, + {7795,[117,804]}, + {7680,[65,805]}, + {7681,[97,805]}, + {199,[67,807]}, + {7696,[68,807]}, + {290,[71,807]}, + {7720,[72,807]}, + {310,[75,807]}, + {315,[76,807]}, + {325,[78,807]}, + {342,[82,807]}, + {350,[83,807]}, + {354,[84,807]}, + {231,[99,807]}, + {7697,[100,807]}, + {291,[103,807]}, + {7721,[104,807]}, + {311,[107,807]}, + {316,[108,807]}, + {326,[110,807]}, + {343,[114,807]}, + {351,[115,807]}, + {355,[116,807]}, + {260,[65,808]}, + {280,[69,808]}, + {302,[73,808]}, + {490,[79,808]}, + {370,[85,808]}, + {261,[97,808]}, + {281,[101,808]}, + {303,[105,808]}, + {491,[111,808]}, + {371,[117,808]}, + {7698,[68,813]}, + {7704,[69,813]}, + {7740,[76,813]}, + {7754,[78,813]}, + {7792,[84,813]}, + {7798,[85,813]}, + {7699,[100,813]}, + {7705,[101,813]}, + {7741,[108,813]}, + {7755,[110,813]}, + {7793,[116,813]}, + {7799,[117,813]}, + {7722,[72,814]}, + {7723,[104,814]}, + {7706,[69,816]}, + {7724,[73,816]}, + {7796,[85,816]}, + {7707,[101,816]}, + {7725,[105,816]}, + {7797,[117,816]}, + {7686,[66,817]}, + {7694,[68,817]}, + {7732,[75,817]}, + {7738,[76,817]}, + {7752,[78,817]}, + {7774,[82,817]}, + {7790,[84,817]}, + {7828,[90,817]}, + {7687,[98,817]}, + {7695,[100,817]}, + {7830,[104,817]}, + {7733,[107,817]}, + {7739,[108,817]}, + {7753,[110,817]}, + {7775,[114,817]}, + {7791,[116,817]}, + {7829,[122,817]}, + {8129,[168,834]}, + {8151,[953,776,834]}, + {8167,[965,776,834]}, + {8078,[913,837,787,834]}, + {8094,[919,837,787,834]}, + {8110,[937,837,787,834]}, + {8070,[945,837,787,834]}, + {8086,[951,837,787,834]}, + {8102,[969,837,787,834]}, + {7950,[913,787,834]}, + {7982,[919,787,834]}, + {7998,[921,787,834]}, + {8046,[937,787,834]}, + {7942,[945,787,834]}, + {7974,[951,787,834]}, + {7990,[953,787,834]}, + {8022,[965,787,834]}, + {8038,[969,787,834]}, + {8079,[913,837,788,834]}, + {8095,[919,837,788,834]}, + {8111,[937,837,788,834]}, + {8071,[945,837,788,834]}, + {8087,[951,837,788,834]}, + {8103,[969,837,788,834]}, + {7951,[913,788,834]}, + {7983,[919,788,834]}, + {7999,[921,788,834]}, + {8031,[933,788,834]}, + {8047,[937,788,834]}, + {7943,[945,788,834]}, + {7975,[951,788,834]}, + {7991,[953,788,834]}, + {8023,[965,788,834]}, + {8039,[969,788,834]}, + {8119,[945,837,834]}, + {8135,[951,837,834]}, + {8183,[969,837,834]}, + {8118,[945,834]}, + {8134,[951,834]}, + {8150,[953,834]}, + {8166,[965,834]}, + {8182,[969,834]}, + {8143,[8127,834]}, + {8159,[8190,834]}, + {8124,[913,837]}, + {8140,[919,837]}, + {8188,[937,837]}, + {8115,[945,837]}, + {8131,[951,837]}, + {8179,[969,837]}, + {64302,[1488,1463]}, + {64287,[1522,1463]}, + {64303,[1488,1464]}, + {64331,[1493,1465]}, + {64304,[1488,1468]}, + {64305,[1489,1468]}, + {64306,[1490,1468]}, + {64307,[1491,1468]}, + {64308,[1492,1468]}, + {64309,[1493,1468]}, + {64310,[1494,1468]}, + {64312,[1496,1468]}, + {64313,[1497,1468]}, + {64314,[1498,1468]}, + {64315,[1499,1468]}, + {64316,[1500,1468]}, + {64318,[1502,1468]}, + {64320,[1504,1468]}, + {64321,[1505,1468]}, + {64323,[1507,1468]}, + {64324,[1508,1468]}, + {64326,[1510,1468]}, + {64327,[1511,1468]}, + {64328,[1512,1468]}, + {64329,[1513,1468]}, + {64330,[1514,1468]}, + {64332,[1489,1471]}, + {64333,[1499,1471]}, + {64334,[1508,1471]}, + {64300,[1513,1468,1473]}, + {64298,[1513,1473]}, + {64301,[1513,1468,1474]}, + {64299,[1513,1474]}, + {2392,[2325,2364]}, + {2393,[2326,2364]}, + {2394,[2327,2364]}, + {2395,[2332,2364]}, + {2396,[2337,2364]}, + {2397,[2338,2364]}, + {2345,[2344,2364]}, + {2398,[2347,2364]}, + {2399,[2351,2364]}, + {2353,[2352,2364]}, + {2356,[2355,2364]}, + {2524,[2465,2492]}, + {2525,[2466,2492]}, + {2480,[2476,2492]}, + {2527,[2479,2492]}, + {2507,[2503,2494]}, + {2508,[2503,2519]}, + {2649,[2582,2620]}, + {2650,[2583,2620]}, + {2651,[2588,2620]}, + {2652,[2593,2620]}, + {2654,[2603,2620]}, + {2908,[2849,2876]}, + {2909,[2850,2876]}, + {2911,[2863,2876]}, + {2891,[2887,2878]}, + {2888,[2887,2902]}, + {2892,[2887,2903]}, + {3018,[3014,3006]}, + {3019,[3015,3006]}, + {2964,[2962,3031]}, + {3020,[3014,3031]}, + {3144,[3142,3158]}, + {3274,[3270,3266]}, + {3264,[3263,3285]}, + {3275,[3270,3266,3285]}, + {3271,[3270,3285]}, + {3272,[3270,3286]}, + {3402,[3398,3390]}, + {3403,[3399,3390]}, + {3404,[3398,3415]}, + {3635,[3661,3634]}, + {3763,[3789,3762]}, + {3955,[3954,3953]}, + {3957,[3956,3953]}, + {3959,[4018,3968,3953]}, + {3961,[4019,3968,3953]}, + {3958,[4018,3968]}, + {3960,[4019,3968]}, + {3945,[3904,4021]}, + {4025,[3984,4021]}, + {3907,[3906,4023]}, + {3917,[3916,4023]}, + {3922,[3921,4023]}, + {3927,[3926,4023]}, + {3932,[3931,4023]}, + {3987,[3986,4023]}, + {3997,[3996,4023]}, + {4002,[4001,4023]}, + {4007,[4006,4023]}, + {4012,[4011,4023]}, + {12436,[12358,12441]}, + {12364,[12363,12441]}, + {12366,[12365,12441]}, + {12368,[12367,12441]}, + {12370,[12369,12441]}, + {12372,[12371,12441]}, + {12374,[12373,12441]}, + {12376,[12375,12441]}, + {12378,[12377,12441]}, + {12380,[12379,12441]}, + {12382,[12381,12441]}, + {12384,[12383,12441]}, + {12386,[12385,12441]}, + {12389,[12388,12441]}, + {12391,[12390,12441]}, + {12393,[12392,12441]}, + {12400,[12399,12441]}, + {12403,[12402,12441]}, + {12406,[12405,12441]}, + {12409,[12408,12441]}, + {12412,[12411,12441]}, + {12446,[12445,12441]}, + {12532,[12454,12441]}, + {12460,[12459,12441]}, + {12462,[12461,12441]}, + {12464,[12463,12441]}, + {12466,[12465,12441]}, + {12468,[12467,12441]}, + {12470,[12469,12441]}, + {12472,[12471,12441]}, + {12474,[12473,12441]}, + {12476,[12475,12441]}, + {12478,[12477,12441]}, + {12480,[12479,12441]}, + {12482,[12481,12441]}, + {12485,[12484,12441]}, + {12487,[12486,12441]}, + {12489,[12488,12441]}, + {12496,[12495,12441]}, + {12499,[12498,12441]}, + {12502,[12501,12441]}, + {12505,[12504,12441]}, + {12508,[12507,12441]}, + {12535,[12527,12441]}, + {12536,[12528,12441]}, + {12537,[12529,12441]}, + {12538,[12530,12441]}, + {12542,[12541,12441]}, + {12401,[12399,12442]}, + {12404,[12402,12442]}, + {12407,[12405,12442]}, + {12410,[12408,12442]}, + {12413,[12411,12442]}, + {12497,[12495,12442]}, + {12500,[12498,12442]}, + {12503,[12501,12442]}, + {12506,[12504,12442]}, + {12509,[12507,12442]}}. diff --git a/lib/kernel/test/gen_sctp_SUITE.erl b/lib/kernel/test/gen_sctp_SUITE.erl index 9aa94a0868..d3aa62d7ec 100644 --- a/lib/kernel/test/gen_sctp_SUITE.erl +++ b/lib/kernel/test/gen_sctp_SUITE.erl @@ -18,26 +18,58 @@ %% -module(gen_sctp_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet_sctp.hrl"). %%-compile(export_all). --export([all/1,init_per_testcase/2,fin_per_testcase/2]). +-export([all/0, suite/0,groups/0, + init_per_suite/1,end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). -export( [basic/1, api_open_close/1,api_listen/1,api_connect_init/1,api_opts/1, xfer_min/1,xfer_active/1,def_sndrcvinfo/1,implicit_inet6/1]). -all(suite) -> - [basic, - api_open_close,api_listen,api_connect_init,api_opts, - xfer_min,xfer_active,def_sndrcvinfo,implicit_inet6]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic, api_open_close, api_listen, api_connect_init, + api_opts, xfer_min, xfer_active, def_sndrcvinfo, + implicit_inet6]. + +groups() -> + []. + +init_per_suite(Config) -> + try gen_sctp:open() of + {ok,Socket} -> + gen_sctp:close(Socket), + []; + _ -> + [] + catch + error:badarg -> + {skip,"SCTP not supported on this machine"}; + _:_ -> + Config + end. + +end_per_suite(_Conifig) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(15)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). diff --git a/lib/kernel/test/gen_tcp_api_SUITE.erl b/lib/kernel/test/gen_tcp_api_SUITE.erl index 94637290a1..c8fe602ac2 100644 --- a/lib/kernel/test/gen_tcp_api_SUITE.erl +++ b/lib/kernel/test/gen_tcp_api_SUITE.erl @@ -22,30 +22,52 @@ %% are not tested here, because they are tested indirectly in this and %% and other test suites. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet.hrl"). --export([all/1, init_per_testcase/2, fin_per_testcase/2, - t_accept/1, t_connect_timeout/1, t_accept_timeout/1, - t_connect/1, t_connect_bad/1, - t_recv/1, t_recv_timeout/1, t_recv_eof/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + t_connect_timeout/1, t_accept_timeout/1, + t_connect_bad/1, + t_recv_timeout/1, t_recv_eof/1, t_shutdown_write/1, t_shutdown_both/1, t_shutdown_error/1, t_fdopen/1, t_implicit_inet6/1]). -all(suite) -> [t_accept, t_connect, t_recv, t_shutdown_write, - t_shutdown_both, t_shutdown_error, t_fdopen, - t_implicit_inet6]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, t_accept}, {group, t_connect}, {group, t_recv}, + t_shutdown_write, t_shutdown_both, t_shutdown_error, + t_fdopen, t_implicit_inet6]. + +groups() -> + [{t_accept, [], [t_accept_timeout]}, + {t_connect, [], [t_connect_timeout, t_connect_bad]}, + {t_recv, [], [t_recv_timeout, t_recv_eof]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). %%% gen_tcp:accept/1,2 -t_accept(suite) -> [t_accept_timeout]. t_accept_timeout(doc) -> "Test that gen_tcp:accept/2 (with timeout) works."; t_accept_timeout(suite) -> []; @@ -55,7 +77,6 @@ t_accept_timeout(Config) when is_list(Config) -> %%% gen_tcp:connect/X -t_connect(suite) -> [t_connect_timeout, t_connect_bad]. t_connect_timeout(doc) -> "Test that gen_tcp:connect/4 (with timeout) works."; t_connect_timeout(Config) when is_list(Config) -> @@ -84,7 +105,6 @@ t_connect_bad(Config) when is_list(Config) -> %%% gen_tcp:recv/X -t_recv(suite) -> [t_recv_timeout, t_recv_eof]. t_recv_timeout(doc) -> "Test that gen_tcp:recv/3 (with timeout works)."; t_recv_timeout(suite) -> []; diff --git a/lib/kernel/test/gen_tcp_echo_SUITE.erl b/lib/kernel/test/gen_tcp_echo_SUITE.erl index a2e09877af..830e2d9c39 100644 --- a/lib/kernel/test/gen_tcp_echo_SUITE.erl +++ b/lib/kernel/test/gen_tcp_echo_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -18,11 +18,13 @@ %% -module(gen_tcp_echo_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%-compile(export_all). --export([all/1, init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, active_echo/1, passive_echo/1, active_once_echo/1, slow_active_echo/1, slow_passive_echo/1, limit_active_echo/1, limit_passive_echo/1, @@ -31,16 +33,34 @@ -define(TPKT_VRSN, 3). -define(LINE_LENGTH, 1023). % (default value of gen_tcp option 'recbuf') - 1 -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [active_echo, passive_echo, active_once_echo, - slow_active_echo, slow_passive_echo, - limit_active_echo, limit_passive_echo, - large_limit_active_echo, large_limit_passive_echo]. + slow_active_echo, slow_passive_echo, limit_active_echo, + limit_passive_echo, large_limit_active_echo, + large_limit_passive_echo]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:minutes(5)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index d73c5fab56..c3ce6497bb 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -18,14 +18,16 @@ %% -module(gen_tcp_misc_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %-compile(export_all). --export([all/1, controlling_process/1, no_accept/1, close_with_pending_output/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + controlling_process/1, no_accept/1, close_with_pending_output/1, data_before_close/1, iter_max_socks/1, get_status/1, passive_sockets/1, accept_closed_by_other_process/1, - init_per_testcase/2, fin_per_testcase/2, + init_per_testcase/2, end_per_testcase/2, otp_3924/1, otp_3924_sender/4, closed_socket/1, shutdown_active/1, shutdown_passive/1, shutdown_pending/1, default_options/1, http_bad_packet/1, @@ -34,39 +36,60 @@ partial_recv_and_close_2/1,partial_recv_and_close_3/1,so_priority/1, % Accept tests primitive_accept/1,multi_accept_close_listen/1,accept_timeout/1, - accept_timeouts_in_order/1,accept_timeouts_in_order2/1,accept_timeouts_in_order3/1, - accept_timeouts_mixed/1, + accept_timeouts_in_order/1,accept_timeouts_in_order2/1, + accept_timeouts_in_order3/1,accept_timeouts_mixed/1, killing_acceptor/1,killing_multi_acceptors/1,killing_multi_acceptors2/1, - several_accepts_in_one_go/1,active_once_closed/1, send_timeout/1, otp_7731/1, - zombie_sockets/1, otp_7816/1, otp_8102/1]). + several_accepts_in_one_go/1,active_once_closed/1, send_timeout/1, + otp_7731/1, zombie_sockets/1, otp_7816/1, otp_8102/1]). %% Internal exports. --export([sender/3, not_owner/1, passive_sockets_server/2, priority_server/1, otp_7731_server/1, zombie_server/2]). +-export([sender/3, not_owner/1, passive_sockets_server/2, priority_server/1, + otp_7731_server/1, zombie_server/2]). init_per_testcase(_Func, Config) when is_list(Config) -> Dog = test_server:timetrap(test_server:seconds(240)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [controlling_process, no_accept, - close_with_pending_output, - data_before_close, iter_max_socks, passive_sockets, + close_with_pending_output, data_before_close, + iter_max_socks, passive_sockets, accept_closed_by_other_process, otp_3924, closed_socket, shutdown_active, shutdown_passive, shutdown_pending, - default_options, http_bad_packet, - busy_send, busy_disconnect_passive, busy_disconnect_active, - fill_sendq, partial_recv_and_close, - partial_recv_and_close_2, partial_recv_and_close_3, so_priority, - primitive_accept,multi_accept_close_listen,accept_timeout, - accept_timeouts_in_order,accept_timeouts_in_order2,accept_timeouts_in_order3, - accept_timeouts_mixed, - killing_acceptor,killing_multi_acceptors,killing_multi_acceptors2, - several_accepts_in_one_go, active_once_closed, send_timeout, otp_7731, + default_options, http_bad_packet, busy_send, + busy_disconnect_passive, busy_disconnect_active, + fill_sendq, partial_recv_and_close, + partial_recv_and_close_2, partial_recv_and_close_3, + so_priority, primitive_accept, + multi_accept_close_listen, accept_timeout, + accept_timeouts_in_order, accept_timeouts_in_order2, + accept_timeouts_in_order3, accept_timeouts_mixed, + killing_acceptor, killing_multi_acceptors, + killing_multi_acceptors2, several_accepts_in_one_go, + active_once_closed, send_timeout, otp_7731, zombie_sockets, otp_7816, otp_8102]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + default_options(doc) -> ["Tests kernel application variables inet_default_listen_options and " diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl index 2ff1d7210a..ee9288bc75 100644 --- a/lib/kernel/test/gen_udp_SUITE.erl +++ b/lib/kernel/test/gen_udp_SUITE.erl @@ -21,7 +21,7 @@ % because udp is not deterministic. % -module(gen_udp_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(1)). @@ -29,23 +29,42 @@ % XXX - we should pick a port that we _know_ is closed. That's pretty hard. -define(CLOSED_PORT, 6666). --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([send_to_closed/1, buffer_size/1, binary_passive_recv/1, bad_address/1, read_packets/1, open_fd/1, connect/1, implicit_inet6/1]). -all(suite) -> - [send_to_closed, - buffer_size, binary_passive_recv, bad_address, read_packets, - open_fd, connect, implicit_inet6]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [send_to_closed, buffer_size, binary_passive_recv, + bad_address, read_packets, open_fd, connect, + implicit_inet6]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/kernel/test/global_SUITE.erl b/lib/kernel/test/global_SUITE.erl index 7a84ad5e75..c88e0f60bb 100644 --- a/lib/kernel/test/global_SUITE.erl +++ b/lib/kernel/test/global_SUITE.erl @@ -20,7 +20,8 @@ %-define(line_trace, 1). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, names/1, names_hidden/1, locks/1, locks_hidden/1, bad_input/1, names_and_locks/1, lock_die/1, name_die/1, basic_partition/1, basic_name_partition/1, @@ -42,14 +43,14 @@ -export([global_load/3, lock_global/2, lock_global2/2]). --export([ttt/1]). +-export([]). -export([mass_spawn/1]). -export([start_tracer/0, stop_tracer/0, get_trace/0]). -compile(export_all). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(NODES, [node()|nodes()]). @@ -58,41 +59,62 @@ %% The resource used by the global module. -define(GLOBAL_LOCK, global). -ttt(suite) -> - [ -%% 5&6: succeeds -%% 4&5&6: succeeds -%% 3&4&5&6: succeeds -%% 1&2&3&6: fails -%% 1&2&6: succeeds -%% 3&6: succeeds - names, names_hidden, locks, locks_hidden, - bad_input, - names_and_locks, lock_die, name_die, basic_partition, -% advanced_partition, basic_name_partition, -% stress_partition, simple_ring, simple_line, - ring]. - -all(suite) -> + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case init:get_argument(ring_line) of - {ok, _} -> - [ring_line]; + {ok, _} -> [ring_line]; _ -> - [names, names_hidden, locks, locks_hidden, - bad_input, + [names, names_hidden, locks, locks_hidden, bad_input, names_and_locks, lock_die, name_die, basic_partition, advanced_partition, basic_name_partition, - stress_partition, simple_ring, simple_line, - ring, line, global_lost_nodes, otp_1849, - otp_3162, otp_5640, otp_5737, otp_6931, - simple_disconnect, simple_resolve, simple_resolve2, - simple_resolve3, - leftover_name, re_register_name, name_exit, - external_nodes, many_nodes, sync_0, global_groups_change, - register_1, both_known_1, lost_unregister, - mass_death, garbage_messages] + stress_partition, simple_ring, simple_line, ring, line, + global_lost_nodes, otp_1849, otp_3162, otp_5640, + otp_5737, otp_6931, simple_disconnect, simple_resolve, + simple_resolve2, simple_resolve3, leftover_name, + re_register_name, name_exit, external_nodes, many_nodes, + sync_0, global_groups_change, register_1, both_known_1, + lost_unregister, mass_death, garbage_messages] end. +groups() -> + [{ttt, [], + [names, names_hidden, locks, locks_hidden, bad_input, + names_and_locks, lock_die, name_die, basic_partition, + ring]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +init_per_suite(Config) -> + + %% Copied from test_server_ctrl ln 647, we have to do this here as + %% the test_server only does this when run without common_test + global:sync(), + case global:whereis_name(test_server) of + undefined -> + io:format(user, "Registering test_server globally!~n",[]), + global:register_name(test_server, whereis(test_server_ctrl)); + Pid -> + case node() of + N when N == node(Pid) -> + io:format(user, "Warning: test_server already running!\n", []), + global:re_register_name(test_server,self()); + _ -> + ok + end + end, + Config. + +end_per_suite(_Config) -> + global:unregister_name(test_server), + ok. + + -define(TESTCASE, testcase_name). -define(testcase, ?config(?TESTCASE, Config)). -define(nodes_tag, '$global_nodes'). @@ -100,9 +122,16 @@ all(suite) -> init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> ok = gen_server:call(global_name_server, high_level_trace_start,infinity), + + %% Make sure that everything is dead and done. Otherwise there are problems + %% on platforms on which it takes a long time to shut down a node. + stop_nodes(nodes()), + timer:sleep(1000), + [{?TESTCASE, Case}, {registered, registered()} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> + ct:log("Calling end_per_testcase!",[]), ?line write_high_level_trace(Config), ?line _ = gen_server:call(global_name_server, high_level_trace_stop, infinity), @@ -114,6 +143,7 @@ fin_per_testcase(_Case, Config) -> {What, N} <- [{"Added", Registered -- InitRegistered}, {"Removed", InitRegistered -- Registered}], N =/= []], + ok. %%% General comments: diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index 430cc61267..c113bbc0cb 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -19,25 +19,61 @@ -module(global_group_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1]). -export([start_gg_proc/1, no_gg_proc/1, no_gg_proc_sync/1, compatible/1, one_grp/1, one_grp_x/1, two_grp/1, hidden_groups/1, test_exit/1]). -export([init/1, init/2, init2/2, start_proc/1, start_proc_rereg/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). %-compile(export_all). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(NODES, [node()|nodes()]). -define(UNTIL(Seq), loop_until_true(fun() -> Seq end)). -all(suite) -> - [start_gg_proc, no_gg_proc, no_gg_proc_sync, - compatible, one_grp, one_grp_x, two_grp, test_exit, - hidden_groups]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [start_gg_proc, no_gg_proc, no_gg_proc_sync, compatible, + one_grp, one_grp_x, two_grp, test_exit, hidden_groups]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) -> + + %% Copied from test_server_ctrl ln 647, we have to do this here as + %% the test_server only does this when run without common_test + global:sync(), + case global:whereis_name(test_server) of + undefined -> + io:format(user, "Registering test_server globally!~n",[]), + global:register_name(test_server, whereis(test_server_ctrl)); + Pid -> + case node() of + N when N == node(Pid) -> + io:format(user, "Warning: test_server already running!\n", []), + global:re_register_name(test_server,self()); + _ -> + ok + end + end, + Config. + +end_per_suite(_Config) -> + global:unregister_name(test_server), + ok. -define(TESTCASE, testcase_name). -define(testcase, ?config(?TESTCASE, Config)). @@ -46,7 +82,7 @@ init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog=?t:timetrap(?t:minutes(5)), [{?TESTCASE, Case}, {watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). @@ -164,8 +200,8 @@ no_gg_proc(Config) when is_list(Config) -> ?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, Cpxnn, Cpynn, Cpznn], ?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), - ?line true = (Own_nodes -- Own_nodes_should) =:= [], - ?line true = (Own_nodes_should -- Own_nodes) =:= [], + ?line [] = (Own_nodes -- Own_nodes_should), + ?line [] = (Own_nodes_should -- Own_nodes), ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), ?line receive @@ -339,8 +375,8 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, Cpxnn, Cpynn, Cpznn], ?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), - ?line true = (Own_nodes -- Own_nodes_should) =:= [], - ?line true = (Own_nodes_should -- Own_nodes) =:= [], + ?line [] = (Own_nodes -- Own_nodes_should), + ?line [] = (Own_nodes_should -- Own_nodes), ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), ?line receive @@ -513,8 +549,8 @@ compatible(Config) when is_list(Config) -> ?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, Cpxnn, Cpynn, Cpznn], ?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), - ?line true = (Own_nodes -- Own_nodes_should) =:= [], - ?line true = (Own_nodes_should -- Own_nodes) =:= [], + ?line [] = (Own_nodes -- Own_nodes_should), + ?line [] = (Own_nodes_should -- Own_nodes), ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), ?line receive diff --git a/lib/kernel/test/heart_SUITE.erl b/lib/kernel/test/heart_SUITE.erl index 0d0296238b..e82eabe530 100644 --- a/lib/kernel/test/heart_SUITE.erl +++ b/lib/kernel/test/heart_SUITE.erl @@ -18,12 +18,14 @@ %% -module(heart_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, ostype/1, start/1, restart/1, reboot/1, set_cmd/1, clear_cmd/1, - dont_drop/1, kill_pid/1, fini/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, start/1, restart/1, + reboot/1, set_cmd/1, clear_cmd/1, + dont_drop/1, kill_pid/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([start_heart_stress/1, mangle/1, suicide_by_heart/0]). @@ -33,7 +35,7 @@ init_per_testcase(_Func, Config) -> Dog=test_server:timetrap(test_server:seconds(?DEFAULT_TIMEOUT_SECS)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Nodes = nodes(), lists:foreach(fun(X) -> NNam = list_to_atom(hd(string:tokens(atom_to_list(X),"@"))), @@ -53,18 +55,29 @@ fin_per_testcase(_Func, Config) -> %% Should be started in a CC view with: %% erl -sname master -rsh ctrsh %%----------------------------------------------------------------- -all(suite) -> - [{conf, ostype, [start, restart, reboot, - set_cmd, clear_cmd, kill_pid], fini}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -ostype(Config) when is_list(Config) -> +all() -> + [start, restart, reboot, set_cmd, clear_cmd, kill_pid]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) when is_list(Config) -> case os:type() of {win32, windows} -> {skipped, "No use to run on Windows 95/98"}; _ -> Config end. -fini(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> Config. start_check(Type, Name) -> diff --git a/lib/kernel/test/inet_SUITE.erl b/lib/kernel/test/inet_SUITE.erl index ec05bf99b9..523e5c63ce 100644 --- a/lib/kernel/test/inet_SUITE.erl +++ b/lib/kernel/test/inet_SUITE.erl @@ -18,29 +18,72 @@ %% -module(inet_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet.hrl"). -include_lib("kernel/src/inet_dns.hrl"). --export([all/1, t_gethostbyaddr/1, t_getaddr/1, t_gethostbyname/1, - t_gethostbyaddr_v6/1, t_getaddr_v6/1, t_gethostbyname_v6/1, - ipv4_to_ipv6/1, host_and_addr/1, parse/1, t_gethostnative/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + t_gethostbyaddr/0, t_gethostbyaddr/1, + t_getaddr/0, t_getaddr/1, + t_gethostbyname/0, t_gethostbyname/1, + t_gethostbyaddr_v6/0, t_gethostbyaddr_v6/1, + t_getaddr_v6/0, t_getaddr_v6/1, + t_gethostbyname_v6/0, t_gethostbyname_v6/1, + ipv4_to_ipv6/0, ipv4_to_ipv6/1, + host_and_addr/0, host_and_addr/1, + t_gethostnative/1, gethostnative_parallell/1, cname_loop/1, - gethostnative_soft_restart/1,gethostnative_debug_level/1,getif/1, - getif_ifr_name_overflow/1,getservbyname_overflow/1,getifaddrs/1]). + gethostnative_soft_restart/0, gethostnative_soft_restart/1, + gethostnative_debug_level/0, gethostnative_debug_level/1, + getif/1, + getif_ifr_name_overflow/1,getservbyname_overflow/1, getifaddrs/1]). -export([get_hosts/1, get_ipv6_hosts/1, parse_hosts/1, parse_address/1, kill_gethost/0, parallell_gethost/0]). -export([init_per_testcase/2, end_per_testcase/2]). +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [t_gethostbyaddr, t_gethostbyname, t_getaddr, + t_gethostbyaddr_v6, t_gethostbyname_v6, t_getaddr_v6, + ipv4_to_ipv6, host_and_addr, {group, parse}, + t_gethostnative, gethostnative_parallell, cname_loop, + gethostnative_debug_level, gethostnative_soft_restart, + getif, getif_ifr_name_overflow, getservbyname_overflow, + getifaddrs]. + +groups() -> + [{parse, [], [parse_hosts, parse_address]}]. + +%% Required configuaration +required(v4) -> + [{require, test_host_ipv4_only}, + {require, test_dummy_host}]; +required(v6) -> + [{require, test_host_ipv6_only}, + {require, test_dummy_ipv6_host}]; +required(hosts) -> + case os:type() of + {OS, _} when OS =:= win32; OS =:= vxworks -> + [{require, hardcoded_hosts}, + {require, hardcoded_ipv6_hosts}]; + _Else -> + [{require, test_hosts}] + end. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [t_gethostbyaddr, t_gethostbyname, t_getaddr, - t_gethostbyaddr_v6, t_gethostbyname_v6, t_getaddr_v6, - ipv4_to_ipv6, host_and_addr, parse,t_gethostnative, - gethostnative_parallell, cname_loop, - gethostnative_debug_level,gethostnative_soft_restart, - getif,getif_ifr_name_overflow,getservbyname_overflow,getifaddrs]. +end_per_group(_GroupName, Config) -> + Config. init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), @@ -50,10 +93,12 @@ end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). - +t_gethostbyaddr() -> + required(v4). t_gethostbyaddr(doc) -> "Test the inet:gethostbyaddr/1 function."; t_gethostbyaddr(Config) when is_list(Config) -> - ?line {Name,FullName,IPStr,IP,Aliases,_,_} = ?config(test_host_ipv4_only, Config), + ?line {Name,FullName,IPStr,IP,Aliases,_,_} = + ct:get_config(test_host_ipv4_only), ?line {ok,HEnt} = inet:gethostbyaddr(IPStr), ?line {ok,HEnt} = inet:gethostbyaddr(IP), ?line {error,Error} = inet:gethostbyaddr(Name), @@ -75,15 +120,16 @@ t_gethostbyaddr(Config) when is_list(Config) -> end, ?line {_DName, _DFullName, DIPStr, DIP, _, _, _} = - ?config(test_dummy_host, Config), + ct:get_config(test_dummy_host), ?line {error,nxdomain} = inet:gethostbyaddr(DIPStr), ?line {error,nxdomain} = inet:gethostbyaddr(DIP), ok. +t_gethostbyaddr_v6() -> required(v6). t_gethostbyaddr_v6(doc) -> "Test the inet:gethostbyaddr/1 inet6 function."; t_gethostbyaddr_v6(Config) when is_list(Config) -> ?line {Name6, FullName6, IPStr6, IP6, Aliases6} = - ?config(test_host_ipv6_only, Config), + ct:get_config(test_host_ipv6_only), ?line case inet:gethostbyaddr(IPStr6) of %% Even if IPv6 is not supported, the native resolver may succeed @@ -103,27 +149,28 @@ t_gethostbyaddr_v6(Config) when is_list(Config) -> {HEnt6#hostent.h_aliases,[[],Aliases6]}]), ?line {_DName6, _DFullName6, DIPStr6, DIP6, _} = - ?config(test_dummy_ipv6_host, Config), + ct:get_config(test_dummy_ipv6_host), ?line {error,nxdomain} = inet:gethostbyaddr(DIPStr6), ?line {error,nxdomain} = inet:gethostbyaddr(DIP6), ok end. +t_gethostbyname() -> required(v4). t_gethostbyname(doc) -> "Test the inet:gethostbyname/1 function."; t_gethostbyname(suite) -> []; t_gethostbyname(Config) when is_list(Config) -> ?line {Name,FullName,IPStr,IP,Aliases,IP_46_Str,_} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), ?line {ok,_} = inet:gethostbyname(IPStr), ?line {ok,HEnt} = inet:gethostbyname(Name), ?line {ok,HEnt} = inet:gethostbyname(list_to_atom(Name)), ?line HEnt_ = HEnt#hostent{h_addrtype = inet, h_length = 4, h_addr_list = [IP]}, + ?line HEnt_ = HEnt, ?line check_elems([{HEnt#hostent.h_name,[Name,FullName]}, {HEnt#hostent.h_aliases,[[],Aliases]}]), - ?line {ok,HEntF} = inet:gethostbyname(FullName), ?line HEntF_ = HEntF#hostent{h_name = FullName, h_addrtype = inet, @@ -133,15 +180,16 @@ t_gethostbyname(Config) when is_list(Config) -> ?line check_elems([{HEnt#hostent.h_aliases,[[],Aliases]}]), ?line {DName, _DFullName, _DIPStr, _DIP, _, _, _} = - ?config(test_dummy_host, Config), + ct:get_config(test_dummy_host), ?line {error,nxdomain} = inet:gethostbyname(DName), ?line {error,nxdomain} = inet:gethostbyname(IP_46_Str). +t_gethostbyname_v6() -> required(v6). t_gethostbyname_v6(doc) -> "Test the inet:gethostbyname/1 inet6 function."; t_gethostbyname_v6(suite) -> []; t_gethostbyname_v6(Config) when is_list(Config) -> ?line {Name, _, _, _,Aliases,IP_46_Str,IP_46} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), case {inet:gethostbyname(IP_46_Str, inet6), inet:gethostbyname(Name, inet6)} of @@ -154,7 +202,7 @@ t_gethostbyname_v6(Config) when is_list(Config) -> ?line check_elems([{HEnt46#hostent.h_aliases,[[],Aliases]}]), ?line {Name6, FullName6, IPStr6, IP6, Aliases6} = - ?config(test_host_ipv6_only, Config), + ct:get_config(test_host_ipv6_only), ?line {ok,_} = inet:gethostbyname(IPStr6, inet6), ?line {ok,HEnt6} = inet:gethostbyname(Name6, inet6), ?line {ok,HEnt6} = inet:gethostbyname(list_to_atom(Name6), inet6), @@ -200,7 +248,7 @@ t_gethostbyname_v6(Config) when is_list(Config) -> end, ?line {DName6, _DFullName6, _DIPStr6, _DIP6, _} = - ?config(test_dummy_ipv6_host, Config), + ct:get_config(test_dummy_ipv6_host), ?line {error,nxdomain} = inet:gethostbyname(DName6, inet6), ok; {_,_} -> @@ -219,11 +267,12 @@ check_elem(Val, [], Tests0) -> ?t:fail({no_match,Val,Tests0}). +t_getaddr() -> required(v4). t_getaddr(doc) -> "Test the inet:getaddr/2 function."; t_getaddr(suite) -> []; t_getaddr(Config) when is_list(Config) -> ?line {Name,FullName,IPStr,IP,_,IP_46_Str,IP46} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), ?line {ok,IP} = inet:getaddr(list_to_atom(Name), inet), ?line {ok,IP} = inet:getaddr(Name, inet), ?line {ok,IP} = inet:getaddr(FullName, inet), @@ -232,17 +281,18 @@ t_getaddr(Config) when is_list(Config) -> ?line {error,nxdomain} = inet:getaddr(IP_46_Str, inet), ?line {error,eafnosupport} = inet:getaddr(IP46, inet), - ?line {DName, DFullName, DIPStr, DIP, _, _, _} = ?config(test_dummy_host, Config), + ?line {DName, DFullName, DIPStr, DIP, _, _, _} = ct:get_config(test_dummy_host), ?line {error,nxdomain} = inet:getaddr(DName, inet), ?line {error,nxdomain} = inet:getaddr(DFullName, inet), ?line {ok,DIP} = inet:getaddr(DIPStr, inet), ?line {ok,DIP} = inet:getaddr(DIP, inet). +t_getaddr_v6() -> required(v4) ++ required(v6). t_getaddr_v6(doc) -> "Test the inet:getaddr/2 function."; t_getaddr_v6(suite) -> []; t_getaddr_v6(Config) when is_list(Config) -> ?line {Name,FullName,IPStr,_IP,_,IP_46_Str,IP46} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), case {inet:getaddr(IP_46_Str, inet6),inet:getaddr(Name, inet6)} of {{ok,IP46},{ok,_}} -> %% Since we suceeded in parsing an IPv6 address string and @@ -261,7 +311,7 @@ t_getaddr_v6(Config) when is_list(Config) -> %% inet_db:res_option(lookup)) %% end, ?line {Name6, FullName6, IPStr6, IP6, _} = - ?config(test_host_ipv6_only, Config), + ct:get_config(test_host_ipv6_only), ?line {ok,_} = inet:getaddr(list_to_atom(Name6), inet6), ?line {ok,_} = inet:getaddr(Name6, inet6), ?line {ok,_} = inet:getaddr(FullName6, inet6), @@ -269,7 +319,7 @@ t_getaddr_v6(Config) when is_list(Config) -> ?line {ok,IP6} = inet:getaddr(IPStr6, inet6), ?line {DName6, DFullName6, DIPStr6, DIP6, _} = - ?config(test_dummy_ipv6_host, Config), + ct:get_config(test_dummy_ipv6_host), ?line {error,nxdomain} = inet:getaddr(DName6, inet6), ?line {error,nxdomain} = inet:getaddr(DFullName6, inet6), ?line {ok,DIP6} = inet:getaddr(DIPStr6, inet6), @@ -279,6 +329,7 @@ t_getaddr_v6(Config) when is_list(Config) -> {skip, "IPv6 is not supported on this host"} end. +ipv4_to_ipv6() -> required(v4). ipv4_to_ipv6(doc) -> "Test if IPv4 address is converted to IPv6 address."; ipv4_to_ipv6(suite) -> []; ipv4_to_ipv6(Config) when is_list(Config) -> @@ -287,7 +338,7 @@ ipv4_to_ipv6(Config) when is_list(Config) -> %% address should be returned. If no IPv6 support on this host, an %% error should beturned. ?line {_Name,_FullName,IPStr,_IP,Aliases,IP_46_Str,IP_46} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), ?line IP4to6Res = case inet:getaddr(IPStr, inet6) of {ok,IP_46} -> @@ -314,6 +365,7 @@ ipv4_to_ipv6(Config) when is_list(Config) -> end, ok. +host_and_addr() -> required(hosts). host_and_addr(doc) -> ["Test looking up hosts and addresses. Use 'ypcat hosts' ", "or the local eqivalent to find all hosts."]; host_and_addr(suite) -> []; @@ -334,30 +386,30 @@ try_host({Ip0, Host}) -> %% Get all hosts from the system using 'ypcat hosts' or the local %% equvivalent. -get_hosts(Config) -> +get_hosts(_Config) -> case os:type() of {unix, _} -> List = lists:map(fun(X) -> atom_to_list(X)++" " - end, ?config(test_hosts, Config)), + end, ct:get_config(test_hosts)), Cmd = "ypmatch "++List++" hosts.byname", HostFile = os:cmd(Cmd), get_hosts(HostFile, [], [], []); _ -> - ?config(hardcoded_hosts, Config) + ct:get_config(hardcoded_hosts) end. -get_ipv6_hosts(Config) -> +get_ipv6_hosts(_Config) -> case os:type() of {unix, _} -> List = lists:map(fun(X) -> atom_to_list(X)++" " - end, ?config(test_hosts, Config)), + end, ct:get_config(ipv6_hosts)), Cmd = "ypmatch "++List++" ipnodes.byname", HostFile = os:cmd(Cmd), get_hosts(HostFile, [], [], []); _ -> - ?config(hardcoded_ipv6_hosts, Config) + ct:get_config(hardcoded_ipv6_hosts) end. get_hosts([$\t|Rest], Cur, Ip, Result) when Ip /= [] -> @@ -376,9 +428,6 @@ get_hosts([C|Rest], Cur, Ip, Result) -> get_hosts([], _, _, Result) -> Result. -parse(suite) -> [parse_hosts, parse_address]; -parse(doc) -> ["Test that parsing of the hosts file or equivalent works,", - "and that erroneous lines are skipped"]. parse_hosts(Config) when is_list(Config) -> ?line DataDir = ?config(data_dir,Config), @@ -730,6 +779,7 @@ cname_loop(Config) when is_list(Config) -> lookup_count=300, lookup_processes=20}). +gethostnative_soft_restart() -> required(hosts). gethostnative_soft_restart(suite) -> []; gethostnative_soft_restart(doc) -> @@ -740,6 +790,8 @@ gethostnative_soft_restart(Config) when is_list(Config) -> #gethostnative_control{ control_seq=[soft_restart]}). + +gethostnative_debug_level() -> required(hosts). gethostnative_debug_level(suite) -> []; gethostnative_debug_level(doc) -> diff --git a/lib/kernel/test/inet_res_SUITE.erl b/lib/kernel/test/inet_res_SUITE.erl index cc32d1f8f9..0c3c7c950c 100644 --- a/lib/kernel/test/inet_res_SUITE.erl +++ b/lib/kernel/test/inet_res_SUITE.erl @@ -18,24 +18,51 @@ %% -module(inet_res_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include_lib("kernel/include/inet.hrl"). -include_lib("kernel/src/inet_dns.hrl"). --export([all/1, init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). -export([basic/1, resolve/1, edns0/1, txt_record/1, files_monitor/1]). --export([gethostbyaddr/1, gethostbyaddr_v6/1, - gethostbyname/1, gethostbyname_v6/1, - getaddr/1, getaddr_v6/1, ipv4_to_ipv6/1, host_and_addr/1]). +-export([ + gethostbyaddr/0, gethostbyaddr/1, + gethostbyaddr_v6/0, gethostbyaddr_v6/1, + gethostbyname/0, gethostbyname/1, + gethostbyname_v6/0, gethostbyname_v6/1, + getaddr/0, getaddr/1, + getaddr_v6/0, getaddr_v6/1, + ipv4_to_ipv6/0, ipv4_to_ipv6/1, + host_and_addr/0, host_and_addr/1 + ]). -define(RUN_NAMED, "run-named"). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [basic, resolve, edns0, txt_record, files_monitor, - gethostbyaddr, gethostbyaddr_v6, gethostbyname, gethostbyname_v6, - getaddr, getaddr_v6, ipv4_to_ipv6, host_and_addr]. + gethostbyaddr, gethostbyaddr_v6, gethostbyname, + gethostbyname_v6, getaddr, getaddr_v6, ipv4_to_ipv6, + host_and_addr]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. zone_dir(basic) -> otptest; @@ -450,11 +477,19 @@ do_files_monitor(Config) -> %% Compatibility tests. Call the inet_SUITE tests, but with %% lookup = [file,dns] instead of [native] +gethostbyaddr() -> inet_SUITE:t_gethostbyaddr(). gethostbyaddr(Config) -> inet_SUITE:t_gethostbyaddr(Config). +gethostbyaddr_v6() -> inet_SUITE:t_gethostbyaddr_v6(). gethostbyaddr_v6(Config) -> inet_SUITE:t_gethostbyaddr_v6(Config). +gethostbyname() -> inet_SUITE:t_gethostbyname(). gethostbyname(Config) -> inet_SUITE:t_gethostbyname(Config). +gethostbyname_v6() -> inet_SUITE:t_gethostbyname_v6(). gethostbyname_v6(Config) -> inet_SUITE:t_gethostbyname_v6(Config). +getaddr() -> inet_SUITE:t_getaddr(). getaddr(Config) -> inet_SUITE:t_getaddr(Config). +getaddr_v6() -> inet_SUITE:t_getaddr_v6(). getaddr_v6(Config) -> inet_SUITE:t_getaddr_v6(Config). +ipv4_to_ipv6() -> inet_SUITE:ipv4_to_ipv6(). ipv4_to_ipv6(Config) -> inet_SUITE:ipv4_to_ipv6(Config). +host_and_addr() -> inet_SUITE:host_and_addr(). host_and_addr(Config) -> inet_SUITE:host_and_addr(Config). diff --git a/lib/kernel/test/inet_sockopt_SUITE.erl b/lib/kernel/test/inet_sockopt_SUITE.erl index 0fa0226ccf..1ef182ca18 100644 --- a/lib/kernel/test/inet_sockopt_SUITE.erl +++ b/lib/kernel/test/inet_sockopt_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -18,7 +18,7 @@ %% -module(inet_sockopt_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(C_GET_IPPROTO_TCP,1). @@ -48,7 +48,9 @@ -define(C_QUIT,99). --export([all/1, simple/1, loop_all/1, simple_raw/1, simple_raw_getbin/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + simple/1, loop_all/1, simple_raw/1, simple_raw_getbin/1, doc_examples_raw/1,doc_examples_raw_getbin/1, large_raw/1,large_raw_getbin/1,combined/1,combined_getbin/1, type_errors/1]). @@ -56,10 +58,29 @@ -export([init_per_testcase/2, end_per_testcase/2]). -all(suite) -> - [simple,loop_all,simple_raw,simple_raw_getbin, - doc_examples_raw, doc_examples_raw_getbin, - large_raw,large_raw_getbin,combined,combined_getbin,type_errors]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [simple, loop_all, simple_raw, simple_raw_getbin, + doc_examples_raw, doc_examples_raw_getbin, large_raw, + large_raw_getbin, combined, combined_getbin, + type_errors]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), diff --git a/lib/kernel/test/init_SUITE.erl b/lib/kernel/test/init_SUITE.erl index bbd8261197..18bb5c7087 100644 --- a/lib/kernel/test/init_SUITE.erl +++ b/lib/kernel/test/init_SUITE.erl @@ -18,16 +18,17 @@ %% -module(init_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([get_arguments/1, get_argument/1, boot_var/1, restart/1, get_plain_arguments/1, - reboot/1, stop/1, get_status/1, script_id/1, boot/1]). + reboot/1, stop/1, get_status/1, script_id/1]). -export([boot1/1, boot2/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([init/1, fini/1]). @@ -38,17 +39,34 @@ %% Should be started in a CC view with: %% erl -sname master -rsh ctrsh %%----------------------------------------------------------------- -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [get_arguments, get_argument, boot_var, - get_plain_arguments, - restart, - get_status, script_id, boot]. + get_plain_arguments, restart, get_status, script_id, + {group, boot}]. + +groups() -> + [{boot, [], [boot1, boot2]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:seconds(?DEFAULT_TIMEOUT_SEC)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). @@ -488,7 +506,6 @@ script_id(Config) when is_list(Config) -> %% ------------------------------------------------ %% Start the slave system with -boot flag. %% ------------------------------------------------ -boot(suite) -> [boot1, boot2]. boot1(doc) -> []; boot1(suite) -> {req, [distribution, {local_slave_nodes, 1}, {time, 35}]}; diff --git a/lib/kernel/test/interactive_shell_SUITE.erl b/lib/kernel/test/interactive_shell_SUITE.erl index c0db292ba5..66a01b1849 100644 --- a/lib/kernel/test/interactive_shell_SUITE.erl +++ b/lib/kernel/test/interactive_shell_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -17,8 +17,10 @@ %% %CopyrightEnd% %% -module(interactive_shell_SUITE). --include("test_server.hrl"). --export([all/1, get_columns_and_rows/1, exit_initial/1, job_control_local/1, +-include_lib("test_server/include/test_server.hrl"). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + get_columns_and_rows/1, exit_initial/1, job_control_local/1, job_control_remote/1, job_control_remote_noshell/1]). @@ -44,10 +46,28 @@ end_per_testcase(_Func, Config) -> test_server:timetrap_cancel(Dog). -all(suite) -> - [get_columns_and_rows, exit_initial, job_control_local, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [get_columns_and_rows, exit_initial, job_control_local, job_control_remote, job_control_remote_noshell]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %-define(DEBUG,1). -ifdef(DEBUG). -define(dbg(Data),erlang:display(Data)). diff --git a/lib/kernel/test/kernel.cover b/lib/kernel/test/kernel.cover index 228dafc565..f6967ca651 100644 --- a/lib/kernel/test/kernel.cover +++ b/lib/kernel/test/kernel.cover @@ -1,4 +1,3 @@ %% -*- erlang -*- -{exclude,all}. -{include,[gen_udp,inet6_udp,inet_res,inet_dns]}. +{incl_mods,[gen_udp,inet6_udp,inet_res,inet_dns]}. diff --git a/lib/kernel/test/kernel.dynspec b/lib/kernel/test/kernel.dynspec deleted file mode 100644 index 297a7c71ea..0000000000 --- a/lib/kernel/test/kernel.dynspec +++ /dev/null @@ -1,57 +0,0 @@ -%% -*- erlang -*- -%% You can test this file using this command. -%% file:script("kernel.dynspec", [{'Os',"Unix"}]). - -case Os of - "VxWorks" -> - FsCantHandle = "VxWorks filesystem can't handle this", - FsOverload = "VxWorks filesystem would overload", - CantHandle = "VxWorks can't handle this", - SlaveMisadaption = "Test not adopted to slaves on different machine", - [{skip,{application_SUITE, - "VxWorks: requires manual testing "++ - "(requires multiple nodes (OTP-1774))"}}, - {skip,{bif_SUITE, spawn_link_race1, "Known bug."}}, - {skip,{erl_distribution_SUITE, "VxWorks: More vx nodes needed"}}, - {skip,{file_SUITE,read_write_file,FsCantHandle}}, - {skip,{file_SUITE,cur_dir_0,FsCantHandle}}, - {skip,{file_SUITE,open1,FsCantHandle}}, - {skip,{file_SUITE,file_info_times,FsCantHandle}}, - {skip,{file_SUITE,file_write_file_info,FsCantHandle}}, - {skip,{file_SUITE,truncate,FsCantHandle}}, - {skip,{file_SUITE,rename,FsCantHandle}}, - {skip,{file_SUITE,e_delete,FsCantHandle}}, - {skip,{file_SUITE,e_rename,FsCantHandle}}, - {skip,{file_SUITE,delayed_write,FsCantHandle}}, - {skip,{file_SUITE,read_ahead,FsCantHandle}}, - {skip,{file_SUITE,segment_write,FsOverload}}, - {skip,{file_SUITE,segment_read,FsOverload}}, - {skip,{file_SUITE,compress_errors,FsCantHandle}}, - {skip,{global_SUITE, - "To heavy on slavenodes for VxWorks (and more)."}}, - {skip,{global_group_SUITE, "To heavy on slavenodes for VxWorks."}}, - {skip,{heart_SUITE, "Not for VxWorks heart, it's special"}}, - {skip,{init_SUITE,restart,"Uses peer nodes"}}, - {skip,{kernel_config_SUITE, "VxWorks does not support slave nodes"}}, - {skip,{os_SUITE,space_in_cwd,CantHandle}}, - {skip,{os_SUITE,space_in_name,CantHandle}}, - {skip,{os_SUITE,quoting,CantHandle}}, - {skip,{prim_file_SUITE,open1,FsCantHandle}}, - {skip,{prim_file_SUITE,compress_errors,FsCantHandle}}, - {skip,{seq_trace_SUITE,distributed_recv,SlaveMisadaption}}, - {skip,{seq_trace_SUITE,distributed_exit,SlaveMisadaption}}]; - _ -> - [] -end ++ -try gen_sctp:open() of - {ok,Socket} -> - gen_sctp:close(Socket), - []; - _ -> - [] -catch - error:badarg -> - [{skip,{gen_sctp_SUITE,"SCTP not supported on this machine"}}]; - _:_ -> - [] -end. diff --git a/lib/kernel/test/kernel.spec b/lib/kernel/test/kernel.spec new file mode 100644 index 0000000000..62afc9f97b --- /dev/null +++ b/lib/kernel/test/kernel.spec @@ -0,0 +1,4 @@ +{config, "../test_server/ts.config"}. +{config, "../test_server/ts.unix.config"}. + +{suites,"../kernel_test", all}. diff --git a/lib/kernel/test/kernel.spec.wxworks b/lib/kernel/test/kernel.spec.wxworks new file mode 100644 index 0000000000..370e474e64 --- /dev/null +++ b/lib/kernel/test/kernel.spec.wxworks @@ -0,0 +1,63 @@ +%% -*- erlang -*- +{suites,"kernel_test",all}. +{skip_cases,"kernel_test",bif_SUITE,[spawn_link_race1],"Known bug."}. +{skip_cases,"kernel_test",file_SUITE, + [read_write_file], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [cur_dir_0], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [open1], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [file_info_times], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [file_write_file_info], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [truncate], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [rename], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [e_delete], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [e_rename], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [delayed_write], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [read_ahead], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [segment_write], + "VxWorks filesystem would overload"}. +{skip_cases,"kernel_test",file_SUITE, + [segment_read], + "VxWorks filesystem would overload"}. +{skip_cases,"kernel_test",file_SUITE, + [compress_errors], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",init_SUITE,[restart],"Uses peer nodes"}. +{skip_cases,"kernel_test",os_SUITE,[space_in_cwd],"VxWorks can't handle this"}. +{skip_cases,"kernel_test",os_SUITE, + [space_in_name], + "VxWorks can't handle this"}. +{skip_cases,"kernel_test",os_SUITE,[quoting],"VxWorks can't handle this"}. +{skip_cases,"kernel_test",prim_file_SUITE, + [open1], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",prim_file_SUITE, + [compress_errors], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",seq_trace_SUITE, + [distributed_recv], + "Test not adopted to slaves on different machine"}. +{skip_cases,"kernel_test",seq_trace_SUITE, + [distributed_exit], + "Test not adopted to slaves on different machine"}. diff --git a/lib/kernel/test/kernel_SUITE.erl b/lib/kernel/test/kernel_SUITE.erl index bb1d905de3..02b6edf0bd 100644 --- a/lib/kernel/test/kernel_SUITE.erl +++ b/lib/kernel/test/kernel_SUITE.erl @@ -20,15 +20,16 @@ %%% Kernel application test suite. %%%----------------------------------------------------------------- -module(kernel_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). % Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). % Test cases must be exported. -export([app_test/1]). @@ -36,15 +37,31 @@ %% %% all/1 %% -all(doc) -> - []; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [app_test]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/kernel/test/kernel_config_SUITE.erl b/lib/kernel/test/kernel_config_SUITE.erl index c72fc3f02d..deef248956 100644 --- a/lib/kernel/test/kernel_config_SUITE.erl +++ b/lib/kernel/test/kernel_config_SUITE.erl @@ -18,23 +18,35 @@ %% -module(kernel_config_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, sync/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, sync/1]). --export([init/1, fini/1]). +-export([init_per_suite/1, end_per_suite/1]). -all(suite) -> - [{conf, init, [sync], fini}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -init(doc) -> []; -init(suite) -> []; -init(Config) when is_list(Config) -> +all() -> + [sync]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(doc) -> []; +init_per_suite(suite) -> []; +init_per_suite(Config) when is_list(Config) -> Config. -fini(doc) -> []; -fini(suite) -> []; -fini(Config) when is_list(Config) -> +end_per_suite(doc) -> []; +end_per_suite(suite) -> []; +end_per_suite(Config) when is_list(Config) -> stop_node(init_test), Config. diff --git a/lib/kernel/test/myApp.erl b/lib/kernel/test/myApp.erl index 2b92046141..26dc74f91b 100644 --- a/lib/kernel/test/myApp.erl +++ b/lib/kernel/test/myApp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl index ace9501d18..b08b12c978 100644 --- a/lib/kernel/test/os_SUITE.erl +++ b/lib/kernel/test/os_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -18,15 +18,34 @@ %% -module(os_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([space_in_cwd/1, quoting/1, space_in_name/1, bad_command/1, find_executable/1, unix_comment_in_command/1, evil/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [space_in_cwd, quoting, space_in_name, bad_command, + find_executable, unix_comment_in_command, evil]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [space_in_cwd, quoting, space_in_name, bad_command, find_executable, - unix_comment_in_command, evil]. space_in_cwd(doc) -> "Test that executing a command in a current working directory " @@ -156,6 +175,21 @@ find_executable(Config) when is_list(Config) -> ?line find_exe(Current, "my_batch", ".bat", Path), ok; {unix, _} -> + DataDir = ?config(data_dir, Config), + + %% Smoke test. + case lib:progname() of + erl -> + ?line ErlPath = os:find_executable("erl"), + ?line true = is_list(ErlPath), + ?line true = filelib:is_regular(ErlPath); + _ -> + %% Don't bother -- the progname could include options. + ok + end, + + %% Never return a directory name. + ?line false = os:find_executable("unix", [DataDir]), ok; vxworks -> ok @@ -204,8 +238,9 @@ evil(Config) when is_list(Config) -> evil_loop(Parent, ?EVIL_LOOPS,N) end) end, lists:seq(1, ?EVIL_PROCS)), - Devil = spawn(fun () -> devil(hd(Ps), hd(lists:reverse(Ps))) end), + Devil = spawn_link(fun () -> devil(hd(Ps), hd(lists:reverse(Ps))) end), lists:foreach(fun (P) -> receive {P, done} -> ok end end, Ps), + unlink(Devil), exit(Devil, kill), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/kernel/test/pdict_SUITE.erl b/lib/kernel/test/pdict_SUITE.erl index 87ee951a0c..d41ad41350 100644 --- a/lib/kernel/test/pdict_SUITE.erl +++ b/lib/kernel/test/pdict_SUITE.erl @@ -20,7 +20,7 @@ %% NB: The ?line macro cannot be used when testing the dictionary. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(M(A,B),m(A,B,?MODULE,?LINE)). -ifdef(DEBUG). @@ -29,22 +29,41 @@ -define(DEBUGF(A,B), noop). -endif. --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, simple/1, complicated/1, heavy/1, info/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([other_process/2]). init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(test_server:minutes(10)), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [simple, complicated, heavy, info]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + simple(doc) -> ["Tests simple functionality in process dictionary."]; simple(suite) -> diff --git a/lib/kernel/test/pg2_SUITE.erl b/lib/kernel/test/pg2_SUITE.erl index df28dcf447..5dc32440a0 100644 --- a/lib/kernel/test/pg2_SUITE.erl +++ b/lib/kernel/test/pg2_SUITE.erl @@ -20,14 +20,16 @@ %%----------------------------------------------------------------- -module(pg2_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(datadir, ?config(data_dir, Config)). -define(privdir, ?config(priv_dir, Config)). --export([all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). --export([tickets/1, - otp_7277/1, otp_8259/1, otp_8653/1, +-export([ + otp_7277/1, otp_8259/1, otp_8653/1, compat/1, basic/1]). % Default timetrap timeout (set in init_per_testcase). @@ -44,16 +46,33 @@ init_per_testcase(Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{?TESTCASE, Case}, {watchdog, Dog} | Config]. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> Dog = ?config(watchdog, _Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [tickets]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, tickets}]. + +groups() -> + [{tickets, [], + [otp_7277, otp_8259, otp_8653, compat, basic]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -tickets(suite) -> - [otp_7277, otp_8259, otp_8653, compat, basic]. otp_7277(doc) -> "OTP-7277. Bugfix leave()."; diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl index 1688ec45ca..3013af70f6 100644 --- a/lib/kernel/test/prim_file_SUITE.erl +++ b/lib/kernel/test/prim_file_SUITE.erl @@ -17,40 +17,40 @@ %% %CopyrightEnd% %% -module(prim_file_SUITE). --export([all/1, - init/1, fini/1, - read_write_file/1, dirs/1, files/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + read_write_file/1]). -export([cur_dir_0a/1, cur_dir_0b/1, cur_dir_1a/1, cur_dir_1b/1, make_del_dir_a/1, make_del_dir_b/1, - pos/1, pos1/1, pos2/1]). + pos1/1, pos2/1]). -export([close/1, delete_a/1, delete_b/1]). --export([open/1, open1/1, modes/1]). --export([file_info/1, - file_info_basic_file_a/1, file_info_basic_file_b/1, - file_info_basic_directory_a/1, file_info_basic_directory_b/1, - file_info_bad_a/1, file_info_bad_b/1, - file_info_times_a/1, file_info_times_b/1, - file_write_file_info_a/1, file_write_file_info_b/1]). +-export([ open1/1, modes/1]). +-export([ + file_info_basic_file_a/1, file_info_basic_file_b/1, + file_info_basic_directory_a/1, file_info_basic_directory_b/1, + file_info_bad_a/1, file_info_bad_b/1, + file_info_times_a/1, file_info_times_b/1, + file_write_file_info_a/1, file_write_file_info_b/1]). -export([rename_a/1, rename_b/1, access/1, truncate/1, datasync/1, sync/1, read_write/1, pread_write/1, append/1, exclusive/1]). --export([errors/1, e_delete/1, e_rename/1, e_make_dir/1, e_del_dir/1]). +-export([ e_delete/1, e_rename/1, e_make_dir/1, e_del_dir/1]). --export([compression/1, read_not_really_compressed/1, - read_compressed/1, write_compressed/1, - compress_errors/1]). +-export([ read_not_really_compressed/1, + read_compressed/1, write_compressed/1, + compress_errors/1]). --export([links/1, - make_link_a/1, make_link_b/1, - read_link_info_for_non_link/1, - symlinks_a/1, symlinks_b/1, - list_dir_limit/1]). +-export([ + make_link_a/1, make_link_b/1, + read_link_info_for_non_link/1, + symlinks_a/1, symlinks_b/1, + list_dir_limit/1]). -export([advise/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). -define(PRIM_FILE, prim_file). @@ -67,14 +67,47 @@ _ -> apply(?PRIM_FILE, F, [H | A]) end). -all(suite) -> {req, [kernel], - {conf, init, - [read_write_file, dirs, files, - delete_a, delete_b, rename_a, rename_b, errors, - compression, links, list_dir_limit], - fini}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [read_write_file, {group, dirs}, {group, files}, + delete_a, delete_b, rename_a, rename_b, {group, errors}, + {group, compression}, {group, links}, list_dir_limit]. + +groups() -> + [{dirs, [], + [make_del_dir_a, make_del_dir_b, cur_dir_0a, cur_dir_0b, + cur_dir_1a, cur_dir_1b]}, + {files, [], + [{group, open}, {group, pos}, {group, file_info}, + truncate, sync, datasync, advise]}, + {open, [], + [open1, modes, close, access, read_write, pread_write, + append, exclusive]}, + {pos, [], [pos1, pos2]}, + {file_info, [], + [file_info_basic_file_a, file_info_basic_file_b, + file_info_basic_directory_a, + file_info_basic_directory_b, file_info_bad_a, + file_info_bad_b, file_info_times_a, file_info_times_b, + file_write_file_info_a, file_write_file_info_b]}, + {errors, [], + [e_delete, e_rename, e_make_dir, e_del_dir]}, + {compression, [], + [read_compressed, read_not_really_compressed, + write_compressed, compress_errors]}, + {links, [], + [make_link_a, make_link_b, read_link_info_for_non_link, + symlinks_a, symlinks_b]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -init(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> case os:type() of {win32, _} -> Priv = ?config(priv_dir, Config), @@ -91,7 +124,7 @@ init(Config) when is_list(Config) -> Config end. -fini(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> case os:type() of {win32, _} -> os:cmd("subst z: /d"); @@ -190,9 +223,6 @@ read_write_file(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dirs(suite) -> [make_del_dir_a, make_del_dir_b, - cur_dir_0a, cur_dir_0b, - cur_dir_1a, cur_dir_1b]. make_del_dir_a(suite) -> []; make_del_dir_a(doc) -> []; @@ -382,10 +412,7 @@ win_cur_dir_1(_Config, Handle) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -files(suite) -> [open,pos,file_info,truncate,sync,datasync,advise]. -open(suite) -> [open1,modes,close,access,read_write, - pread_write,append,exclusive]. open1(suite) -> []; open1(doc) -> []; @@ -628,7 +655,6 @@ exclusive(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -pos(suite) -> [pos1,pos2]. pos1(suite) -> []; pos1(doc) -> []; @@ -716,12 +742,6 @@ pos2(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -file_info(suite) -> [file_info_basic_file_a, file_info_basic_file_b, - file_info_basic_directory_a, - file_info_basic_directory_b, - file_info_bad_a, file_info_bad_b, - file_info_times_a, file_info_times_b, - file_write_file_info_a, file_write_file_info_b]. file_info_basic_file_a(suite) -> []; file_info_basic_file_a(doc) -> []; @@ -1298,7 +1318,6 @@ rename(Config, Handle, Suffix) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -errors(suite) -> [e_delete, e_rename, e_make_dir, e_del_dir]. e_delete(suite) -> []; e_delete(doc) -> []; @@ -1550,8 +1569,6 @@ e_del_dir(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -compression(suite) -> [read_compressed, read_not_really_compressed, - write_compressed, compress_errors]. %% Trying reading and positioning from a compressed file. @@ -1704,11 +1721,6 @@ compress_errors(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -links(doc) -> "Test the link functions."; -links(suite) -> - [make_link_a, make_link_b, - read_link_info_for_non_link, - symlinks_a, symlinks_b]. make_link_a(doc) -> "Test creating a hard link."; make_link_a(suite) -> []; diff --git a/lib/kernel/test/ram_file_SUITE.erl b/lib/kernel/test/ram_file_SUITE.erl index 798a37d3dc..5f9ccaa34f 100644 --- a/lib/kernel/test/ram_file_SUITE.erl +++ b/lib/kernel/test/ram_file_SUITE.erl @@ -19,14 +19,15 @@ -module(ram_file_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, %% init/1, fini/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). -export([open_modes/1, open_old_modes/1, pread_pwrite/1, position/1, truncate/1, sync/1, get_set_file/1, compress/1, uuencode/1, large_file_errors/1, large_file_light/1, large_file_heavy/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). -define(FILE_MODULE, file). % Name of module to test @@ -34,11 +35,29 @@ %%-------------------------------------------------------------------------- -all(suite) -> - [open_modes, open_old_modes, pread_pwrite, position, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [open_modes, open_old_modes, pread_pwrite, position, truncate, sync, get_set_file, compress, uuencode, large_file_errors, large_file_light, large_file_heavy]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Time = case Func of @@ -51,7 +70,7 @@ init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> %% error_logger:info_msg("~p:~p *****~n", [?MODULE, Func]), [{watchdog, Dog} | Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> %% error_logger:info_msg("~p:~p END *****~n", [?MODULE, Func]), Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog). diff --git a/lib/kernel/test/rpc_SUITE.erl b/lib/kernel/test/rpc_SUITE.erl index 2b7de40797..895441251a 100644 --- a/lib/kernel/test/rpc_SUITE.erl +++ b/lib/kernel/test/rpc_SUITE.erl @@ -18,7 +18,8 @@ %% -module(rpc_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([call/1, block_call/1, multicall/1, multicall_timeout/1, multicall_dies/1, multicall_node_dies/1, called_dies/1, called_node_dies/1, @@ -26,13 +27,31 @@ -export([suicide/2, suicide/3, f/0, f2/0]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [call, block_call, multicall, multicall_timeout, + multicall_dies, multicall_node_dies, called_dies, + called_node_dies, called_throws, call_benchmark, + async_call]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [call, block_call, multicall, multicall_timeout, - multicall_dies, multicall_node_dies, - called_dies, called_node_dies, - called_throws, call_benchmark, async_call]. call(doc) -> "Test different rpc calls"; diff --git a/lib/kernel/test/seq_trace_SUITE.erl b/lib/kernel/test/seq_trace_SUITE.erl index b557c7fb1e..9637e18959 100644 --- a/lib/kernel/test/seq_trace_SUITE.erl +++ b/lib/kernel/test/seq_trace_SUITE.erl @@ -18,7 +18,9 @@ %% -module(seq_trace_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2]). -export([token_set_get/1, tracer_set_get/1, print/1, send/1, distributed_send/1, recv/1, distributed_recv/1, trace_exit/1, distributed_exit/1, call/1, port/1, @@ -29,21 +31,40 @@ start_tracer/0, stop_tracer/1, do_match_set_seq_token/1, do_gc_seq_token/1, countdown_start/2]). -%-define(line_trace, 1). --include("test_server.hrl"). + %-define(line_trace, 1). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(1)). -all(suite) -> [token_set_get, tracer_set_get, print, - send, distributed_send, recv, distributed_recv, - trace_exit, distributed_exit, call, port, - match_set_seq_token, gc_seq_token]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [token_set_get, tracer_set_get, print, send, + distributed_send, recv, distributed_recv, trace_exit, + distributed_exit, call, port, match_set_seq_token, + gc_seq_token]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog = test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/kernel/test/topApp.erl b/lib/kernel/test/topApp.erl index acf98e6da0..f44e99f738 100644 --- a/lib/kernel/test/topApp.erl +++ b/lib/kernel/test/topApp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/topApp2.erl b/lib/kernel/test/topApp2.erl index 4587910ff3..b791d4a914 100644 --- a/lib/kernel/test/topApp2.erl +++ b/lib/kernel/test/topApp2.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/topApp3.erl b/lib/kernel/test/topApp3.erl index 1bb6f2f31a..456ef5b2fb 100644 --- a/lib/kernel/test/topApp3.erl +++ b/lib/kernel/test/topApp3.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/kernel/test/wrap_log_reader_SUITE.erl b/lib/kernel/test/wrap_log_reader_SUITE.erl index ceac593e44..b4a9b578eb 100644 --- a/lib/kernel/test/wrap_log_reader_SUITE.erl +++ b/lib/kernel/test/wrap_log_reader_SUITE.erl @@ -28,31 +28,53 @@ -define(config(X,Y), foo). -define(t,test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -define(privdir(Conf), ?config(priv_dir, Conf)). -endif. --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, no_file/1, - one/1, one_empty/1, one_filled/1, - two/1, two_filled/1, - four/1, four_filled/1, - wrap/1, wrap_filled/1, + one_empty/1, one_filled/1, + two_filled/1, + four_filled/1, + wrap_filled/1, wrapping/1, external/1, error/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [no_file, {group, one}, {group, two}, {group, four}, + {group, wrap}, wrapping, external, error]. + +groups() -> + [{one, [], [one_empty, one_filled]}, + {two, [], [two_filled]}, {four, [], [four_filled]}, + {wrap, [], [wrap_filled]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [no_file, one, two, four, wrap, wrapping, external, error]. init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:seconds(60)), [{watchdog, Dog} | Config]. -fin_per_testcase(_Func, _Config) -> +end_per_testcase(_Func, _Config) -> Dog=?config(watchdog, _Config), ?t:timetrap_cancel(Dog). @@ -76,8 +98,6 @@ no_file(Conf) when is_list(Conf) -> delete_files(File), ok. -one(suite) -> [one_empty, one_filled]; -one(doc) -> ["One index file"]. one_empty(suite) -> []; one_empty(doc) -> ["One empty index file"]; @@ -139,8 +159,6 @@ test_one(File) -> {chunk, 1, ["first round, two"]}, eof], wlt, ?LINE), ok. -two(suite) -> [two_filled]; -two(doc) -> ["Two index files"]. two_filled(suite) -> []; two_filled(doc) -> ["Two filled index files"]; @@ -181,8 +199,6 @@ test_two(File) -> {chunk, 2, ["first round, 12"]}, eof], wlt, ?LINE), ok. -four(suite) -> [four_filled]; -four(doc) -> ["Four index files"]. four_filled(suite) -> []; four_filled(doc) -> ["Four filled index files"]; @@ -226,8 +242,6 @@ test_four(File) -> {chunk, 2, ["first round, 42"]}, eof], wlt, ?LINE), ok. -wrap(suite) -> [wrap_filled]; -wrap(doc) -> ["Wrap index file, first wrapping"]. wrap_filled(suite) -> []; wrap_filled(doc) -> ["First wrap, open, filled index file"]; diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl index f20c9a176b..170f685390 100644 --- a/lib/kernel/test/zlib_SUITE.erl +++ b/lib/kernel/test/zlib_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -19,7 +19,7 @@ -module(zlib_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -compile(export_all). @@ -48,7 +48,7 @@ init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). @@ -69,33 +69,40 @@ error(Format, Args, File, Line) -> %% end, %% log("<>ERROR<>~n" ++ Format, Args, File, Line). -all(suite) -> - [api, examples, func, smp, otp_7359]. - -api(doc) -> "Basic the api tests"; -api(suite) -> - [api_open_close, - api_deflateInit, - api_deflateSetDictionary, - api_deflateReset, - api_deflateParams, - api_deflate, - api_deflateEnd, - api_inflateInit, - api_inflateSetDictionary, - api_inflateSync, - api_inflateReset, - api_inflate, - api_inflateEnd, - api_setBufsz, - api_getBufsz, - api_crc32, - api_adler32, - api_getQSize, - api_un_compress, - api_un_zip, -% api_g_un_zip_file, - api_g_un_zip]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, api}, {group, examples}, {group, func}, smp, + otp_7359]. + +groups() -> + [{api, [], + [api_open_close, api_deflateInit, + api_deflateSetDictionary, api_deflateReset, + api_deflateParams, api_deflate, api_deflateEnd, + api_inflateInit, api_inflateSetDictionary, + api_inflateSync, api_inflateReset, api_inflate, + api_inflateEnd, api_setBufsz, api_getBufsz, api_crc32, + api_adler32, api_getQSize, api_un_compress, api_un_zip, + api_g_un_zip]}, + {examples, [], [intro]}, + {func, [], + [zip_usage, gz_usage, gz_usage2, compress_usage, + dictionary_usage, large_deflate, crc, adler]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + api_open_close(doc) -> "Test open/0 and close/1"; api_open_close(suite) -> []; @@ -517,11 +524,6 @@ bad_len_data() -> %% zlib:zip(<<42>>), one byte changed. <<31,139,8,0,0,0,0,0,0,3,211,2,0,91,38,185,9,2,0,0,0>>. -examples(doc) -> "Test the doc examples"; -examples(suite) -> - [ - intro - ]. intro(suite) -> []; intro(doc) -> ""; @@ -551,15 +553,6 @@ intro(Config) when is_list(Config) -> Orig = list_to_binary(lists:duplicate(5, D)), ?m(Orig, zlib:uncompress(Res)). -func(doc) -> "Test the functionality"; -func(suite) -> - [zip_usage, gz_usage, gz_usage2, compress_usage, - dictionary_usage, - large_deflate, - %% inflateSync, - crc, - adler - ]. large_deflate(doc) -> "Test deflate large file, which had a bug reported on erlang-bugs"; large_deflate(suite) -> []; diff --git a/lib/kernel/vsn.mk b/lib/kernel/vsn.mk index 03fe63e385..e33b90a274 100644 --- a/lib/kernel/vsn.mk +++ b/lib/kernel/vsn.mk @@ -1 +1 @@ -KERNEL_VSN = 2.14.2 +KERNEL_VSN = 2.14.3 diff --git a/lib/megaco/test/megaco.cover b/lib/megaco/test/megaco.cover index e7764017d4..be21216c24 100644 --- a/lib/megaco/test/megaco.cover +++ b/lib/megaco/test/megaco.cover @@ -1,5 +1,7 @@ +{incl_app,megaco,details}. + %% -*- erlang -*- -{exclude, +{excl_mods, megaco, [megaco_encoder, megaco_edist_compress, megaco_filter, diff --git a/lib/megaco/test/megaco.spec b/lib/megaco/test/megaco.spec index 7493bd5df8..cab8499835 100644 --- a/lib/megaco/test/megaco.spec +++ b/lib/megaco/test/megaco.spec @@ -1,5 +1,2 @@ -{topcase, {dir, "../megaco_test"}}. -{require_nodenames, 1}. -%{skip, {megaco_digit_map_test, all, "Not yet implemented"}}. -{skip, {megaco_measure_test, all, "Not yet implemented"}}. -%{skip, {M, F, "Not yet implemented"}}. +{suites,"../megaco_test",all}. +{skip_cases,"../megaco_test",megaco_measure_test,[all],"Not yet implemented"}. diff --git a/lib/megaco/test/megaco_SUITE.erl b/lib/megaco/test/megaco_SUITE.erl index 1bb3a570a4..4faa6736e6 100644 --- a/lib/megaco/test/megaco_SUITE.erl +++ b/lib/megaco/test/megaco_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -36,8 +36,8 @@ t(Case) -> megaco_test_lib:t({?MODULE, Case}). init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). init() -> process_flag(trap_exit, true), @@ -46,97 +46,75 @@ init() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - app_test, - appup_test, - config, - flex, - udp, - tcp, - examples, - %% call_flow, - digit_map, - mess, - measure, - binary_term_id, - codec, - sdp, - mib, - trans, - actions, - load, - pending_limit, - segmented, - timer - ]. +suite() -> [{ct_hooks,[{ts_install_cth,[{nodenames,1}]}]}]. + +all() -> + [{group, app_test}, {group, appup_test}, + {group, config}, {group, flex}, {group, udp}, + {group, tcp}, {group, examples}, {group, digit_map}, + {group, mess}, {group, measure}, + {group, binary_term_id}, {group, codec}, {group, sdp}, + {group, mib}, {group, trans}, {group, actions}, + {group, load}, {group, pending_limit}, + {group, segmented}, {group, timer}]. + +groups() -> + [{tickets, [], [{group, mess}, {group, codec}]}, + {app_test, [], [{megaco_app_test, all}]}, + {appup_test, [], [{megaco_appup_test, all}]}, + {config, [], [{megaco_config_test, all}]}, + {call_flow, [], [{megaco_call_flow_test, all}]}, + {digit_map, [], [{megaco_digit_map_test, all}]}, + {mess, [], [{megaco_mess_test, all}]}, + {udp, [], [{megaco_udp_test, all}]}, + {tcp, [], [{megaco_tcp_test, all}]}, + {examples, [], [{megaco_examples_test, all}]}, + {measure, [], [{megaco_measure_test, all}]}, + {binary_term_id, [], + [{megaco_binary_term_id_test, all}]}, + {codec, [], [{megaco_codec_test, all}]}, + {sdp, [], [{megaco_sdp_test, all}]}, + {mib, [], [{megaco_mib_test, all}]}, + {trans, [], [{megaco_trans_test, all}]}, + {actions, [], [{megaco_actions_test, all}]}, + {load, [], [{megaco_load_test, all}]}, + {pending_limit, [], [{megaco_pending_limit_test, all}]}, + {segmented, [], [{megaco_segment_test, all}]}, + {timer, [], [{megaco_timer_test, all}]}, + {flex, [], [{megaco_flex_test, all}]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -tickets(suite) -> - [ - mess, - codec - ]. -app_test(suite) -> - [{megaco_app_test, all}]. -appup_test(suite) -> - [{megaco_appup_test, all}]. -config(suite) -> - [{megaco_config_test, all}]. -call_flow(suite) -> - [{megaco_call_flow_test, all}]. -digit_map(suite) -> - [{megaco_digit_map_test, all}]. -mess(suite) -> - [{megaco_mess_test, all}]. -udp(suite) -> - [{megaco_udp_test, all}]. -tcp(suite) -> - [{megaco_tcp_test, all}]. -examples(suite) -> - [{megaco_examples_test, all}]. -measure(suite) -> - [{megaco_measure_test, all}]. -binary_term_id(suite) -> - [{megaco_binary_term_id_test, all}]. -codec(suite) -> - [{megaco_codec_test, all}]. -sdp(suite) -> - [{megaco_sdp_test, all}]. -mib(suite) -> - [{megaco_mib_test, all}]. -trans(suite) -> - [{megaco_trans_test, all}]. -actions(suite) -> - [{megaco_actions_test, all}]. -load(suite) -> - [{megaco_load_test, all}]. -pending_limit(suite) -> - [{megaco_pending_limit_test, all}]. -segmented(suite) -> - [{megaco_segment_test, all}]. -timer(suite) -> - [{megaco_timer_test, all}]. -flex(suite) -> - [{megaco_flex_test, all}]. diff --git a/lib/megaco/test/megaco_actions_test.erl b/lib/megaco/test/megaco_actions_test.erl index d493022ca1..2efb6e834a 100644 --- a/lib/megaco/test/megaco_actions_test.erl +++ b/lib/megaco/test/megaco_actions_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -72,28 +72,25 @@ init_per_testcase(Case, Config) -> process_flag(trap_exit, true), megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> process_flag(trap_exit, false), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - pretty_text, - flex_pretty_text, - compact_text, - flex_compact_text, - erl_dist, - erl_dist_mc, - ber_bin, - ber_bin_drv, - ber_bin_native, - ber_bin_drv_native - ], - Cases. +all() -> + [pretty_text, flex_pretty_text, compact_text, + flex_compact_text, erl_dist, erl_dist_mc, ber_bin, + ber_bin_drv, ber_bin_native, ber_bin_drv_native]. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_app_test.erl b/lib/megaco/test/megaco_app_test.erl index 597ec26338..0bfa388ef6 100644 --- a/lib/megaco/test/megaco_app_test.erl +++ b/lib/megaco/test/megaco_app_test.erl @@ -39,28 +39,30 @@ init_per_testcase(undef_funcs = Case, Config) -> init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - fields, - modules, - exportall, - app_depend, - undef_funcs - ], - {req, [], {conf, app_init, Cases, app_fin}}. +all() -> + [fields, modules, exportall, app_depend, + undef_funcs]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -app_init(suite) -> []; -app_init(doc) -> []; -app_init(Config) when is_list(Config) -> +init_per_suite(suite) -> []; +init_per_suite(doc) -> []; +init_per_suite(Config) when is_list(Config) -> case is_app(megaco) of {ok, AppFile} -> io:format("AppFile: ~n~p~n", [AppFile]), @@ -96,9 +98,9 @@ is_app(App) -> end. -app_fin(suite) -> []; -app_fin(doc) -> []; -app_fin(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. diff --git a/lib/megaco/test/megaco_appup_mg.erl b/lib/megaco/test/megaco_appup_mg.erl index f6060e406b..bb8b098f5d 100644 --- a/lib/megaco/test/megaco_appup_mg.erl +++ b/lib/megaco/test/megaco_appup_mg.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 diff --git a/lib/megaco/test/megaco_appup_mgc.erl b/lib/megaco/test/megaco_appup_mgc.erl index b6e53655f8..49c5f24852 100644 --- a/lib/megaco/test/megaco_appup_mgc.erl +++ b/lib/megaco/test/megaco_appup_mgc.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 diff --git a/lib/megaco/test/megaco_appup_test.erl b/lib/megaco/test/megaco_appup_test.erl index 09732c6a4d..a49ab0a968 100644 --- a/lib/megaco/test/megaco_appup_test.erl +++ b/lib/megaco/test/megaco_appup_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% 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 @@ -37,25 +37,31 @@ t(Case) -> megaco_test_lib:t({?MODULE, Case}). init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - appup - ], - {req, [], {conf, appup_init, Cases, appup_fin}}. +all() -> + [appup]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -appup_init(suite) -> []; -appup_init(doc) -> []; -appup_init(Config) when is_list(Config) -> +init_per_suite(suite) -> []; +init_per_suite(doc) -> []; +init_per_suite(Config) when is_list(Config) -> AppFile = file_name(?APPLICATION, ".app"), AppupFile = file_name(?APPLICATION, ".appup"), [{app_file, AppFile}, {appup_file, AppupFile}|Config]. @@ -66,9 +72,9 @@ file_name(App, Ext) -> filename:join([LibDir, "ebin", atom_to_list(App) ++ Ext]). -appup_fin(suite) -> []; -appup_fin(doc) -> []; -appup_fin(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. diff --git a/lib/megaco/test/megaco_binary_term_id_test.erl b/lib/megaco/test/megaco_binary_term_id_test.erl index da4e69c617..47a7a76c1c 100644 --- a/lib/megaco/test/megaco_binary_term_id_test.erl +++ b/lib/megaco/test/megaco_binary_term_id_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -37,8 +37,8 @@ -export([t/0]). %% Test suite exports --export([all/1, encode_first/1, decode_first/1, - init_per_testcase/2, fin_per_testcase/2]). +-export([all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). %%---------------------------------------------------------------------- @@ -57,25 +57,25 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - encode_first, - decode_first - ]. +all() -> + [{group, encode_first}, {group, decode_first}]. -encode_first(suite) -> - encode_first_cases(). +groups() -> + [{encode_first, [], encode_first_cases()}, + {decode_first, [], decode_first_cases()}]. -decode_first(suite) -> - decode_first_cases(). +init_per_group(_GroupName, Config) -> + Config. +end_per_group(_GroupName, Config) -> + Config. %% Test server callbacks init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%====================================================================== @@ -89,11 +89,12 @@ t() -> cases() -> encode_first_cases() ++ decode_first_cases(). -encode_first_cases() -> [te01,te02,te03,te04,te05, - te06,te07,te08,te09,te10, - te11,te12,te13,te14,te15, - te16,te17,te18,te19]. -decode_first_cases() -> [td01,td02,td03,td04,td05,td06]. +encode_first_cases() -> +[te01, te02, te03, te04, te05, te06, te07, te08, te09, + te10, te11, te12, te13, te14, te15, te16, te17, te18, + te19]. +decode_first_cases() -> +[td01, td02, td03, td04, td05, td06]. do(Case) -> case doc(Case) of diff --git a/lib/megaco/test/megaco_call_flow_test.erl b/lib/megaco/test/megaco_call_flow_test.erl index a25a7924e8..b9d64ca8b2 100644 --- a/lib/megaco/test/megaco_call_flow_test.erl +++ b/lib/megaco/test/megaco_call_flow_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -50,37 +50,25 @@ t(Case) -> megaco_test_lib:t({?MODULE, Case}). init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - text, - binary - ]. +all() -> + [{group, text}, {group, binary}]. -text(suite) -> - [ - pretty, - compact - ]. +groups() -> + [{text, [], [pretty, compact]}, + {flex, [], [pretty_flex, compact_flex]}, + {binary, [], [bin, ber, ber_bin, per]}]. -flex(suite) -> - [ - pretty_flex, - compact_flex - ]. +init_per_group(_GroupName, Config) -> + Config. -binary(suite) -> - [ - bin, - ber, - ber_bin, - per - ]. +end_per_group(_GroupName, Config) -> + Config. pretty(suite) -> []; diff --git a/lib/megaco/test/megaco_codec_flex_lib.erl b/lib/megaco/test/megaco_codec_flex_lib.erl index de76956711..93bc5d4bbc 100644 --- a/lib/megaco/test/megaco_codec_flex_lib.erl +++ b/lib/megaco/test/megaco_codec_flex_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 diff --git a/lib/megaco/test/megaco_codec_mini_test.erl b/lib/megaco/test/megaco_codec_mini_test.erl index e509739bb1..ff0c154c7c 100644 --- a/lib/megaco/test/megaco_codec_mini_test.erl +++ b/lib/megaco/test/megaco_codec_mini_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -34,14 +34,14 @@ -export([t/0, t/1]). --export([all/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, tickets/0, - tickets/1, + otp7672_msg01/1, otp7672_msg02/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). %% ---- @@ -49,31 +49,6 @@ -define(SET_DBG(S,D), begin put(severity, S), put(dbg, D) end). -define(RESET_DBG(), begin erase(severity), erase(dbg) end). - -%% ---- - -tickets() -> - Flag = process_flag(trap_exit, true), - Cases = expand(tickets), - Fun = fun(Case) -> - C = init_per_testcase(Case, [{tc_timeout, - timer:minutes(10)}]), - io:format("Eval ~w~n", [Case]), - Result = - case (catch apply(?MODULE, Case, [C])) of - {'EXIT', Reason} -> - io:format("~n~p exited:~n ~p~n", - [Case, Reason]), - {error, {Case, Reason}}; - Res -> - Res - end, - fin_per_testcase(Case, C), - Result - end, - process_flag(trap_exit, Flag), - lists:map(Fun, Cases). - expand(RootCase) -> expand([RootCase], []). @@ -106,24 +81,51 @@ init_per_testcase(Case, Config) -> end, megaco_test_lib:init_per_testcase(Case, C). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> erase(verbosity), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - tickets - ]. +all() -> + [{group, tickets}]. + +groups() -> + [{tickets, [], [otp7672_msg01, otp7672_msg02]}]. + +init_per_group(_GroupName, Config) -> + Config. -tickets(suite) -> - [ - otp7672_msg01, - otp7672_msg02 - ]. +end_per_group(_GroupName, Config) -> + Config. + + + +%% ---- + +tickets() -> + Flag = process_flag(trap_exit, true), + Cases = expand(tickets), + Fun = fun(Case) -> + C = init_per_testcase(Case, [{tc_timeout, + timer:minutes(10)}]), + io:format("Eval ~w~n", [Case]), + Result = + case (catch apply(?MODULE, Case, [C])) of + {'EXIT', Reason} -> + io:format("~n~p exited:~n ~p~n", + [Case, Reason]), + {error, {Case, Reason}}; + Res -> + Res + end, + end_per_testcase(Case, C), + Result + end, + process_flag(trap_exit, Flag), + lists:map(Fun, Cases). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_codec_prev3a_test.erl b/lib/megaco/test/megaco_codec_prev3a_test.erl index 696a72343c..d50e72aef1 100644 --- a/lib/megaco/test/megaco_codec_prev3a_test.erl +++ b/lib/megaco/test/megaco_codec_prev3a_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -36,22 +36,16 @@ -export([t/0, t/1]). --export([all/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, - text/1, - - pretty/1, pretty_test_msgs/1, - - compact/1, + compact_test_msgs/1, - - flex_pretty/1, + flex_pretty_init/1, flex_pretty_finish/1, flex_pretty_test_msgs/1, - - flex_compact/1, + flex_compact_init/1, flex_compact_finish/1, flex_compact_test_msgs/1, @@ -64,32 +58,21 @@ flex_compact_dm_timers6/1, flex_compact_dm_timers7/1, flex_compact_dm_timers8/1, - - binary/1, - bin/1, bin_test_msgs/1, - - ber/1, + ber_test_msgs/1, - - ber_bin/1, + ber_bin_test_msgs/1, - - per/1, + per_test_msgs/1, - - per_bin/1, + per_bin_test_msgs/1, - - erl_dist/1, - erl_dist_m/1, + erl_dist_m_test_msgs/1, tickets/0, - tickets/1, - - compact_tickets/1, + compact_otp4011_msg1/1, compact_otp4011_msg2/1, compact_otp4011_msg3/1, @@ -132,8 +115,7 @@ compact_otp6017_msg01/1, compact_otp6017_msg02/1, compact_otp6017_msg03/1, - - flex_compact_tickets/1, + flex_compact_otp7431_msg01/1, flex_compact_otp7431_msg02/1, flex_compact_otp7431_msg03/1, @@ -141,8 +123,7 @@ flex_compact_otp7431_msg05/1, flex_compact_otp7431_msg06/1, flex_compact_otp7431_msg07/1, - - pretty_tickets/1, + pretty_otp4632_msg1/1, pretty_otp4632_msg2/1, pretty_otp4632_msg3/1, @@ -185,8 +166,7 @@ pretty_otp7671_msg04/1, pretty_otp7671_msg05/1, pretty_otp8114_msg01/1, - - flex_pretty_tickets/1, + flex_pretty_otp5042_msg1/1, flex_pretty_otp5085_msg1/1, flex_pretty_otp5085_msg2/1, @@ -208,7 +188,7 @@ flex_pretty_otp7431_msg06/1, flex_pretty_otp7431_msg07/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). -export([display_text_messages/0]). @@ -263,30 +243,7 @@ expand([Case|Cases], Acc) -> expand(Cases, [Case|Acc]) end. - -%% ---- - -tickets() -> - Flag = process_flag(trap_exit, true), - Cases = expand(tickets), - Fun = fun(Case) -> - C = init_per_testcase(Case, [{tc_timeout, - timer:minutes(10)}]), - io:format("Eval ~w~n", [Case]), - Result = - case (catch apply(?MODULE, Case, [C])) of - {'EXIT', Reason} -> - io:format("~n~p exited:~n ~p~n", - [Case, Reason]), - {error, {Case, Reason}}; - Res -> - Res - end, - fin_per_testcase(Case, C), - Result - end, - process_flag(trap_exit, Flag), - lists:map(Fun, Cases). + %% ---- @@ -306,268 +263,166 @@ init_per_testcase(Case, Config) -> end, megaco_test_lib:init_per_testcase(Case, C). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> erase(verbosity), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - text, - binary, - erl_dist, - tickets - ]. - -text(suite) -> - [ - pretty, - flex_pretty, - compact, - flex_compact - ]. - -binary(suite) -> - [ - bin, - ber, - ber_bin, - per, - per_bin - ]. - -erl_dist(suite) -> - [ - erl_dist_m - ]. - -pretty(suite) -> - [ - pretty_test_msgs - ]. - - -compact(suite) -> - [ - compact_test_msgs - ]. - - -flex_pretty(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_cases(), flex_pretty_finish}}. - -flex_pretty_cases() -> - [ - flex_pretty_test_msgs - ]. - -flex_compact(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_cases(), flex_compact_finish}}. - -flex_compact_cases() -> - [ - flex_compact_test_msgs, - flex_compact_dm_timers1, - flex_compact_dm_timers2, - flex_compact_dm_timers3, - flex_compact_dm_timers4, - flex_compact_dm_timers5, - flex_compact_dm_timers6, - flex_compact_dm_timers7, - flex_compact_dm_timers8 - ]. - - -bin(suite) -> - [ - bin_test_msgs - ]. - - -ber(suite) -> - [ - ber_test_msgs - ]. - - -ber_bin(suite) -> - [ - ber_bin_test_msgs - ]. - - -per(suite) -> - [ - per_test_msgs - ]. - +all() -> + [{group, text}, {group, binary}, {group, erl_dist}, + {group, tickets}]. + +groups() -> + [{text, [], + [{group, pretty}, {group, flex_pretty}, + {group, compact}, {group, flex_compact}]}, + {binary, [], + [{group, bin}, {group, ber}, {group, ber_bin}, + {group, per}, {group, per_bin}]}, + {erl_dist, [], [{group, erl_dist_m}]}, + {pretty, [], [pretty_test_msgs]}, + {compact, [], [compact_test_msgs]}, + {flex_pretty, [], flex_pretty_cases()}, + {flex_compact, [], flex_compact_cases()}, + {bin, [], [bin_test_msgs]}, {ber, [], [ber_test_msgs]}, + {ber_bin, [], [ber_bin_test_msgs]}, + {per, [], [per_test_msgs]}, + {per_bin, [], [per_bin_test_msgs]}, + {erl_dist_m, [], [erl_dist_m_test_msgs]}, + {tickets, [], + [{group, compact_tickets}, + {group, flex_compact_tickets}, {group, pretty_tickets}, + {group, flex_pretty_tickets}]}, + {compact_tickets, [], + [compact_otp4011_msg1, compact_otp4011_msg2, + compact_otp4011_msg3, compact_otp4013_msg1, + compact_otp4085_msg1, compact_otp4085_msg2, + compact_otp4280_msg1, compact_otp4299_msg1, + compact_otp4299_msg2, compact_otp4359_msg1, + compact_otp4920_msg0, compact_otp4920_msg1, + compact_otp4920_msg2, compact_otp4920_msg3, + compact_otp4920_msg4, compact_otp4920_msg5, + compact_otp4920_msg6, compact_otp4920_msg7, + compact_otp4920_msg8, compact_otp4920_msg9, + compact_otp4920_msg10, compact_otp4920_msg11, + compact_otp4920_msg12, compact_otp4920_msg20, + compact_otp4920_msg21, compact_otp4920_msg22, + compact_otp4920_msg23, compact_otp4920_msg24, + compact_otp4920_msg25, compact_otp5186_msg01, + compact_otp5186_msg02, compact_otp5186_msg03, + compact_otp5186_msg04, compact_otp5186_msg05, + compact_otp5186_msg06, compact_otp5793_msg01, + compact_otp5993_msg01, compact_otp5993_msg02, + compact_otp5993_msg03, compact_otp6017_msg01, + compact_otp6017_msg02, compact_otp6017_msg03]}, + {flex_compact_tickets, [], + flex_compact_tickets_cases()}, + {pretty_tickets, [], + [pretty_otp4632_msg1, pretty_otp4632_msg2, + pretty_otp4632_msg3, pretty_otp4632_msg4, + pretty_otp4710_msg1, pretty_otp4710_msg2, + pretty_otp4945_msg1, pretty_otp4945_msg2, + pretty_otp4945_msg3, pretty_otp4945_msg4, + pretty_otp4945_msg5, pretty_otp4945_msg6, + pretty_otp4949_msg1, pretty_otp4949_msg2, + pretty_otp4949_msg3, pretty_otp5042_msg1, + pretty_otp5068_msg1, pretty_otp5085_msg1, + pretty_otp5085_msg2, pretty_otp5085_msg3, + pretty_otp5085_msg4, pretty_otp5085_msg5, + pretty_otp5085_msg6, pretty_otp5085_msg7, + pretty_otp5085_msg8, pretty_otp5600_msg1, + pretty_otp5600_msg2, pretty_otp5601_msg1, + pretty_otp5793_msg01, pretty_otp5882_msg01, + pretty_otp6490_msg01, pretty_otp6490_msg02, + pretty_otp6490_msg03, pretty_otp6490_msg04, + pretty_otp6490_msg05, pretty_otp6490_msg06, + pretty_otp7671_msg01, pretty_otp7671_msg02, + pretty_otp7671_msg03, pretty_otp7671_msg04, + pretty_otp7671_msg05, pretty_otp8114_msg01]}, + {flex_pretty_tickets, [], flex_pretty_tickets_cases()}]. + +init_per_group(flex_pretty_tickets, Config) -> + flex_pretty_init(Config); +init_per_group(flex_compact_tickets, Config) -> + flex_compact_init(Config); +init_per_group(flex_compact, Config) -> + flex_compact_init(Config); +init_per_group(flex_pretty, Config) -> + flex_pretty_init(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(flex_pretty_tickets, Config) -> + flex_pretty_finish(Config); +end_per_group(flex_compact_tickets, Config) -> + flex_compact_finish(Config); +end_per_group(flex_compact, Config) -> + flex_compact_finish(Config); +end_per_group(flex_pretty, Config) -> + flex_pretty_finish(Config); +end_per_group(_GroupName, Config) -> + Config. + +flex_pretty_cases() -> + [flex_pretty_test_msgs]. + + +flex_compact_cases() -> + [flex_compact_test_msgs, flex_compact_dm_timers1, + flex_compact_dm_timers2, flex_compact_dm_timers3, + flex_compact_dm_timers4, flex_compact_dm_timers5, + flex_compact_dm_timers6, flex_compact_dm_timers7, + flex_compact_dm_timers8]. %% Support for per_bin was added to ASN.1 as of version %% 1.3.2 (R8). And later merged into 1.3.1.3 (R7). These %% releases are identical (as far as I know). %% -per_bin(suite) -> - [ - per_bin_test_msgs - ]. - - -erl_dist_m(suite) -> - [ - erl_dist_m_test_msgs - ]. - -tickets(suite) -> - [ - compact_tickets, - flex_compact_tickets, - pretty_tickets, - flex_pretty_tickets - ]. - -compact_tickets(suite) -> - [ - compact_otp4011_msg1, - compact_otp4011_msg2, - compact_otp4011_msg3, - compact_otp4013_msg1, - compact_otp4085_msg1, - compact_otp4085_msg2, - compact_otp4280_msg1, - compact_otp4299_msg1, - compact_otp4299_msg2, - compact_otp4359_msg1, - compact_otp4920_msg0, - compact_otp4920_msg1, - compact_otp4920_msg2, - compact_otp4920_msg3, - compact_otp4920_msg4, - compact_otp4920_msg5, - compact_otp4920_msg6, - compact_otp4920_msg7, - compact_otp4920_msg8, - compact_otp4920_msg9, - compact_otp4920_msg10, - compact_otp4920_msg11, - compact_otp4920_msg12, - compact_otp4920_msg20, - compact_otp4920_msg21, - compact_otp4920_msg22, - compact_otp4920_msg23, - compact_otp4920_msg24, - compact_otp4920_msg25, - compact_otp5186_msg01, - compact_otp5186_msg02, - compact_otp5186_msg03, - compact_otp5186_msg04, - compact_otp5186_msg05, - compact_otp5186_msg06, - compact_otp5793_msg01, - compact_otp5993_msg01, - compact_otp5993_msg02, - compact_otp5993_msg03, - compact_otp6017_msg01, - compact_otp6017_msg02, - compact_otp6017_msg03 - ]. - -flex_compact_tickets(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_tickets_cases(), - flex_compact_finish}}. +flex_compact_tickets_cases() -> + [flex_compact_otp7431_msg01, flex_compact_otp7431_msg02, + flex_compact_otp7431_msg03, flex_compact_otp7431_msg04, + flex_compact_otp7431_msg05, flex_compact_otp7431_msg06, + flex_compact_otp7431_msg07]. + +flex_pretty_tickets_cases() -> + [flex_pretty_otp5042_msg1, flex_pretty_otp5085_msg1, + flex_pretty_otp5085_msg2, flex_pretty_otp5085_msg3, + flex_pretty_otp5085_msg4, flex_pretty_otp5085_msg5, + flex_pretty_otp5085_msg6, flex_pretty_otp5085_msg7, + flex_pretty_otp5085_msg8, flex_pretty_otp5600_msg1, + flex_pretty_otp5600_msg2, flex_pretty_otp5601_msg1, + flex_pretty_otp5793_msg01, flex_pretty_otp7431_msg01, + flex_pretty_otp7431_msg02, flex_pretty_otp7431_msg03, + flex_pretty_otp7431_msg04, flex_pretty_otp7431_msg05, + flex_pretty_otp7431_msg06, flex_pretty_otp7431_msg07]. -flex_compact_tickets_cases() -> - [ - flex_compact_otp7431_msg01, - flex_compact_otp7431_msg02, - flex_compact_otp7431_msg03, - flex_compact_otp7431_msg04, - flex_compact_otp7431_msg05, - flex_compact_otp7431_msg06, - flex_compact_otp7431_msg07 - ]. - - -pretty_tickets(suite) -> - [ - pretty_otp4632_msg1, - pretty_otp4632_msg2, - pretty_otp4632_msg3, - pretty_otp4632_msg4, - pretty_otp4710_msg1, - pretty_otp4710_msg2, - pretty_otp4945_msg1, - pretty_otp4945_msg2, - pretty_otp4945_msg3, - pretty_otp4945_msg4, - pretty_otp4945_msg5, - pretty_otp4945_msg6, - pretty_otp4949_msg1, - pretty_otp4949_msg2, - pretty_otp4949_msg3, - pretty_otp5042_msg1, - pretty_otp5068_msg1, - pretty_otp5085_msg1, - pretty_otp5085_msg2, - pretty_otp5085_msg3, - pretty_otp5085_msg4, - pretty_otp5085_msg5, - pretty_otp5085_msg6, - pretty_otp5085_msg7, - pretty_otp5085_msg8, - pretty_otp5600_msg1, - pretty_otp5600_msg2, - pretty_otp5601_msg1, - pretty_otp5793_msg01, - pretty_otp5882_msg01, - pretty_otp6490_msg01, - pretty_otp6490_msg02, - pretty_otp6490_msg03, - pretty_otp6490_msg04, - pretty_otp6490_msg05, - pretty_otp6490_msg06, - pretty_otp7671_msg01, - pretty_otp7671_msg02, - pretty_otp7671_msg03, - pretty_otp7671_msg04, - pretty_otp7671_msg05, - pretty_otp8114_msg01 - ]. +%% ---- -flex_pretty_tickets(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_tickets_cases(), - flex_pretty_finish}}. - -flex_pretty_tickets_cases() -> - [ - flex_pretty_otp5042_msg1, - flex_pretty_otp5085_msg1, - flex_pretty_otp5085_msg2, - flex_pretty_otp5085_msg3, - flex_pretty_otp5085_msg4, - flex_pretty_otp5085_msg5, - flex_pretty_otp5085_msg6, - flex_pretty_otp5085_msg7, - flex_pretty_otp5085_msg8, - flex_pretty_otp5600_msg1, - flex_pretty_otp5600_msg2, - flex_pretty_otp5601_msg1, - flex_pretty_otp5793_msg01, - flex_pretty_otp7431_msg01, - flex_pretty_otp7431_msg02, - flex_pretty_otp7431_msg03, - flex_pretty_otp7431_msg04, - flex_pretty_otp7431_msg05, - flex_pretty_otp7431_msg06, - flex_pretty_otp7431_msg07 - ]. +tickets() -> + Flag = process_flag(trap_exit, true), + Cases = expand(tickets), + Fun = fun(Case) -> + C = init_per_testcase(Case, [{tc_timeout, + timer:minutes(10)}]), + io:format("Eval ~w~n", [Case]), + Result = + case (catch apply(?MODULE, Case, [C])) of + {'EXIT', Reason} -> + io:format("~n~p exited:~n ~p~n", + [Case, Reason]), + {error, {Case, Reason}}; + Res -> + Res + end, + end_per_testcase(Case, C), + Result + end, + process_flag(trap_exit, Flag), + lists:map(Fun, Cases). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_codec_prev3b_test.erl b/lib/megaco/test/megaco_codec_prev3b_test.erl index b5fe4d2038..eaab8f37c1 100644 --- a/lib/megaco/test/megaco_codec_prev3b_test.erl +++ b/lib/megaco/test/megaco_codec_prev3b_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -36,22 +36,16 @@ -export([t/0, t/1]). --export([all/1, - - text/1, - - pretty/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, + pretty_test_msgs/1, - - compact/1, + compact_test_msgs/1, - flex_pretty/1, flex_pretty_init/1, flex_pretty_finish/1, flex_pretty_test_msgs/1, - - flex_compact/1, + flex_compact_init/1, flex_compact_finish/1, flex_compact_test_msgs/1, @@ -64,32 +58,21 @@ flex_compact_dm_timers6/1, flex_compact_dm_timers7/1, flex_compact_dm_timers8/1, - - binary/1, - bin/1, bin_test_msgs/1, - - ber/1, + ber_test_msgs/1, - - ber_bin/1, + ber_bin_test_msgs/1, - - per/1, + per_test_msgs/1, - - per_bin/1, + per_bin_test_msgs/1, - - erl_dist/1, - erl_dist_m/1, + erl_dist_m_test_msgs/1, tickets/0, - tickets/1, - - compact_tickets/1, + compact_otp4011_msg1/1, compact_otp4011_msg2/1, compact_otp4011_msg3/1, @@ -133,8 +116,7 @@ compact_otp6017_msg01/1, compact_otp6017_msg02/1, compact_otp6017_msg03/1, - - flex_compact_tickets/1, + flex_compact_otp7431_msg01/1, flex_compact_otp7431_msg02/1, flex_compact_otp7431_msg03/1, @@ -142,8 +124,7 @@ flex_compact_otp7431_msg05/1, flex_compact_otp7431_msg06/1, flex_compact_otp7431_msg07/1, - - pretty_tickets/1, + pretty_otp4632_msg1/1, pretty_otp4632_msg2/1, pretty_otp4632_msg3/1, @@ -190,8 +171,7 @@ pretty_otp7671_msg04/1, pretty_otp7671_msg05/1, pretty_otp8114_msg01/1, - - flex_pretty_tickets/1, + flex_pretty_otp5042_msg1/1, flex_pretty_otp5085_msg1/1, flex_pretty_otp5085_msg2/1, @@ -217,7 +197,7 @@ flex_pretty_otp7431_msg06/1, flex_pretty_otp7431_msg07/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). -export([display_text_messages/0, generate_text_messages/0]). @@ -281,31 +261,6 @@ expand([Case|Cases], Acc) -> expand(Cases, [Case|Acc]) end. - -%% ---- - -tickets() -> - Flag = process_flag(trap_exit, true), - Cases = expand(tickets), - Fun = fun(Case) -> - C = init_per_testcase(Case, [{tc_timeout, - timer:minutes(10)}]), - io:format("Eval ~w~n", [Case]), - Result = - case (catch apply(?MODULE, Case, [C])) of - {'EXIT', Reason} -> - io:format("~n~p exited:~n ~p~n", - [Case, Reason]), - {error, {Case, Reason}}; - Res -> - Res - end, - fin_per_testcase(Case, C), - Result - end, - process_flag(trap_exit, Flag), - lists:map(Fun, Cases). - %% ---- @@ -324,276 +279,170 @@ init_per_testcase(Case, Config) -> end, megaco_test_lib:init_per_testcase(Case, C). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> erase(verbosity), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - text, - binary, - erl_dist, - tickets - ]. - -text(suite) -> - [ - pretty, - flex_pretty, - compact, - flex_compact - ]. - -binary(suite) -> - [ - bin, - ber, - ber_bin, - per, - per_bin - ]. - -erl_dist(suite) -> - [ - erl_dist_m - ]. - -pretty(suite) -> - [ - pretty_test_msgs - ]. - - -compact(suite) -> - [ - compact_test_msgs - ]. - - -flex_pretty(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_cases(), flex_pretty_finish}}. - -flex_pretty_cases() -> - [ - flex_pretty_test_msgs - ]. - -flex_compact(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_cases(), flex_compact_finish}}. - -flex_compact_cases() -> - [ - flex_compact_test_msgs, - flex_compact_dm_timers1, - flex_compact_dm_timers2, - flex_compact_dm_timers3, - flex_compact_dm_timers4, - flex_compact_dm_timers5, - flex_compact_dm_timers6, - flex_compact_dm_timers7, - flex_compact_dm_timers8 - ]. - - -bin(suite) -> - [ - bin_test_msgs - ]. - - -ber(suite) -> - [ - ber_test_msgs - ]. - - -ber_bin(suite) -> - [ - ber_bin_test_msgs - ]. - - -per(suite) -> - [ - per_test_msgs - ]. - +all() -> + [{group, text}, {group, binary}, {group, erl_dist}, + {group, tickets}]. + +groups() -> + [{text, [], + [{group, pretty}, {group, flex_pretty}, + {group, compact}, {group, flex_compact}]}, + {binary, [], + [{group, bin}, {group, ber}, {group, ber_bin}, + {group, per}, {group, per_bin}]}, + {erl_dist, [], [{group, erl_dist_m}]}, + {pretty, [], [pretty_test_msgs]}, + {compact, [], [compact_test_msgs]}, + {flex_pretty, [], flex_pretty_cases()}, + {flex_compact, [], flex_compact_cases()}, + {bin, [], [bin_test_msgs]}, {ber, [], [ber_test_msgs]}, + {ber_bin, [], [ber_bin_test_msgs]}, + {per, [], [per_test_msgs]}, + {per_bin, [], [per_bin_test_msgs]}, + {erl_dist_m, [], [erl_dist_m_test_msgs]}, + {tickets, [], + [{group, compact_tickets}, + {group, flex_compact_tickets}, {group, pretty_tickets}, + {group, flex_pretty_tickets}]}, + {compact_tickets, [], + [compact_otp4011_msg1, compact_otp4011_msg2, + compact_otp4011_msg3, compact_otp4013_msg1, + compact_otp4085_msg1, compact_otp4085_msg2, + compact_otp4280_msg1, compact_otp4299_msg1, + compact_otp4299_msg2, compact_otp4359_msg1, + compact_otp4920_msg0, compact_otp4920_msg1, + compact_otp4920_msg2, compact_otp4920_msg3, + compact_otp4920_msg4, compact_otp4920_msg5, + compact_otp4920_msg6, compact_otp4920_msg7, + compact_otp4920_msg8, compact_otp4920_msg9, + compact_otp4920_msg10, compact_otp4920_msg11, + compact_otp4920_msg12, compact_otp4920_msg20, + compact_otp4920_msg21, compact_otp4920_msg22, + compact_otp4920_msg23, compact_otp4920_msg24, + compact_otp4920_msg25, compact_otp5186_msg01, + compact_otp5186_msg02, compact_otp5186_msg03, + compact_otp5186_msg04, compact_otp5186_msg05, + compact_otp5186_msg06, compact_otp5793_msg01, + compact_otp5836_msg01, compact_otp5993_msg01, + compact_otp5993_msg02, compact_otp5993_msg03, + compact_otp6017_msg01, compact_otp6017_msg02, + compact_otp6017_msg03]}, + {flex_compact_tickets, [], + flex_compact_tickets_cases()}, + {pretty_tickets, [], + [pretty_otp4632_msg1, pretty_otp4632_msg2, + pretty_otp4632_msg3, pretty_otp4632_msg4, + pretty_otp4710_msg1, pretty_otp4710_msg2, + pretty_otp4945_msg1, pretty_otp4945_msg2, + pretty_otp4945_msg3, pretty_otp4945_msg4, + pretty_otp4945_msg5, pretty_otp4945_msg6, + pretty_otp4949_msg1, pretty_otp4949_msg2, + pretty_otp4949_msg3, pretty_otp5042_msg1, + pretty_otp5068_msg1, pretty_otp5085_msg1, + pretty_otp5085_msg2, pretty_otp5085_msg3, + pretty_otp5085_msg4, pretty_otp5085_msg5, + pretty_otp5085_msg6, pretty_otp5085_msg7, + pretty_otp5085_msg8, pretty_otp5600_msg1, + pretty_otp5600_msg2, pretty_otp5601_msg1, + pretty_otp5793_msg01, pretty_otp5803_msg01, + pretty_otp5803_msg02, pretty_otp5805_msg01, + pretty_otp5836_msg01, pretty_otp5882_msg01, + pretty_otp6490_msg01, pretty_otp6490_msg02, + pretty_otp6490_msg03, pretty_otp6490_msg04, + pretty_otp6490_msg05, pretty_otp6490_msg06, + pretty_otp7671_msg01, pretty_otp7671_msg02, + pretty_otp7671_msg03, pretty_otp7671_msg04, + pretty_otp7671_msg05, pretty_otp8114_msg01]}, + {flex_pretty_tickets, [], flex_pretty_tickets_cases()}]. + +init_per_group(flex_pretty_tickets, Config) -> + flex_pretty_init(Config); +init_per_group(flex_compact_tickets, Config) -> + flex_compact_init(Config); +init_per_group(flex_compact, Config) -> + flex_compact_init(Config); +init_per_group(flex_pretty, Config) -> + flex_pretty_init(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(flex_pretty_tickets, Config) -> + flex_pretty_finish(Config); +end_per_group(flex_compact_tickets, Config) -> + flex_compact_finish(Config); +end_per_group(flex_compact, Config) -> + flex_compact_finish(Config); +end_per_group(flex_pretty, Config) -> + flex_pretty_finish(Config); +end_per_group(_GroupName, Config) -> + Config. + +flex_pretty_cases() -> + [flex_pretty_test_msgs]. + +flex_compact_cases() -> + [flex_compact_test_msgs, flex_compact_dm_timers1, + flex_compact_dm_timers2, flex_compact_dm_timers3, + flex_compact_dm_timers4, flex_compact_dm_timers5, + flex_compact_dm_timers6, flex_compact_dm_timers7, + flex_compact_dm_timers8]. %% Support for per_bin was added to ASN.1 as of version %% 1.3.2 (R8). And later merged into 1.3.1.3 (R7). These %% releases are identical (as far as I know). %% -per_bin(suite) -> - [ - per_bin_test_msgs - ]. - - -erl_dist_m(suite) -> - [ - erl_dist_m_test_msgs - ]. - -tickets(suite) -> - [ - compact_tickets, - flex_compact_tickets, - pretty_tickets, - flex_pretty_tickets - ]. +flex_compact_tickets_cases() -> + [flex_compact_otp7431_msg01, flex_compact_otp7431_msg02, + flex_compact_otp7431_msg03, flex_compact_otp7431_msg04, + flex_compact_otp7431_msg05, flex_compact_otp7431_msg06, + flex_compact_otp7431_msg07]. + +flex_pretty_tickets_cases() -> + [flex_pretty_otp5042_msg1, flex_pretty_otp5085_msg1, + flex_pretty_otp5085_msg2, flex_pretty_otp5085_msg3, + flex_pretty_otp5085_msg4, flex_pretty_otp5085_msg5, + flex_pretty_otp5085_msg6, flex_pretty_otp5085_msg7, + flex_pretty_otp5085_msg8, flex_pretty_otp5600_msg1, + flex_pretty_otp5600_msg2, flex_pretty_otp5601_msg1, + flex_pretty_otp5793_msg01, flex_pretty_otp5803_msg01, + flex_pretty_otp5803_msg02, flex_pretty_otp5805_msg01, + flex_pretty_otp5836_msg01, flex_pretty_otp7431_msg01, + flex_pretty_otp7431_msg02, flex_pretty_otp7431_msg03, + flex_pretty_otp7431_msg04, flex_pretty_otp7431_msg05, + flex_pretty_otp7431_msg06, flex_pretty_otp7431_msg07]. -compact_tickets(suite) -> - [ - compact_otp4011_msg1, - compact_otp4011_msg2, - compact_otp4011_msg3, - compact_otp4013_msg1, - compact_otp4085_msg1, - compact_otp4085_msg2, - compact_otp4280_msg1, - compact_otp4299_msg1, - compact_otp4299_msg2, - compact_otp4359_msg1, - compact_otp4920_msg0, - compact_otp4920_msg1, - compact_otp4920_msg2, - compact_otp4920_msg3, - compact_otp4920_msg4, - compact_otp4920_msg5, - compact_otp4920_msg6, - compact_otp4920_msg7, - compact_otp4920_msg8, - compact_otp4920_msg9, - compact_otp4920_msg10, - compact_otp4920_msg11, - compact_otp4920_msg12, - compact_otp4920_msg20, - compact_otp4920_msg21, - compact_otp4920_msg22, - compact_otp4920_msg23, - compact_otp4920_msg24, - compact_otp4920_msg25, - compact_otp5186_msg01, - compact_otp5186_msg02, - compact_otp5186_msg03, - compact_otp5186_msg04, - compact_otp5186_msg05, - compact_otp5186_msg06, - compact_otp5793_msg01, - compact_otp5836_msg01, - compact_otp5993_msg01, - compact_otp5993_msg02, - compact_otp5993_msg03, - compact_otp6017_msg01, - compact_otp6017_msg02, - compact_otp6017_msg03 - ]. - -flex_compact_tickets(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_tickets_cases(), - flex_compact_finish}}. - -flex_compact_tickets_cases() -> - [ - flex_compact_otp7431_msg01, - flex_compact_otp7431_msg02, - flex_compact_otp7431_msg03, - flex_compact_otp7431_msg04, - flex_compact_otp7431_msg05, - flex_compact_otp7431_msg06, - flex_compact_otp7431_msg07 - ]. - -pretty_tickets(suite) -> - [ - pretty_otp4632_msg1, - pretty_otp4632_msg2, - pretty_otp4632_msg3, - pretty_otp4632_msg4, - pretty_otp4710_msg1, - pretty_otp4710_msg2, - pretty_otp4945_msg1, - pretty_otp4945_msg2, - pretty_otp4945_msg3, - pretty_otp4945_msg4, - pretty_otp4945_msg5, - pretty_otp4945_msg6, - pretty_otp4949_msg1, - pretty_otp4949_msg2, - pretty_otp4949_msg3, - pretty_otp5042_msg1, - pretty_otp5068_msg1, - pretty_otp5085_msg1, - pretty_otp5085_msg2, - pretty_otp5085_msg3, - pretty_otp5085_msg4, - pretty_otp5085_msg5, - pretty_otp5085_msg6, - pretty_otp5085_msg7, - pretty_otp5085_msg8, - pretty_otp5600_msg1, - pretty_otp5600_msg2, - pretty_otp5601_msg1, - pretty_otp5793_msg01, - pretty_otp5803_msg01, - pretty_otp5803_msg02, - pretty_otp5805_msg01, - pretty_otp5836_msg01, - pretty_otp5882_msg01, - pretty_otp6490_msg01, - pretty_otp6490_msg02, - pretty_otp6490_msg03, - pretty_otp6490_msg04, - pretty_otp6490_msg05, - pretty_otp6490_msg06, - pretty_otp7671_msg01, - pretty_otp7671_msg02, - pretty_otp7671_msg03, - pretty_otp7671_msg04, - pretty_otp7671_msg05, - pretty_otp8114_msg01 - ]. +%% ---- -flex_pretty_tickets(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_tickets_cases(), - flex_pretty_finish}}. - -flex_pretty_tickets_cases() -> - [ - flex_pretty_otp5042_msg1, - flex_pretty_otp5085_msg1, - flex_pretty_otp5085_msg2, - flex_pretty_otp5085_msg3, - flex_pretty_otp5085_msg4, - flex_pretty_otp5085_msg5, - flex_pretty_otp5085_msg6, - flex_pretty_otp5085_msg7, - flex_pretty_otp5085_msg8, - flex_pretty_otp5600_msg1, - flex_pretty_otp5600_msg2, - flex_pretty_otp5601_msg1, - flex_pretty_otp5793_msg01, - flex_pretty_otp5803_msg01, - flex_pretty_otp5803_msg02, - flex_pretty_otp5805_msg01, - flex_pretty_otp5836_msg01, - flex_pretty_otp7431_msg01, - flex_pretty_otp7431_msg02, - flex_pretty_otp7431_msg03, - flex_pretty_otp7431_msg04, - flex_pretty_otp7431_msg05, - flex_pretty_otp7431_msg06, - flex_pretty_otp7431_msg07 - ]. +tickets() -> + Flag = process_flag(trap_exit, true), + Cases = expand(tickets), + Fun = fun(Case) -> + C = init_per_testcase(Case, [{tc_timeout, + timer:minutes(10)}]), + io:format("Eval ~w~n", [Case]), + Result = + case (catch apply(?MODULE, Case, [C])) of + {'EXIT', Reason} -> + io:format("~n~p exited:~n ~p~n", + [Case, Reason]), + {error, {Case, Reason}}; + Res -> + Res + end, + end_per_testcase(Case, C), + Result + end, + process_flag(trap_exit, Flag), + lists:map(Fun, Cases). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_codec_prev3c_test.erl b/lib/megaco/test/megaco_codec_prev3c_test.erl index 813d0cf57d..7f9c0fe4e7 100644 --- a/lib/megaco/test/megaco_codec_prev3c_test.erl +++ b/lib/megaco/test/megaco_codec_prev3c_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -37,22 +37,17 @@ -export([t/0, t/1]). --export([all/1, - - text/1, - - pretty/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, + pretty_test_msgs/1, - - compact/1, + compact_test_msgs/1, - - flex_pretty/1, + flex_pretty_init/1, flex_pretty_finish/1, flex_pretty_test_msgs/1, - flex_compact/1, + flex_compact_init/1, flex_compact_finish/1, flex_compact_test_msgs/1, @@ -65,32 +60,21 @@ flex_compact_dm_timers6/1, flex_compact_dm_timers7/1, flex_compact_dm_timers8/1, - - binary/1, - bin/1, bin_test_msgs/1, - - ber/1, + ber_test_msgs/1, - - ber_bin/1, + ber_bin_test_msgs/1, - - per/1, + per_test_msgs/1, - - per_bin/1, + per_bin_test_msgs/1, - - erl_dist/1, - erl_dist_m/1, + erl_dist_m_test_msgs/1, tickets/0, - tickets/1, - - compact_tickets/1, + compact_otp4011_msg1/1, compact_otp4011_msg2/1, compact_otp4011_msg3/1, @@ -133,8 +117,7 @@ compact_otp6017_msg01/1, compact_otp6017_msg02/1, compact_otp6017_msg03/1, - - flex_compact_tickets/1, + flex_compact_otp4299_msg1/1, flex_compact_otp7431_msg01/1, flex_compact_otp7431_msg02/1, @@ -143,8 +126,7 @@ flex_compact_otp7431_msg05/1, flex_compact_otp7431_msg06/1, flex_compact_otp7431_msg07/1, - - pretty_tickets/1, + pretty_otp4632_msg1/1, pretty_otp4632_msg2/1, pretty_otp4632_msg3/1, @@ -191,8 +173,7 @@ pretty_otp7671_msg04/1, pretty_otp7671_msg05/1, pretty_otp8114_msg01/1, - - flex_pretty_tickets/1, + flex_pretty_otp5042_msg1/1, flex_pretty_otp5085_msg1/1, flex_pretty_otp5085_msg2/1, @@ -218,7 +199,7 @@ flex_pretty_otp7431_msg06/1, flex_pretty_otp7431_msg07/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). -export([display_text_messages/0, generate_text_messages/0]). @@ -286,32 +267,6 @@ expand([Case|Cases], Acc) -> expand(Cases, [Case|Acc]) end. - -%% ---- - -tickets() -> - Flag = process_flag(trap_exit, true), - Cases = expand(tickets), - Fun = fun(Case) -> - C = init_per_testcase(Case, [{tc_timeout, - timer:minutes(10)}]), - io:format("Eval ~w~n", [Case]), - Result = - case (catch apply(?MODULE, Case, [C])) of - {'EXIT', Reason} -> - io:format("~n~p exited:~n ~p~n", - [Case, Reason]), - {error, {Case, Reason}}; - Res -> - Res - end, - fin_per_testcase(Case, C), - Result - end, - process_flag(trap_exit, Flag), - lists:map(Fun, Cases). - - %% ---- t() -> megaco_test_lib:t(?MODULE). @@ -329,279 +284,169 @@ init_per_testcase(Case, Config) -> end, megaco_test_lib:init_per_testcase(Case, C). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> erase(verbosity), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - text, - binary, - erl_dist, - tickets - ]. - -text(suite) -> - [ - pretty, - flex_pretty, - compact, - flex_compact - ]. - -binary(suite) -> - [ - bin, - ber, - ber_bin, - per, - per_bin - ]. - -erl_dist(suite) -> - [ - erl_dist_m - ]. - -pretty(suite) -> - [ - pretty_test_msgs - ]. - - -compact(suite) -> - [ - compact_test_msgs - ]. - - -flex_pretty(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_cases(), flex_pretty_finish}}. - -flex_pretty_cases() -> - [ - flex_pretty_test_msgs - ]. - -flex_compact(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_cases(), flex_compact_finish}}. - -flex_compact_cases() -> - [ - flex_compact_test_msgs, - flex_compact_dm_timers1, - flex_compact_dm_timers2, - flex_compact_dm_timers3, - flex_compact_dm_timers4, - flex_compact_dm_timers5, - flex_compact_dm_timers6, - flex_compact_dm_timers7, - flex_compact_dm_timers8 - ]. - - -bin(suite) -> - [ - bin_test_msgs - ]. - - -ber(suite) -> - [ - ber_test_msgs - ]. - - -ber_bin(suite) -> - [ - ber_bin_test_msgs - ]. - - -per(suite) -> - [ - per_test_msgs - ]. - +all() -> + [{group, text}, {group, binary}, {group, erl_dist}, + {group, tickets}]. + +groups() -> + [{text, [], + [{group, pretty}, {group, flex_pretty}, + {group, compact}, {group, flex_compact}]}, + {binary, [], + [{group, bin}, {group, ber}, {group, ber_bin}, + {group, per}, {group, per_bin}]}, + {erl_dist, [], [{group, erl_dist_m}]}, + {pretty, [], [pretty_test_msgs]}, + {compact, [], [compact_test_msgs]}, + {flex_pretty, [], flex_pretty_cases()}, + {flex_compact, [], flex_compact_cases()}, + {bin, [], [bin_test_msgs]}, {ber, [], [ber_test_msgs]}, + {ber_bin, [], [ber_bin_test_msgs]}, + {per, [], [per_test_msgs]}, + {per_bin, [], [per_bin_test_msgs]}, + {erl_dist_m, [], [erl_dist_m_test_msgs]}, + {tickets, [], + [{group, compact_tickets}, + {group, flex_compact_tickets}, {group, pretty_tickets}, + {group, flex_pretty_tickets}]}, + {compact_tickets, [], + [compact_otp4011_msg1, compact_otp4011_msg2, + compact_otp4011_msg3, compact_otp4013_msg1, + compact_otp4085_msg1, compact_otp4085_msg2, + compact_otp4280_msg1, compact_otp4299_msg1, + compact_otp4359_msg1, compact_otp4920_msg0, + compact_otp4920_msg1, compact_otp4920_msg2, + compact_otp4920_msg3, compact_otp4920_msg4, + compact_otp4920_msg5, compact_otp4920_msg6, + compact_otp4920_msg7, compact_otp4920_msg8, + compact_otp4920_msg9, compact_otp4920_msg10, + compact_otp4920_msg11, compact_otp4920_msg12, + compact_otp4920_msg20, compact_otp4920_msg21, + compact_otp4920_msg22, compact_otp4920_msg23, + compact_otp4920_msg24, compact_otp4920_msg25, + compact_otp5186_msg01, compact_otp5186_msg02, + compact_otp5186_msg03, compact_otp5186_msg04, + compact_otp5186_msg05, compact_otp5186_msg06, + compact_otp5793_msg01, compact_otp5836_msg01, + compact_otp5993_msg01, compact_otp5993_msg02, + compact_otp5993_msg03, compact_otp6017_msg01, + compact_otp6017_msg02, compact_otp6017_msg03]}, + {flex_compact_tickets, [], + flex_compact_tickets_cases()}, + {pretty_tickets, [], + [pretty_otp4632_msg1, pretty_otp4632_msg2, + pretty_otp4632_msg3, pretty_otp4632_msg4, + pretty_otp4710_msg1, pretty_otp4710_msg2, + pretty_otp4945_msg1, pretty_otp4945_msg2, + pretty_otp4945_msg3, pretty_otp4945_msg4, + pretty_otp4945_msg5, pretty_otp4945_msg6, + pretty_otp4949_msg1, pretty_otp4949_msg2, + pretty_otp4949_msg3, pretty_otp5042_msg1, + pretty_otp5068_msg1, pretty_otp5085_msg1, + pretty_otp5085_msg2, pretty_otp5085_msg3, + pretty_otp5085_msg4, pretty_otp5085_msg5, + pretty_otp5085_msg6, pretty_otp5085_msg7, + pretty_otp5085_msg8, pretty_otp5600_msg1, + pretty_otp5600_msg2, pretty_otp5601_msg1, + pretty_otp5793_msg01, pretty_otp5803_msg01, + pretty_otp5803_msg02, pretty_otp5805_msg01, + pretty_otp5836_msg01, pretty_otp5882_msg01, + pretty_otp6490_msg01, pretty_otp6490_msg02, + pretty_otp6490_msg03, pretty_otp6490_msg04, + pretty_otp6490_msg05, pretty_otp6490_msg06, + pretty_otp7671_msg01, pretty_otp7671_msg02, + pretty_otp7671_msg03, pretty_otp7671_msg04, + pretty_otp7671_msg05, pretty_otp8114_msg01]}, + {flex_pretty_tickets, [], flex_pretty_tickets_cases()}]. + +init_per_group(flex_pretty_tickets, Config) -> + flex_pretty_init(Config); +init_per_group(flex_compact_tickets, Config) -> + flex_compact_init(Config); +init_per_group(flex_compact, Config) -> + flex_compact_init(Config); +init_per_group(flex_pretty, Config) -> + flex_pretty_init(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(flex_pretty_tickets, Config) -> + flex_pretty_finish(Config); +end_per_group(flex_compact_tickets, Config) -> + flex_compact_finish(Config); +end_per_group(flex_compact, Config) -> + flex_compact_finish(Config); +end_per_group(flex_pretty, Config) -> + flex_pretty_finish(Config); +end_per_group(_GroupName, Config) -> + Config. + +flex_pretty_cases() -> + [flex_pretty_test_msgs]. + +flex_compact_cases() -> + [flex_compact_test_msgs, flex_compact_dm_timers1, + flex_compact_dm_timers2, flex_compact_dm_timers3, + flex_compact_dm_timers4, flex_compact_dm_timers5, + flex_compact_dm_timers6, flex_compact_dm_timers7, + flex_compact_dm_timers8]. %% Support for per_bin was added to ASN.1 as of version %% 1.3.2 (R8). And later merged into 1.3.1.3 (R7). These %% releases are identical (as far as I know). %% -per_bin(suite) -> - [ - per_bin_test_msgs - ]. - - -erl_dist_m(suite) -> - [ - erl_dist_m_test_msgs - ]. - -tickets(suite) -> - [ - compact_tickets, - flex_compact_tickets, - pretty_tickets, - flex_pretty_tickets - ]. - - -compact_tickets(suite) -> - [ - compact_otp4011_msg1, - compact_otp4011_msg2, - compact_otp4011_msg3, - compact_otp4013_msg1, - compact_otp4085_msg1, - compact_otp4085_msg2, - compact_otp4280_msg1, - compact_otp4299_msg1, - compact_otp4359_msg1, - compact_otp4920_msg0, - compact_otp4920_msg1, - compact_otp4920_msg2, - compact_otp4920_msg3, - compact_otp4920_msg4, - compact_otp4920_msg5, - compact_otp4920_msg6, - compact_otp4920_msg7, - compact_otp4920_msg8, - compact_otp4920_msg9, - compact_otp4920_msg10, - compact_otp4920_msg11, - compact_otp4920_msg12, - compact_otp4920_msg20, - compact_otp4920_msg21, - compact_otp4920_msg22, - compact_otp4920_msg23, - compact_otp4920_msg24, - compact_otp4920_msg25, - compact_otp5186_msg01, - compact_otp5186_msg02, - compact_otp5186_msg03, - compact_otp5186_msg04, - compact_otp5186_msg05, - compact_otp5186_msg06, - compact_otp5793_msg01, - compact_otp5836_msg01, - compact_otp5993_msg01, - compact_otp5993_msg02, - compact_otp5993_msg03, - compact_otp6017_msg01, - compact_otp6017_msg02, - compact_otp6017_msg03 - ]. - - -flex_compact_tickets(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_tickets_cases(), - flex_compact_finish}}. -flex_compact_tickets_cases() -> - [ - flex_compact_otp4299_msg1, - flex_compact_otp7431_msg01, - flex_compact_otp7431_msg02, - flex_compact_otp7431_msg03, - flex_compact_otp7431_msg04, - flex_compact_otp7431_msg05, - flex_compact_otp7431_msg06, - flex_compact_otp7431_msg07 - ]. - - -pretty_tickets(suite) -> - [ - pretty_otp4632_msg1, - pretty_otp4632_msg2, - pretty_otp4632_msg3, - pretty_otp4632_msg4, - pretty_otp4710_msg1, - pretty_otp4710_msg2, - pretty_otp4945_msg1, - pretty_otp4945_msg2, - pretty_otp4945_msg3, - pretty_otp4945_msg4, - pretty_otp4945_msg5, - pretty_otp4945_msg6, - pretty_otp4949_msg1, - pretty_otp4949_msg2, - pretty_otp4949_msg3, - pretty_otp5042_msg1, - pretty_otp5068_msg1, - pretty_otp5085_msg1, - pretty_otp5085_msg2, - pretty_otp5085_msg3, - pretty_otp5085_msg4, - pretty_otp5085_msg5, - pretty_otp5085_msg6, - pretty_otp5085_msg7, - pretty_otp5085_msg8, - pretty_otp5600_msg1, - pretty_otp5600_msg2, - pretty_otp5601_msg1, - pretty_otp5793_msg01, - pretty_otp5803_msg01, - pretty_otp5803_msg02, - pretty_otp5805_msg01, - pretty_otp5836_msg01, - pretty_otp5882_msg01, - pretty_otp6490_msg01, - pretty_otp6490_msg02, - pretty_otp6490_msg03, - pretty_otp6490_msg04, - pretty_otp6490_msg05, - pretty_otp6490_msg06, - pretty_otp7671_msg01, - pretty_otp7671_msg02, - pretty_otp7671_msg03, - pretty_otp7671_msg04, - pretty_otp7671_msg05, - pretty_otp8114_msg01 - ]. +flex_compact_tickets_cases() -> + [flex_compact_otp4299_msg1, flex_compact_otp7431_msg01, + flex_compact_otp7431_msg02, flex_compact_otp7431_msg03, + flex_compact_otp7431_msg04, flex_compact_otp7431_msg05, + flex_compact_otp7431_msg06, flex_compact_otp7431_msg07]. + +flex_pretty_tickets_cases() -> + [flex_pretty_otp5042_msg1, flex_pretty_otp5085_msg1, + flex_pretty_otp5085_msg2, flex_pretty_otp5085_msg3, + flex_pretty_otp5085_msg4, flex_pretty_otp5085_msg5, + flex_pretty_otp5085_msg6, flex_pretty_otp5085_msg7, + flex_pretty_otp5085_msg8, flex_pretty_otp5600_msg1, + flex_pretty_otp5600_msg2, flex_pretty_otp5601_msg1, + flex_pretty_otp5793_msg01, flex_pretty_otp5803_msg01, + flex_pretty_otp5803_msg02, flex_pretty_otp5805_msg01, + flex_pretty_otp5836_msg01, flex_pretty_otp7431_msg01, + flex_pretty_otp7431_msg02, flex_pretty_otp7431_msg03, + flex_pretty_otp7431_msg04, flex_pretty_otp7431_msg05, + flex_pretty_otp7431_msg06, flex_pretty_otp7431_msg07]. +%% ---- -flex_pretty_tickets(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_tickets_cases(), - flex_pretty_finish}}. - -flex_pretty_tickets_cases() -> - [ - flex_pretty_otp5042_msg1, - flex_pretty_otp5085_msg1, - flex_pretty_otp5085_msg2, - flex_pretty_otp5085_msg3, - flex_pretty_otp5085_msg4, - flex_pretty_otp5085_msg5, - flex_pretty_otp5085_msg6, - flex_pretty_otp5085_msg7, - flex_pretty_otp5085_msg8, - flex_pretty_otp5600_msg1, - flex_pretty_otp5600_msg2, - flex_pretty_otp5601_msg1, - flex_pretty_otp5793_msg01, - flex_pretty_otp5803_msg01, - flex_pretty_otp5803_msg02, - flex_pretty_otp5805_msg01, - flex_pretty_otp5836_msg01, - flex_pretty_otp7431_msg01, - flex_pretty_otp7431_msg02, - flex_pretty_otp7431_msg03, - flex_pretty_otp7431_msg04, - flex_pretty_otp7431_msg05, - flex_pretty_otp7431_msg06, - flex_pretty_otp7431_msg07 - ]. +tickets() -> + Flag = process_flag(trap_exit, true), + Cases = expand(tickets), + Fun = fun(Case) -> + C = init_per_testcase(Case, [{tc_timeout, + timer:minutes(10)}]), + io:format("Eval ~w~n", [Case]), + Result = + case (catch apply(?MODULE, Case, [C])) of + {'EXIT', Reason} -> + io:format("~n~p exited:~n ~p~n", + [Case, Reason]), + {error, {Case, Reason}}; + Res -> + Res + end, + end_per_testcase(Case, C), + Result + end, + process_flag(trap_exit, Flag), + lists:map(Fun, Cases). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_codec_test.erl b/lib/megaco/test/megaco_codec_test.erl index d247959cc5..8391024c3f 100644 --- a/lib/megaco/test/megaco_codec_test.erl +++ b/lib/megaco/test/megaco_codec_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -36,8 +36,8 @@ t(Case) -> megaco_test_lib:t({?MODULE, Case}). init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). init() -> process_flag(trap_exit, true), @@ -47,17 +47,24 @@ init() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - codec - ]. - -codec(suite) -> - [{megaco_codec_mini_test, all}, - {megaco_codec_v1_test, all}, - {megaco_codec_v2_test, all}, - {megaco_codec_prev3a_test, all}, - {megaco_codec_prev3b_test, all}, - {megaco_codec_prev3c_test, all}, - {megaco_codec_v3_test, all}]. +all() -> + [{group, codec}]. + +groups() -> + [{codec, [], + [{megaco_codec_mini_test, all}, + {megaco_codec_v1_test, all}, + {megaco_codec_v2_test, all}, + {megaco_codec_prev3a_test, all}, + {megaco_codec_prev3b_test, all}, + {megaco_codec_prev3c_test, all}, + {megaco_codec_v3_test, all}]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + diff --git a/lib/megaco/test/megaco_codec_test_lib.erl b/lib/megaco/test/megaco_codec_test_lib.erl index 66e8a52a24..0a903f5617 100644 --- a/lib/megaco/test/megaco_codec_test_lib.erl +++ b/lib/megaco/test/megaco_codec_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 diff --git a/lib/megaco/test/megaco_codec_v1_test.erl b/lib/megaco/test/megaco_codec_v1_test.erl index 7f2af37282..7068d005da 100644 --- a/lib/megaco/test/megaco_codec_v1_test.erl +++ b/lib/megaco/test/megaco_codec_v1_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -38,22 +38,16 @@ -export([t/0, t/1]). --export([all/1, - - text/1, - - pretty/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, + pretty_test_msgs/1, - - compact/1, + compact_test_msgs/1, - - flex_pretty/1, + flex_pretty_init/1, flex_pretty_finish/1, flex_pretty_test_msgs/1, - - flex_compact/1, + flex_compact_init/1, flex_compact_finish/1, flex_compact_test_msgs/1, @@ -63,32 +57,21 @@ flex_compact_dm_timers4/1, flex_compact_dm_timers5/1, flex_compact_dm_timers6/1, - - binary/1, - bin/1, bin_test_msgs/1, - - ber/1, + ber_test_msgs/1, - - ber_bin/1, + ber_bin_test_msgs/1, - - per/1, + per_test_msgs/1, - - per_bin/1, + per_bin_test_msgs/1, - - erl_dist/1, - erl_dist_m/1, + erl_dist_m_test_msgs/1, tickets/0, - tickets/1, - - compact_tickets/1, + compact_otp4011_msg1/1, compact_otp4011_msg2/1, compact_otp4011_msg3/1, @@ -131,8 +114,7 @@ compact_otp6017_msg01/1, compact_otp6017_msg02/1, compact_otp6017_msg03/1, - - flex_compact_tickets/1, + flex_compact_otp7431_msg01a/1, flex_compact_otp7431_msg01b/1, flex_compact_otp7431_msg02/1, @@ -141,8 +123,7 @@ flex_compact_otp7431_msg05/1, flex_compact_otp7431_msg06/1, flex_compact_otp7431_msg07/1, - - pretty_tickets/1, + pretty_otp4632_msg1/1, pretty_otp4632_msg2/1, pretty_otp4632_msg3/1, @@ -184,7 +165,6 @@ pretty_otp7671_msg04/1, pretty_otp7671_msg05/1, - flex_pretty_tickets/1, flex_pretty_otp5042_msg1/1, flex_pretty_otp5085_msg1/1, flex_pretty_otp5085_msg2/1, @@ -205,7 +185,7 @@ flex_pretty_otp7431_msg06/1, flex_pretty_otp7431_msg07/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). -export([display_text_messages/0, generate_text_messages/0]). @@ -451,31 +431,6 @@ expand([Case|Cases], Acc) -> expand(Cases, [Case|Acc]) end. - -%% ---- - -tickets() -> - Flag = process_flag(trap_exit, true), - Cases = expand(tickets), - Fun = fun(Case) -> - C = init_per_testcase(Case, [{tc_timeout, - timer:minutes(10)}]), - io:format("Eval ~w~n", [Case]), - Result = - case (catch apply(?MODULE, Case, [C])) of - {'EXIT', Reason} -> - io:format("~n~p exited:~n ~p~n", - [Case, Reason]), - {error, {Case, Reason}}; - Res -> - Res - end, - fin_per_testcase(Case, C), - Result - end, - process_flag(trap_exit, Flag), - lists:map(Fun, Cases). - %% ---- @@ -494,265 +449,164 @@ init_per_testcase(Case, Config) -> end, megaco_test_lib:init_per_testcase(Case, C). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> erase(verbosity), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - text, - binary, - erl_dist, - tickets - ]. - -text(suite) -> - [ - pretty, - flex_pretty, - compact, - flex_compact - ]. - -binary(suite) -> - [ - bin, - ber, - ber_bin, - per, - per_bin - ]. - -erl_dist(suite) -> - [ - erl_dist_m - ]. - -pretty(suite) -> - [ - pretty_test_msgs - ]. - - -compact(suite) -> - [ - compact_test_msgs - ]. - - -flex_pretty(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_cases(), flex_pretty_finish}}. - -flex_pretty_cases() -> - [ - flex_pretty_test_msgs - ]. - - -flex_compact(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_cases(), flex_compact_finish}}. - -flex_compact_cases() -> - [ - flex_compact_test_msgs, - - flex_compact_dm_timers1, - flex_compact_dm_timers2, - flex_compact_dm_timers3, - flex_compact_dm_timers4, - flex_compact_dm_timers5, - flex_compact_dm_timers6 - ]. - - -bin(suite) -> - [ - bin_test_msgs - ]. - - -ber(suite) -> - [ - ber_test_msgs - ]. - - -ber_bin(suite) -> - [ - ber_bin_test_msgs - ]. - - -per(suite) -> - [ - per_test_msgs - ]. - +all() -> + [{group, text}, {group, binary}, {group, erl_dist}, + {group, tickets}]. + +groups() -> + [{text, [], + [{group, pretty}, {group, flex_pretty}, + {group, compact}, {group, flex_compact}]}, + {binary, [], + [{group, bin}, {group, ber}, {group, ber_bin}, + {group, per}, {group, per_bin}]}, + {erl_dist, [], [{group, erl_dist_m}]}, + {pretty, [], [pretty_test_msgs]}, + {compact, [], [compact_test_msgs]}, + {flex_pretty, [], flex_pretty_cases()}, + {flex_compact, [], flex_compact_cases()}, + {bin, [], [bin_test_msgs]}, {ber, [], [ber_test_msgs]}, + {ber_bin, [], [ber_bin_test_msgs]}, + {per, [], [per_test_msgs]}, + {per_bin, [], [per_bin_test_msgs]}, + {erl_dist_m, [], [erl_dist_m_test_msgs]}, + {tickets, [], + [{group, compact_tickets}, {group, pretty_tickets}, + {group, flex_compact_tickets}, + {group, flex_pretty_tickets}]}, + {compact_tickets, [], + [compact_otp4011_msg1, compact_otp4011_msg2, + compact_otp4011_msg3, compact_otp4013_msg1, + compact_otp4085_msg1, compact_otp4085_msg2, + compact_otp4280_msg1, compact_otp4299_msg1, + compact_otp4299_msg2, compact_otp4359_msg1, + compact_otp4920_msg0, compact_otp4920_msg1, + compact_otp4920_msg2, compact_otp4920_msg3, + compact_otp4920_msg4, compact_otp4920_msg5, + compact_otp4920_msg6, compact_otp4920_msg7, + compact_otp4920_msg8, compact_otp4920_msg9, + compact_otp4920_msg10, compact_otp4920_msg11, + compact_otp4920_msg12, compact_otp4920_msg20, + compact_otp4920_msg21, compact_otp4920_msg22, + compact_otp4920_msg23, compact_otp4920_msg24, + compact_otp4920_msg25, compact_otp5186_msg01, + compact_otp5186_msg02, compact_otp5186_msg03, + compact_otp5186_msg04, compact_otp5186_msg05, + compact_otp5186_msg06, compact_otp5793_msg01, + compact_otp5993_msg01, compact_otp5993_msg02, + compact_otp5993_msg03, compact_otp6017_msg01, + compact_otp6017_msg02, compact_otp6017_msg03]}, + {flex_compact_tickets, [], + flex_compact_tickets_cases()}, + {pretty_tickets, [], + [pretty_otp4632_msg1, pretty_otp4632_msg2, + pretty_otp4632_msg3, pretty_otp4632_msg4, + pretty_otp4710_msg1, pretty_otp4710_msg2, + pretty_otp4945_msg1, pretty_otp4945_msg2, + pretty_otp4945_msg3, pretty_otp4945_msg4, + pretty_otp4945_msg5, pretty_otp4945_msg6, + pretty_otp4949_msg1, pretty_otp4949_msg2, + pretty_otp4949_msg3, pretty_otp5042_msg1, + pretty_otp5068_msg1, pretty_otp5085_msg1, + pretty_otp5085_msg2, pretty_otp5085_msg3, + pretty_otp5085_msg4, pretty_otp5085_msg5, + pretty_otp5085_msg6, pretty_otp5085_msg7, + pretty_otp5600_msg1, pretty_otp5600_msg2, + pretty_otp5601_msg1, pretty_otp5793_msg01, + pretty_otp5882_msg01, pretty_otp6490_msg01, + pretty_otp6490_msg02, pretty_otp6490_msg03, + pretty_otp6490_msg04, pretty_otp6490_msg05, + pretty_otp6490_msg06, pretty_otp7671_msg01, + pretty_otp7671_msg02, pretty_otp7671_msg03, + pretty_otp7671_msg04, pretty_otp7671_msg05]}, + {flex_pretty_tickets, [], flex_pretty_tickets_cases()}]. + +init_per_group(flex_pretty_tickets, Config) -> + flex_pretty_init(Config); +init_per_group(flex_compact_tickets, Config) -> + flex_compact_init(Config); +init_per_group(flex_compact, Config) -> + flex_compact_init(Config); +init_per_group(flex_pretty, Config) -> + flex_pretty_init(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(flex_pretty_tickets, Config) -> + flex_pretty_finish(Config); +end_per_group(flex_compact_tickets, Config) -> + flex_compact_finish(Config); +end_per_group(flex_compact, Config) -> + flex_compact_finish(Config); +end_per_group(flex_pretty, Config) -> + flex_pretty_finish(Config); +end_per_group(_GroupName, Config) -> + Config. + +flex_pretty_cases() -> + [flex_pretty_test_msgs]. + +flex_compact_cases() -> + [flex_compact_test_msgs, flex_compact_dm_timers1, + flex_compact_dm_timers2, flex_compact_dm_timers3, + flex_compact_dm_timers4, flex_compact_dm_timers5, + flex_compact_dm_timers6]. %% Support for per_bin was added to ASN.1 as of version %% 1.3.2 (R8). And later merged into 1.3.1.3 (R7). These %% releases are identical (as far as I know). %% -per_bin(suite) -> - [ - per_bin_test_msgs - ]. - -erl_dist_m(suite) -> - [ - erl_dist_m_test_msgs - ]. -tickets(suite) -> - [ - compact_tickets, - pretty_tickets, - flex_compact_tickets, - flex_pretty_tickets - ]. +flex_compact_tickets_cases() -> + [flex_compact_otp7431_msg01a, + flex_compact_otp7431_msg01b, flex_compact_otp7431_msg02, + flex_compact_otp7431_msg03, flex_compact_otp7431_msg04, + flex_compact_otp7431_msg05, flex_compact_otp7431_msg06, + flex_compact_otp7431_msg07]. + +flex_pretty_tickets_cases() -> + [flex_pretty_otp5042_msg1, flex_pretty_otp5085_msg1, + flex_pretty_otp5085_msg2, flex_pretty_otp5085_msg3, + flex_pretty_otp5085_msg4, flex_pretty_otp5085_msg5, + flex_pretty_otp5085_msg6, flex_pretty_otp5085_msg7, + flex_pretty_otp5600_msg1, flex_pretty_otp5600_msg2, + flex_pretty_otp5601_msg1, flex_pretty_otp5793_msg01, + flex_pretty_otp7431_msg01, flex_pretty_otp7431_msg02, + flex_pretty_otp7431_msg03, flex_pretty_otp7431_msg04, + flex_pretty_otp7431_msg05, flex_pretty_otp7431_msg06, + flex_pretty_otp7431_msg07]. +%% ---- -compact_tickets(suite) -> - [ - compact_otp4011_msg1, - compact_otp4011_msg2, - compact_otp4011_msg3, - compact_otp4013_msg1, - compact_otp4085_msg1, - compact_otp4085_msg2, - compact_otp4280_msg1, - compact_otp4299_msg1, - compact_otp4299_msg2, - compact_otp4359_msg1, - compact_otp4920_msg0, - compact_otp4920_msg1, - compact_otp4920_msg2, - compact_otp4920_msg3, - compact_otp4920_msg4, - compact_otp4920_msg5, - compact_otp4920_msg6, - compact_otp4920_msg7, - compact_otp4920_msg8, - compact_otp4920_msg9, - compact_otp4920_msg10, - compact_otp4920_msg11, - compact_otp4920_msg12, - compact_otp4920_msg20, - compact_otp4920_msg21, - compact_otp4920_msg22, - compact_otp4920_msg23, - compact_otp4920_msg24, - compact_otp4920_msg25, - compact_otp5186_msg01, - compact_otp5186_msg02, - compact_otp5186_msg03, - compact_otp5186_msg04, - compact_otp5186_msg05, - compact_otp5186_msg06, - compact_otp5793_msg01, - compact_otp5993_msg01, - compact_otp5993_msg02, - compact_otp5993_msg03, - compact_otp6017_msg01, - compact_otp6017_msg02, - compact_otp6017_msg03 - ]. - -flex_compact_tickets(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_tickets_cases(), - flex_compact_finish}}. - -flex_compact_tickets_cases() -> - [ - flex_compact_otp7431_msg01a, - flex_compact_otp7431_msg01b, - flex_compact_otp7431_msg02, - flex_compact_otp7431_msg03, - flex_compact_otp7431_msg04, - flex_compact_otp7431_msg05, - flex_compact_otp7431_msg06, - flex_compact_otp7431_msg07 - ]. - - -pretty_tickets(suite) -> - [ - pretty_otp4632_msg1, - pretty_otp4632_msg2, - pretty_otp4632_msg3, - pretty_otp4632_msg4, - pretty_otp4710_msg1, - pretty_otp4710_msg2, - pretty_otp4945_msg1, - pretty_otp4945_msg2, - pretty_otp4945_msg3, - pretty_otp4945_msg4, - pretty_otp4945_msg5, - pretty_otp4945_msg6, - pretty_otp4949_msg1, - pretty_otp4949_msg2, - pretty_otp4949_msg3, - pretty_otp5042_msg1, - pretty_otp5068_msg1, - pretty_otp5085_msg1, - pretty_otp5085_msg2, - pretty_otp5085_msg3, - pretty_otp5085_msg4, - pretty_otp5085_msg5, - pretty_otp5085_msg6, - pretty_otp5085_msg7, - pretty_otp5600_msg1, - pretty_otp5600_msg2, - pretty_otp5601_msg1, - pretty_otp5793_msg01, - pretty_otp5882_msg01, - pretty_otp6490_msg01, - pretty_otp6490_msg02, - pretty_otp6490_msg03, - pretty_otp6490_msg04, - pretty_otp6490_msg05, - pretty_otp6490_msg06, - pretty_otp7671_msg01, - pretty_otp7671_msg02, - pretty_otp7671_msg03, - pretty_otp7671_msg04, - pretty_otp7671_msg05 - ]. - -flex_pretty_tickets(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_tickets_cases(), - flex_pretty_finish}}. - -flex_pretty_tickets_cases() -> - [ - flex_pretty_otp5042_msg1, - flex_pretty_otp5085_msg1, - flex_pretty_otp5085_msg2, - flex_pretty_otp5085_msg3, - flex_pretty_otp5085_msg4, - flex_pretty_otp5085_msg5, - flex_pretty_otp5085_msg6, - flex_pretty_otp5085_msg7, - flex_pretty_otp5600_msg1, - flex_pretty_otp5600_msg2, - flex_pretty_otp5601_msg1, - flex_pretty_otp5793_msg01, - flex_pretty_otp7431_msg01, - flex_pretty_otp7431_msg02, - flex_pretty_otp7431_msg03, - flex_pretty_otp7431_msg04, - flex_pretty_otp7431_msg05, - flex_pretty_otp7431_msg06, - flex_pretty_otp7431_msg07 - ]. +tickets() -> + Flag = process_flag(trap_exit, true), + Cases = expand(tickets), + Fun = fun(Case) -> + C = init_per_testcase(Case, [{tc_timeout, + timer:minutes(10)}]), + io:format("Eval ~w~n", [Case]), + Result = + case (catch apply(?MODULE, Case, [C])) of + {'EXIT', Reason} -> + io:format("~n~p exited:~n ~p~n", + [Case, Reason]), + {error, {Case, Reason}}; + Res -> + Res + end, + end_per_testcase(Case, C), + Result + end, + process_flag(trap_exit, Flag), + lists:map(Fun, Cases). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_codec_v2_test.erl b/lib/megaco/test/megaco_codec_v2_test.erl index 1df1c6c93b..c3a80febba 100644 --- a/lib/megaco/test/megaco_codec_v2_test.erl +++ b/lib/megaco/test/megaco_codec_v2_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -37,22 +37,16 @@ -export([t/0, t/1]). --export([all/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, - text/1, - - pretty/1, pretty_test_msgs/1, - compact/1, compact_test_msgs/1, - - flex_pretty/1, + flex_pretty_init/1, flex_pretty_finish/1, flex_pretty_test_msgs/1, - - flex_compact/1, + flex_compact_init/1, flex_compact_finish/1, flex_compact_test_msgs/1, @@ -65,32 +59,21 @@ flex_compact_dm_timers6/1, flex_compact_dm_timers7/1, flex_compact_dm_timers8/1, - - binary/1, - bin/1, bin_test_msgs/1, - ber/1, ber_test_msgs/1, - - ber_bin/1, + ber_bin_test_msgs/1, - - per/1, + per_test_msgs/1, - - per_bin/1, + per_bin_test_msgs/1, - - erl_dist/1, - erl_dist_m/1, + erl_dist_m_test_msgs/1, tickets/0, - tickets/1, - - compact_tickets/1, + compact_otp4011_msg1/1, compact_otp4011_msg2/1, compact_otp4011_msg3/1, @@ -143,8 +126,7 @@ compact_otp7534_msg01/1, compact_otp7576_msg01/1, compact_otp7671_msg01/1, - - flex_compact_tickets/1, + flex_compact_otp7138_msg01/1, flex_compact_otp7138_msg02/1, flex_compact_otp7431_msg01/1, @@ -160,8 +142,7 @@ flex_compact_otp7534_msg01/1, flex_compact_otp7573_msg01/1, flex_compact_otp7576_msg01/1, - - pretty_tickets/1, + pretty_otp4632_msg1/1, pretty_otp4632_msg2/1, pretty_otp4632_msg3/1, @@ -204,7 +185,6 @@ pretty_otp7671_msg04/1, pretty_otp7671_msg05/1, - flex_pretty_tickets/1, flex_pretty_otp5042_msg1/1, flex_pretty_otp5085_msg1/1, flex_pretty_otp5085_msg2/1, @@ -225,7 +205,7 @@ flex_pretty_otp7431_msg06/1, flex_pretty_otp7431_msg07/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). -export([display_text_messages/0, generate_text_messages/0]). @@ -431,31 +411,7 @@ expand([Case|Cases], Acc) -> expand(Cases, [Case|Acc]) end. - -%% ---- - -tickets() -> - Flag = process_flag(trap_exit, true), - Cases = expand(tickets), - Fun = fun(Case) -> - C = init_per_testcase(Case, [{tc_timeout, - timer:minutes(10)}]), - io:format("Eval ~w~n", [Case]), - Result = - case (catch apply(?MODULE, Case, [C])) of - {'EXIT', Reason} -> - io:format("~n~p exited:~n ~p~n", - [Case, Reason]), - {error, {Case, Reason}}; - Res -> - Res - end, - fin_per_testcase(Case, C), - Result - end, - process_flag(trap_exit, Flag), - lists:map(Fun, Cases). - + %% ---- @@ -474,284 +430,202 @@ init_per_testcase(Case, Config) -> end, megaco_test_lib:init_per_testcase(Case, C). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> erase(verbosity), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - text, - binary, - erl_dist, - tickets - ]. - -text(suite) -> - [ - pretty, - flex_pretty, - compact, - flex_compact - ]. - -binary(suite) -> - [ - bin, - ber, - ber_bin, - per, - per_bin - ]. - -erl_dist(suite) -> - [ - erl_dist_m - ]. - -pretty(suite) -> - [ - pretty_test_msgs - ]. - - -compact(suite) -> - [ - compact_test_msgs - ]. +all() -> +[{group, text}, {group, binary}, {group, erl_dist}, + {group, tickets}]. + +groups() -> + [{text, [], + [{group, pretty}, {group, flex_pretty}, + {group, compact}, {group, flex_compact}]}, + {binary, [], + [{group, bin}, {group, ber}, {group, ber_bin}, + {group, per}, {group, per_bin}]}, + {erl_dist, [], [{group, erl_dist_m}]}, + {pretty, [], [pretty_test_msgs]}, + {compact, [], [compact_test_msgs]}, + {flex_pretty, [], flex_pretty_cases()}, + {flex_compact, [], flex_compact_cases()}, + {bin, [], [bin_test_msgs]}, {ber, [], [ber_test_msgs]}, + {ber_bin, [], [ber_bin_test_msgs]}, + {per, [], [per_test_msgs]}, + {per_bin, [], [per_bin_test_msgs]}, + {erl_dist_m, [], [erl_dist_m_test_msgs]}, + {tickets, [], + [{group, compact_tickets}, {group, pretty_tickets}, + {group, flex_compact_tickets}, + {group, flex_pretty_tickets}]}, + {compact_tickets, [], + [compact_otp4011_msg1, compact_otp4011_msg2, + compact_otp4011_msg3, compact_otp4013_msg1, + compact_otp4085_msg1, compact_otp4085_msg2, + compact_otp4280_msg1, compact_otp4299_msg1, + compact_otp4299_msg2, compact_otp4359_msg1, + compact_otp4920_msg0, compact_otp4920_msg1, + compact_otp4920_msg2, compact_otp4920_msg3, + compact_otp4920_msg4, compact_otp4920_msg5, + compact_otp4920_msg6, compact_otp4920_msg7, + compact_otp4920_msg8, compact_otp4920_msg9, + compact_otp4920_msg10, compact_otp4920_msg11, + compact_otp4920_msg12, compact_otp4920_msg20, + compact_otp4920_msg21, compact_otp4920_msg22, + compact_otp4920_msg23, compact_otp4920_msg24, + compact_otp4920_msg25, compact_otp5186_msg01, + compact_otp5186_msg02, compact_otp5186_msg03, + compact_otp5186_msg04, compact_otp5186_msg05, + compact_otp5186_msg06, compact_otp5290_msg01, + compact_otp5290_msg02, compact_otp5793_msg01, + compact_otp5993_msg01, compact_otp5993_msg02, + compact_otp5993_msg03, compact_otp6017_msg01, + compact_otp6017_msg02, compact_otp6017_msg03, + compact_otp7138_msg01, compact_otp7138_msg02, + compact_otp7457_msg01, compact_otp7457_msg02, + compact_otp7457_msg03, compact_otp7534_msg01, + compact_otp7576_msg01, compact_otp7671_msg01]}, + {flex_compact_tickets, [], + flex_compact_tickets_cases()}, + {pretty_tickets, [], + [pretty_otp4632_msg1, pretty_otp4632_msg2, + pretty_otp4632_msg3, pretty_otp4632_msg4, + pretty_otp4710_msg1, pretty_otp4710_msg2, + pretty_otp4945_msg1, pretty_otp4945_msg2, + pretty_otp4945_msg3, pretty_otp4945_msg4, + pretty_otp4945_msg5, pretty_otp4945_msg6, + pretty_otp4949_msg1, pretty_otp4949_msg2, + pretty_otp4949_msg3, pretty_otp5042_msg1, + pretty_otp5068_msg1, pretty_otp5085_msg1, + pretty_otp5085_msg2, pretty_otp5085_msg3, + pretty_otp5085_msg4, pretty_otp5085_msg5, + pretty_otp5085_msg6, pretty_otp5085_msg7, + pretty_otp5600_msg1, pretty_otp5600_msg2, + pretty_otp5601_msg1, pretty_otp5793_msg01, + pretty_otp5882_msg01, pretty_otp6490_msg01, + pretty_otp6490_msg02, pretty_otp6490_msg03, + pretty_otp6490_msg04, pretty_otp6490_msg05, + pretty_otp6490_msg06, pretty_otp7249_msg01, + pretty_otp7671_msg01, pretty_otp7671_msg02, + pretty_otp7671_msg03, pretty_otp7671_msg04, + pretty_otp7671_msg05]}, + {flex_pretty_tickets, [], flex_pretty_tickets_cases()}]. + +init_per_group(flex_pretty_tickets, Config) -> + flex_pretty_init(Config); +init_per_group(flex_compact_tickets, Config) -> + flex_compact_init(Config); +init_per_group(flex_compact, Config) -> + flex_compact_init(Config); +init_per_group(flex_pretty, Config) -> + flex_pretty_init(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(flex_pretty_tickets, Config) -> + flex_pretty_finish(Config); +end_per_group(flex_compact_tickets, Config) -> + flex_compact_finish(Config); +end_per_group(flex_compact, Config) -> + flex_compact_finish(Config); +end_per_group(flex_pretty, Config) -> + flex_pretty_finish(Config); +end_per_group(_GroupName, Config) -> + Config. + + + + + + + + + + +flex_pretty_cases() -> +[flex_pretty_test_msgs]. + + +flex_compact_cases() -> +[flex_compact_test_msgs, flex_compact_dm_timers1, + flex_compact_dm_timers2, flex_compact_dm_timers3, + flex_compact_dm_timers4, flex_compact_dm_timers5, + flex_compact_dm_timers6, flex_compact_dm_timers7, + flex_compact_dm_timers8]. -flex_pretty(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_cases(), flex_pretty_finish}}. -flex_pretty_cases() -> - [ - flex_pretty_test_msgs - ]. -flex_compact(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_cases(), flex_compact_finish}}. -flex_compact_cases() -> - [ - flex_compact_test_msgs, - flex_compact_dm_timers1, - flex_compact_dm_timers2, - flex_compact_dm_timers3, - flex_compact_dm_timers4, - flex_compact_dm_timers5, - flex_compact_dm_timers6, - flex_compact_dm_timers7, - flex_compact_dm_timers8 - ]. -bin(suite) -> - [ - bin_test_msgs - ]. -ber(suite) -> - [ - ber_test_msgs - ]. - - -ber_bin(suite) -> - [ - ber_bin_test_msgs - ]. - - -per(suite) -> - [ - per_test_msgs - ]. - %% Support for per_bin was added to ASN.1 as of version %% 1.3.2 (R8). And later merged into 1.3.1.3 (R7). These %% releases are identical (as far as I know). %% -per_bin(suite) -> - [ - per_bin_test_msgs - ]. -erl_dist_m(suite) -> - [ - erl_dist_m_test_msgs - ]. -tickets(suite) -> - [ - compact_tickets, - pretty_tickets, - flex_compact_tickets, - flex_pretty_tickets - ]. -compact_tickets(suite) -> - [ - compact_otp4011_msg1, - compact_otp4011_msg2, - compact_otp4011_msg3, - compact_otp4013_msg1, - compact_otp4085_msg1, - compact_otp4085_msg2, - compact_otp4280_msg1, - compact_otp4299_msg1, - compact_otp4299_msg2, - compact_otp4359_msg1, - compact_otp4920_msg0, - compact_otp4920_msg1, - compact_otp4920_msg2, - compact_otp4920_msg3, - compact_otp4920_msg4, - compact_otp4920_msg5, - compact_otp4920_msg6, - compact_otp4920_msg7, - compact_otp4920_msg8, - compact_otp4920_msg9, - compact_otp4920_msg10, - compact_otp4920_msg11, - compact_otp4920_msg12, - compact_otp4920_msg20, - compact_otp4920_msg21, - compact_otp4920_msg22, - compact_otp4920_msg23, - compact_otp4920_msg24, - compact_otp4920_msg25, - compact_otp5186_msg01, - compact_otp5186_msg02, - compact_otp5186_msg03, - compact_otp5186_msg04, - compact_otp5186_msg05, - compact_otp5186_msg06, - compact_otp5290_msg01, - compact_otp5290_msg02, - compact_otp5793_msg01, - compact_otp5993_msg01, - compact_otp5993_msg02, - compact_otp5993_msg03, - compact_otp6017_msg01, - compact_otp6017_msg02, - compact_otp6017_msg03, - compact_otp7138_msg01, - compact_otp7138_msg02, - compact_otp7457_msg01, - compact_otp7457_msg02, - compact_otp7457_msg03, - compact_otp7534_msg01, - compact_otp7576_msg01, - compact_otp7671_msg01 - ]. -flex_compact_tickets(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_tickets_cases(), - flex_compact_finish}}. -flex_compact_tickets_cases() -> - [ - flex_compact_otp7138_msg01, - flex_compact_otp7138_msg02, - flex_compact_otp7431_msg01, - flex_compact_otp7431_msg02, - flex_compact_otp7431_msg03, - flex_compact_otp7431_msg04, - flex_compact_otp7431_msg05, - flex_compact_otp7431_msg06, - flex_compact_otp7431_msg07, - flex_compact_otp7138_msg02, - flex_compact_otp7457_msg01, - flex_compact_otp7457_msg02, - flex_compact_otp7457_msg03, - flex_compact_otp7534_msg01, - flex_compact_otp7573_msg01, - flex_compact_otp7576_msg01 - ]. +flex_compact_tickets_cases() -> +[flex_compact_otp7138_msg01, flex_compact_otp7138_msg02, + flex_compact_otp7431_msg01, flex_compact_otp7431_msg02, + flex_compact_otp7431_msg03, flex_compact_otp7431_msg04, + flex_compact_otp7431_msg05, flex_compact_otp7431_msg06, + flex_compact_otp7431_msg07, flex_compact_otp7138_msg02, + flex_compact_otp7457_msg01, flex_compact_otp7457_msg02, + flex_compact_otp7457_msg03, flex_compact_otp7534_msg01, + flex_compact_otp7573_msg01, flex_compact_otp7576_msg01]. -pretty_tickets(suite) -> - [ - pretty_otp4632_msg1, - pretty_otp4632_msg2, - pretty_otp4632_msg3, - pretty_otp4632_msg4, - pretty_otp4710_msg1, - pretty_otp4710_msg2, - pretty_otp4945_msg1, - pretty_otp4945_msg2, - pretty_otp4945_msg3, - pretty_otp4945_msg4, - pretty_otp4945_msg5, - pretty_otp4945_msg6, - pretty_otp4949_msg1, - pretty_otp4949_msg2, - pretty_otp4949_msg3, - pretty_otp5042_msg1, - pretty_otp5068_msg1, - pretty_otp5085_msg1, - pretty_otp5085_msg2, - pretty_otp5085_msg3, - pretty_otp5085_msg4, - pretty_otp5085_msg5, - pretty_otp5085_msg6, - pretty_otp5085_msg7, - pretty_otp5600_msg1, - pretty_otp5600_msg2, - pretty_otp5601_msg1, - pretty_otp5793_msg01, - pretty_otp5882_msg01, - pretty_otp6490_msg01, - pretty_otp6490_msg02, - pretty_otp6490_msg03, - pretty_otp6490_msg04, - pretty_otp6490_msg05, - pretty_otp6490_msg06, - pretty_otp7249_msg01, - pretty_otp7671_msg01, - pretty_otp7671_msg02, - pretty_otp7671_msg03, - pretty_otp7671_msg04, - pretty_otp7671_msg05 - ]. -flex_pretty_tickets(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_tickets_cases(), - flex_pretty_finish}}. -flex_pretty_tickets_cases() -> - [ - flex_pretty_otp5042_msg1, - flex_pretty_otp5085_msg1, - flex_pretty_otp5085_msg2, - flex_pretty_otp5085_msg3, - flex_pretty_otp5085_msg4, - flex_pretty_otp5085_msg5, - flex_pretty_otp5085_msg6, - flex_pretty_otp5085_msg7, - flex_pretty_otp5600_msg1, - flex_pretty_otp5600_msg2, - flex_pretty_otp5601_msg1, - flex_pretty_otp5793_msg01, - flex_pretty_otp7431_msg01, - flex_pretty_otp7431_msg02, - flex_pretty_otp7431_msg03, - flex_pretty_otp7431_msg04, - flex_pretty_otp7431_msg05, - flex_pretty_otp7431_msg06, - flex_pretty_otp7431_msg07 - ]. +flex_pretty_tickets_cases() -> +[flex_pretty_otp5042_msg1, flex_pretty_otp5085_msg1, + flex_pretty_otp5085_msg2, flex_pretty_otp5085_msg3, + flex_pretty_otp5085_msg4, flex_pretty_otp5085_msg5, + flex_pretty_otp5085_msg6, flex_pretty_otp5085_msg7, + flex_pretty_otp5600_msg1, flex_pretty_otp5600_msg2, + flex_pretty_otp5601_msg1, flex_pretty_otp5793_msg01, + flex_pretty_otp7431_msg01, flex_pretty_otp7431_msg02, + flex_pretty_otp7431_msg03, flex_pretty_otp7431_msg04, + flex_pretty_otp7431_msg05, flex_pretty_otp7431_msg06, + flex_pretty_otp7431_msg07]. + +%% ---- + +tickets() -> + Flag = process_flag(trap_exit, true), + Cases = expand(tickets), + Fun = fun(Case) -> + C = init_per_testcase(Case, [{tc_timeout, + timer:minutes(10)}]), + io:format("Eval ~w~n", [Case]), + Result = + case (catch apply(?MODULE, Case, [C])) of + {'EXIT', Reason} -> + io:format("~n~p exited:~n ~p~n", + [Case, Reason]), + {error, {Case, Reason}}; + Res -> + Res + end, + end_per_testcase(Case, C), + Result + end, + process_flag(trap_exit, Flag), + lists:map(Fun, Cases). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_codec_v3_test.erl b/lib/megaco/test/megaco_codec_v3_test.erl index f49c3a677a..2c35ce13b3 100644 --- a/lib/megaco/test/megaco_codec_v3_test.erl +++ b/lib/megaco/test/megaco_codec_v3_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -37,26 +37,15 @@ -export([t/0, t/1]). --export([all/1, - - text/1, - - pretty/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, pretty_test_msgs/1, - - compact/1, compact_test_msgs/1, - - flex_pretty/1, flex_pretty_init/1, flex_pretty_finish/1, flex_pretty_test_msgs/1, - - flex_compact/1, flex_compact_init/1, flex_compact_finish/1, flex_compact_test_msgs/1, - flex_compact_dm_timers1/1, flex_compact_dm_timers2/1, flex_compact_dm_timers3/1, @@ -65,32 +54,15 @@ flex_compact_dm_timers6/1, flex_compact_dm_timers7/1, flex_compact_dm_timers8/1, - - binary/1, - - bin/1, bin_test_msgs/1, - - ber/1, ber_test_msgs/1, - - ber_bin/1, ber_bin_test_msgs/1, - - per/1, per_test_msgs/1, - - per_bin/1, per_bin_test_msgs/1, - - erl_dist/1, - erl_dist_m/1, erl_dist_m_test_msgs/1, tickets/0, - tickets/1, - - compact_tickets/1, + compact_otp4011_msg1/1, compact_otp4011_msg2/1, compact_otp4011_msg3/1, @@ -133,8 +105,7 @@ compact_otp6017_msg01/1, compact_otp6017_msg02/1, compact_otp6017_msg03/1, - - flex_compact_tickets/1, + flex_compact_otp4299_msg1/1, flex_compact_otp7431_msg01/1, flex_compact_otp7431_msg02/1, @@ -143,9 +114,7 @@ flex_compact_otp7431_msg05/1, flex_compact_otp7431_msg06/1, flex_compact_otp7431_msg07/1, - - - pretty_tickets/1, + pretty_otp4632_msg1/1, pretty_otp4632_msg2/1, pretty_otp4632_msg3/1, @@ -192,8 +161,7 @@ pretty_otp7671_msg04/1, pretty_otp7671_msg05/1, pretty_otp8114_msg01/1, - - flex_pretty_tickets/1, + flex_pretty_otp5042_msg1/1, flex_pretty_otp5085_msg1/1, flex_pretty_otp5085_msg2/1, @@ -219,7 +187,7 @@ flex_pretty_otp7431_msg06/1, flex_pretty_otp7431_msg07/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). -export([display_text_messages/0, generate_text_messages/0]). @@ -285,31 +253,6 @@ expand([Case|Cases], Acc) -> expand(Cases, [Case|Acc]) end. - -%% ---- - -tickets() -> - Flag = process_flag(trap_exit, true), - Cases = expand(tickets), - Fun = fun(Case) -> - C = init_per_testcase(Case, [{tc_timeout, - timer:minutes(10)}]), - io:format("Eval ~w~n", [Case]), - Result = - case (catch apply(?MODULE, Case, [C])) of - {'EXIT', Reason} -> - io:format("~n~p exited:~n ~p~n", - [Case, Reason]), - {error, {Case, Reason}}; - Res -> - Res - end, - fin_per_testcase(Case, C), - Result - end, - process_flag(trap_exit, Flag), - lists:map(Fun, Cases). - %% ---- @@ -328,279 +271,174 @@ init_per_testcase(Case, Config) -> end, megaco_test_lib:init_per_testcase(Case, C). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> erase(verbosity), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - text, - binary, - erl_dist, - tickets - ]. - -text(suite) -> - [ - pretty, - flex_pretty, - compact, - flex_compact - ]. - -binary(suite) -> - [ - bin, - ber, - ber_bin, - per, - per_bin - ]. - -erl_dist(suite) -> - [ - erl_dist_m - ]. - -pretty(suite) -> - [ - pretty_test_msgs - ]. - - -compact(suite) -> - [ - compact_test_msgs - ]. - - -flex_pretty(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_cases(), flex_pretty_finish}}. +all() -> + [{group, text}, {group, binary}, {group, erl_dist}, + {group, tickets}]. + +groups() -> + [{text, [], + [{group, pretty}, {group, flex_pretty}, + {group, compact}, {group, flex_compact}]}, + {binary, [], + [{group, bin}, {group, ber}, {group, ber_bin}, + {group, per}, {group, per_bin}]}, + {erl_dist, [], [{group, erl_dist_m}]}, + {pretty, [], [pretty_test_msgs]}, + {compact, [], [compact_test_msgs]}, + {flex_pretty, [], flex_pretty_cases()}, + {flex_compact, [], flex_compact_cases()}, + {bin, [], [bin_test_msgs]}, {ber, [], [ber_test_msgs]}, + {ber_bin, [], [ber_bin_test_msgs]}, + {per, [], [per_test_msgs]}, + {per_bin, [], [per_bin_test_msgs]}, + {erl_dist_m, [], [erl_dist_m_test_msgs]}, + {tickets, [], + [{group, compact_tickets}, + {group, flex_compact_tickets}, {group, pretty_tickets}, + {group, flex_pretty_tickets}]}, + {compact_tickets, [], + [compact_otp4011_msg1, compact_otp4011_msg2, + compact_otp4011_msg3, compact_otp4013_msg1, + compact_otp4085_msg1, compact_otp4085_msg2, + compact_otp4280_msg1, compact_otp4299_msg1, + compact_otp4359_msg1, compact_otp4920_msg0, + compact_otp4920_msg1, compact_otp4920_msg2, + compact_otp4920_msg3, compact_otp4920_msg4, + compact_otp4920_msg5, compact_otp4920_msg6, + compact_otp4920_msg7, compact_otp4920_msg8, + compact_otp4920_msg9, compact_otp4920_msg10, + compact_otp4920_msg11, compact_otp4920_msg12, + compact_otp4920_msg20, compact_otp4920_msg21, + compact_otp4920_msg22, compact_otp4920_msg23, + compact_otp4920_msg24, compact_otp4920_msg25, + compact_otp5186_msg01, compact_otp5186_msg02, + compact_otp5186_msg03, compact_otp5186_msg04, + compact_otp5186_msg05, compact_otp5186_msg06, + compact_otp5793_msg01, compact_otp5836_msg01, + compact_otp5993_msg01, compact_otp5993_msg02, + compact_otp5993_msg03, compact_otp6017_msg01, + compact_otp6017_msg02, compact_otp6017_msg03]}, + {flex_compact_tickets, [], + flex_compact_tickets_cases()}, + {pretty_tickets, [], + [pretty_otp4632_msg1, pretty_otp4632_msg2, + pretty_otp4632_msg3, pretty_otp4632_msg4, + pretty_otp4710_msg1, pretty_otp4710_msg2, + pretty_otp4945_msg1, pretty_otp4945_msg2, + pretty_otp4945_msg3, pretty_otp4945_msg4, + pretty_otp4945_msg5, pretty_otp4945_msg6, + pretty_otp4949_msg1, pretty_otp4949_msg2, + pretty_otp4949_msg3, pretty_otp5042_msg1, + pretty_otp5068_msg1, pretty_otp5085_msg1, + pretty_otp5085_msg2, pretty_otp5085_msg3, + pretty_otp5085_msg4, pretty_otp5085_msg5, + pretty_otp5085_msg6, pretty_otp5085_msg7, + pretty_otp5085_msg8, pretty_otp5600_msg1, + pretty_otp5600_msg2, pretty_otp5601_msg1, + pretty_otp5793_msg01, pretty_otp5803_msg01, + pretty_otp5803_msg02, pretty_otp5805_msg01, + pretty_otp5836_msg01, pretty_otp5882_msg01, + pretty_otp6490_msg01, pretty_otp6490_msg02, + pretty_otp6490_msg03, pretty_otp6490_msg04, + pretty_otp6490_msg05, pretty_otp6490_msg06, + pretty_otp7671_msg01, pretty_otp7671_msg02, + pretty_otp7671_msg03, pretty_otp7671_msg04, + pretty_otp7671_msg05, pretty_otp8114_msg01]}, + {flex_pretty_tickets, [], flex_pretty_tickets_cases()}]. + +init_per_group(flex_pretty_tickets, Config) -> + flex_pretty_init(Config); +init_per_group(flex_compact_tickets, Config) -> + flex_compact_init(Config); +init_per_group(flex_compact, Config) -> + flex_compact_init(Config); +init_per_group(flex_pretty, Config) -> + flex_pretty_init(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(flex_pretty_tickets, Config) -> + flex_pretty_finish(Config); +end_per_group(flex_compact_tickets, Config) -> + flex_compact_finish(Config); +end_per_group(flex_compact, Config) -> + flex_compact_finish(Config); +end_per_group(flex_pretty, Config) -> + flex_pretty_finish(Config); +end_per_group(_GroupName, Config) -> + Config. + + +flex_pretty_cases() -> + [flex_pretty_test_msgs]. + + +flex_compact_cases() -> + [flex_compact_test_msgs, flex_compact_dm_timers1, + flex_compact_dm_timers2, flex_compact_dm_timers3, + flex_compact_dm_timers4, flex_compact_dm_timers5, + flex_compact_dm_timers6, flex_compact_dm_timers7, + flex_compact_dm_timers8]. -flex_pretty_cases() -> - [ - flex_pretty_test_msgs - ]. - -flex_compact(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_cases(), flex_compact_finish}}. - -flex_compact_cases() -> - [ - flex_compact_test_msgs, - flex_compact_dm_timers1, - flex_compact_dm_timers2, - flex_compact_dm_timers3, - flex_compact_dm_timers4, - flex_compact_dm_timers5, - flex_compact_dm_timers6, - flex_compact_dm_timers7, - flex_compact_dm_timers8 - ]. - - -bin(suite) -> - [ - bin_test_msgs - ]. - - -ber(suite) -> - [ - ber_test_msgs - ]. - - -ber_bin(suite) -> - [ - ber_bin_test_msgs - ]. - - -per(suite) -> - [ - per_test_msgs - ]. %% Support for per_bin was added to ASN.1 as of version %% 1.3.2 (R8). And later merged into 1.3.1.3 (R7). These %% releases are identical (as far as I know). %% -per_bin(suite) -> - [ - per_bin_test_msgs - ]. - - -erl_dist_m(suite) -> - [ - erl_dist_m_test_msgs - ]. - -tickets(suite) -> - [ - compact_tickets, - flex_compact_tickets, - pretty_tickets, - flex_pretty_tickets - ]. - - -compact_tickets(suite) -> - [ - compact_otp4011_msg1, - compact_otp4011_msg2, - compact_otp4011_msg3, - compact_otp4013_msg1, - compact_otp4085_msg1, - compact_otp4085_msg2, - compact_otp4280_msg1, - compact_otp4299_msg1, - compact_otp4359_msg1, - compact_otp4920_msg0, - compact_otp4920_msg1, - compact_otp4920_msg2, - compact_otp4920_msg3, - compact_otp4920_msg4, - compact_otp4920_msg5, - compact_otp4920_msg6, - compact_otp4920_msg7, - compact_otp4920_msg8, - compact_otp4920_msg9, - compact_otp4920_msg10, - compact_otp4920_msg11, - compact_otp4920_msg12, - compact_otp4920_msg20, - compact_otp4920_msg21, - compact_otp4920_msg22, - compact_otp4920_msg23, - compact_otp4920_msg24, - compact_otp4920_msg25, - compact_otp5186_msg01, - compact_otp5186_msg02, - compact_otp5186_msg03, - compact_otp5186_msg04, - compact_otp5186_msg05, - compact_otp5186_msg06, - compact_otp5793_msg01, - compact_otp5836_msg01, - compact_otp5993_msg01, - compact_otp5993_msg02, - compact_otp5993_msg03, - compact_otp6017_msg01, - compact_otp6017_msg02, - compact_otp6017_msg03 - ]. -flex_compact_tickets(suite) -> - {req, [], - {conf, flex_compact_init, flex_compact_tickets_cases(), - flex_compact_finish}}. - -flex_compact_tickets_cases() -> - [ - flex_compact_otp4299_msg1, - flex_compact_otp7431_msg01, - flex_compact_otp7431_msg02, - flex_compact_otp7431_msg03, - flex_compact_otp7431_msg04, - flex_compact_otp7431_msg05, - flex_compact_otp7431_msg06, - flex_compact_otp7431_msg07 - ]. - - -pretty_tickets(suite) -> - [ - pretty_otp4632_msg1, - pretty_otp4632_msg2, - pretty_otp4632_msg3, - pretty_otp4632_msg4, - pretty_otp4710_msg1, - pretty_otp4710_msg2, - pretty_otp4945_msg1, - pretty_otp4945_msg2, - pretty_otp4945_msg3, - pretty_otp4945_msg4, - pretty_otp4945_msg5, - pretty_otp4945_msg6, - pretty_otp4949_msg1, - pretty_otp4949_msg2, - pretty_otp4949_msg3, - pretty_otp5042_msg1, - pretty_otp5068_msg1, - pretty_otp5085_msg1, - pretty_otp5085_msg2, - pretty_otp5085_msg3, - pretty_otp5085_msg4, - pretty_otp5085_msg5, - pretty_otp5085_msg6, - pretty_otp5085_msg7, - pretty_otp5085_msg8, - pretty_otp5600_msg1, - pretty_otp5600_msg2, - pretty_otp5601_msg1, - pretty_otp5793_msg01, - pretty_otp5803_msg01, - pretty_otp5803_msg02, - pretty_otp5805_msg01, - pretty_otp5836_msg01, - pretty_otp5882_msg01, - pretty_otp6490_msg01, - pretty_otp6490_msg02, - pretty_otp6490_msg03, - pretty_otp6490_msg04, - pretty_otp6490_msg05, - pretty_otp6490_msg06, - pretty_otp7671_msg01, - pretty_otp7671_msg02, - pretty_otp7671_msg03, - pretty_otp7671_msg04, - pretty_otp7671_msg05, - pretty_otp8114_msg01 - ]. +flex_compact_tickets_cases() -> + [flex_compact_otp4299_msg1, flex_compact_otp7431_msg01, + flex_compact_otp7431_msg02, flex_compact_otp7431_msg03, + flex_compact_otp7431_msg04, flex_compact_otp7431_msg05, + flex_compact_otp7431_msg06, flex_compact_otp7431_msg07]. + +flex_pretty_tickets_cases() -> + [flex_pretty_otp5042_msg1, flex_pretty_otp5085_msg1, + flex_pretty_otp5085_msg2, flex_pretty_otp5085_msg3, + flex_pretty_otp5085_msg4, flex_pretty_otp5085_msg5, + flex_pretty_otp5085_msg6, flex_pretty_otp5085_msg7, + flex_pretty_otp5085_msg8, flex_pretty_otp5600_msg1, + flex_pretty_otp5600_msg2, flex_pretty_otp5601_msg1, + flex_pretty_otp5793_msg01, flex_pretty_otp5803_msg01, + flex_pretty_otp5803_msg02, flex_pretty_otp5805_msg01, + flex_pretty_otp5836_msg01, flex_pretty_otp7431_msg01, + flex_pretty_otp7431_msg02, flex_pretty_otp7431_msg03, + flex_pretty_otp7431_msg04, flex_pretty_otp7431_msg05, + flex_pretty_otp7431_msg06, flex_pretty_otp7431_msg07]. +%% ---- -flex_pretty_tickets(suite) -> - {req, [], - {conf, flex_pretty_init, flex_pretty_tickets_cases(), - flex_pretty_finish}}. - -flex_pretty_tickets_cases() -> - [ - flex_pretty_otp5042_msg1, - flex_pretty_otp5085_msg1, - flex_pretty_otp5085_msg2, - flex_pretty_otp5085_msg3, - flex_pretty_otp5085_msg4, - flex_pretty_otp5085_msg5, - flex_pretty_otp5085_msg6, - flex_pretty_otp5085_msg7, - flex_pretty_otp5085_msg8, - flex_pretty_otp5600_msg1, - flex_pretty_otp5600_msg2, - flex_pretty_otp5601_msg1, - flex_pretty_otp5793_msg01, - flex_pretty_otp5803_msg01, - flex_pretty_otp5803_msg02, - flex_pretty_otp5805_msg01, - flex_pretty_otp5836_msg01, - flex_pretty_otp7431_msg01, - flex_pretty_otp7431_msg02, - flex_pretty_otp7431_msg03, - flex_pretty_otp7431_msg04, - flex_pretty_otp7431_msg05, - flex_pretty_otp7431_msg06, - flex_pretty_otp7431_msg07 - ]. +tickets() -> + Flag = process_flag(trap_exit, true), + Cases = expand(tickets), + Fun = fun(Case) -> + C = init_per_testcase(Case, [{tc_timeout, + timer:minutes(10)}]), + io:format("Eval ~w~n", [Case]), + Result = + case (catch apply(?MODULE, Case, [C])) of + {'EXIT', Reason} -> + io:format("~n~p exited:~n ~p~n", + [Case, Reason]), + {error, {Case, Reason}}; + Res -> + Res + end, + end_per_testcase(Case, C), + Result + end, + process_flag(trap_exit, Flag), + lists:map(Fun, Cases). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_config_test.erl b/lib/megaco/test/megaco_config_test.erl index 9ab1a7d90d..1fc4d09d3b 100644 --- a/lib/megaco/test/megaco_config_test.erl +++ b/lib/megaco/test/megaco_config_test.erl @@ -44,9 +44,9 @@ do_init_per_testcase(Case, Config) -> process_flag(trap_exit, true), megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> process_flag(trap_exit, false), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). -record(command, {id, desc, cmd, verify}). @@ -58,25 +58,21 @@ fin_per_testcase(Case, Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(suite) -> - [ - config, - transaction_id_counter, - tickets - ]. - -transaction_id_counter(suite) -> - [ - transaction_id_counter_mg, - transaction_id_counter_mgc - ]. - -tickets(suite) -> - [ - otp_7216, - otp_8167, - otp_8183 - ]. +all() -> + [config, {group, transaction_id_counter}, + {group, tickets}]. + +groups() -> + [{transaction_id_counter, [], + [transaction_id_counter_mg, + transaction_id_counter_mgc]}, + {tickets, [], [otp_7216, otp_8167, otp_8183]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_digit_map_test.erl b/lib/megaco/test/megaco_digit_map_test.erl index 22e115278f..d16fb679ae 100644 --- a/lib/megaco/test/megaco_digit_map_test.erl +++ b/lib/megaco/test/megaco_digit_map_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -36,54 +36,39 @@ t(Case) -> megaco_test_lib:t({?MODULE, Case}). init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - tickets - ], - Cases. +all() -> + [{group, tickets}]. + +groups() -> + [{tickets, [], + [{group, otp_5750}, {group, otp_5799}, + {group, otp_5826}, {group, otp_7449}]}, + {otp_5750, [], [otp_5750_01, otp_5750_02]}, + {otp_5799, [], [otp_5799_01]}, + {otp_5826, [], [otp_5826_01, otp_5826_02, otp_5826_03]}, + {otp_7449, [], [otp_7449_1, otp_7449_2]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -tickets(suite) -> - [ - otp_5750, - otp_5799, - otp_5826, - otp_7449 - ]. - - -otp_5750(suite) -> - [ - otp_5750_01, - otp_5750_02 - ]. - -otp_5799(suite) -> - [ - otp_5799_01 - ]. - -otp_5826(suite) -> - [ - otp_5826_01, - otp_5826_02, - otp_5826_03 - ]. - -otp_7449(suite) -> - [ - otp_7449_1, - otp_7449_2 - ]. + + + + + diff --git a/lib/megaco/test/megaco_examples_test.erl b/lib/megaco/test/megaco_examples_test.erl index ef15cb1bde..528b61c2af 100644 --- a/lib/megaco/test/megaco_examples_test.erl +++ b/lib/megaco/test/megaco_examples_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -41,11 +41,11 @@ init_per_testcase(Case, Config) -> megaco:enable_trace(max, io), megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> purge_examples(), erase(dbg), megaco:disable_trace(), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). example_modules() -> [megaco_simple_mg, megaco_simple_mgc]. @@ -70,13 +70,18 @@ purge_examples() -> %% Top test case %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Run all examples mentioned in the documentation", - "Are really all examples covered?"]; -all(suite) -> - [ - simple - ]. +all() -> + [simple]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + simple(suite) -> []; diff --git a/lib/megaco/test/megaco_flex_test.erl b/lib/megaco/test/megaco_flex_test.erl index 3dbcf53e7a..d7fc8eacb5 100644 --- a/lib/megaco/test/megaco_flex_test.erl +++ b/lib/megaco/test/megaco_flex_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -32,10 +32,10 @@ -export([ t/0, t/1, - init_per_testcase/2, fin_per_testcase/2, + init_per_testcase/2, end_per_testcase/2, - all/1, - flex_init/1, flex_fin/1, + all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, plain/1, port_exit/1, @@ -55,26 +55,31 @@ t(Case) -> megaco_test_lib:t({?MODULE, Case}). init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - plain, - port_exit, - garbage_in - ], - {req, [], {conf, flex_init, Cases, flex_fin}}. +all() -> + [plain, port_exit, garbage_in]. -flex_init(suite) -> + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(suite) -> []; -flex_init(doc) -> +init_per_suite(doc) -> []; -flex_init(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> case megaco_flex_scanner:is_enabled() of true -> Config; @@ -82,9 +87,9 @@ flex_init(Config) when is_list(Config) -> ?SKIP(flex_scanner_not_enabled) end. -flex_fin(suite) -> []; -flex_fin(doc) -> []; -flex_fin(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. diff --git a/lib/megaco/test/megaco_load_test.erl b/lib/megaco/test/megaco_load_test.erl index 5a22b7b4ee..5519ca15c6 100644 --- a/lib/megaco/test/megaco_load_test.erl +++ b/lib/megaco/test/megaco_load_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -99,26 +99,29 @@ do_init_per_testcase(Case, Config) -> process_flag(trap_exit, true), megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> process_flag(trap_exit, false), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - single_user_light_load, - single_user_medium_load, - single_user_heavy_load, - single_user_extreme_load, - multi_user_light_load, - multi_user_medium_load, - multi_user_heavy_load, - multi_user_extreme_load - ], - Cases. +all() -> + [single_user_light_load, + single_user_medium_load, single_user_heavy_load, + single_user_extreme_load, multi_user_light_load, + multi_user_medium_load, multi_user_heavy_load, + multi_user_extreme_load]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_mess_otp8212_test.erl b/lib/megaco/test/megaco_mess_otp8212_test.erl index 109886ebc4..e074e2f0b3 100644 --- a/lib/megaco/test/megaco_mess_otp8212_test.erl +++ b/lib/megaco/test/megaco_mess_otp8212_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 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 diff --git a/lib/megaco/test/megaco_mess_test.erl b/lib/megaco/test/megaco_mess_test.erl index 368800fa54..ded1506271 100644 --- a/lib/megaco/test/megaco_mess_test.erl +++ b/lib/megaco/test/megaco_mess_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -34,13 +34,13 @@ %% -compile(export_all). -export([ - all/1, + all/0,groups/0,init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, connect/1, - request_and_reply/1, + request_and_reply_plain/1, request_and_no_reply/1, request_and_reply_pending_ack_no_pending/1, @@ -52,13 +52,13 @@ request_and_reply_and_late_ack/1, trans_req_and_reply_and_req/1, - pending_ack/1, + pending_ack_plain/1, request_and_pending_and_late_reply/1, dist/1, - tickets/1, + otp_4359/1, otp_4836/1, otp_5805/1, @@ -67,18 +67,18 @@ otp_6253/1, otp_6275/1, otp_6276/1, - otp_6442/1, + otp_6442_resend_request1/1, otp_6442_resend_request2/1, otp_6442_resend_reply1/1, otp_6442_resend_reply2/1, - otp_6865/1, + otp_6865_request_and_reply_plain_extra1/1, otp_6865_request_and_reply_plain_extra2/1, otp_7189/1, otp_7259/1, otp_7713/1, - otp_8183/1, + otp_8183_request1/1, otp_8212/1 ]). @@ -337,83 +337,50 @@ init_per_testcase(Case, Config) -> C = lists:keydelete(tc_timeout, 1, Config), megaco_test_lib:init_per_testcase(Case, [{tc_timeout, min(1)} |C]). -% fin_per_testcase(pending_ack = Case, Config) -> +% end_per_testcase(pending_ack = Case, Config) -> % erase(dbg), -% megaco_test_lib:fin_per_testcase(Case, Config); -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +% megaco_test_lib:end_per_testcase(Case, Config); +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - [ - connect, - request_and_reply, - pending_ack, - dist, - - %% Tickets last - tickets - ]. - -request_and_reply(suite) -> - [ - request_and_reply_plain, - request_and_no_reply, - request_and_reply_pending_ack_no_pending, - request_and_reply_pending_ack_one_pending, - single_trans_req_and_reply, - single_trans_req_and_reply_sendopts, - request_and_reply_and_ack, - request_and_reply_and_no_ack, - request_and_reply_and_late_ack, - trans_req_and_reply_and_req - ]. - -pending_ack(suite) -> - [ - pending_ack_plain, - request_and_pending_and_late_reply - ]. - -tickets(suite) -> - [ - otp_4359, - otp_4836, - otp_5805, - otp_5881, - otp_5887, - otp_6253, - otp_6275, - otp_6276, - otp_6442, - otp_6865, - otp_7189, - otp_7259, - otp_7713, - otp_8183, - otp_8212 - ]. - -otp_6442(suite) -> - [ - otp_6442_resend_request1, - otp_6442_resend_request2, - otp_6442_resend_reply1, - otp_6442_resend_reply2 - ]. - -otp_6865(suite) -> - [ - otp_6865_request_and_reply_plain_extra1, - otp_6865_request_and_reply_plain_extra2 - ]. - -otp_8183(suite) -> - [ - otp_8183_request1 - ]. +all() -> + [connect, {group, request_and_reply}, + {group, pending_ack}, dist, {group, tickets}]. + +groups() -> + [{request_and_reply, [], + [request_and_reply_plain, request_and_no_reply, + request_and_reply_pending_ack_no_pending, + request_and_reply_pending_ack_one_pending, + single_trans_req_and_reply, + single_trans_req_and_reply_sendopts, + request_and_reply_and_ack, request_and_reply_and_no_ack, + request_and_reply_and_late_ack, + trans_req_and_reply_and_req]}, + {pending_ack, [], + [pending_ack_plain, + request_and_pending_and_late_reply]}, + {tickets, [], + [otp_4359, otp_4836, otp_5805, otp_5881, otp_5887, + otp_6253, otp_6275, otp_6276, {group, otp_6442}, + {group, otp_6865}, otp_7189, otp_7259, otp_7713, + {group, otp_8183}, otp_8212]}, + {otp_6442, [], + [otp_6442_resend_request1, otp_6442_resend_request2, + otp_6442_resend_reply1, otp_6442_resend_reply2]}, + {otp_6865, [], + [otp_6865_request_and_reply_plain_extra1, + otp_6865_request_and_reply_plain_extra2]}, + {otp_8183, [], [otp_8183_request1]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_mess_user_test.erl b/lib/megaco/test/megaco_mess_user_test.erl index 50284be549..ce682c167b 100644 --- a/lib/megaco/test/megaco_mess_user_test.erl +++ b/lib/megaco/test/megaco_mess_user_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 diff --git a/lib/megaco/test/megaco_mib_test.erl b/lib/megaco/test/megaco_mib_test.erl index 2da6aa3bf3..52d99d1442 100644 --- a/lib/megaco/test/megaco_mib_test.erl +++ b/lib/megaco/test/megaco_mib_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% 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 @@ -63,21 +63,25 @@ init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config) end. -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> process_flag(trap_exit, false), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - plain, - connect, - traffic - ], - Cases. +all() -> + [plain, connect, traffic]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_mreq_test.erl b/lib/megaco/test/megaco_mreq_test.erl index 676acd8a12..1d3f38d50d 100644 --- a/lib/megaco/test/megaco_mreq_test.erl +++ b/lib/megaco/test/megaco_mreq_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -69,20 +69,24 @@ init_per_testcase(Case, Config) -> process_flag(trap_exit, true), megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> process_flag(trap_exit, false), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - req_and_rep, - req_and_pending, - req_and_cancel - ], - Cases. +all() -> + [req_and_rep, req_and_pending, req_and_cancel]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_pending_limit_test.erl b/lib/megaco/test/megaco_pending_limit_test.erl index 1ca29c195c..233c22f4d2 100644 --- a/lib/megaco/test/megaco_pending_limit_test.erl +++ b/lib/megaco/test/megaco_pending_limit_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -26,22 +26,16 @@ -module(megaco_pending_limit_test). -export([t/0, t/1]). --export([init_per_testcase/2, fin_per_testcase/2]). --export([all/1, - - sent/1, +-export([init_per_testcase/2, end_per_testcase/2]). +-export([all/0,groups/0,init_per_group/2,end_per_group/2, sent_timer_late_reply/1, sent_timer_exceeded/1, sent_timer_exceeded_long/1, sent_resend_late_reply/1, sent_resend_exceeded/1, sent_resend_exceeded_long/1, - - recv/1, recv_limit_exceeded1/1, recv_limit_exceeded2/1, - - tickets/1, otp_4956/1, otp_5310/1, otp_5619/1 @@ -139,45 +133,29 @@ init_per_testcase(Case, Config) -> process_flag(trap_exit, true), megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> process_flag(trap_exit, false), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - [ - sent, - recv, - - %% Tickets last - tickets - ]. - -sent(suite) -> - [ - sent_timer_late_reply, - sent_timer_exceeded, - sent_timer_exceeded_long, - sent_resend_late_reply, - sent_resend_exceeded, - sent_resend_exceeded_long - - ]. +all() -> + [{group, sent}, {group, recv}, {group, tickets}]. -recv(suite) -> - [ - recv_limit_exceeded1, - recv_limit_exceeded2 - ]. +groups() -> + [{sent, [], + [sent_timer_late_reply, sent_timer_exceeded, + sent_timer_exceeded_long, sent_resend_late_reply, + sent_resend_exceeded, sent_resend_exceeded_long]}, + {recv, [], + [recv_limit_exceeded1, recv_limit_exceeded2]}, + {tickets, [], [otp_4956, otp_5310, otp_5619]}]. -tickets(suite) -> - [ - otp_4956, - otp_5310, - otp_5619 - ]. +init_per_group(_GroupName, Config) -> + Config. +end_per_group(_GroupName, Config) -> + Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% %%% diff --git a/lib/megaco/test/megaco_profile.erl b/lib/megaco/test/megaco_profile.erl index 01fa0b5a14..d0b62610e1 100644 --- a/lib/megaco/test/megaco_profile.erl +++ b/lib/megaco/test/megaco_profile.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 diff --git a/lib/megaco/test/megaco_sdp_test.erl b/lib/megaco/test/megaco_sdp_test.erl index e9bd550518..796a956f23 100644 --- a/lib/megaco/test/megaco_sdp_test.erl +++ b/lib/megaco/test/megaco_sdp_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -24,13 +24,12 @@ -module(megaco_sdp_test). --export([all/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, decode_encode/1, - tickets/1, otp8123/1, - init_per_testcase/2, fin_per_testcase/2, + init_per_testcase/2, end_per_testcase/2, t/0, t/1]). @@ -46,8 +45,8 @@ t(Case) -> megaco_test_lib:t({?MODULE, Case}). init_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -55,16 +54,19 @@ fin_per_testcase(Case, Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - [ - decode_encode, - tickets - ]. +all() -> + [decode_encode, {group, tickets}]. + +groups() -> + [{tickets, [], [otp8123]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -tickets(suite) -> - [ - otp8123 - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_segment_test.erl b/lib/megaco/test/megaco_segment_test.erl index ef07ee54b1..e4b568119d 100644 --- a/lib/megaco/test/megaco_segment_test.erl +++ b/lib/megaco/test/megaco_segment_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -24,10 +24,10 @@ -module(megaco_segment_test). -export([t/0, t/1]). --export([init_per_testcase/2, fin_per_testcase/2]). --export([all/1, +-export([init_per_testcase/2, end_per_testcase/2]). +-export([all/0,groups/0,init_per_group/2,end_per_group/2, - send/1, + send_segmented_msg_plain1/1, send_segmented_msg_plain2/1, send_segmented_msg_plain3/1, @@ -36,13 +36,11 @@ send_segmented_msg_missing_seg_reply1/1, send_segmented_msg_missing_seg_reply2/1, - recv/1, + recv_segmented_msg_plain/1, recv_segmented_msg_ooo_seg/1, recv_segmented_msg_missing_seg1/1, - recv_segmented_msg_missing_seg2/1, - - tickets/1 + recv_segmented_msg_missing_seg2/1 ]). @@ -66,45 +64,33 @@ init_per_testcase(Case, Config) -> process_flag(trap_exit, true), megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> process_flag(trap_exit, false), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - [ - send, - recv - - %% Tickets last - %% tickets - ]. - -send(suite) -> - [ - send_segmented_msg_plain1, - send_segmented_msg_plain2, - send_segmented_msg_plain3, - send_segmented_msg_plain4, - send_segmented_msg_ooo1, - send_segmented_msg_missing_seg_reply1, - send_segmented_msg_missing_seg_reply2 - ]. - -recv(suite) -> - [ - recv_segmented_msg_plain, - recv_segmented_msg_ooo_seg, - recv_segmented_msg_missing_seg1, - recv_segmented_msg_missing_seg2 - ]. - -tickets(suite) -> - [ - ]. - +all() -> + [{group, send}, {group, recv}]. + +groups() -> + [{send, [], + [send_segmented_msg_plain1, send_segmented_msg_plain2, + send_segmented_msg_plain3, send_segmented_msg_plain4, + send_segmented_msg_ooo1, + send_segmented_msg_missing_seg_reply1, + send_segmented_msg_missing_seg_reply2]}, + {recv, [], + [recv_segmented_msg_plain, recv_segmented_msg_ooo_seg, + recv_segmented_msg_missing_seg1, + recv_segmented_msg_missing_seg2]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_tc_controller.erl b/lib/megaco/test/megaco_tc_controller.erl index dedf45e321..458bff55e8 100644 --- a/lib/megaco/test/megaco_tc_controller.erl +++ b/lib/megaco/test/megaco_tc_controller.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 diff --git a/lib/megaco/test/megaco_tcp_test.erl b/lib/megaco/test/megaco_tcp_test.erl index 31c88489fe..013096c385 100644 --- a/lib/megaco/test/megaco_tcp_test.erl +++ b/lib/megaco/test/megaco_tcp_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -36,25 +36,19 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - - start/1, + all/0,groups/0,init_per_group/2,end_per_group/2, start_normal/1, start_invalid_opt/1, start_and_stop/1, - - sending/1, sendreceive/1, block_unblock/1, - - errors/1, socket_failure/1, accept_process/1, accept_supervisor/1, connection_supervisor/1, tcp_server/1, - init_per_testcase/2, fin_per_testcase/2, + init_per_testcase/2, end_per_testcase/2, t/0, t/1 ]). @@ -111,44 +105,32 @@ init_per_testcase(Case, Config) -> %%---------------------------------------------------------------------- -%% Function: fin_per_testcase/2 +%% Function: end_per_testcase/2 %% Description: %%---------------------------------------------------------------------- -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%====================================================================== %% Test case definitions %%====================================================================== -all(suite) -> - [ - start, - sending, - errors - ]. - -start(suite) -> - [ - start_normal, - start_invalid_opt, - start_and_stop - ]. - -sending(suite) -> - [ - sendreceive, - block_unblock - ]. - -errors(suite) -> - [ - socket_failure, - accept_process, - accept_supervisor, - connection_supervisor, - tcp_server - ]. +all() -> + [{group, start}, {group, sending}, {group, errors}]. + +groups() -> + [{start, [], + [start_normal, start_invalid_opt, start_and_stop]}, + {sending, [], [sendreceive, block_unblock]}, + {errors, [], + [socket_failure, accept_process, accept_supervisor, + connection_supervisor, tcp_server]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %% ------------------ start ------------------------ diff --git a/lib/megaco/test/megaco_test_deliver.erl b/lib/megaco/test/megaco_test_deliver.erl index 2d0f0c1cbe..ece0a48015 100644 --- a/lib/megaco/test/megaco_test_deliver.erl +++ b/lib/megaco/test/megaco_test_deliver.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 diff --git a/lib/megaco/test/megaco_test_generator.erl b/lib/megaco/test/megaco_test_generator.erl index 8bbc60e6cd..a021d2451b 100644 --- a/lib/megaco/test/megaco_test_generator.erl +++ b/lib/megaco/test/megaco_test_generator.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 diff --git a/lib/megaco/test/megaco_test_generator_lib.erl b/lib/megaco/test/megaco_test_generator_lib.erl index cf0dcaf722..1584605913 100644 --- a/lib/megaco/test/megaco_test_generator_lib.erl +++ b/lib/megaco/test/megaco_test_generator_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 diff --git a/lib/megaco/test/megaco_test_generic_transport.erl b/lib/megaco/test/megaco_test_generic_transport.erl index 10afa45baa..7a3dbc5317 100644 --- a/lib/megaco/test/megaco_test_generic_transport.erl +++ b/lib/megaco/test/megaco_test_generic_transport.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 diff --git a/lib/megaco/test/megaco_test_lib.erl b/lib/megaco/test/megaco_test_lib.erl index 03c04831e8..0d2b4a3f4e 100644 --- a/lib/megaco/test/megaco_test_lib.erl +++ b/lib/megaco/test/megaco_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -333,7 +333,7 @@ eval(Mod, Fun, Config) -> Config2 = Mod:init_per_testcase(Fun, Config), Pid = spawn_link(?MODULE, do_eval, [self(), Mod, Fun, Config2]), R = wait_for_evaluator(Pid, Mod, Fun, Config2, []), - Mod:fin_per_testcase(Fun, Config2), + Mod:end_per_testcase(Fun, Config2), erase(megaco_test_server), global:unregister_name(megaco_test_case_sup), process_flag(trap_exit, Flag), @@ -677,11 +677,11 @@ init_per_testcase(_Case, Config) -> end, set_kill_timer(Config). -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Name = megaco_global_logger, case global:whereis_name(Name) of undefined -> - io:format("~w:fin_per_testcase -> already un-registered~n", + io:format("~w:end_per_testcase -> already un-registered~n", [?MODULE]), ok; Pid when is_pid(Pid) -> diff --git a/lib/megaco/test/megaco_test_megaco_generator.erl b/lib/megaco/test/megaco_test_megaco_generator.erl index 5ff7162223..21b33e4abc 100644 --- a/lib/megaco/test/megaco_test_megaco_generator.erl +++ b/lib/megaco/test/megaco_test_megaco_generator.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 diff --git a/lib/megaco/test/megaco_test_mg.erl b/lib/megaco/test/megaco_test_mg.erl index 22b65a1ac6..ecb3cedc83 100644 --- a/lib/megaco/test/megaco_test_mg.erl +++ b/lib/megaco/test/megaco_test_mg.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 diff --git a/lib/megaco/test/megaco_test_mgc.erl b/lib/megaco/test/megaco_test_mgc.erl index 05c482f1af..13c1cebe56 100644 --- a/lib/megaco/test/megaco_test_mgc.erl +++ b/lib/megaco/test/megaco_test_mgc.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 diff --git a/lib/megaco/test/megaco_test_msg_prev3a_lib.erl b/lib/megaco/test/megaco_test_msg_prev3a_lib.erl index 5ce2ec302b..2fb0752865 100644 --- a/lib/megaco/test/megaco_test_msg_prev3a_lib.erl +++ b/lib/megaco/test/megaco_test_msg_prev3a_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 diff --git a/lib/megaco/test/megaco_test_msg_prev3b_lib.erl b/lib/megaco/test/megaco_test_msg_prev3b_lib.erl index be87dc9a41..6e042080b7 100644 --- a/lib/megaco/test/megaco_test_msg_prev3b_lib.erl +++ b/lib/megaco/test/megaco_test_msg_prev3b_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 diff --git a/lib/megaco/test/megaco_test_msg_prev3c_lib.erl b/lib/megaco/test/megaco_test_msg_prev3c_lib.erl index 74a05060d0..c768105194 100644 --- a/lib/megaco/test/megaco_test_msg_prev3c_lib.erl +++ b/lib/megaco/test/megaco_test_msg_prev3c_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 diff --git a/lib/megaco/test/megaco_test_msg_v1_lib.erl b/lib/megaco/test/megaco_test_msg_v1_lib.erl index 638215e8c1..424a66b7c9 100644 --- a/lib/megaco/test/megaco_test_msg_v1_lib.erl +++ b/lib/megaco/test/megaco_test_msg_v1_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 diff --git a/lib/megaco/test/megaco_test_msg_v2_lib.erl b/lib/megaco/test/megaco_test_msg_v2_lib.erl index b680bc869a..b29920006d 100644 --- a/lib/megaco/test/megaco_test_msg_v2_lib.erl +++ b/lib/megaco/test/megaco_test_msg_v2_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 diff --git a/lib/megaco/test/megaco_test_msg_v3_lib.erl b/lib/megaco/test/megaco_test_msg_v3_lib.erl index 7b0d4f7d37..fee61542b7 100644 --- a/lib/megaco/test/megaco_test_msg_v3_lib.erl +++ b/lib/megaco/test/megaco_test_msg_v3_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 diff --git a/lib/megaco/test/megaco_test_tcp_generator.erl b/lib/megaco/test/megaco_test_tcp_generator.erl index e4f27f32f5..416d56d742 100644 --- a/lib/megaco/test/megaco_test_tcp_generator.erl +++ b/lib/megaco/test/megaco_test_tcp_generator.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 diff --git a/lib/megaco/test/megaco_timer_test.erl b/lib/megaco/test/megaco_timer_test.erl index 8bcfc5a907..cccf4651ab 100644 --- a/lib/megaco/test/megaco_timer_test.erl +++ b/lib/megaco/test/megaco_timer_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -25,20 +25,13 @@ -export([ t/0, t/1, - init_per_testcase/2, fin_per_testcase/2, - - all/1, - - simple/1, + init_per_testcase/2, end_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, simple_init/1, simple_usage/1, - - integer_timer/1, integer_timer_start_and_expire/1, integer_timer_start_and_stop/1%% , - %% incr_timer/1 - ]). -export([ @@ -71,49 +64,39 @@ do_init_per_testcase(Case, Config) -> {ok, _Pid} = megaco_monitor:start_link(), megaco_test_lib:init_per_testcase(Case, [{monitor_running, true}|Config]). -fin_per_testcase(Case, Config) -> - io:format("fin_per_testcase -> entry with" +end_per_testcase(Case, Config) -> + io:format("end_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p" "~n", [Case, Config]), process_flag(trap_exit, false), case lists:keydelete(monitor_running, 1, Config) of Config -> - megaco_test_lib:fin_per_testcase(Case, Config); + megaco_test_lib:end_per_testcase(Case, Config); Config2 -> megaco_monitor:stop(), - megaco_test_lib:fin_per_testcase(Case, Config2) + megaco_test_lib:end_per_testcase(Case, Config2) end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - simple, - integer_timer%% , -%% incr_timer - ], - Cases. - - -simple(suite) -> - Cases = - [ - simple_init, - simple_usage - ], - Cases. - - -integer_timer(suite) -> - Cases = - [ - integer_timer_start_and_expire, - integer_timer_start_and_stop - ], - Cases. +all() -> + [{group, simple}, {group, integer_timer}]. + +groups() -> + [{simple, [], + [simple_init, simple_usage]}, +%, incr_timer + {integer_timer, [], + [integer_timer_start_and_expire, + integer_timer_start_and_stop]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %% incr_timer(suite) -> diff --git a/lib/megaco/test/megaco_trans_test.erl b/lib/megaco/test/megaco_trans_test.erl index 44d4b3fff7..5f564e3bf6 100644 --- a/lib/megaco/test/megaco_trans_test.erl +++ b/lib/megaco/test/megaco_trans_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -95,78 +95,49 @@ init_per_testcase(Case, Config) -> process_flag(trap_exit, true), megaco_test_lib:init_per_testcase(Case, Config). -fin_per_testcase(Case, Config) -> +end_per_testcase(Case, Config) -> process_flag(trap_exit, false), - megaco_test_lib:fin_per_testcase(Case, Config). + megaco_test_lib:end_per_testcase(Case, Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - [ - ack, - trans_req, - trans_req_and_ack, - pending, - reply, - - tickets - ]. - -ack(suite) -> - [ - single_ack, - multi_ack_timeout, - multi_ack_maxcount - ]. - -trans_req(suite) -> - [ - single_trans_req, - multi_trans_req_timeout, - multi_trans_req_maxcount1, - multi_trans_req_maxcount2, - multi_trans_req_maxsize1, - multi_trans_req_maxsize2 - ]. - -trans_req_and_ack(suite) -> - [ - single_trans_req_and_ack, - multi_trans_req_and_ack_timeout, - multi_trans_req_and_ack_ackmaxcount, - multi_trans_req_and_ack_reqmaxcount, - multi_trans_req_and_ack_maxsize1, - multi_trans_req_and_ack_maxsize2 - ]. - -pending(suite) -> - [ - single_trans_req_and_pending, - multi_trans_req_and_pending, - multi_trans_req_and_ack_and_pending, - multi_ack_and_pending - ]. - -reply(suite) -> - [ - multi_trans_req_and_reply, - multi_trans_req_and_ack_and_reply, - multi_ack_and_reply - ]. - -tickets(suite) -> - [ - otp_7192 - ]. - -otp_7192(suite) -> - [ - otp_7192_1, - otp_7192_2, - otp_7192_3 - ]. - +all() -> + [{group, ack}, {group, trans_req}, + {group, trans_req_and_ack}, {group, pending}, + {group, reply}, {group, tickets}]. + +groups() -> + [{ack, [], + [single_ack, multi_ack_timeout, multi_ack_maxcount]}, + {trans_req, [], + [single_trans_req, multi_trans_req_timeout, + multi_trans_req_maxcount1, multi_trans_req_maxcount2, + multi_trans_req_maxsize1, multi_trans_req_maxsize2]}, + {trans_req_and_ack, [], + [single_trans_req_and_ack, + multi_trans_req_and_ack_timeout, + multi_trans_req_and_ack_ackmaxcount, + multi_trans_req_and_ack_reqmaxcount, + multi_trans_req_and_ack_maxsize1, + multi_trans_req_and_ack_maxsize2]}, + {pending, [], + [single_trans_req_and_pending, + multi_trans_req_and_pending, + multi_trans_req_and_ack_and_pending, + multi_ack_and_pending]}, + {reply, [], + [multi_trans_req_and_reply, + multi_trans_req_and_ack_and_reply, + multi_ack_and_reply]}, + {tickets, [], [{group, otp_7192}]}, + {otp_7192, [], [otp_7192_1, otp_7192_2, otp_7192_3]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_udp_test.erl b/lib/megaco/test/megaco_udp_test.erl index 2e2f5465dd..ffbff9b762 100644 --- a/lib/megaco/test/megaco_udp_test.erl +++ b/lib/megaco/test/megaco_udp_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -34,22 +34,14 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - - start/1, + all/0,groups/0,init_per_group/2,end_per_group/2, start_normal/1, start_invalid_opt/1, start_and_stop/1, - - sending/1, sendreceive/1, block_unblock/1, - - errors/1, socket_failure/1, - - init_per_testcase/2, fin_per_testcase/2, - + init_per_testcase/2, end_per_testcase/2, t/0, t/1 ]). @@ -104,42 +96,31 @@ init_per_testcase(Case, Config) -> %%---------------------------------------------------------------------- -%% Function: fin_per_testcase/2 +%% Function: end_per_testcase/2 %% Description: %%---------------------------------------------------------------------- -fin_per_testcase(Case, Config) -> - megaco_test_lib:fin_per_testcase(Case, Config). +end_per_testcase(Case, Config) -> + megaco_test_lib:end_per_testcase(Case, Config). %%====================================================================== %% Test case definitions %%====================================================================== -all(suite) -> - [ - start, - sending, - errors - ]. - -start(suite) -> - [ - start_normal, - start_invalid_opt, - start_and_stop - ]. +all() -> + [{group, start}, {group, sending}, {group, errors}]. -sending(suite) -> - [ - sendreceive, - block_unblock +groups() -> + [{start, [], + [start_normal, start_invalid_opt, start_and_stop]}, + {sending, [], [sendreceive, block_unblock]}, + {errors, [], [socket_failure]}]. - ]. +init_per_group(_GroupName, Config) -> + Config. -errors(suite) -> - [ - socket_failure - ]. +end_per_group(_GroupName, Config) -> + Config. %% ================================================= diff --git a/lib/mnesia/doc/src/notes.xml b/lib/mnesia/doc/src/notes.xml index 2352f11b93..5a6de05c8b 100644 --- a/lib/mnesia/doc/src/notes.xml +++ b/lib/mnesia/doc/src/notes.xml @@ -38,7 +38,36 @@ thus constitutes one section in this document. The title of each section is the version number of Mnesia.</p> - <section><title>Mnesia 4.4.15</title> + <section><title>Mnesia 4.4.16</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Sometimes a 'log_header' record was added to tables when + invoking mnesia:restore/2 with the option + 'recreate_tables'. Thanks Vance Shipley.</p> + <p> + Own Id: OTP-8960</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Compiler warnings were eliminated.</p> + <p> + Own Id: OTP-8855</p> + </item> + </list> + </section> + +</section> + +<section><title>Mnesia 4.4.15</title> <section><title>Improvements and New Features</title> <list> diff --git a/lib/mnesia/test/Makefile b/lib/mnesia/test/Makefile index 4f98efaed1..bce2467a5f 100644 --- a/lib/mnesia/test/Makefile +++ b/lib/mnesia/test/Makefile @@ -108,7 +108,7 @@ release_spec: opt release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) mnesia.spec mnesia.spec.vxworks $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) mnesia.spec mnesia.cover $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) $(INSTALL_SCRIPT) mt $(INSTALL_PROGS) $(RELSYSDIR) # chmod -f -R u+w $(RELSYSDIR) # @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/mnesia/test/mnesia.cover b/lib/mnesia/test/mnesia.cover new file mode 100644 index 0000000000..66ffc06e89 --- /dev/null +++ b/lib/mnesia/test/mnesia.cover @@ -0,0 +1,2 @@ +{incl_app,mnesia,details}. + diff --git a/lib/mnesia/test/mnesia.spec b/lib/mnesia/test/mnesia.spec index 596f8b917d..204d1519cb 100644 --- a/lib/mnesia/test/mnesia.spec +++ b/lib/mnesia/test/mnesia.spec @@ -1,23 +1,76 @@ -{topcase, {dir, "../mnesia_test"}}. -{require_nodenames, 2}. -{skip, {mnesia_measure_test, ram_meter, "Takes to long time"}}. -{skip, {mnesia_measure_test, disc_meter, "Takes to long time"}}. -{skip, {mnesia_measure_test, disc_only_meter, "Takes to long time"}}. -{skip, {mnesia_measure_test, cost, "Takes to long time"}}. -{skip, {mnesia_measure_test, dbn_meters, "Takes to long time"}}. -{skip, {mnesia_measure_test, tpcb, "Takes to long time"}}. -{skip, {mnesia_measure_test, prediction, "Not yet implemented"}}. -{skip, {mnesia_measure_test, consumption, "Not yet implemented"}}. -{skip, {mnesia_measure_test, scalability, "Not yet implemented"}}. -{skip, {mnesia_measure_test, tpcb, "Takes too much time and memory"}}. -{skip, {mnesia_measure_test, measure_all_api_functions, "Not yet implemented"}}. -{skip, {mnesia_measure_test, mnemosyne_vs_mnesia_kernel, "Not yet implemented"}}. -{skip, {mnesia_examples_test, company, "Not yet implemented"}}. -{skip, {mnesia_config_test, ignore_fallback_at_startup, "Not yet implemented"}}. -{skip, {mnesia_evil_backup, local_backup_checkpoint, "Not yet implemented"}}. -{skip, {mnesia_config_test, max_wait_for_decision, "Not yet implemented"}}. -{skip, {mnesia_recovery_test, after_full_disc_partition, "Not yet implemented"}}. -{skip, {mnesia_recovery_test, system_upgrade, "Not yet implemented"}}. -{skip, {mnesia_consistency_test, consistency_after_change_table_copy_type, "Not yet implemented"}}. -{skip, {mnesia_consistency_test, consistency_after_transform_table, "Not yet implemented"}}. -{skip, {mnesia_consistency_test, consistency_after_rename_of_node, "Not yet implemented"}}. +{suites,"../mnesia_test",all}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [ram_meter], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [disc_meter], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [disc_only_meter], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test,[cost],"Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [dbn_meters], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [ram_tpcb,disc_tpcb,disc_only_tpcb], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [reader_disturbed_by_node_down,writer_disturbed_by_node_down, + reader_disturbed_by_node_up,writer_disturbed_by_node_up, + reader_disturbed_by_schema_ops,writer_disturbed_by_schema_ops, + reader_disturbed_by_checkpoint,writer_disturbed_by_checkpoint, + reader_disturbed_by_dump_log,writer_disturbed_by_dump_log, + reader_disturbed_by_backup,writer_disturbed_by_backup, + reader_disturbed_by_restore,writer_disturbed_by_restore, + reader_competing_with_reader,reader_competing_with_writer, + writer_competing_with_reader,writer_competing_with_writer], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [measure_resource_consumption,determine_resource_leakage], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [determine_system_limits,performance_at_min_config, + performance_at_max_config,performance_at_full_load, + resource_consumption_at_min_config, + resource_consumption_at_max_config, + resource_consumption_at_full_load], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [ram_tpcb,disc_tpcb,disc_only_tpcb], + "Takes too much time and memory"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [measure_all_api_functions], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [mnemosyne_vs_mnesia_kernel], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_examples_test, + [company], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_config_test, + [ignore_fallback_at_startup], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_evil_backup, + [local_backup_checkpoint], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_config_test, + [max_wait_for_decision], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_recovery_test, + [after_full_disc_partition], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_recovery_test, + [system_upgrade], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_consistency_test, + [consistency_after_change_table_copy_type], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_consistency_test, + [consistency_after_transform_table_ram, + consistency_after_transform_table_disc, + consistency_after_transform_table_disc_only], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_consistency_test, + [consistency_after_rename_of_node], + "Not yet implemented"}. diff --git a/lib/mnesia/test/mnesia_SUITE.erl b/lib/mnesia/test/mnesia_SUITE.erl index b28deaf330..fe7d366eb3 100644 --- a/lib/mnesia/test/mnesia_SUITE.erl +++ b/lib/mnesia/test/mnesia_SUITE.erl @@ -26,135 +26,122 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify that Mnesia really is a distributed real-time DBMS", - "This is the test suite of the Mnesia DBMS. The test suite", - "covers many aspects of usage and is indended to be developed", - "incrementally. The test suite is divided into a hierarchy of test", - "suites where the leafs actually implements the test cases.", - "The intention of each test case and sub test suite can be", - "read in comments where they are implemented or in worst cases", - "from their long mnemonic names. ", - "", - "The most simple test case of them all is called 'silly'", - "and is useful to run now and then, e.g. when some new fatal", - "bug has been introduced. It may be run even if Mnesia is in", - "such a bad shape that the test machinery cannot be used.", - "NB! Invoke the function directly with mnesia_SUITE:silly()", - "and do not involve the normal test machinery."]; -all(suite) -> - [ - light, - medium, - heavy, - clean_up_suite - ]. +suite() -> [{ct_hooks,[{ts_install_cth,[{nodenames,1}]}]}]. + + +%% Verify that Mnesia really is a distributed real-time DBMS. +%% This is the test suite of the Mnesia DBMS. The test suite +%% covers many aspects of usage and is indended to be developed +%% incrementally. The test suite is divided into a hierarchy of test +%% suites where the leafs actually implements the test cases. +%% The intention of each test case and sub test suite can be +%% read in comments where they are implemented or in worst cases +%% from their long mnemonic names. +%% +%% The most simple test case of them all is called 'silly' +%% and is useful to run now and then, e.g. when some new fatal +%% bug has been introduced. It may be run even if Mnesia is in +%% such a bad shape that the test machinery cannot be used. +%% NB! Invoke the function directly with mnesia_SUITE:silly() +%% and do not involve the normal test machinery. + +all() -> + [{group, light}, {group, medium}, {group, heavy}, + clean_up_suite]. + +groups() -> + %% The 'light' test suite runs a selected set of test suites and is + %% intended to be the smallest test suite that is meaningful + %% to run. It starts with an installation test (which in essence is the + %% 'silly' test case) and then it covers all functions in the API in + %% various depths. All configuration parameters and examples are also + %% covered. + [{light, [], + [{group, install}, {group, nice}, {group, evil}, + {group, mnesia_frag_test, light}, {group, qlc}, + {group, registry}, {group, config}, {group, examples}]}, + {install, [], [{mnesia_install_test, all}]}, + {nice, [], [{mnesia_nice_coverage_test, all}]}, + {evil, [], [{mnesia_evil_coverage_test, all}]}, + {qlc, [], [{mnesia_qlc_test, all}]}, + {registry, [], [{mnesia_registry_test, all}]}, + {config, [], [{mnesia_config_test, all}]}, + {examples, [], [{mnesia_examples_test, all}]}, + %% The 'medium' test suite verfies the ACID (atomicity, consistency + %% isolation and durability) properties and various recovery scenarios + %% These tests may take quite while to run. + {medium, [], + [{group, install}, {group, atomicity}, + {group, isolation}, {group, durability}, + {group, recovery}, {group, consistency}, + {group, mnesia_frag_test, medium}]}, + {atomicity, [], [{mnesia_atomicity_test, all}]}, + {isolation, [], [{mnesia_isolation_test, all}]}, + {durability, [], [{mnesia_durability_test, all}]}, + {recovery, [], [{mnesia_recovery_test, all}]}, + {consistency, [], [{mnesia_consistency_test, all}]}, + %% The 'heavy' test suite runs some resource consuming tests and + %% benchmarks + {heavy, [], [{group, measure}]}, + {measure, [], [{mnesia_measure_test, all}]}, + {prediction, [], + [{group, mnesia_measure_test, prediction}]}, + {fairness, [], + [{group, mnesia_measure_test, fairness}]}, + {benchmarks, [], + [{group, mnesia_measure_test, benchmarks}]}, + {consumption, [], + [{group, mnesia_measure_test, consumption}]}, + {scalability, [], + [{group, mnesia_measure_test, scalability}]}, + %% This test suite is an extract of the grand Mnesia suite + %% it contains OTP R4B specific test cases + {otp_r4b, [], + [{mnesia_config_test, access_module}, + {mnesia_config_test, dump_log_load_regulation}, + {mnesia_config_test, embedded_mnemosyne}, + {mnesia_config_test, ignore_fallback_at_startup}, + {mnesia_config_test, max_wait_for_decision}, + {mnesia_consistency_test, consistency_after_restore}, + {mnesia_evil_backup, restore}, + {mnesia_evil_coverage_test, offline_set_master_nodes}, + {mnesia_evil_coverage_test, record_name}, + {mnesia_evil_coverage_test, user_properties}, + {mnesia_registry_test, all}, {group, otp_2363}]}, + %% Index on disc only tables + {otp_2363, [], + [{mnesia_dirty_access_test, + dirty_index_match_object_disc_only}, + {mnesia_dirty_access_test, dirty_index_read_disc_only}, + {mnesia_dirty_access_test, + dirty_index_update_bag_disc_only}, + {mnesia_dirty_access_test, + dirty_index_update_set_disc_only}, + {mnesia_evil_coverage_test, + create_live_table_index_disc_only}]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +init_per_suite(Config) -> + Config. + +end_per_suite(Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% silly() -> mnesia_install_test:silly(). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -light(doc) -> - ["The 'light' test suite runs a selected set of test suites and is", - "intended to be the smallest test suite that is meaningful", - "to run. It starts with an installation test (which in essence is the", - "'silly' test case) and then it covers all functions in the API in", - "various depths. All configuration parameters and examples are also", - "covered."]; -light(suite) -> - [ - install, - nice, - evil, - {mnesia_frag_test, light}, - qlc, - registry, - config, - examples - ]. - -install(suite) -> - [{mnesia_install_test, all}]. - -nice(suite) -> - [{mnesia_nice_coverage_test, all}]. - -evil(suite) -> - [{mnesia_evil_coverage_test, all}]. - -qlc(suite) -> - [{mnesia_qlc_test, all}]. - -registry(suite) -> - [{mnesia_registry_test, all}]. - -config(suite) -> - [{mnesia_config_test, all}]. - -examples(suite) -> - [{mnesia_examples_test, all}]. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -medium(doc) -> - ["The 'medium' test suite verfies the ACID (atomicity, consistency", - "isolation and durability) properties and various recovery scenarios", - "These tests may take quite while to run."]; -medium(suite) -> - [ - install, - atomicity, - isolation, - durability, - recovery, - consistency, - {mnesia_frag_test, medium} - ]. - -atomicity(suite) -> - [{mnesia_atomicity_test, all}]. - -isolation(suite) -> - [{mnesia_isolation_test, all}]. - -durability(suite) -> - [{mnesia_durability_test, all}]. - -recovery(suite) -> - [{mnesia_recovery_test, all}]. - -consistency(suite) -> - [{mnesia_consistency_test, all}]. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -heavy(doc) -> - ["The 'heavy' test suite runs some resource consuming tests and", - "benchmarks"]; -heavy(suite) -> - [measure]. - -measure(suite) -> - [{mnesia_measure_test, all}]. - -prediction(suite) -> - [{mnesia_measure_test, prediction}]. - -fairness(suite) -> - [{mnesia_measure_test, fairness}]. - -benchmarks(suite) -> - [{mnesia_measure_test, benchmarks}]. - -consumption(suite) -> - [{mnesia_measure_test, consumption}]. - -scalability(suite) -> - [{mnesia_measure_test, scalability}]. - clean_up_suite(doc) -> ["Not a test case only kills mnesia and nodes, that where" "started during the tests"]; @@ -169,35 +156,7 @@ clean_up_suite(Config) when is_list(Config)-> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -otp_r4b(doc) -> - ["This test suite is an extract of the grand Mnesia suite", - "it contains OTP R4B specific test cases"]; -otp_r4b(suite) -> - [ - {mnesia_config_test, access_module}, - {mnesia_config_test, dump_log_load_regulation}, - {mnesia_config_test, embedded_mnemosyne}, - {mnesia_config_test, ignore_fallback_at_startup}, - {mnesia_config_test, max_wait_for_decision}, - {mnesia_consistency_test, consistency_after_restore}, - {mnesia_evil_backup, restore}, - {mnesia_evil_coverage_test, offline_set_master_nodes}, - {mnesia_evil_coverage_test, record_name}, - {mnesia_evil_coverage_test, user_properties}, - {mnesia_registry_test, all}, - otp_2363 - ]. - -otp_2363(doc) -> - ["Index on disc only tables"]; -otp_2363(suite) -> - [ - {mnesia_dirty_access_test, dirty_index_match_object_disc_only}, - {mnesia_dirty_access_test,dirty_index_read_disc_only}, - {mnesia_dirty_access_test,dirty_index_update_bag_disc_only}, - {mnesia_dirty_access_test,dirty_index_update_set_disc_only}, - {mnesia_evil_coverage_test, create_live_table_index_disc_only} - ]. + diff --git a/lib/mnesia/test/mnesia_atomicity_test.erl b/lib/mnesia/test/mnesia_atomicity_test.erl index 645c203a91..cf878fc820 100644 --- a/lib/mnesia/test/mnesia_atomicity_test.erl +++ b/lib/mnesia/test/mnesia_atomicity_test.erl @@ -27,24 +27,46 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify atomicity of transactions", - "Verify that transactions are atomic, i.e. either all operations", - "in a transaction will be performed or none of them. It must be", - "assured that no partitially completed operations leaves any", - "effects in the database."]; -all(suite) -> - [ - explicit_abort_in_middle_of_trans, +all() -> + [explicit_abort_in_middle_of_trans, runtime_error_in_middle_of_trans, - kill_self_in_middle_of_trans, - throw_in_middle_of_trans, - mnesia_down_in_middle_of_trans - ]. + kill_self_in_middle_of_trans, throw_in_middle_of_trans, + {group, mnesia_down_in_middle_of_trans}]. + +groups() -> + [{mnesia_down_in_middle_of_trans, [], + [mnesia_down_during_infinite_trans, + {group, lock_waiter}, {group, restart_check}]}, + {lock_waiter, [], + [lock_waiter_sw_r, lock_waiter_sw_rt, lock_waiter_sw_wt, + lock_waiter_wr_r, lock_waiter_srw_r, lock_waiter_sw_sw, + lock_waiter_sw_w, lock_waiter_sw_wr, lock_waiter_sw_srw, + lock_waiter_wr_wt, lock_waiter_srw_wt, + lock_waiter_wr_sw, lock_waiter_srw_sw, lock_waiter_wr_w, + lock_waiter_srw_w, lock_waiter_r_sw, lock_waiter_r_w, + lock_waiter_r_wt, lock_waiter_rt_sw, lock_waiter_rt_w, + lock_waiter_rt_wt, lock_waiter_wr_wr, + lock_waiter_srw_srw, lock_waiter_wt_r, lock_waiter_wt_w, + lock_waiter_wt_rt, lock_waiter_wt_wt, lock_waiter_wt_wr, + lock_waiter_wt_srw, lock_waiter_wt_sw, lock_waiter_w_wr, + lock_waiter_w_srw, lock_waiter_w_sw, lock_waiter_w_r, + lock_waiter_w_w, lock_waiter_w_rt, lock_waiter_w_wt]}, + {restart_check, [], + [restart_r_one, restart_w_one, restart_rt_one, + restart_wt_one, restart_wr_one, restart_sw_one, + restart_r_two, restart_w_two, restart_rt_two, + restart_wt_two, restart_wr_two, restart_sw_two]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% explicit_abort_in_middle_of_trans(suite) -> []; @@ -259,12 +281,6 @@ throw_in_middle_of_trans(Config) when is_list(Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -mnesia_down_in_middle_of_trans(suite) -> - [ - mnesia_down_during_infinite_trans, - lock_waiter, - restart_check - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% mnesia_down_during_infinite_trans(suite) -> []; @@ -304,56 +320,6 @@ mnesia_down_during_infinite_trans(Config) when is_list(Config) -> ?verify_mnesia([Node2], [Node1]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -lock_waiter(doc) -> - ["The purpose of this test case is to test the following situation:", - "process B locks an object, process A accesses that object as", - "well, but A has to wait for the lock to be released. Then", - "mnesia of B goes down. Question: will A get the lock ?", - "important: the transaction of A is the oldest one !!! (= a little tricky)", - "", - "several different access operations shall be tested", - "rt = read_lock_table, wt = write_lock_table, r = read,", - "sw = s_write, w = write, wr = wread"]; -lock_waiter(suite) -> - [ - lock_waiter_sw_r, - lock_waiter_sw_rt, - lock_waiter_sw_wt, - lock_waiter_wr_r, - lock_waiter_srw_r, - lock_waiter_sw_sw, - lock_waiter_sw_w, - lock_waiter_sw_wr, - lock_waiter_sw_srw, - lock_waiter_wr_wt, - lock_waiter_srw_wt, - lock_waiter_wr_sw, - lock_waiter_srw_sw, - lock_waiter_wr_w, - lock_waiter_srw_w, - lock_waiter_r_sw, - lock_waiter_r_w, - lock_waiter_r_wt, - lock_waiter_rt_sw, - lock_waiter_rt_w, - lock_waiter_rt_wt, - lock_waiter_wr_wr, - lock_waiter_srw_srw, - lock_waiter_wt_r, - lock_waiter_wt_w, - lock_waiter_wt_rt, - lock_waiter_wt_wt, - lock_waiter_wt_wr, - lock_waiter_wt_srw, - lock_waiter_wt_sw, - lock_waiter_w_wr, - lock_waiter_w_srw, - lock_waiter_w_sw, - lock_waiter_w_r, - lock_waiter_w_w, - lock_waiter_w_rt, - lock_waiter_w_wt - ]. lock_waiter_sw_r(suite) -> []; lock_waiter_sw_r(Config) when is_list(Config) -> @@ -649,29 +615,6 @@ wait(Mseconds) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -restart_check (doc) -> - [ - "test case:'A' performs a transaction on a table which", - "is only replicated on node B. During that transaction", - "mnesia on node B is killed. The transaction of A should", - "be stopped, since there is no further replica", - "rt = read_lock_table, wt = write_lock_table, r = read,", - "sw = s_write, w = write, wr = wread,"]; -restart_check(suite) -> - [ - restart_r_one, - restart_w_one, - restart_rt_one, - restart_wt_one, - restart_wr_one, - restart_sw_one, - restart_r_two, - restart_w_two, - restart_rt_two, - restart_wt_two, - restart_wr_two, - restart_sw_two - ]. restart_r_one(suite) -> []; restart_r_one(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_config_backup.erl b/lib/mnesia/test/mnesia_config_backup.erl index a33ec6ac5c..0916e255e2 100644 --- a/lib/mnesia/test/mnesia_config_backup.erl +++ b/lib/mnesia/test/mnesia_config_backup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 diff --git a/lib/mnesia/test/mnesia_config_event.erl b/lib/mnesia/test/mnesia_config_event.erl index 6c1dea7ed5..832bf94eb9 100644 --- a/lib/mnesia/test/mnesia_config_event.erl +++ b/lib/mnesia/test/mnesia_config_event.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 diff --git a/lib/mnesia/test/mnesia_config_test.erl b/lib/mnesia/test/mnesia_config_test.erl index 7b62c63a62..93510d539c 100644 --- a/lib/mnesia/test/mnesia_config_test.erl +++ b/lib/mnesia/test/mnesia_config_test.erl @@ -27,14 +27,14 @@ -record(test_table2,{i, b}). -export([ - all/1, + all/0,groups/0,init_per_group/2,end_per_group/2, access_module/1, auto_repair/1, backup_module/1, debug/1, dir/1, dump_log_load_regulation/1, - dump_log_thresholds/1, + dump_log_update_in_place/1, embedded_mnemosyne/1, event_module/1, @@ -44,7 +44,7 @@ send_compressed/1, app_test/1, - schema_config/1, + schema_merge/1, unknown_config/1, @@ -56,13 +56,13 @@ start_first_one_disc_less_then_two_more_disc_less/1, schema_location_and_extra_db_nodes_combinations/1, table_load_to_disc_less_nodes/1, - dynamic_connect/1, + dynamic_basic/1, dynamic_ext/1, dynamic_bad/1, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, c_nodes/0 ]). @@ -95,46 +95,40 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - [ - "Test all configuration parameters", - "Perform an exhaustive test of all the various parameters that", - "may be used to configure the Mnesia application.", - "", - "Hint: Check out the unofficial function mnesia:start/1.", - " But be careful to cleanup all configuration parameters", - " afterwards since the rest of the test suite may rely on", - " these default configurations. Perhaps it is best to run", - " these tests in a separate node which is dropped afterwards.", - "Are really all configuration parameters covered?"]; - -all(suite) -> - [ - access_module, - auto_repair, - backup_module, - debug, - dir, - dump_log_load_regulation, - dump_log_thresholds, - dump_log_update_in_place, - embedded_mnemosyne, - event_module, - ignore_fallback_at_startup, - inconsistent_database, - max_wait_for_decision, - send_compressed, - - app_test, - schema_config, - unknown_config - ]. +all() -> + [access_module, auto_repair, backup_module, debug, dir, + dump_log_load_regulation, {group, dump_log_thresholds}, + dump_log_update_in_place, embedded_mnemosyne, + event_module, ignore_fallback_at_startup, + inconsistent_database, max_wait_for_decision, + send_compressed, app_test, {group, schema_config}, + unknown_config]. + +groups() -> + [{dump_log_thresholds, [], + [dump_log_time_threshold, dump_log_write_threshold]}, + {schema_config, [], + [start_one_disc_full_then_one_disc_less, + start_first_one_disc_less_then_one_disc_full, + start_first_one_disc_less_then_two_more_disc_less, + schema_location_and_extra_db_nodes_combinations, + table_load_to_disc_less_nodes, schema_merge, + {group, dynamic_connect}]}, + {dynamic_connect, [], + [dynamic_basic, dynamic_ext, dynamic_bad]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -445,21 +439,6 @@ dump_log_update_in_place(Config) when is_list(Config) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dump_log_thresholds(doc) -> - ["Elaborate with various values of the dump log thresholds and how", - "they affects each others. Both the dump_log_time_threshold and the", - "dump_log_write_threshold must be covered. Do also check that both", - "kinds of overload events are generated as expected.", - "", - "Logs are checked by first doing whatever has to be done to trigger ", - "a dump, and then stopping Mnesia and then look in the ", - "data files and see that the correct amount of transactions ", - "have been done."]; -dump_log_thresholds(suite) -> - [ - dump_log_time_threshold, - dump_log_write_threshold - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dump_log_write_threshold(doc)-> @@ -783,22 +762,6 @@ event_module(Config) when is_list(Config) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -schema_config(doc) -> - ["Try many configurations with various schema_location's with and", - "without explicit extra_db_nodes. Do also provoke various schema merge", - "situations. Most of the other test suites focusses on tests where the", - "schema is residing on disc. Now it is time to perform an exhaustive", - "elaboration with various disc less configurations."]; -schema_config(suite) -> - [ - start_one_disc_full_then_one_disc_less, - start_first_one_disc_less_then_one_disc_full, - start_first_one_disc_less_then_two_more_disc_less, - schema_location_and_extra_db_nodes_combinations, - table_load_to_disc_less_nodes, - schema_merge, - dynamic_connect - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% start_one_disc_full_then_one_disc_less(doc)-> ["Start a disk node and then a disk less one. Distribute some", @@ -1160,15 +1123,6 @@ sort(NS) when is_list(NS) -> lists:sort(NS). -dynamic_connect(doc) -> - ["Test the new functionality where we start mnesia first and then " - "connect to the other mnesia nodes"]; -dynamic_connect(suite) -> - [ - dynamic_basic, - dynamic_ext, - dynamic_bad - ]. dynamic_basic(suite) -> []; diff --git a/lib/mnesia/test/mnesia_consistency_test.erl b/lib/mnesia/test/mnesia_consistency_test.erl index ffe8ab7ac3..f38e13f3a2 100644 --- a/lib/mnesia/test/mnesia_consistency_test.erl +++ b/lib/mnesia/test/mnesia_consistency_test.erl @@ -27,33 +27,121 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify transaction consistency", - "Consistency is the property of the application that requires any", - "execution of the transaction to take the database from one", - "consistent state to another. Verify that the database is", - "consistent at any point in time.", - "Verify for various configurations.", - " Verify for both set and bag"]; -all(suite) -> - [ - consistency_after_restart, - consistency_after_dump_tables, - consistency_after_add_replica, - consistency_after_del_replica, - consistency_after_move_replica, - consistency_after_transform_table, +all() -> + [{group, consistency_after_restart}, + {group, consistency_after_dump_tables}, + {group, consistency_after_add_replica}, + {group, consistency_after_del_replica}, + {group, consistency_after_move_replica}, + {group, consistency_after_transform_table}, consistency_after_change_table_copy_type, - consistency_after_fallback, - consistency_after_restore, + {group, consistency_after_fallback}, + {group, consistency_after_restore}, consistency_after_rename_of_node, - checkpoint_retainer_consistency, - backup_consistency - ]. + {group, checkpoint_retainer_consistency}, + {group, backup_consistency}]. + +groups() -> + [{consistency_after_restart, [], + [consistency_after_restart_1_ram, + consistency_after_restart_1_disc, + consistency_after_restart_1_disc_only, + consistency_after_restart_2_ram, + consistency_after_restart_2_disc, + consistency_after_restart_2_disc_only]}, + {consistency_after_dump_tables, [], + [consistency_after_dump_tables_1_ram, + consistency_after_dump_tables_2_ram]}, + {consistency_after_add_replica, [], + [consistency_after_add_replica_2_ram, + consistency_after_add_replica_2_disc, + consistency_after_add_replica_2_disc_only, + consistency_after_add_replica_3_ram, + consistency_after_add_replica_3_disc, + consistency_after_add_replica_3_disc_only]}, + {consistency_after_del_replica, [], + [consistency_after_del_replica_2_ram, + consistency_after_del_replica_2_disc, + consistency_after_del_replica_2_disc_only, + consistency_after_del_replica_3_ram, + consistency_after_del_replica_3_disc, + consistency_after_del_replica_3_disc_only]}, + {consistency_after_move_replica, [], + [consistency_after_move_replica_2_ram, + consistency_after_move_replica_2_disc, + consistency_after_move_replica_2_disc_only, + consistency_after_move_replica_3_ram, + consistency_after_move_replica_3_disc, + consistency_after_move_replica_3_disc_only]}, + {consistency_after_transform_table, [], + [consistency_after_transform_table_ram, + consistency_after_transform_table_disc, + consistency_after_transform_table_disc_only]}, + {consistency_after_fallback, [], + [consistency_after_fallback_2_ram, + consistency_after_fallback_2_disc, + consistency_after_fallback_2_disc_only, + consistency_after_fallback_3_ram, + consistency_after_fallback_3_disc, + consistency_after_fallback_3_disc_only]}, + {consistency_after_restore, [], + [consistency_after_restore_clear_ram, + consistency_after_restore_clear_disc, + consistency_after_restore_clear_disc_only, + consistency_after_restore_recreate_ram, + consistency_after_restore_recreate_disc, + consistency_after_restore_recreate_disc_only]}, + {checkpoint_retainer_consistency, [], + [{group, updates_during_checkpoint_activation}, + {group, updates_during_checkpoint_iteration}, + {group, load_table_with_activated_checkpoint}, + {group, + add_table_copy_to_table_with_activated_checkpoint}]}, + {updates_during_checkpoint_activation, [], + [updates_during_checkpoint_activation_2_ram, + updates_during_checkpoint_activation_2_disc, + updates_during_checkpoint_activation_2_disc_only, + updates_during_checkpoint_activation_3_ram, + updates_during_checkpoint_activation_3_disc, + updates_during_checkpoint_activation_3_disc_only]}, + {updates_during_checkpoint_iteration, [], + [updates_during_checkpoint_iteration_2_ram, + updates_during_checkpoint_iteration_2_disc, + updates_during_checkpoint_iteration_2_disc_only]}, + {load_table_with_activated_checkpoint, [], + [load_table_with_activated_checkpoint_ram, + load_table_with_activated_checkpoint_disc, + load_table_with_activated_checkpoint_disc_only]}, + {add_table_copy_to_table_with_activated_checkpoint, [], + [add_table_copy_to_table_with_activated_checkpoint_ram, + add_table_copy_to_table_with_activated_checkpoint_disc, + add_table_copy_to_table_with_activated_checkpoint_disc_only]}, + {backup_consistency, [], + [{group, interupted_install_fallback}, + {group, interupted_uninstall_fallback}, + {group, mnesia_down_during_backup_causes_switch}, + {group, mnesia_down_during_backup_causes_abort}, + {group, schema_transactions_during_backup}]}, + {interupted_install_fallback, [], + [inst_fallback_process_dies, fatal_when_inconsistency]}, + {interupted_uninstall_fallback, [], [after_delete]}, + {mnesia_down_during_backup_causes_switch, [], + [cause_switch_before, cause_switch_after]}, + {mnesia_down_during_backup_causes_abort, [], + [cause_abort_before, cause_abort_after]}, + {schema_transactions_during_backup, [], + [change_schema_before, change_schema_after]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -185,15 +273,6 @@ receive_messages(ListOfMsgs) -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_restart(suite) -> - [ - consistency_after_restart_1_ram, - consistency_after_restart_1_disc, - consistency_after_restart_1_disc_only, - consistency_after_restart_2_ram, - consistency_after_restart_2_disc, - consistency_after_restart_2_disc_only - ]. consistency_after_restart_1_ram(suite) -> []; consistency_after_restart_1_ram(Config) when is_list(Config) -> @@ -237,11 +316,6 @@ consistency_after_restart(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_dump_tables(suite) -> - [ - consistency_after_dump_tables_1_ram, - consistency_after_dump_tables_2_ram - ]. consistency_after_dump_tables_1_ram(suite) -> []; consistency_after_dump_tables_1_ram(Config) when is_list(Config) -> @@ -274,15 +348,6 @@ consistency_after_dump_tables(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_add_replica(suite) -> - [ - consistency_after_add_replica_2_ram, - consistency_after_add_replica_2_disc, - consistency_after_add_replica_2_disc_only, - consistency_after_add_replica_3_ram, - consistency_after_add_replica_3_disc, - consistency_after_add_replica_3_disc_only - ]. consistency_after_add_replica_2_ram(suite) -> []; consistency_after_add_replica_2_ram(Config) when is_list(Config) -> @@ -326,15 +391,6 @@ consistency_after_add_replica(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes0, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_del_replica(suite) -> - [ - consistency_after_del_replica_2_ram, - consistency_after_del_replica_2_disc, - consistency_after_del_replica_2_disc_only, - consistency_after_del_replica_3_ram, - consistency_after_del_replica_3_disc, - consistency_after_del_replica_3_disc_only - ]. consistency_after_del_replica_2_ram(suite) -> []; consistency_after_del_replica_2_ram(Config) when is_list(Config) -> @@ -377,15 +433,6 @@ consistency_after_del_replica(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_move_replica(suite) -> - [ - consistency_after_move_replica_2_ram, - consistency_after_move_replica_2_disc, - consistency_after_move_replica_2_disc_only, - consistency_after_move_replica_3_ram, - consistency_after_move_replica_3_disc, - consistency_after_move_replica_3_disc_only - ]. consistency_after_move_replica_2_ram(suite) -> []; consistency_after_move_replica_2_ram(Config) when is_list(Config) -> @@ -430,16 +477,6 @@ consistency_after_move_replica(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_transform_table(doc) -> - ["Check that the database is consistent after transform_table.", - " While applications are updating the involved tables. "]; - -consistency_after_transform_table(suite) -> - [ - consistency_after_transform_table_ram, - consistency_after_transform_table_disc, - consistency_after_transform_table_disc_only - ]. consistency_after_transform_table_ram(suite) -> []; @@ -498,20 +535,6 @@ consistency_after_change_table_copy_type(doc) -> " While applications are updating the involved tables. "]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_fallback(doc) -> - ["Check that installed fallbacks are consistent. Check this by starting ", - "some nodes, run tpcb on them, take a backup at any time, install it ", - "as a fallback, kill all nodes, start mnesia again and check for ", - "any inconsistencies"]; -consistency_after_fallback(suite) -> - [ - consistency_after_fallback_2_ram, - consistency_after_fallback_2_disc, - consistency_after_fallback_2_disc_only, - consistency_after_fallback_3_ram, - consistency_after_fallback_3_disc - , consistency_after_fallback_3_disc_only - ]. consistency_after_fallback_2_ram(suite) -> []; consistency_after_fallback_2_ram(Config) when is_list(Config) -> @@ -583,18 +606,6 @@ consistency_after_fallback(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_restore(doc) -> - ["Verify consistency after restore operations."]; - -consistency_after_restore(suite) -> - [ - consistency_after_restore_clear_ram, - consistency_after_restore_clear_disc, - consistency_after_restore_clear_disc_only, - consistency_after_restore_recreate_ram, - consistency_after_restore_recreate_disc, - consistency_after_restore_recreate_disc_only - ]. consistency_after_restore_clear_ram(suite) -> []; consistency_after_restore_clear_ram(Config) when is_list(Config) -> @@ -716,32 +727,8 @@ consistency_after_rename_of_node(doc) -> ["Skipped because it is an unimportant case."]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -checkpoint_retainer_consistency(doc) -> - ["Verify that the contents of a checkpoint retainer has the expected", - "contents in various situations."]; -checkpoint_retainer_consistency(suite) -> - [ - updates_during_checkpoint_activation, - updates_during_checkpoint_iteration, - load_table_with_activated_checkpoint, - add_table_copy_to_table_with_activated_checkpoint - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -updates_during_checkpoint_activation(doc) -> - ["Perform updates while the checkpoint getting activated", - "and verify that all checkpoint retainers associated with", - "different replicas of the same table really has the same", - "contents."]; -updates_during_checkpoint_activation(suite) -> - [ - updates_during_checkpoint_activation_2_ram, - updates_during_checkpoint_activation_2_disc, - updates_during_checkpoint_activation_2_disc_only, - updates_during_checkpoint_activation_3_ram, - updates_during_checkpoint_activation_3_disc - , updates_during_checkpoint_activation_3_disc_only - ]. updates_during_checkpoint_activation_2_ram(suite) -> []; updates_during_checkpoint_activation_2_ram(Config) when is_list(Config) -> @@ -808,17 +795,6 @@ updates_during_checkpoint_activation(ReplicaType,NodeConfig,Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -updates_during_checkpoint_iteration(doc) -> - ["Perform updates while someone is iterating over a checkpoint", - "and verify that the iterator really finds the expected data", - "regardless of ongoing upates."]; - -updates_during_checkpoint_iteration(suite) -> - [ - updates_during_checkpoint_iteration_2_ram, - updates_during_checkpoint_iteration_2_disc - , updates_during_checkpoint_iteration_2_disc_only - ]. updates_during_checkpoint_iteration_2_ram(suite) -> []; updates_during_checkpoint_iteration_2_ram(Config) when is_list(Config) -> @@ -890,17 +866,6 @@ loop_accounts(N_br, N_acc) when N_acc >= 1 -> loop_accounts(_,_) -> done. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -load_table_with_activated_checkpoint(doc) -> - ["Load a table with a checkpoint attached to it and verify that the", - "newly loaded replica also gets a checkpoint retainer attached to it", - "and that it is consistent with the original retainer."]; - -load_table_with_activated_checkpoint(suite) -> - [ - load_table_with_activated_checkpoint_ram, - load_table_with_activated_checkpoint_disc, - load_table_with_activated_checkpoint_disc_only - ]. load_table_with_activated_checkpoint_ram(suite) -> []; load_table_with_activated_checkpoint_ram(Config) when is_list(Config) -> @@ -986,18 +951,6 @@ view(Source, Mod) -> lists:sort(TabList). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -add_table_copy_to_table_with_activated_checkpoint(doc) -> - ["Add a replica to a table with a checkpoint attached to it", - "and verify that the new replica also gets a checkpoint", - "retainer attached to it and that it is consistent with the", - "original retainer."]; - -add_table_copy_to_table_with_activated_checkpoint(suite) -> - [ - add_table_copy_to_table_with_activated_checkpoint_ram, - add_table_copy_to_table_with_activated_checkpoint_disc, - add_table_copy_to_table_with_activated_checkpoint_disc_only - ]. add_table_copy_to_table_with_activated_checkpoint_ram(suite) -> []; add_table_copy_to_table_with_activated_checkpoint_ram(Config) when is_list(Config) -> @@ -1070,25 +1023,8 @@ add_table_copy_to_table_with_activated_checkpoint(Type,Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -backup_consistency(suite) -> - [ - interupted_install_fallback, - interupted_uninstall_fallback, - mnesia_down_during_backup_causes_switch, - mnesia_down_during_backup_causes_abort, - schema_transactions_during_backup - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -interupted_install_fallback(doc) -> - ["Verify that a interrupted install_fallback really", - "is performed on all nodes or none"]; - -interupted_install_fallback(suite) -> - [ - inst_fallback_process_dies, - fatal_when_inconsistency - ]. inst_fallback_process_dies(suite) -> []; @@ -1232,13 +1168,6 @@ is_running(Node, Shouldbe) -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -interupted_uninstall_fallback(doc) -> - ["Verify that a interrupted uninstall_fallback really", - "is performed on all nodes or none"]; -interupted_uninstall_fallback(suite) -> - [ - after_delete - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1371,17 +1300,6 @@ do_uninstall(Config,DebugPoint) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -mnesia_down_during_backup_causes_switch(doc) -> - ["Verify that an ongoing backup is not disturbed", - "even if the node hosting the replica that currently", - "is being backup'ed is stopped. The backup utility", - "is expected to switch over to another replica and", - "fulfill the backup."]; -mnesia_down_during_backup_causes_switch(suite) -> - [ - cause_switch_before, - cause_switch_after - ]. %%%%%%%%%%%%%%% @@ -1401,16 +1319,6 @@ cause_switch_after(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -mnesia_down_during_backup_causes_abort(doc) -> - ["Verify that an ongoing backup is aborted nicely", - "without leaving any backup file if the last replica", - "of a table becomes unavailable due to a node down", - "or some crash."]; -mnesia_down_during_backup_causes_abort(suite) -> - [ - cause_abort_before, - cause_abort_after - ]. %%%%%%%%%%%%%%%%%% @@ -1432,14 +1340,6 @@ cause_abort_after(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -schema_transactions_during_backup(doc) -> - ["Verify that an schema transactions does not", - "affect an ongoing backup."]; -schema_transactions_during_backup(suite) -> - [ - change_schema_before, - change_schema_after - ]. %%%%%%%%%%%%% diff --git a/lib/mnesia/test/mnesia_cost.erl b/lib/mnesia/test/mnesia_cost.erl index 54cb2b3064..3221f46f61 100644 --- a/lib/mnesia/test/mnesia_cost.erl +++ b/lib/mnesia/test/mnesia_cost.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/mnesia/test/mnesia_dirty_access_test.erl b/lib/mnesia/test/mnesia_dirty_access_test.erl index 5f9f2a9733..abbdab48c0 100644 --- a/lib/mnesia/test/mnesia_dirty_access_test.erl +++ b/lib/mnesia/test/mnesia_dirty_access_test.erl @@ -26,37 +26,72 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Evil dirty access, regardless of transaction scope.", - "Invoke all functions in the API and try to cover all legal uses", - "cases as well the illegal dito. This is a complement to the", - "other more explicit test cases."]; -all(suite) -> - [ - dirty_write, - dirty_read, - dirty_update_counter, - dirty_delete, - dirty_delete_object, - dirty_match_object, - dirty_index, - dirty_iter, - admin_tests - ]. +all() -> + [{group, dirty_write}, {group, dirty_read}, + {group, dirty_update_counter}, {group, dirty_delete}, + {group, dirty_delete_object}, + {group, dirty_match_object}, {group, dirty_index}, + {group, dirty_iter}, {group, admin_tests}]. + +groups() -> + [{dirty_write, [], + [dirty_write_ram, dirty_write_disc, + dirty_write_disc_only]}, + {dirty_read, [], + [dirty_read_ram, dirty_read_disc, + dirty_read_disc_only]}, + {dirty_update_counter, [], + [dirty_update_counter_ram, dirty_update_counter_disc, + dirty_update_counter_disc_only]}, + {dirty_delete, [], + [dirty_delete_ram, dirty_delete_disc, + dirty_delete_disc_only]}, + {dirty_delete_object, [], + [dirty_delete_object_ram, dirty_delete_object_disc, + dirty_delete_object_disc_only]}, + {dirty_match_object, [], + [dirty_match_object_ram, dirty_match_object_disc, + dirty_match_object_disc_only]}, + {dirty_index, [], + [{group, dirty_index_match_object}, + {group, dirty_index_read}, + {group, dirty_index_update}]}, + {dirty_index_match_object, [], + [dirty_index_match_object_ram, + dirty_index_match_object_disc, + dirty_index_match_object_disc_only]}, + {dirty_index_read, [], + [dirty_index_read_ram, dirty_index_read_disc, + dirty_index_read_disc_only]}, + {dirty_index_update, [], + [dirty_index_update_set_ram, + dirty_index_update_set_disc, + dirty_index_update_set_disc_only, + dirty_index_update_bag_ram, dirty_index_update_bag_disc, + dirty_index_update_bag_disc_only]}, + {dirty_iter, [], + [dirty_iter_ram, dirty_iter_disc, + dirty_iter_disc_only]}, + {admin_tests, [], + [del_table_copy_1, del_table_copy_2, del_table_copy_3, + add_table_copy_1, add_table_copy_2, add_table_copy_3, + add_table_copy_4, move_table_copy_1, move_table_copy_2, + move_table_copy_3, move_table_copy_4]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Write records dirty -dirty_write(suite) -> - [ - dirty_write_ram, - dirty_write_disc, - dirty_write_disc_only - ]. dirty_write_ram(suite) -> []; dirty_write_ram(Config) when is_list(Config) -> @@ -88,12 +123,6 @@ dirty_write(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Read records dirty -dirty_read(suite) -> - [ - dirty_read_ram, - dirty_read_disc, - dirty_read_disc_only - ]. dirty_read_ram(suite) -> []; dirty_read_ram(Config) when is_list(Config) -> @@ -137,12 +166,6 @@ dirty_read(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Update counter record dirty -dirty_update_counter(suite) -> - [ - dirty_update_counter_ram, - dirty_update_counter_disc, - dirty_update_counter_disc_only - ]. dirty_update_counter_ram(suite) -> []; dirty_update_counter_ram(Config) when is_list(Config) -> @@ -180,12 +203,6 @@ dirty_update_counter(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Delete record dirty -dirty_delete(suite) -> - [ - dirty_delete_ram, - dirty_delete_disc, - dirty_delete_disc_only - ]. dirty_delete_ram(suite) -> []; dirty_delete_ram(Config) when is_list(Config) -> @@ -223,12 +240,6 @@ dirty_delete(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Delete matching record dirty -dirty_delete_object(suite) -> - [ - dirty_delete_object_ram, - dirty_delete_object_disc, - dirty_delete_object_disc_only - ]. dirty_delete_object_ram(suite) -> []; dirty_delete_object_ram(Config) when is_list(Config) -> @@ -272,12 +283,6 @@ dirty_delete_object(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Read matching records dirty -dirty_match_object(suite) -> - [ - dirty_match_object_ram, - dirty_match_object_disc, - dirty_match_object_disc_only - ]. dirty_match_object_ram(suite) -> []; dirty_match_object_ram(Config) when is_list(Config) -> @@ -311,22 +316,10 @@ dirty_match_object(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dirty_index(suite) -> - [ - dirty_index_match_object, - dirty_index_read, - dirty_index_update - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Dirty read matching records by using an index -dirty_index_match_object(suite) -> - [ - dirty_index_match_object_ram, - dirty_index_match_object_disc, - dirty_index_match_object_disc_only - ]. dirty_index_match_object_ram(suite) -> []; dirty_index_match_object_ram(Config) when is_list(Config) -> @@ -364,12 +357,6 @@ dirty_index_match_object(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Read records by using an index -dirty_index_read(suite) -> - [ - dirty_index_read_ram, - dirty_index_read_disc, - dirty_index_read_disc_only - ]. dirty_index_read_ram(suite) -> []; dirty_index_read_ram(Config) when is_list(Config) -> @@ -413,19 +400,6 @@ dirty_index_read(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dirty_index_update(suite) -> - [ - dirty_index_update_set_ram, - dirty_index_update_set_disc, - dirty_index_update_set_disc_only, - dirty_index_update_bag_ram, - dirty_index_update_bag_disc, - dirty_index_update_bag_disc_only - ]; -dirty_index_update(doc) -> - ["See Ticket OTP-2083, verifies that a table with a index is " - "update in the correct way i.e. the index finds the correct " - "records after a update"]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dirty_index_update_set_ram(suite) -> []; @@ -631,12 +605,6 @@ dirty_index_update_bag(Config, Storage) -> %% Dirty iteration %% dirty_slot, dirty_first, dirty_next -dirty_iter(suite) -> - [ - dirty_iter_ram, - dirty_iter_disc, - dirty_iter_disc_only - ]. dirty_iter_ram(suite) -> []; dirty_iter_ram(Config) when is_list(Config) -> @@ -700,21 +668,6 @@ all_nexts(Tab, PrevKey) -> [PrevKey] ++ all_nexts(Tab, Key). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -admin_tests(doc) -> - ["Verifies that dirty operations work during schema operations"]; - -admin_tests(suite) -> - [del_table_copy_1, - del_table_copy_2, - del_table_copy_3, - add_table_copy_1, - add_table_copy_2, - add_table_copy_3, - add_table_copy_4, - move_table_copy_1, - move_table_copy_2, - move_table_copy_3, - move_table_copy_4]. update_trans(Tab, Key, Acc) -> Update = diff --git a/lib/mnesia/test/mnesia_durability_test.erl b/lib/mnesia/test/mnesia_durability_test.erl index b917b0ca40..55205d1222 100644 --- a/lib/mnesia/test/mnesia_durability_test.erl +++ b/lib/mnesia/test/mnesia_durability_test.erl @@ -28,47 +28,54 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -record(test_rec,{key,val}). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify durability", - "Verify that the effects of committed transactions are durable.", - "The content of the tables tables must be restored at startup."]; -all(suite) -> - [ - load_tables, - durability_of_dump_tables, +all() -> + [{group, load_tables}, + {group, durability_of_dump_tables}, durability_of_disc_copies, - durability_of_disc_only_copies - ]. + durability_of_disc_only_copies]. + +groups() -> + [{load_tables, [], + [load_latest_data, load_local_contents_directly, + load_directly_when_all_are_ram_copiesA, + load_directly_when_all_are_ram_copiesB, + {group, late_load_when_all_are_ram_copies_on_ram_nodes}, + load_when_last_replica_becomes_available, + load_when_we_have_down_from_all_other_replica_nodes, + late_load_transforms_into_disc_load, + late_load_leads_to_hanging, + force_load_when_nobody_intents_to_load, + force_load_when_someone_has_decided_to_load, + force_load_when_someone_else_already_has_loaded, + force_load_when_we_has_loaded, + force_load_on_a_non_local_table, + force_load_when_the_table_does_not_exist, + {group, load_tables_with_master_tables}]}, + {late_load_when_all_are_ram_copies_on_ram_nodes, [], + [late_load_when_all_are_ram_copies_on_ram_nodes1, + late_load_when_all_are_ram_copies_on_ram_nodes2]}, + {load_tables_with_master_tables, [], + [master_nodes, starting_master_nodes, + master_on_non_local_tables, + remote_force_load_with_local_master_node]}, + {durability_of_dump_tables, [], + [dump_ram_copies, dump_disc_copies, dump_disc_only]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -load_tables(doc) -> - ["Try to provoke all kinds of table load scenarios."]; -load_tables(suite) -> - [ - load_latest_data, - load_local_contents_directly, - load_directly_when_all_are_ram_copiesA, - load_directly_when_all_are_ram_copiesB, - late_load_when_all_are_ram_copies_on_ram_nodes, - load_when_last_replica_becomes_available, - load_when_we_have_down_from_all_other_replica_nodes, - late_load_transforms_into_disc_load, - late_load_leads_to_hanging, - force_load_when_nobody_intents_to_load, - force_load_when_someone_has_decided_to_load, - force_load_when_someone_else_already_has_loaded, - force_load_when_we_has_loaded, - force_load_on_a_non_local_table, - force_load_when_the_table_does_not_exist, - load_tables_with_master_tables - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load_latest_data(doc) -> @@ -284,13 +291,6 @@ load_directly_when_all_are_ram_copiesB(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -late_load_when_all_are_ram_copies_on_ram_nodes(doc) -> - ["Load of ram_copies tables when all replicas resides on disc less nodes"]; -late_load_when_all_are_ram_copies_on_ram_nodes(suite) -> - [ - late_load_when_all_are_ram_copies_on_ram_nodes1, - late_load_when_all_are_ram_copies_on_ram_nodes2 - ]. late_load_when_all_are_ram_copies_on_ram_nodes1(suite) -> []; late_load_when_all_are_ram_copies_on_ram_nodes1(Config) when is_list(Config) -> @@ -916,22 +916,6 @@ force_load_when_the_table_does_not_exist(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -load_tables_with_master_tables(doc) -> - ["Verifies the semantics of different master nodes settings", - "The semantics should be:", - "1. Mnesia downs, Normally decides from where mnesia should load tables", - "2. Master tables (overrides mnesia downs) ", - "3. Force load (overrides Master tables) ", - "--- 1st from active master nodes", - "--- 2nd from active nodes", - "--- 3rd get local copy (if ram create new one)" - ]; - -load_tables_with_master_tables(suite) -> - [master_nodes, - starting_master_nodes, - master_on_non_local_tables, - remote_force_load_with_local_master_node]. -define(SDwrite(Tup), fun() -> mnesia:write(Tup) end). @@ -1156,13 +1140,6 @@ remote_force_load_with_local_master_node(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -durability_of_dump_tables(doc) -> - [ "Verify that all tables contain the correct data when Mnesia", - "is restarted and tables are loaded from disc to recover", - " their previous contents. " ]; -durability_of_dump_tables(suite) -> [dump_ram_copies, - dump_disc_copies, - dump_disc_only]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/mnesia/test/mnesia_evil_backup.erl b/lib/mnesia/test/mnesia_evil_backup.erl index bbbebeb02c..63f4146d98 100644 --- a/lib/mnesia/test/mnesia_evil_backup.erl +++ b/lib/mnesia/test/mnesia_evil_backup.erl @@ -35,31 +35,30 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Checking all the functionality regarding ", - "to the backup and different ", - "kinds of restore and fallback interface"]; - -all(suite) -> - [ - backup, - bad_backup, - global_backup_checkpoint, - restore_tables, - traverse_backup, +all() -> + [backup, bad_backup, global_backup_checkpoint, + {group, restore_tables}, traverse_backup, selective_backup_checkpoint, - incremental_backup_checkpoint, -%% local_backup_checkpoint, - install_fallback, - uninstall_fallback, - local_fallback, - sops_with_checkpoint - ]. + incremental_backup_checkpoint, install_fallback, + uninstall_fallback, local_fallback, + sops_with_checkpoint]. + +groups() -> + [{restore_tables, [], + [restore_errors, restore_clear, restore_keep, + restore_recreate, restore_clear_ram]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + backup(doc) -> ["Checking the interface to the function backup", "We don't check that the backups can be used here", @@ -132,17 +131,6 @@ global_backup_checkpoint(Config) when is_list(Config) -> ?match(ok, file:delete(File2)), ?verify_mnesia(Nodes, []). -restore_tables(doc) -> - ["Tests the interface of restore"]; - -restore_tables(suite) -> - [ - restore_errors, - restore_clear, - restore_keep, - restore_recreate, - restore_clear_ram - ]. restore_errors(suite) -> []; restore_errors(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_evil_coverage_test.erl b/lib/mnesia/test/mnesia_evil_coverage_test.erl index 4fbf1b4003..668eba176f 100644 --- a/lib/mnesia/test/mnesia_evil_coverage_test.erl +++ b/lib/mnesia/test/mnesia_evil_coverage_test.erl @@ -30,45 +30,54 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Evil usage of the API.", - "Invoke all functions in the API and try to cover all legal uses", - "cases as well the illegal dito. This is a complement to the", - "other more explicit test cases."]; -all(suite) -> - [ - system_info, - table_info, - error_description, - db_node_lifecycle, - evil_delete_db_node, - start_and_stop, - checkpoint, - table_lifecycle, - add_copy_conflict, - add_copy_when_going_down, - replica_management, - schema_availability, - local_content, - table_access_modifications, - replica_location, - table_sync, - user_properties, - unsupp_user_props, - record_name, - snmp_access, - subscriptions, - iteration, - debug_support, - sorted_ets, +all() -> + [system_info, table_info, error_description, + db_node_lifecycle, evil_delete_db_node, start_and_stop, + checkpoint, table_lifecycle, add_copy_conflict, + add_copy_when_going_down, replica_management, + schema_availability, local_content, + {group, table_access_modifications}, replica_location, + {group, table_sync}, user_properties, unsupp_user_props, + {group, record_name}, {group, snmp_access}, + {group, subscriptions}, {group, iteration}, + {group, debug_support}, sorted_ets, {mnesia_dirty_access_test, all}, {mnesia_trans_access_test, all}, - {mnesia_evil_backup, all} - ]. + {mnesia_evil_backup, all}]. + +groups() -> + [{table_access_modifications, [], + [change_table_access_mode, change_table_load_order, + set_master_nodes, offline_set_master_nodes]}, + {table_sync, [], + [dump_tables, dump_log, wait_for_tables, + force_load_table]}, + {snmp_access, [], + [snmp_open_table, snmp_close_table, snmp_get_next_index, + snmp_get_row, snmp_get_mnesia_key, snmp_update_counter, + snmp_order]}, + {subscriptions, [], + [subscribe_standard, subscribe_extended]}, + {iteration, [], [foldl]}, + {debug_support, [], + [info, schema_0, schema_1, view_0, view_1, view_2, + lkill, kill]}, + {record_name, [], [{group, record_name_dirty_access}]}, + {record_name_dirty_access, [], + [record_name_dirty_access_ram, + record_name_dirty_access_disc, + record_name_dirty_access_disc_only]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -910,13 +919,6 @@ local_content(Config) when is_list(Config) -> ?verify_mnesia(Nodes, []). -table_access_modifications(suite) -> - [ - change_table_access_mode, - change_table_load_order, - set_master_nodes, - offline_set_master_nodes - ]. change_table_access_mode(suite) -> []; change_table_access_mode(Config) when is_list(Config) -> @@ -1103,13 +1105,6 @@ offline_set_master_nodes(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Syncronize table with log or disc %% -table_sync(suite) -> - [ - dump_tables, - dump_log, - wait_for_tables, - force_load_table - ]. %% Dump ram tables on disc dump_tables(suite) -> []; @@ -1359,19 +1354,6 @@ unsupp_user_props(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -snmp_access(doc) -> - ["Make Mnesia table accessible via SNMP"]; - -snmp_access(suite) -> - [ - snmp_open_table, - snmp_close_table, - snmp_get_next_index, - snmp_get_row, - snmp_get_mnesia_key, - snmp_update_counter, - snmp_order - ]. snmp_open_table(suite) -> []; snmp_open_table(Config) when is_list(Config) -> @@ -1779,11 +1761,6 @@ get_keys(Tab, Key) -> -record(tab, {i, e1, e2}). % Simple test table -subscriptions(doc) -> - ["Test the event subscription mechanism"]; -subscriptions(suite) -> - [subscribe_standard, - subscribe_extended]. subscribe_extended(doc) -> ["Test the extended set of events, test with and without checkpoints. "]; @@ -2009,10 +1986,6 @@ recv_event() -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -iteration(doc) -> - ["Verify that the iteration functions works as expected"]; -iteration(suite) -> - [foldl]. foldl(suite) -> @@ -2074,19 +2047,6 @@ sort_res(Else) -> Else. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -debug_support(doc) -> - ["Check that the debug support has not decayed."]; -debug_support(suite) -> - [ - info, - schema_0, - schema_1, - view_0, - view_1, - view_2, - lkill, - kill - ]. info(suite) -> []; info(Config) when is_list(Config) -> @@ -2173,21 +2133,7 @@ kill(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -record_name(doc) -> - ["Verify that record names may be differ from the name of ", - "the hosting table. Check at least access, restore, " - "registry, subscriptions and traveres_backup"]; -record_name(suite) -> - [ - record_name_dirty_access - ]. - -record_name_dirty_access(suite) -> - [ - record_name_dirty_access_ram, - record_name_dirty_access_disc, - record_name_dirty_access_disc_only - ]. + record_name_dirty_access_ram(suite) -> []; diff --git a/lib/mnesia/test/mnesia_examples_test.erl b/lib/mnesia/test/mnesia_examples_test.erl index d1b1409c9d..373d47a05a 100644 --- a/lib/mnesia/test/mnesia_examples_test.erl +++ b/lib/mnesia/test/mnesia_examples_test.erl @@ -26,8 +26,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(init(N, Config), mnesia_test_lib:prepare_test_case([{init_test_case, [mnesia]}, @@ -61,16 +61,21 @@ opt_load(Mod) -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Run all examples mentioned in the documentation", - "Are really all examples covered?"]; -all(suite) -> - [ - bup, - company, - meter, - tpcb - ]. +all() -> + [bup, company, meter, {group, tpcb}]. + +groups() -> + [{tpcb, [], + [replica_test, sticky_replica_test, dist_test, + conflict_test, frag_test, frag2_test, remote_test, + remote_frag2_test]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% bup(doc) -> ["Run the backup examples in bup.erl"]; @@ -85,19 +90,6 @@ company(doc) -> ["Run the company examples in company.erl and company_o.erl"]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -tpcb(doc) -> - ["Run the sample configurations of the stress tests in mnesia_tpcb.erl"]; -tpcb(suite) -> - [ - replica_test, - sticky_replica_test, - dist_test, - conflict_test, - frag_test, - frag2_test, - remote_test, - remote_frag2_test - ]. replica_test(suite) -> []; replica_test(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_frag_test.erl b/lib/mnesia/test/mnesia_frag_test.erl index 4add340254..d3f6762af7 100644 --- a/lib/mnesia/test/mnesia_frag_test.erl +++ b/lib/mnesia/test/mnesia_frag_test.erl @@ -27,8 +27,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(match_dist(ExpectedRes, Expr), case ?match(ExpectedRes, Expr) of @@ -37,34 +37,29 @@ fin_per_testcase(Func, Conf) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify the functionality of fragmented tables"]; -all(suite) -> - [ - light, - medium - ]. - -light(suite) -> - [ - nice, - evil - ]. - -medium(suite) -> - [ - consistency - ]. +all() -> + [{group, light}, {group, medium}]. + +groups() -> + [{light, [], [{group, nice}, {group, evil}]}, + {medium, [], [consistency]}, + {nice, [], + [nice_single, nice_multi, nice_access, iter_access]}, + {evil, [], + [evil_create, evil_delete, evil_change, evil_combine, + evil_loop, evil_delete_db_node]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -nice(suite) -> - [ - nice_single, - nice_multi, - nice_access, - iter_access - ]. nice_single(suite) -> []; nice_single(Config) when is_list(Config) -> @@ -503,17 +498,6 @@ consistency(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -evil(doc) -> - ["Evil coverage of fragmentation API."]; -evil(suite) -> - [ - evil_create, - evil_delete, - evil_change, - evil_combine, - evil_loop, - evil_delete_db_node - ]. evil_create(suite) -> []; evil_create(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_inconsistent_database_test.erl b/lib/mnesia/test/mnesia_inconsistent_database_test.erl index b19cd8e01b..c4b6257d5b 100644 --- a/lib/mnesia/test/mnesia_inconsistent_database_test.erl +++ b/lib/mnesia/test/mnesia_inconsistent_database_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/mnesia/test/mnesia_install_test.erl b/lib/mnesia/test/mnesia_install_test.erl index 42a2a19f37..5d55fcac0e 100644 --- a/lib/mnesia/test/mnesia_install_test.erl +++ b/lib/mnesia/test/mnesia_install_test.erl @@ -27,29 +27,22 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Run some small but demanding test cases in order to verify", - "that the basic functionality in Mnesia still works.", - "", - "Try some very simple things to begin with and increase the", - "difficulty stepwise. This test suite should be run before", - "all the others if you expect to find bugs.", - "", - "The function mnesia_install_test:silly() does not use the whole", - "infra structure of the test suite. Invoke it on a single node to", - "begin with. If that works, proceed with pong = net_adm:ping(SomeOtherNode)", - "and rerun silly() in order to perform some distributed tests."]; -all(suite) -> - [ - silly_durability, - silly_move, - silly_upgrade - %,stress - ]. +all() -> + [silly_durability, silly_move, silly_upgrade]. + +groups() -> + [{stress, [], stress_cases()}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Stepwise of more and more advanced features @@ -86,11 +79,11 @@ silly2(Config) when is_list(Config) -> [schema])), MoveRes = silly_move(Config), UpgradeRes = silly_upgrade(Config), - StressRes = [StressFun(F) || F <- stress(suite)], + StressRes = [StressFun(F) || F <- stress_cases()], ?verify_mnesia([Node2], []), [Res, MoveRes, UpgradeRes] ++ StressRes; _ -> - StressRes = [StressFun(F) || F <- stress(suite)], + StressRes = [StressFun(F) || F <- stress_cases()], ?warning("Too few nodes. Perform net_adm:ping(OtherNode) " "and rerun!!!~n", []), [Res | StressRes] @@ -286,13 +279,9 @@ transform_some_records(Tab1, _Tab2, Old) -> lists:sort(lists:zf(Filter, Old)). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -stress(doc) -> - ["Stress the system a little"]; -stress(suite) -> - [ - conflict, - dist - ]. + +stress_cases() -> +[conflict, dist]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dist(doc) -> diff --git a/lib/mnesia/test/mnesia_isolation_test.erl b/lib/mnesia/test/mnesia_isolation_test.erl index 4fc6e8fe58..3273bc4d40 100644 --- a/lib/mnesia/test/mnesia_isolation_test.erl +++ b/lib/mnesia/test/mnesia_isolation_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -27,46 +27,53 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify the isolation property.", - "Operations of concurrent transactions must yield results which", - "are indistinguishable from the results which would be obtained by", - "forcing each transaction to be serially executed to completion in", - "some order. This means that repeated reads of the same records", - "within any committed transaction must have returned identical", - "data when run concurrently with any mix of arbitary transactions.", - "Updates in one transaction must not be visible in any other", - "transaction before the transaction has been committed."]; -all(suite) -> - [ - locking, - visibility - ]. +all() -> + [{group, locking}, {group, visibility}]. + +groups() -> + [{locking, [], + [no_conflict, simple_queue_conflict, + advanced_queue_conflict, simple_deadlock_conflict, + advanced_deadlock_conflict, lock_burst, + {group, sticky_locks}, {group, unbound_locking}, + {group, admin_conflict}, nasty]}, + {sticky_locks, [], [basic_sticky_functionality]}, + {unbound_locking, [], [unbound1, unbound2]}, + {admin_conflict, [], + [create_table, delete_table, move_table_copy, + add_table_index, del_table_index, transform_table, + snmp_open_table, snmp_close_table, + change_table_copy_type, change_table_access, + add_table_copy, del_table_copy, dump_tables, + {group, extra_admin_tests}]}, + {extra_admin_tests, [], + [del_table_copy_1, del_table_copy_2, del_table_copy_3, + add_table_copy_1, add_table_copy_2, add_table_copy_3, + add_table_copy_4, move_table_copy_1, move_table_copy_2, + move_table_copy_3, move_table_copy_4]}, + {visibility, [], + [dirty_updates_visible_direct, + dirty_reads_regardless_of_trans, + trans_update_invisibible_outside_trans, + trans_update_visible_inside_trans, write_shadows, + delete_shadows, write_delete_shadows_bag, + write_delete_shadows_bag2, {group, iteration}, + shadow_search, snmp_shadows]}, + {removed_resources, [], [rr_kill_copy]}, + {iteration, [], [foldl, first_next]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -locking(doc) -> - ["Verify locking semantics for various configurations", - " NoLock = lock_funs(no_lock, any_granularity)", - " SharedLock = lock_funs(shared_lock, any_granularity)", - " ExclusiveLock = lock_funs(exclusive_lock, any_granularity)", - " AnyLock = lock_funs(any_lock, any_granularity)"]; -locking(suite) -> - [no_conflict, - simple_queue_conflict, - advanced_queue_conflict, - simple_deadlock_conflict, - advanced_deadlock_conflict, - lock_burst, - sticky_locks, - unbound_locking, - admin_conflict, -%% removed_resources, - nasty - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -431,14 +438,6 @@ burst_incr(Tab, Father) -> Father ! burst_incr_done. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -sticky_locks(doc) -> - ["Simple Tests of sticky locks"]; - -sticky_locks(suite) -> - [ - basic_sticky_functionality - %% Needs to be expandand a little bit further - ]. basic_sticky_functionality(suite) -> []; basic_sticky_functionality(Config) when is_list(Config) -> @@ -519,12 +518,6 @@ get_held() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -unbound_locking(suite) -> - [unbound1, unbound2]; - -unbound_locking(doc) -> - ["Check that mnesia handles unbound key variables, GPRS bug." - "Ticket id: OTP-3342"]. unbound1(suite) -> []; unbound1(Config) when is_list(Config) -> @@ -637,25 +630,6 @@ receiver() -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -admin_conflict(doc) -> - ["Provoke lock conflicts with schema transactions and checkpoints."]; -admin_conflict(suite) -> - [ - create_table, - delete_table, - move_table_copy, - add_table_index, - del_table_index, - transform_table, - snmp_open_table, - snmp_close_table, - change_table_copy_type, - change_table_access, - add_table_copy, - del_table_copy, - dump_tables, - extra_admin_tests - ]. create_table(suite) -> []; create_table(Config) when is_list(Config) -> @@ -1088,18 +1062,6 @@ insert(Tab, N) when N > 0 -> ok = mnesia:sync_dirty(fun() -> mnesia:write({Tab, N, N, 0}) end), insert(Tab, N-1). -extra_admin_tests(suite) -> - [del_table_copy_1, - del_table_copy_2, - del_table_copy_3, - add_table_copy_1, - add_table_copy_2, - add_table_copy_3, - add_table_copy_4, - move_table_copy_1, - move_table_copy_2, - move_table_copy_3, - move_table_copy_4]. update_own(Tab, Key, Acc) -> Update = @@ -1347,23 +1309,6 @@ move_table(CallFrom, FromNode, ToNode, [Node1, Node2, Node3], Def) -> ?verify_mnesia([Node1, Node2, Node3], []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -visibility(doc) -> - ["Verify the visibility semantics for various configurations"]; -visibility(suite) -> - [ - dirty_updates_visible_direct, - dirty_reads_regardless_of_trans, - trans_update_invisibible_outside_trans, - trans_update_visible_inside_trans, - write_shadows, - delete_shadows, -%% delete_shadows2, - write_delete_shadows_bag, - write_delete_shadows_bag2, - iteration, - shadow_search, - snmp_shadows - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dirty_updates_visible_direct(doc) -> @@ -1969,10 +1914,6 @@ shadow_search(Config) when is_list(Config) -> ?verify_mnesia([Node1], []). -removed_resources(suite) -> - [rr_kill_copy]; -removed_resources(doc) -> - ["Verify that the locking behave when resources are removed"]. rr_kill_copy(suite) -> []; rr_kill_copy(Config) when is_list(Config) -> @@ -2138,11 +2079,6 @@ get_exit(Pid) -> ?error("Timeout EXIT ~p~n", [Pid]) end. -iteration(doc) -> - ["Verify that the updates before/during iteration are visable " - "and that the order is preserved for ordered_set tables"]; -iteration(suite) -> - [foldl,first_next]. foldl(doc) -> [""]; diff --git a/lib/mnesia/test/mnesia_measure_test.erl b/lib/mnesia/test/mnesia_measure_test.erl index fbf804dbec..e63689d83a 100644 --- a/lib/mnesia/test/mnesia_measure_test.erl +++ b/lib/mnesia/test/mnesia_measure_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -27,8 +27,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(init(N, Config), mnesia_test_lib:prepare_test_case([{init_test_case, [mnesia]}, @@ -37,101 +37,62 @@ fin_per_testcase(Func, Conf) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Measure various aspects of Mnesia", - "Verify that Mnesia has predictable response times,", - "that the transaction system has fair algoritms,", - "resource consumption, scalabilitym system limits etc.", - "Perform some benchmarks."]; -all(suite) -> - [ - prediction, - consumption, - scalability, - benchmarks - ]. +all() -> + [{group, prediction}, {group, consumption}, + {group, scalability}, {group, benchmarks}]. + +groups() -> + [{prediction, [], + [reader_disturbed_by_node_down, + writer_disturbed_by_node_down, + reader_disturbed_by_node_up, + writer_disturbed_by_node_up, + reader_disturbed_by_schema_ops, + writer_disturbed_by_schema_ops, + reader_disturbed_by_checkpoint, + writer_disturbed_by_checkpoint, + reader_disturbed_by_dump_log, + writer_disturbed_by_dump_log, + reader_disturbed_by_backup, writer_disturbed_by_backup, + reader_disturbed_by_restore, + writer_disturbed_by_restore, {group, fairness}]}, + {fairness, [], + [reader_competing_with_reader, + reader_competing_with_writer, + writer_competing_with_reader, + writer_competing_with_writer]}, + {consumption, [], + [measure_resource_consumption, + determine_resource_leakage]}, + {scalability, [], + [determine_system_limits, performance_at_min_config, + performance_at_max_config, performance_at_full_load, + resource_consumption_at_min_config, + resource_consumption_at_max_config, + resource_consumption_at_full_load]}, + {benchmarks, [], + [{group, meter}, cost, dbn_meters, + measure_all_api_functions, {group, tpcb}, + mnemosyne_vs_mnesia_kernel]}, + {tpcb, [], [ram_tpcb, disc_tpcb, disc_only_tpcb]}, + {meter, [], [ram_meter, disc_meter, disc_only_meter]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -prediction(doc) -> - ["The system must have predictable response times.", - "The maintenance of the system should not impact on the", - "availability. Make sure that the response times does not vary too", - "much from the undisturbed normal usage.", - "Verify that deadlocks never occurs."]; -prediction(suite) -> - [ - reader_disturbed_by_node_down, - writer_disturbed_by_node_down, - reader_disturbed_by_node_up, - writer_disturbed_by_node_up, - reader_disturbed_by_schema_ops, - writer_disturbed_by_schema_ops, - reader_disturbed_by_checkpoint, - writer_disturbed_by_checkpoint, - reader_disturbed_by_dump_log, - writer_disturbed_by_dump_log, - reader_disturbed_by_backup, - writer_disturbed_by_backup, - reader_disturbed_by_restore, - writer_disturbed_by_restore, - fairness - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -fairness(doc) -> - ["Verify that the transaction system behaves fair, even under intense", - "stress. Combine different access patterns (transaction profiles)", - "in order to verify that concurrent applications gets a fair share", - "of the database resource. Verify that starvation never may occur."]; -fairness(suite) -> - [ - reader_competing_with_reader, - reader_competing_with_writer, - writer_competing_with_reader, - writer_competing_with_writer - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consumption(doc) -> - ["Measure the resource consumption and publish the outcome. Make", - "sure that resources are released after failures."]; -consumption(suite) -> - [ - measure_resource_consumption, - determine_resource_leakage - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -scalability(doc) -> - ["Try out where the system limits are. We must at least meet the", - "documented system limits.", - "Redo the performance meters for various configurations and load,", - "especially near system limits."]; -scalability(suite) -> - [ - determine_system_limits, - performance_at_min_config, - performance_at_max_config, - performance_at_full_load, - resource_consumption_at_min_config, - resource_consumption_at_max_config, - resource_consumption_at_full_load - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -benchmarks(doc) -> - ["Measure typical database operations and publish them. Try to", - "verify that new releases of Mnesia always outperforms old", - "releases, or at least that the meters does not get worse."]; -benchmarks(suite) -> - [ - meter, - cost, - dbn_meters, - measure_all_api_functions, - tpcb, - mnemosyne_vs_mnesia_kernel - ]. dbn_meters(suite) -> []; dbn_meters(Config) when is_list(Config) -> @@ -139,12 +100,6 @@ dbn_meters(Config) when is_list(Config) -> ?match(ok, mnesia_dbn_meters:start()), ok. -tpcb(suite) -> - [ - ram_tpcb, - disc_tpcb, - disc_only_tpcb - ]. tpcb(ReplicaType, Config) -> HarakiriDelay = {tc_timeout, timer:minutes(20)}, @@ -171,12 +126,6 @@ disc_only_tpcb(suite) -> []; disc_only_tpcb(Config) when is_list(Config) -> tpcb(disc_only_copies, Config). -meter(suite) -> - [ - ram_meter, - disc_meter, - disc_only_meter - ]. ram_meter(suite) -> []; ram_meter(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_nice_coverage_test.erl b/lib/mnesia/test/mnesia_nice_coverage_test.erl index aa9339f6b9..78eab67b11 100644 --- a/lib/mnesia/test/mnesia_nice_coverage_test.erl +++ b/lib/mnesia/test/mnesia_nice_coverage_test.erl @@ -28,16 +28,22 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Test nice usage of the entire API", - "Invoke all functions in the API, at least once.", - "Try to verify that all functions exists and that they perform", - "reasonable things when used in the most simple way."]; -all(suite) -> [nice]. +all() -> + [nice]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + nice(doc) -> [""]; nice(suite) -> []; diff --git a/lib/mnesia/test/mnesia_qlc_test.erl b/lib/mnesia/test/mnesia_qlc_test.erl index 1e4f776c7d..141de71d01 100644 --- a/lib/mnesia/test/mnesia_qlc_test.erl +++ b/lib/mnesia/test/mnesia_qlc_test.erl @@ -22,7 +22,7 @@ -compile(export_all). --export([all/1]). +-export([all/0,groups/0,init_per_group/2,end_per_group/2]). -include("mnesia_test_lib.hrl"). -include_lib("stdlib/include/qlc.hrl"). @@ -31,20 +31,34 @@ init_per_testcase(Func, Conf) -> setup(Conf), mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -all(doc) -> - ["Test that the qlc mnesia interface works as expected."]; -all(suite) -> +all() -> case code:which(qlc) of non_existing -> []; - _ -> - all_qlc() + _ -> all_qlc() end. -all_qlc() -> - [dirty, trans, frag, info, mnesia_down]. +groups() -> + [{dirty, [], + [dirty_nice_ram_copies, dirty_nice_disc_copies, + dirty_nice_disc_only_copies]}, + {trans, [], + [trans_nice_ram_copies, trans_nice_disc_copies, + trans_nice_disc_only_copies, {group, atomic}]}, + {atomic, [], [atomic_eval]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +all_qlc() -> + [{group, dirty}, {group, trans}, frag, info, + mnesia_down]. init_testcases(Type,Config) -> Nodes = [N1,N2] = ?acquire_nodes(2, Config), @@ -59,10 +73,6 @@ init_testcases(Type,Config) -> Nodes. %% Test cases -dirty(suite) -> - [dirty_nice_ram_copies, - dirty_nice_disc_copies, - dirty_nice_disc_only_copies]. dirty_nice_ram_copies(Setup) -> dirty_nice(Setup,ram_copies). dirty_nice_disc_copies(Setup) -> dirty_nice(Setup,disc_copies). @@ -109,12 +119,6 @@ dirty_nice(Config, Type) when is_list(Config) -> end, ?verify_mnesia(Ns, []). -trans(suite) -> - [trans_nice_ram_copies, - trans_nice_disc_copies, - trans_nice_disc_only_copies, - atomic - ]. trans_nice_ram_copies(Setup) -> trans_nice(Setup,ram_copies). trans_nice_disc_copies(Setup) -> trans_nice(Setup,disc_copies). @@ -182,9 +186,7 @@ recs() -> "-record(b, {k,v}). " "-record(k, {t,v}). " >>. - -atomic(suite) -> [atomic_eval]; -atomic(doc) -> []. + atomic_eval(suite) -> []; atomic_eval(doc) -> []; diff --git a/lib/mnesia/test/mnesia_recovery_test.erl b/lib/mnesia/test/mnesia_recovery_test.erl index f6ecf2ce2e..625e6e824c 100644 --- a/lib/mnesia/test/mnesia_recovery_test.erl +++ b/lib/mnesia/test/mnesia_recovery_test.erl @@ -28,8 +28,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(receive_messages(Msgs), receive_messages(Msgs, ?FILE, ?LINE)). @@ -42,34 +42,93 @@ fin_per_testcase(Func, Conf) -> -endif. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify recoverability", - "Verify that the effects of committed transactions are preserved", - "after recovery from system failures. It must be possible to", - "restore the tables to a consistent state on a node, from (any kind", - "of) replica on other nodes as well as from local disk on the failed", - "node. The system must also recover from instantaneous", - "interruption causing disk files to not be completely synchronized."]; - -all(suite) -> - [ - mnesia_down, - explicit_stop, - coord_dies, - schema_trans, - async_dirty, - sync_dirty, - sym_trans, - asym_trans, - after_full_disc_partition, - after_corrupt_files, - disc_less, - garb_decision, - system_upgrade - ]. - -schema_trans(suite) -> - [{mnesia_schema_recovery_test, all}]. +all() -> + [{group, mnesia_down}, {group, explicit_stop}, + coord_dies, {group, schema_trans}, {group, async_dirty}, + {group, sync_dirty}, {group, sym_trans}, + {group, asym_trans}, after_full_disc_partition, + {group, after_corrupt_files}, disc_less, garb_decision, + system_upgrade]. + +groups() -> + [{schema_trans, [], + [{mnesia_schema_recovery_test, all}]}, + {mnesia_down, [], + [{group, mnesia_down_during_startup}, + {group, master_node_tests}, {group, read_during_down}, + {group, with_checkpoint}, delete_during_start]}, + {master_node_tests, [], + [no_master_2, no_master_3, one_master_2, one_master_3, + two_master_2, two_master_3, all_master_2, + all_master_3]}, + {read_during_down, [], + [dirty_read_during_down, trans_read_during_down]}, + {mnesia_down_during_startup, [], + [mnesia_down_during_startup_disk_ram, + mnesia_down_during_startup_init_ram, + mnesia_down_during_startup_init_disc, + mnesia_down_during_startup_init_disc_only, + mnesia_down_during_startup_tm_ram, + mnesia_down_during_startup_tm_disc, + mnesia_down_during_startup_tm_disc_only]}, + {with_checkpoint, [], + [with_checkpoint_same, with_checkpoint_other]}, + {explicit_stop, [], [explicit_stop_during_snmp]}, + {sym_trans, [], + [sym_trans_before_commit_kill_coord_node, + sym_trans_before_commit_kill_coord_pid, + sym_trans_before_commit_kill_part_after_ask, + sym_trans_before_commit_kill_part_before_ask, + sym_trans_after_commit_kill_coord_node, + sym_trans_after_commit_kill_coord_pid, + sym_trans_after_commit_kill_part_after_ask, + sym_trans_after_commit_kill_part_do_commit_pre, + sym_trans_after_commit_kill_part_do_commit_post]}, + {sync_dirty, [], + [sync_dirty_pre_kill_part, + sync_dirty_pre_kill_coord_node, + sync_dirty_pre_kill_coord_pid, + sync_dirty_post_kill_part, + sync_dirty_post_kill_coord_node, + sync_dirty_post_kill_coord_pid]}, + {async_dirty, [], + [async_dirty_pre_kill_part, + async_dirty_pre_kill_coord_node, + async_dirty_pre_kill_coord_pid, + async_dirty_post_kill_part, + async_dirty_post_kill_coord_node, + async_dirty_post_kill_coord_pid]}, + {asym_trans, [], + [asym_trans_kill_part_ask, + asym_trans_kill_part_commit_vote, + asym_trans_kill_part_pre_commit, + asym_trans_kill_part_log_commit, + asym_trans_kill_part_do_commit, + asym_trans_kill_coord_got_votes, + asym_trans_kill_coord_pid_got_votes, + asym_trans_kill_coord_log_commit_rec, + asym_trans_kill_coord_pid_log_commit_rec, + asym_trans_kill_coord_log_commit_dec, + asym_trans_kill_coord_pid_log_commit_dec, + asym_trans_kill_coord_rec_acc_pre_commit_log_commit, + asym_trans_kill_coord_pid_rec_acc_pre_commit_log_commit, + asym_trans_kill_coord_rec_acc_pre_commit_done_commit, + asym_trans_kill_coord_pid_rec_acc_pre_commit_done_commit]}, + {after_corrupt_files, [], + [after_corrupt_files_decision_log_head, + after_corrupt_files_decision_log_tail, + after_corrupt_files_latest_log_head, + after_corrupt_files_latest_log_tail, + after_corrupt_files_table_dat_head, + after_corrupt_files_table_dat_tail, + after_corrupt_files_schema_dat_head, + after_corrupt_files_schema_dat_tail]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. tpcb_config(ReplicaType, _NodeConfig, Nodes) -> [{n_branches, 5}, @@ -83,30 +142,7 @@ tpcb_config(ReplicaType, _NodeConfig, Nodes) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -mnesia_down(doc) -> - [" Various tests about recovery when mnesia goes down on one or several nodes."]; -mnesia_down(suite) -> - [ - mnesia_down_during_startup, - master_node_tests, - read_during_down, - with_checkpoint, - delete_during_start - ]. - -master_node_tests(doc) -> - ["Verify that mnesia loads the correct data after it has been down, regarding master node settings."]; -master_node_tests(suite) -> - [ - no_master_2, - no_master_3, - one_master_2, - one_master_3, - two_master_2, - two_master_3, - all_master_2, - all_master_3 - ]. + no_master_2(suite) -> []; no_master_2(Config) when is_list(Config) -> mnesia_down_2(no, Config). @@ -251,13 +287,6 @@ mnesia_down_3(Masters, Config) -> ?verify_mnesia(Nodes, []). -read_during_down(doc) -> - ["Verify that read operation can continue to read when mnesia goes down"]; -read_during_down(suite) -> - [ - dirty_read_during_down, - trans_read_during_down - ]. dirty_read_during_down(suite) -> []; @@ -325,20 +354,6 @@ loop_and_kill_mnesia(N, Node, Tabs) -> timer:sleep(100), loop_and_kill_mnesia(N-1, KN, Tabs). -mnesia_down_during_startup(doc) -> - ["Verify that mnesia can come back up again in a consistent state", - "after it has gone down during startup (with different store and", - "when it goes down in different situations"]; -mnesia_down_during_startup(suite) -> - [ - mnesia_down_during_startup_disk_ram, - mnesia_down_during_startup_init_ram, - mnesia_down_during_startup_init_disc, - mnesia_down_during_startup_init_disc_only, - mnesia_down_during_startup_tm_ram, - mnesia_down_during_startup_tm_disc, - mnesia_down_during_startup_tm_disc_only - ]. mnesia_down_during_startup_disk_ram(suite) -> []; mnesia_down_during_startup_disk_ram(Config) when is_list(Config)-> @@ -433,10 +448,6 @@ mnesia_down_during_startup2(Config, ReplicaType, Debug_Point, _Father) -> ?verify_mnesia(Nodes, []). -with_checkpoint(doc) -> - ["Restart mnesia with checkpoint"]; -with_checkpoint(suite) -> - [with_checkpoint_same, with_checkpoint_other]. with_checkpoint_same(suite) -> []; with_checkpoint_same(Config) when is_list(Config) -> @@ -581,10 +592,6 @@ verify_where2read([]) -> ok. %%------------------------------------------------------------------------------------------- -explicit_stop(doc) -> - ["Stop Mnesia in different situations"]; -explicit_stop(suite) -> - [explicit_stop_during_snmp]. %% This is a bad implementation, but at least gives a indication if something is wrong explicit_stop_during_snmp(suite) -> []; explicit_stop_during_snmp(Config) when is_list(Config) -> @@ -700,21 +707,7 @@ coord_dies(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -sym_trans(doc) -> - ["Recovery of symmetrical transactions in a couple of different", - "situations; when coordinator or participant or node dies"]; - -sym_trans(suite) -> - [sym_trans_before_commit_kill_coord_node, %% coordinator node dies - sym_trans_before_commit_kill_coord_pid, %% coordinator process dies - sym_trans_before_commit_kill_part_after_ask, %% participating node dies - sym_trans_before_commit_kill_part_before_ask, - sym_trans_after_commit_kill_coord_node, - sym_trans_after_commit_kill_coord_pid, - sym_trans_after_commit_kill_part_after_ask, - sym_trans_after_commit_kill_part_do_commit_pre, - sym_trans_after_commit_kill_part_do_commit_post]. + %kill_after_debug_point(Config, TestCase, {Debug_node, Debug_Point}, TransFun, Tab) @@ -828,17 +821,6 @@ do_sym_trans([Tab], _Fahter) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -sync_dirty(doc) -> - ["Verify recovery of synchronously operations in a couple of different", - "situations"]; -sync_dirty(suite) -> - [sync_dirty_pre_kill_part, - sync_dirty_pre_kill_coord_node, - sync_dirty_pre_kill_coord_pid, - sync_dirty_post_kill_part, - sync_dirty_post_kill_coord_node, - sync_dirty_post_kill_coord_pid - ]. sync_dirty_pre_kill_part(suite) -> []; sync_dirty_pre_kill_part(Config) when is_list(Config) -> @@ -916,16 +898,6 @@ do_sync_dirty([Tab], _Father) -> ?dl("SYNC_DIRTY done: ~p ", [Res]), ok. -async_dirty(doc) -> - ["Verify recovery of asynchronously dirty operations in a couple of different", - "situations"]; -async_dirty(suite) -> - [async_dirty_pre_kill_part, - async_dirty_pre_kill_coord_node, - async_dirty_pre_kill_coord_pid, - async_dirty_post_kill_part, - async_dirty_post_kill_coord_node, - async_dirty_post_kill_coord_pid]. async_dirty_pre_kill_part(suite) -> []; async_dirty_pre_kill_part(Config) when is_list(Config) -> @@ -1005,29 +977,6 @@ do_async_dirty([Tab], _Fahter) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -asym_trans(doc) -> - ["Recovery of asymmetrical transactions in a couple of different", - "situations, currently the error cases are not covered, i.e. ", - "not tested are the situations when we kill mnesia or a process", - "during a recovery"]; -asym_trans(suite) -> - [ - asym_trans_kill_part_ask, - asym_trans_kill_part_commit_vote, - asym_trans_kill_part_pre_commit, - asym_trans_kill_part_log_commit, - asym_trans_kill_part_do_commit, - asym_trans_kill_coord_got_votes, - asym_trans_kill_coord_pid_got_votes, - asym_trans_kill_coord_log_commit_rec, - asym_trans_kill_coord_pid_log_commit_rec, - asym_trans_kill_coord_log_commit_dec, - asym_trans_kill_coord_pid_log_commit_dec, - asym_trans_kill_coord_rec_acc_pre_commit_log_commit, - asym_trans_kill_coord_pid_rec_acc_pre_commit_log_commit, - asym_trans_kill_coord_rec_acc_pre_commit_done_commit, - asym_trans_kill_coord_pid_rec_acc_pre_commit_done_commit - ]. asym_trans_kill_part_ask(suite) -> []; asym_trans_kill_part_ask(Config) when is_list(Config) -> @@ -1435,18 +1384,6 @@ after_full_disc_partition(doc) -> %% interrupted_fallback_start %% is implemented in consistency interupted_install_fallback! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -after_corrupt_files(doc) -> - ["Verify that mnesia (and dets) can handle corrupt files"]; -after_corrupt_files(suite) -> % cope with unsynced disks - [after_corrupt_files_decision_log_head, - after_corrupt_files_decision_log_tail, - after_corrupt_files_latest_log_head, - after_corrupt_files_latest_log_tail, - after_corrupt_files_table_dat_head, - after_corrupt_files_table_dat_tail, - after_corrupt_files_schema_dat_head, - after_corrupt_files_schema_dat_tail - ]. after_corrupt_files_decision_log_head(suite) -> []; after_corrupt_files_decision_log_head(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_registry_test.erl b/lib/mnesia/test/mnesia_registry_test.erl index 2305ef93b7..cf8da38632 100644 --- a/lib/mnesia/test/mnesia_registry_test.erl +++ b/lib/mnesia/test/mnesia_registry_test.erl @@ -26,17 +26,22 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Test the mnesia_registry module"]; -all(suite) -> - [ - good_dump, - bad_dump - ]. +all() -> + [good_dump, bad_dump]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% good_dump(doc) -> diff --git a/lib/mnesia/test/mnesia_schema_recovery_test.erl b/lib/mnesia/test/mnesia_schema_recovery_test.erl index 387238ae6b..0fe26efd0b 100644 --- a/lib/mnesia/test/mnesia_schema_recovery_test.erl +++ b/lib/mnesia/test/mnesia_schema_recovery_test.erl @@ -26,8 +26,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(receive_messages(Msgs), receive_messages(Msgs, ?FILE, ?LINE)). @@ -41,92 +41,82 @@ fin_per_testcase(Func, Conf) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify recoverabiliy of schema transactions.", - " Verify that a schema transaction", - " can be completed when it has been logged correctly and Mnesia", - " crashed before the log has been dumped. Then the transaction ", - " should be handled during the log dump at startup" - ]; -all(suite) -> - [interrupted_before_log_dump, - interrupted_after_log_dump]. - -interrupted_before_log_dump(suite) -> - [interrupted_before_create_ram, - interrupted_before_create_disc, - interrupted_before_create_disc_only, - interrupted_before_create_nostore, - interrupted_before_delete_ram, - interrupted_before_delete_disc, - interrupted_before_delete_disc_only, - interrupted_before_add_ram, - interrupted_before_add_disc, - interrupted_before_add_disc_only, - interrupted_before_add_kill_copier, - interrupted_before_move_ram, - interrupted_before_move_disc, - interrupted_before_move_disc_only, - interrupted_before_move_kill_copier, - interrupted_before_delcopy_ram, - interrupted_before_delcopy_disc, - interrupted_before_delcopy_disc_only, - interrupted_before_delcopy_kill_copier, - interrupted_before_addindex_ram, - interrupted_before_addindex_disc, - interrupted_before_addindex_disc_only, - interrupted_before_delindex_ram, - interrupted_before_delindex_disc, - interrupted_before_delindex_disc_only, - interrupted_before_change_type_ram2disc, - interrupted_before_change_type_ram2disc_only, - interrupted_before_change_type_disc2ram, - interrupted_before_change_type_disc2disc_only, - interrupted_before_change_type_disc_only2ram, - interrupted_before_change_type_disc_only2disc, - interrupted_before_change_type_other_node, - interrupted_before_change_schema_type %% Change schema table copy type!! - ]. - -interrupted_after_log_dump(suite) -> - [interrupted_after_create_ram, - interrupted_after_create_disc, - interrupted_after_create_disc_only, - interrupted_after_create_nostore, - interrupted_after_delete_ram, - interrupted_after_delete_disc, - interrupted_after_delete_disc_only, - interrupted_after_add_ram, - interrupted_after_add_disc, - interrupted_after_add_disc_only, - interrupted_after_add_kill_copier, - interrupted_after_move_ram, - interrupted_after_move_disc, - interrupted_after_move_disc_only, - interrupted_after_move_kill_copier, - interrupted_after_delcopy_ram, - interrupted_after_delcopy_disc, - interrupted_after_delcopy_disc_only, - interrupted_after_delcopy_kill_copier, - interrupted_after_addindex_ram, - interrupted_after_addindex_disc, - interrupted_after_addindex_disc_only, - interrupted_after_delindex_ram, - interrupted_after_delindex_disc, - interrupted_after_delindex_disc_only, - interrupted_after_change_type_ram2disc, - interrupted_after_change_type_ram2disc_only, - interrupted_after_change_type_disc2ram, - interrupted_after_change_type_disc2disc_only, - interrupted_after_change_type_disc_only2ram, - interrupted_after_change_type_disc_only2disc, - interrupted_after_change_type_other_node, - interrupted_after_change_schema_type %% Change schema table copy type!! - -% interrupted_before_change_access_mode, -% interrupted_before_transform, -% interrupted_before_restore, - ]. +all() -> + [{group, interrupted_before_log_dump}, + {group, interrupted_after_log_dump}]. + +groups() -> + [{interrupted_before_log_dump, [], + [interrupted_before_create_ram, + interrupted_before_create_disc, + interrupted_before_create_disc_only, + interrupted_before_create_nostore, + interrupted_before_delete_ram, + interrupted_before_delete_disc, + interrupted_before_delete_disc_only, + interrupted_before_add_ram, interrupted_before_add_disc, + interrupted_before_add_disc_only, + interrupted_before_add_kill_copier, + interrupted_before_move_ram, + interrupted_before_move_disc, + interrupted_before_move_disc_only, + interrupted_before_move_kill_copier, + interrupted_before_delcopy_ram, + interrupted_before_delcopy_disc, + interrupted_before_delcopy_disc_only, + interrupted_before_delcopy_kill_copier, + interrupted_before_addindex_ram, + interrupted_before_addindex_disc, + interrupted_before_addindex_disc_only, + interrupted_before_delindex_ram, + interrupted_before_delindex_disc, + interrupted_before_delindex_disc_only, + interrupted_before_change_type_ram2disc, + interrupted_before_change_type_ram2disc_only, + interrupted_before_change_type_disc2ram, + interrupted_before_change_type_disc2disc_only, + interrupted_before_change_type_disc_only2ram, + interrupted_before_change_type_disc_only2disc, + interrupted_before_change_type_other_node, + interrupted_before_change_schema_type]}, + {interrupted_after_log_dump, [], + [interrupted_after_create_ram, + interrupted_after_create_disc, + interrupted_after_create_disc_only, + interrupted_after_create_nostore, + interrupted_after_delete_ram, + interrupted_after_delete_disc, + interrupted_after_delete_disc_only, + interrupted_after_add_ram, interrupted_after_add_disc, + interrupted_after_add_disc_only, + interrupted_after_add_kill_copier, + interrupted_after_move_ram, interrupted_after_move_disc, + interrupted_after_move_disc_only, + interrupted_after_move_kill_copier, + interrupted_after_delcopy_ram, + interrupted_after_delcopy_disc, + interrupted_after_delcopy_disc_only, + interrupted_after_delcopy_kill_copier, + interrupted_after_addindex_ram, + interrupted_after_addindex_disc, + interrupted_after_addindex_disc_only, + interrupted_after_delindex_ram, + interrupted_after_delindex_disc, + interrupted_after_delindex_disc_only, + interrupted_after_change_type_ram2disc, + interrupted_after_change_type_ram2disc_only, + interrupted_after_change_type_disc2ram, + interrupted_after_change_type_disc2disc_only, + interrupted_after_change_type_disc_only2ram, + interrupted_after_change_type_disc_only2disc, + interrupted_after_change_type_other_node, + interrupted_after_change_schema_type]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. interrupted_before_create_ram(suite) -> []; interrupted_before_create_ram(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_test_lib.erl b/lib/mnesia/test/mnesia_test_lib.erl index 1e98f017f7..182c240084 100644 --- a/lib/mnesia/test/mnesia_test_lib.erl +++ b/lib/mnesia/test/mnesia_test_lib.erl @@ -130,7 +130,7 @@ doc/1, struct/1, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, kill_tc/2 ]). @@ -144,7 +144,7 @@ init_per_testcase(_Func, Config) -> global:register_name(mnesia_global_logger, group_leader()), Config. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> global:unregister_name(mnesia_global_logger), %% Nodes = select_nodes(all, Config, ?FILE, ?LINE), %% rpc:multicall(Nodes, mnesia, lkill, []), @@ -492,19 +492,19 @@ wait_for_evaluator(Pid, Mod, Fun, Config) -> {'EXIT', Pid, {skipped, Reason}} -> log("<WARNING> Test case ~w skipped, because ~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {skip, {Mod, Fun}, Reason}; {'EXIT', Pid, Reason} -> log("<>ERROR<> Eval process ~w exited, because ~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {crash, {Mod, Fun}, Reason} end. test_case_evaluator(Mod, Fun, [Config]) -> NewConfig = Mod:init_per_testcase(Fun, Config), R = apply(Mod, Fun, [NewConfig]), - Mod:fin_per_testcase(Fun, NewConfig), + Mod:end_per_testcase(Fun, NewConfig), exit({test_case_ok, R}). activity_evaluator(Coordinator) -> diff --git a/lib/mnesia/test/mnesia_tpcb.erl b/lib/mnesia/test/mnesia_tpcb.erl index 903c53a21c..595412ff24 100644 --- a/lib/mnesia/test/mnesia_tpcb.erl +++ b/lib/mnesia/test/mnesia_tpcb.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/mnesia/test/mnesia_trans_access_test.erl b/lib/mnesia/test/mnesia_trans_access_test.erl index c67382e694..55ba4dd761 100644 --- a/lib/mnesia/test/mnesia_trans_access_test.erl +++ b/lib/mnesia/test/mnesia_trans_access_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -26,8 +26,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(receive_messages(Msgs), mnesia_recovery_test:receive_messages(Msgs, ?FILE, ?LINE)). @@ -40,18 +40,41 @@ fin_per_testcase(Func, Conf) -> -endif. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Evil access of records in the scope of transactions", - "Invoke all functions in the API and try to cover all legal uses", - "cases as well the illegal dito. This is a complement to the", - "other more explicit test cases."]; -all(suite) -> - [ - write, read, wread, delete, delete_object, - match_object, select, select14, all_keys, - transaction, nested_activities, - index_tabs, index_lifecycle - ]. +all() -> + [write, read, wread, delete, delete_object, + match_object, select, select14, all_keys, transaction, + {group, nested_activities}, {group, index_tabs}, + {group, index_lifecycle}]. + +groups() -> + [{nested_activities, [], + [basic_nested, {group, nested_transactions}, + mix_of_nested_activities]}, + {nested_transactions, [], + [nested_trans_both_ok, nested_trans_child_dies, + nested_trans_parent_dies, nested_trans_both_dies]}, + {index_tabs, [], + [index_match_object, index_read, {group, index_update}, + index_write]}, + {index_update, [], + [index_update_set, index_update_bag]}, + {index_lifecycle, [], + [add_table_index_ram, add_table_index_disc, + add_table_index_disc_only, create_live_table_index_ram, + create_live_table_index_disc, + create_live_table_index_disc_only, del_table_index_ram, + del_table_index_disc, del_table_index_disc_only, + {group, idx_schema_changes}]}, + {idx_schema_changes, [], + [idx_schema_changes_ram, idx_schema_changes_disc, + idx_schema_changes_disc_only]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Write records @@ -404,12 +427,6 @@ transaction(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -nested_activities(suite) -> - [ - basic_nested, - nested_transactions, - mix_of_nested_activities - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -520,13 +537,6 @@ n_f4() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -nested_transactions(doc) -> - ["Verify that nested_transactions are handled as expected"]; -nested_transactions(suite) -> - [nested_trans_both_ok, - nested_trans_child_dies, - nested_trans_parent_dies, - nested_trans_both_dies]. nested_trans_both_ok(suite) -> []; nested_trans_both_ok(Config) when is_list(Config) -> @@ -671,13 +681,6 @@ read_op(Oid) -> Ops end. -index_tabs(suite) -> - [ - index_match_object, - index_read, - index_update, - index_write - ]. %% Read matching records by using an index @@ -767,10 +770,6 @@ index_read(Config) when is_list(Config) -> ?match({'EXIT', {aborted, no_transaction}}, mnesia:index_read(Tab, 2, ValPos)), ?verify_mnesia(Nodes, []). -index_update(suite) -> [index_update_set, index_update_bag]; -index_update(doc) -> ["See Ticket OTP-2083, verifies that a table with a index is " - "update in the correct way i.e. the index finds the correct " - "records after a update"]. index_update_set(suite) -> []; index_update_set(Config)when is_list(Config) -> [Node1] = Nodes = ?acquire_nodes(1, Config), @@ -1046,19 +1045,6 @@ index_write(Config)when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Add and drop indecies -index_lifecycle(suite) -> - [ - add_table_index_ram, - add_table_index_disc, - add_table_index_disc_only, - create_live_table_index_ram, - create_live_table_index_disc, - create_live_table_index_disc_only, - del_table_index_ram, - del_table_index_disc, - del_table_index_disc_only, - idx_schema_changes - ]. add_table_index_ram(suite) -> []; add_table_index_ram(Config) when is_list(Config) -> @@ -1171,13 +1157,6 @@ del_table_index(Config, Storage) -> ?match({atomic, ok}, mnesia:transaction(NestedFun)), ?verify_mnesia(Nodes, []). -idx_schema_changes(suite) -> [idx_schema_changes_ram, - idx_schema_changes_disc, - idx_schema_changes_disc_only]; -idx_schema_changes(doc) -> - ["Tests that index tables are handled correctly when schema changes.", - "For example when a replica is deleted or inserted", - "TICKET OTP-2XXX (ELVIRA)"]. idx_schema_changes_ram(suite) -> []; idx_schema_changes_ram(Config) when is_list(Config) -> diff --git a/lib/observer/doc/src/notes.xml b/lib/observer/doc/src/notes.xml index 3d7c4fa269..76c13fb3ff 100644 --- a/lib/observer/doc/src/notes.xml +++ b/lib/observer/doc/src/notes.xml @@ -31,6 +31,23 @@ <p>This document describes the changes made to the Observer application.</p> +<section><title>Observer 0.9.8.4</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + The multitrace.erl installation example file is now + installed in the examples directory. (Thanks to Peter + Lemenkov.)</p> + <p> + Own Id: OTP-8857</p> + </item> + </list> + </section> + +</section> + <section><title>Observer 0.9.8.3</title> <section><title>Improvements and New Features</title> diff --git a/lib/observer/test/Makefile b/lib/observer/test/Makefile index 6f1430b00a..e15bde7346 100644 --- a/lib/observer/test/Makefile +++ b/lib/observer/test/Makefile @@ -80,7 +80,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) observer.spec observer.dynspec $(EMAKEFILE) \ + $(INSTALL_DATA) observer.spec $(EMAKEFILE) \ $(COVERFILE) $(ERL_FILES) \ $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/observer/test/crashdump_viewer_SUITE.erl b/lib/observer/test/crashdump_viewer_SUITE.erl index fcf383dc2e..1a7e6f61fe 100644 --- a/lib/observer/test/crashdump_viewer_SUITE.erl +++ b/lib/observer/test/crashdump_viewer_SUITE.erl @@ -20,12 +20,13 @@ -module(crashdump_viewer_SUITE). %% Test functions --export([all/1,translate/1,start/1,fini/1,load_file/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + translate/1,start/1,fini/1,load_file/1, non_existing/1,not_a_crashdump/1,old_crashdump/1]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include_lib("kernel/include/file.hrl"). @@ -46,9 +47,21 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), ok. -all(suite) -> - [translate,{conf,start,[load_file,non_existing,not_a_crashdump, - old_crashdump],fini}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [translate, load_file, non_existing, not_a_crashdump, + old_crashdump]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_suite(doc) -> ["Create a lot of crashdumps which can be used in the testcases below"]; diff --git a/lib/observer/test/etop_SUITE.erl b/lib/observer/test/etop_SUITE.erl index 54f4a78e69..ab2a6f5d18 100644 --- a/lib/observer/test/etop_SUITE.erl +++ b/lib/observer/test/etop_SUITE.erl @@ -20,22 +20,42 @@ -module(etop_SUITE). %% Test functions --export([all/1,text/1,text_tracing_off/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,text/1,text_tracing_off/1]). +-export([init_per_testcase/2, end_per_testcase/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(1)). init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -all(suite) -> [text,text_tracing_off]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [text, text_tracing_off]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + text(suite) -> []; diff --git a/lib/observer/test/observer.cover b/lib/observer/test/observer.cover index 47770ba839..fafb718840 100644 --- a/lib/observer/test/observer.cover +++ b/lib/observer/test/observer.cover @@ -1,2 +1,4 @@ -{exclude,[multitrace]}. -{include,[observer_backend]}. +{incl_app,observer,details}. + +{excl_mods,observer,[multitrace]}. +{incl_mods,observer,[observer_backend]}. diff --git a/lib/observer/test/observer.spec b/lib/observer/test/observer.spec index 801eb80607..3b4b5da28c 100644 --- a/lib/observer/test/observer.spec +++ b/lib/observer/test/observer.spec @@ -1,2 +1 @@ -{topcase, {dir, "../observer_test"}}. - +{suites,"../observer_test",all}. diff --git a/lib/observer/test/observer_SUITE.erl b/lib/observer/test/observer_SUITE.erl index 3e9522c7a4..46d4612706 100644 --- a/lib/observer/test/observer_SUITE.erl +++ b/lib/observer/test/observer_SUITE.erl @@ -18,10 +18,11 @@ %% -module(observer_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([init_per_testcase/2, end_per_testcase/2]). %% Test cases @@ -39,9 +40,27 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), ok. -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [app_file]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + app_file(suite) -> []; app_file(doc) -> diff --git a/lib/observer/test/ttb_SUITE.erl b/lib/observer/test/ttb_SUITE.erl index 6da5e36b29..14bd1e9c33 100644 --- a/lib/observer/test/ttb_SUITE.erl +++ b/lib/observer/test/ttb_SUITE.erl @@ -21,14 +21,16 @@ -compile(export_all). %% Test functions --export([all/1,file/1,file_no_pi/1,file_fetch/1,wrap/1,wrap_merge/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + file/1,file_no_pi/1,file_fetch/1,wrap/1,wrap_merge/1, wrap_merge_fetch_format/1,write_config1/1,write_config2/1, write_config3/1,history/1,write_trace_info/1,seq_trace/1, diskless/1,otp_4967_1/1,otp_4967_2/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([foo/0]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(1)). @@ -36,15 +38,34 @@ init_per_testcase(_Case, Config) -> ttb:stop(), ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -all(suite) -> [file,file_no_pi,file_fetch,wrap,wrap_merge, - wrap_merge_fetch_format,write_config1,write_config2, - write_config3,history,write_trace_info,seq_trace,diskless, - otp_4967_1,otp_4967_2]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [file, file_no_pi, file_fetch, wrap, wrap_merge, + wrap_merge_fetch_format, write_config1, write_config2, + write_config3, history, write_trace_info, seq_trace, + diskless, otp_4967_1, otp_4967_2]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + file(suite) -> []; diff --git a/lib/observer/vsn.mk b/lib/observer/vsn.mk index 499cce6b97..1b72d30eab 100644 --- a/lib/observer/vsn.mk +++ b/lib/observer/vsn.mk @@ -1 +1 @@ -OBSERVER_VSN = 0.9.8.3 +OBSERVER_VSN = 0.9.8.4 diff --git a/lib/odbc/doc/src/notes.xml b/lib/odbc/doc/src/notes.xml index 09d78c3248..7dece7c584 100644 --- a/lib/odbc/doc/src/notes.xml +++ b/lib/odbc/doc/src/notes.xml @@ -31,7 +31,31 @@ <p>This document describes the changes made to the odbc application. </p> - <section><title>ODBC 2.10.8</title> + <section><title>ODBC 2.10.9</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Ipv6 is now supported on Windows as well as on UNIX for + internal socket communication. (ODBC uses sockets instead + of the "Erlang port pipes" as some ODBC-drivers are known + to mess with stdin/stdout.) </p> + <p> + Loopback address constants are used when connecting the + c-side to the erlang-side over local socket API avoiding + getaddrinfo problems, and the {ip, loopback} option is + added as a listen option on the erlang-side. Also cleaned + up the TIME_STAMP contribution.</p> + <p> + Own Id: OTP-8917</p> + </item> + </list> + </section> + +</section> + +<section><title>ODBC 2.10.8</title> <section><title>Improvements and New Features</title> <list> diff --git a/lib/odbc/test/Makefile b/lib/odbc/test/Makefile index 935ecbf5a7..ab3cdea543 100644 --- a/lib/odbc/test/Makefile +++ b/lib/odbc/test/Makefile @@ -45,8 +45,8 @@ HRL_FILES= odbc_test.hrl\ TARGET_FILES= \ $(MODULES:%=$(EBIN)/%.$(EMULATOR)) -SPEC_FILES = odbc.spec odbc.dynspec \ - odbc.spec.win +SPEC_FILES = odbc.spec +COVER_FILE = odbc.cover EMAKEFILE = Emakefile MAKE_EMAKE = $(wildcard $(ERL_TOP)/make/make_emakefile) @@ -101,7 +101,7 @@ release_spec: opt release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) $(SPEC_FILES) $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) $(SPEC_FILES) $(COVER_FILE) $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) release_docs_spec: diff --git a/lib/odbc/test/odbc.cover b/lib/odbc/test/odbc.cover new file mode 100644 index 0000000000..1acca281fb --- /dev/null +++ b/lib/odbc/test/odbc.cover @@ -0,0 +1,2 @@ +{incl_app,odbc,details}. + diff --git a/lib/odbc/test/odbc.spec b/lib/odbc/test/odbc.spec index acba9f8d98..edaf821c91 100644 --- a/lib/odbc/test/odbc.spec +++ b/lib/odbc/test/odbc.spec @@ -1,9 +1,25 @@ -{topcase, {dir, "../odbc_test"}}. -{skip, {odbc_data_type_SUITE, varchar_upper_limit, "Known bug in database"}}. -{skip, {odbc_data_type_SUITE, text_upper_limit, "Consumes too much resources"}}. -{skip, {odbc_data_type_SUITE, bit_true , "Not supported by driver"}}. -{skip, {odbc_data_type_SUITE, bit_false, "Not supported by driver"}}. -{skip, {odbc_query_SUITE, multiple_select_result_sets,"Not supported by driver"}}. -{skip, {odbc_query_SUITE, multiple_mix_result_sets, "Not supported by driver"}}. -{skip, {odbc_query_SUITE, multiple_result_sets_error, "Not supported by driver"}}. -{skip, {odbc_query_SUITE, param_insert_tiny_int, "Not supported by driver"}}.
\ No newline at end of file +{suites,"../odbc_test",all}. +{skip_cases,"../odbc_test",odbc_data_type_SUITE, + [varchar_upper_limit], + "Known bug in database"}. +{skip_cases,"../odbc_test",odbc_data_type_SUITE, + [text_upper_limit], + "Consumes too much resources"}. +{skip_cases,"../odbc_test",odbc_data_type_SUITE, + [bit_true], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_data_type_SUITE, + [bit_false], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_query_SUITE, + [multiple_select_result_sets], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_query_SUITE, + [multiple_mix_result_sets], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_query_SUITE, + [multiple_result_sets_error], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_query_SUITE, + [param_insert_tiny_int], + "Not supported by driver"}. diff --git a/lib/odbc/test/odbc_connect_SUITE.erl b/lib/odbc/test/odbc_connect_SUITE.erl index 4d37a8f543..fd7693de3a 100644 --- a/lib/odbc/test/odbc_connect_SUITE.erl +++ b/lib/odbc/test/odbc_connect_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -40,20 +40,32 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Tests the ability to connect and disconnet to/from the database"]; -all(suite) -> + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case odbc_test_lib:odbc_check() of - ok -> all(); + ok -> + [not_exist_db, commit, rollback, not_explicit_commit, + no_c_node, port_dies, control_process_dies, + {group, client_dies}, connect_timeout, timeout, + many_timeouts, timeout_reset, disconnect_on_timeout, + connection_closed, disable_scrollable_cursors, + return_rows_as_lists, api_missuse]; Other -> {skip, Other} - end. + end. + +groups() -> + [{client_dies, [], + [client_dies_normal, client_dies_timeout, + client_dies_error]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all() -> - [not_exist_db, commit, rollback, not_explicit_commit, - no_c_node, port_dies, control_process_dies, client_dies, - connect_timeout, timeout, many_timeouts, timeout_reset, - disconnect_on_timeout, connection_closed, - disable_scrollable_cursors, return_rows_as_lists, api_missuse]. %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config @@ -66,7 +78,7 @@ all() -> %%-------------------------------------------------------------------- init_per_suite(Config) -> application:start(odbc), - case odbc:connect(?RDBMS:connection_string(), + case catch odbc:connect(?RDBMS:connection_string(), [{auto_commit, off}]) of {ok, Ref} -> odbc:disconnect(Ref), @@ -283,11 +295,6 @@ control_process_dies(_Config) -> ok. %%------------------------------------------------------------------------- -client_dies(doc) -> - ["Test that the odbc process is terminated when the client process " - "dies"]; -client_dies(suite) -> - [client_dies_normal, client_dies_timeout, client_dies_error]. %%------------------------------------------------------------------------- client_dies_normal(doc) -> diff --git a/lib/odbc/test/odbc_data_type_SUITE.erl b/lib/odbc/test/odbc_data_type_SUITE.erl index 7d4a0ca15f..83bb821e2b 100644 --- a/lib/odbc/test/odbc_data_type_SUITE.erl +++ b/lib/odbc/test/odbc_data_type_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("stdlib/include/ms_transform.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -39,16 +39,48 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Tests data types"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case odbc_test_lib:odbc_check() of - ok -> all(); - Other -> {skip,Other} - end. + ok -> + [{group, char}, {group, int}, {group, floats}, + {group, dec_and_num}, timestamp]; + Other -> {skip, Other} + end. -all() -> - [char, int, floats, dec_and_num, timestamp]. +groups() -> + [{char, [], + [char_fixed_lower_limit, char_fixed_upper_limit, + char_fixed_padding, varchar_lower_limit, + varchar_upper_limit, varchar_no_padding, + text_lower_limit, text_upper_limit, unicode]}, + {binary_char, [], + [binary_char_fixed_lower_limit, + binary_char_fixed_upper_limit, + binary_char_fixed_padding, binary_varchar_lower_limit, + binary_varchar_upper_limit, binary_varchar_no_padding, + binary_text_lower_limit, binary_text_upper_limit, + unicode]}, + {int, [], + [tiny_int_lower_limit, tiny_int_upper_limit, + small_int_lower_limit, small_int_upper_limit, + int_lower_limit, int_upper_limit, big_int_lower_limit, + big_int_upper_limit, bit_false, bit_true]}, + {floats, [], + [float_lower_limit, float_upper_limit, float_zero, + real_zero]}, + {dec_and_num, [], + [dec_long, dec_double, dec_bignum, num_long, num_double, + num_bignum]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config @@ -124,14 +156,6 @@ end_per_testcase(_TestCase, Config) -> %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -char(doc) -> - ["Tests char data types"]; - -char(suite) -> - [char_fixed_lower_limit, char_fixed_upper_limit, - char_fixed_padding, varchar_lower_limit, varchar_upper_limit, - varchar_no_padding, text_lower_limit, text_upper_limit, unicode - ]. char_fixed_lower_limit(doc) -> ["Tests fixed length char data type lower boundaries."]; @@ -424,14 +448,6 @@ text_upper_limit(Config) when is_list(Config) -> %% ok. %%------------------------------------------------------------------------- -binary_char(doc) -> - ["Tests char data types returned as erlang binaries"]; - -binary_char(suite) -> - [binary_char_fixed_lower_limit, binary_char_fixed_upper_limit, - binary_char_fixed_padding, binary_varchar_lower_limit, binary_varchar_upper_limit, - binary_varchar_no_padding, binary_text_lower_limit, binary_text_upper_limit, unicode - ]. binary_char_fixed_lower_limit(doc) -> ["Tests fixed length char data type lower boundaries."]; @@ -726,13 +742,6 @@ binary_text_upper_limit(Config) when is_list(Config) -> %%------------------------------------------------------------------------- -int(doc) -> - ["Tests integer data types"]; - -int(suite) -> - [tiny_int_lower_limit, tiny_int_upper_limit, small_int_lower_limit, - small_int_upper_limit, int_lower_limit, int_upper_limit, - big_int_lower_limit, big_int_upper_limit, bit_false, bit_true]. %%------------------------------------------------------------------------- @@ -1053,10 +1062,6 @@ bit_true(Config) when is_list(Config) -> %%------------------------------------------------------------------------- -floats(doc) -> - ["Test the datatype float."]; -floats(suite) -> - [float_lower_limit, float_upper_limit, float_zero, real_zero]. %%------------------------------------------------------------------------- float_lower_limit(doc) -> @@ -1184,10 +1189,6 @@ real_zero(Config) when is_list(Config) -> ok end. %%------------------------------------------------------------------------- -dec_and_num(doc) -> - ["Tests decimal and numeric datatypes."]; -dec_and_num(suite) -> - [dec_long, dec_double, dec_bignum, num_long, num_double, num_bignum]. %%------------------------------------------------------------------------ dec_long(doc) -> [""]; diff --git a/lib/odbc/test/odbc_query_SUITE.erl b/lib/odbc/test/odbc_query_SUITE.erl index 12b39be3b7..5c8126ace6 100644 --- a/lib/odbc/test/odbc_query_SUITE.erl +++ b/lib/odbc/test/odbc_query_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -38,22 +38,47 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Tests SQL queries"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case odbc_test_lib:odbc_check() of - ok -> all(); + ok -> + [sql_query, first, last, next, prev, select_count, + select_next, select_relative, select_absolute, + create_table_twice, delete_table_twice, duplicate_key, + not_connection_owner, no_result_set, query_error, + multiple_select_result_sets, multiple_mix_result_sets, + multiple_result_sets_error, + {group, parameterized_queries}, {group, describe_table}, + delete_nonexisting_row]; Other -> {skip, Other} - end. + end. -all() -> - [sql_query, first, last, next, prev, select_count,select_next, - select_relative, select_absolute, create_table_twice, - delete_table_twice, duplicate_key, not_connection_owner, - no_result_set, query_error, multiple_select_result_sets, - multiple_mix_result_sets, multiple_result_sets_error, - parameterized_queries, describe_table, - delete_nonexisting_row]. +groups() -> + [{parameterized_queries, [], + [{group, param_integers}, param_insert_decimal, + param_insert_numeric, {group, param_insert_string}, + param_insert_float, param_insert_real, + param_insert_double, param_insert_mix, param_update, + param_delete, param_select]}, + {param_integers, [], + [param_insert_tiny_int, param_insert_small_int, + param_insert_int, param_insert_integer]}, + {param_insert_string, [], + [param_insert_char, param_insert_character, + param_insert_char_varying, + param_insert_character_varying]}, + {describe_table, [], + [describe_integer, describe_string, describe_floating, + describe_dec_num, describe_no_such_table]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- @@ -638,23 +663,8 @@ multiple_result_sets_error(Config) when is_list(Config) -> end. %%------------------------------------------------------------------------- -parameterized_queries(doc)-> - ["Tests diffrent variants of parameterized queries."]; -parameterized_queries(suite) -> - %% Note timestamps are inserted with param_query in odbc_data_type_SUITE - %% so no need to test this again. - [param_integers, - param_insert_decimal, param_insert_numeric, - param_insert_string, - param_insert_float, param_insert_real, param_insert_double, - param_insert_mix, param_update, param_delete, param_select]. %%------------------------------------------------------------------------- -param_integers(doc)-> - ["Test insertion of integers by parameterized queries."]; -param_integers(suite) -> - [param_insert_tiny_int, - param_insert_small_int, param_insert_int, param_insert_integer]. %%------------------------------------------------------------------------- param_insert_tiny_int(doc)-> ["Test insertion of tiny ints by parameterized queries."]; @@ -891,11 +901,6 @@ param_insert_numeric(Config) when is_list(Config) -> ok. %%------------------------------------------------------------------------- -param_insert_string(doc) -> - ["Test insertion of strings by parameterized queries."]; -param_insert_string(suite) -> - [param_insert_char, param_insert_character, param_insert_char_varying, - param_insert_character_varying]. %%------------------------------------------------------------------------- param_insert_char(doc)-> @@ -1320,11 +1325,6 @@ param_select(Config) when is_list(Config) -> ok. %%------------------------------------------------------------------------- -describe_table(doc) -> - ["Test describe_table/[2,3]"]; -describe_table(suite) -> - [describe_integer, describe_string, describe_floating, describe_dec_num, - describe_no_such_table]. %%------------------------------------------------------------------------- describe_integer(doc) -> diff --git a/lib/odbc/test/odbc_start_SUITE.erl b/lib/odbc/test/odbc_start_SUITE.erl index 2cca8e4546..902e77d210 100644 --- a/lib/odbc/test/odbc_start_SUITE.erl +++ b/lib/odbc/test/odbc_start_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -98,17 +98,23 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test start/stop of odbc"]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> +all() -> case odbc_test_lib:odbc_check() of - ok -> all(); + ok -> [start]; Other -> {skip, Other} - end. + end. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all() -> - [start]. %% Test cases starts here. diff --git a/lib/odbc/test/odbc_test_lib.erl b/lib/odbc/test/odbc_test_lib.erl index 92e895eb87..012eb96e43 100644 --- a/lib/odbc/test/odbc_test_lib.erl +++ b/lib/odbc/test/odbc_test_lib.erl @@ -51,7 +51,7 @@ odbc_check() -> [Other])) end; Other -> - case test_server:os_type() of + case os:type() of {unix, linux} -> ok; Platform -> diff --git a/lib/orber/doc/src/ch_idl_to_erlang_mapping.xml b/lib/orber/doc/src/ch_idl_to_erlang_mapping.xml index a97ad65f0e..964ae3e92d 100644 --- a/lib/orber/doc/src/ch_idl_to_erlang_mapping.xml +++ b/lib/orber/doc/src/ch_idl_to_erlang_mapping.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -445,7 +445,19 @@ void op(in myEnum a);</cell> <section> <title>Struct Data Type</title> <p>A <c>struct</c> may have Basic, Template, Scoped Names and Constructed - types as members.</p> + types as members. By using forward declaration we can define a recursive struct:</p> + <code type="none"><![CDATA[ +struct myStruct; // Forward declaration +typedef sequence<myStruct> myStructSeq; +struct myStruct { + myStructSeq chain; +}; + +// Deprecated definition (anonymous) not supported by IC +struct myStruct { + sequence<myStruct> chain; +}; + ]]></code> </section> <section> @@ -510,6 +522,25 @@ union LongUnion2 switch(long) { default: boolean DefaultValue; }; </code> + <p>In the same way as structs, unions can be recursive if forward + declaration is used (anonymous types is deprecated and not supported):</p> + <code type="none"><![CDATA[ +// Forward declaration +union myUnion; +typedef sequence<myUnion>myUnionSeq; +union myUnion switch (long) { + case 1 : myUnionSeq chain; + default: boolean DefaultValue; +}; + ]]></code> + + <note> + <p>Recursive types (union and struct) require Light IFR. I.e. the + IC option {light_ifr, true} is used and that Orber is configured in such a way that + Light IFR is activated. Recursive TypeCode is currently not supported, which is + why these cannot be encapsulated in an any data type.</p> + </note> + </section> <warning> <p>Every field in, for example, a struct must be initiated. Otherwise @@ -890,7 +921,7 @@ attribute long RWAttribute; object internal state with its object reference. The object internal state is an Erlang term which has a format defined by the user.</p> <note> - <p>It is is not always the case that the internal state will be the first parameter, as stubs can use their own object reference as the first parameter (see the IC documentation).</p> + <p>It is not always the case that the internal state will be the first parameter, as stubs can use their own object reference as the first parameter (see the IC documentation).</p> </note> <p>A function call will invoke an operation. The first parameter of the function should be the object reference and then diff --git a/lib/orber/doc/src/notes.xml b/lib/orber/doc/src/notes.xml index 6eda16a517..ba16682f0b 100644 --- a/lib/orber/doc/src/notes.xml +++ b/lib/orber/doc/src/notes.xml @@ -33,6 +33,36 @@ </header> <section> + <title>Orber 3.6.19</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p> + Partial support for recursive structs and unions. + Only available for the erl_corba backend and requires + that Light IFR is used. I.e. the IC option {light_ifr, true} + and that Orber is configured in such a way that Light IFR + is activated. Recursive TypeCode is currently not supported.</p> + <p> + Own Id: OTP-8868 Aux Id: seq11633</p> + </item> + </list> + </section> + <section> + <title>Fixed Bugs and Malfunctions</title> + <list type="bulleted"> + <item> + <p>The SSL option {ssl_imp, old} was not used if ssl_generation was + set to 2. Only R14B was affected by this.</p> + <p>Own Id: OTP-8994 Aux Id: seq11747</p> + </item> + </list> + </section> + </section> + + <section> <title>Orber 3.6.18</title> <section> <title>Fixed Bugs and Malfunctions</title> diff --git a/lib/orber/src/cdr_decode.erl b/lib/orber/src/cdr_decode.erl index 9d30098940..36ef6ce02f 100644 --- a/lib/orber/src/cdr_decode.erl +++ b/lib/orber/src/cdr_decode.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -898,9 +898,13 @@ dec_sequence_struct(Version, Message, N, TypeCodeList, Len, ByteOrder, Buff, C, {Seq, Rest2, Len2, NewC2} = dec_sequence_struct(Version, Rest1, N - 1, TypeCodeList, Len1, ByteOrder, Buff, NewC, Name), {[list_to_tuple([Name |Struct]) | Seq], Rest2, Len2, NewC2}. -dec_sequence_union(_, Message, 0, _DiscrTC, _Default, _ElementList, Len, _ByteOrder, _Buff, C, _Name) -> + + +dec_sequence_union(_, Message, 0, _DiscrTC, _Default, _ElementList, + Len, _ByteOrder, _Buff, C, _Name) -> {[], Message, Len, C}; -dec_sequence_union(Version, Message, N, DiscrTC, Default, ElementList, Len, ByteOrder, Buff, C, Name) -> +dec_sequence_union(Version, Message, N, DiscrTC, Default, ElementList, + Len, ByteOrder, Buff, C, Name) when is_list(ElementList) -> {Label, Rest1, Len1, NewC} = dec_type(DiscrTC, Version, Message, Len, ByteOrder, Buff, C), Result = dec_union(Version, stringify_enum(DiscrTC, Label), ElementList, Default, @@ -916,7 +920,20 @@ dec_sequence_union(Version, Message, N, DiscrTC, Default, ElementList, Len, Byte DiscrTC, Default, ElementList, Len2, ByteOrder, Buff, NewC3, Name), - {[{Name, Label, Value} | Seq], Rest3, Len3, NewC4}. + {[{Name, Label, Value} | Seq], Rest3, Len3, NewC4}; +dec_sequence_union(Version, Message, N, _DiscrTC, _Default, Module, + Len, ByteOrder, Buff, C, Name) when is_atom(Module) -> + case catch Module:tc() of + {tk_union, _, _, DiscrTC, Default, ElementList} -> + dec_sequence_union(Version, Message, N, DiscrTC, Default, ElementList, + Len, ByteOrder, Buff, C, Name); + What -> + orber:dbg("[~p] ~p:dec_sequence_union(~p). Union module doesn't exist or incorrect.", + [?LINE, ?MODULE, What], ?DEBUG_LEVEL), + corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) + end. + + %% A special case; when something is encapsulated (i.e. sent as octet-sequence) %% we sometimes don not want the result to be converted to a list. @@ -993,14 +1010,16 @@ dec_wstring(Version, Message, Len, ByteOrder, Buff, C) -> %% Func: dec_union/9 %%----------------------------------------------------------------- %% ## NEW IIOP 1.2 ## -dec_union(Version, ?SYSTEM_TYPE, Name, DiscrTC, Default, ElementList, Bytes, Len, ByteOrder, Buff, C) -> +dec_union(Version, ?SYSTEM_TYPE, Name, DiscrTC, Default, ElementList, Bytes, + Len, ByteOrder, Buff, C) -> {Label, Rest1, Len1, NewC} = dec_type(DiscrTC, Version, Bytes, Len, ByteOrder, Buff, C), {Value, Rest2, Len2, NewC3} = dec_union(Version, Label, ElementList, Default, Rest1, Len1, ByteOrder, Buff, NewC), {{Name, Label, Value}, Rest2, Len2, NewC3}; -dec_union(Version, IFRId, _, DiscrTC, Default, ElementList, Bytes, Len, ByteOrder, Buff, C) -> +dec_union(Version, IFRId, _, DiscrTC, Default, ElementList, Bytes, Len, + ByteOrder, Buff, C) when is_list(ElementList) -> {Label, Rest1, Len1, NewC} = dec_type(DiscrTC, Version, Bytes, Len, ByteOrder, Buff, C), Result = dec_union(Version, stringify_enum(DiscrTC, Label), ElementList, Default, Rest1, Len1, ByteOrder, Buff, NewC), @@ -1012,7 +1031,20 @@ dec_union(Version, IFRId, _, DiscrTC, Default, ElementList, Bytes, Len, ByteOrde X end, Name = ifrid_to_name(IFRId, ?IFR_UnionDef), - {{Name, Label, Value}, Rest2, Len2, NewC3}. + {{Name, Label, Value}, Rest2, Len2, NewC3}; +dec_union(Version, IFRId, _, _DiscrTC, _Default, Module, Bytes, Len, + ByteOrder, Buff, C) when is_atom(Module) -> + case catch Module:tc() of + {tk_union, _, Name, DiscrTC, Default, ElementList} -> + dec_union(Version, IFRId, Name, DiscrTC, Default, ElementList, Bytes, Len, + ByteOrder, Buff, C); + What -> + orber:dbg("[~p] ~p:dec_union(~p). Union module doesn't exist or incorrect.", + [?LINE, ?MODULE, What], ?DEBUG_LEVEL), + corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) + end. + + dec_union(_, _, [], Default, Message, Len, _, _Buff, C) when Default < 0 -> {undefined, Message, Len, C}; @@ -1047,7 +1079,16 @@ dec_struct1(_, [], Message, Len, _ByteOrder, _, C) -> dec_struct1(Version, [{_ElemName, ElemType} | TypeCodeList], Message, Len, ByteOrder, Buff, C) -> {Element, Rest, Len1, NewC} = dec_type(ElemType, Version, Message, Len, ByteOrder, Buff, C), {Struct, Rest1, Len2, NewC2} = dec_struct1(Version, TypeCodeList, Rest, Len1, ByteOrder, Buff, NewC), - {[Element |Struct], Rest1, Len2, NewC2}. + {[Element |Struct], Rest1, Len2, NewC2}; +dec_struct1(Version, Module, Message, Len, ByteOrder, Buff, C) -> + case catch Module:tc() of + {tk_struct, _, _, TypeCodeList} -> + dec_struct1(Version, TypeCodeList, Message, Len, ByteOrder, Buff, C); + What -> + orber:dbg("[~p] ~p:dec_struct1(~p). Struct module doesn't exist or incorrect.", + [?LINE, ?MODULE, What], ?DEBUG_LEVEL), + corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) + end. ifrid_to_name([], Type) -> orber:dbg("[~p] ~p:ifrid_to_name([], ~p). No Id supplied.", @@ -1232,7 +1273,9 @@ get_user_exception_type(TypeId) -> %%----------------------------------------------------------------- dec_type_code(Version, Message, Len, ByteOrder, Buff, C) -> {TypeNo, Message1, Len1, NewC} = dec_type('tk_ulong', Version, Message, Len, ByteOrder, Buff, C), - dec_type_code(TypeNo, Version, Message1, Len1, ByteOrder, Buff, NewC). + TC = dec_type_code(TypeNo, Version, Message1, Len1, ByteOrder, Buff, NewC), + erase(orber_indirection), + TC. %%----------------------------------------------------------------- %% Func: dec_type_code/5 @@ -1441,13 +1484,22 @@ dec_type_code(33, Version, Message, Len, ByteOrder, Buff, C) -> {"name", {'tk_string', 0}}]}, Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), {{'tk_local_interface', RepId, Name}, Message1, Len1, NewC}; -dec_type_code(16#ffffffff, Version, Message, Len, ByteOrder, Buff, C) -> %% placeholder +dec_type_code(16#ffffffff, Version, Message, Len, ByteOrder, Buff, C) -> {Indirection, Message1, Len1, NewC} = dec_type('tk_long', Version, Message, Len, ByteOrder, Buff, C), Position = C+Indirection, - <<_:Position/binary, SubBuff/binary>> = Buff, - {TC, _, _, _} = dec_type_code(Version, SubBuff, Position, ByteOrder, Buff, Position), - {TC, Message1, Len1, NewC}; + case put(orber_indirection, Position) of + Position -> +%% {{'none', Indirection}, Message1, Len1, NewC}; + %% Recursive TypeCode. Break the loop. + orber:dbg("[~p] cdr_decode:dec_type_code(~p); Recursive TC not supported.", + [?LINE,Position], ?DEBUG_LEVEL), + corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); + _ -> + <<_:Position/binary, SubBuff/binary>> = Buff, + {TC, _, _, _} = dec_type_code(Version, SubBuff, Position, ByteOrder, Buff, Position), + {TC, Message1, Len1, NewC} + end; dec_type_code(Type, _, _, _, _, _, _) -> orber:dbg("[~p] cdr_decode:dec_type_code(~p); No match.", [?LINE, Type], ?DEBUG_LEVEL), diff --git a/lib/orber/src/cdr_encode.erl b/lib/orber/src/cdr_encode.erl index 3ecb8833f5..eaf3c5b7dc 100644 --- a/lib/orber/src/cdr_encode.erl +++ b/lib/orber/src/cdr_encode.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -815,11 +815,21 @@ enc_wstring(Env, String, MaxLength, Bytes, Len) -> %%----------------------------------------------------------------- %% Func: enc_union/5 %%----------------------------------------------------------------- -enc_union(Env, {_, Label, Value}, DiscrTC, Default, TypeCodeList, Bytes, Len) -> +enc_union(Env, {_, Label, Value}, DiscrTC, Default, TypeCodeList, + Bytes, Len) when is_list(TypeCodeList) -> {ByteSequence, Len1} = enc_type(DiscrTC, Env, Label, Bytes, Len), Label2 = stringify_enum(DiscrTC,Label), enc_union2(Env, {Label2, Value},TypeCodeList, Default, - ByteSequence, Len1, undefined). + ByteSequence, Len1, undefined); +enc_union(Env, Value, _DiscrTC, _Default, Module, Bytes, Len) when is_atom(Module) -> + case catch Module:tc() of + {tk_union, _, _, DiscrTC, Default, ElementList} -> + enc_union(Env, Value, DiscrTC, Default, ElementList, Bytes, Len); + What -> + orber:dbg("[~p] ~p:enc_union(~p). Union module doesn't exist or incorrect.", + [?LINE, ?MODULE, What], ?DEBUG_LEVEL), + corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) + end. enc_union2(_Env, _What, [], Default, Bytes, Len, _) when Default < 0 -> {Bytes, Len}; @@ -840,9 +850,19 @@ stringify_enum(_, Label) -> %%----------------------------------------------------------------- %% Func: enc_struct/4 %%----------------------------------------------------------------- -enc_struct(Env, Struct, TypeCodeList, Bytes, Len) -> +enc_struct(Env, Struct, TypeCodeList, Bytes, Len) when is_list(TypeCodeList) -> [_Name | StructList] = tuple_to_list(Struct), - enc_struct1(Env, StructList, TypeCodeList, Bytes, Len). + enc_struct1(Env, StructList, TypeCodeList, Bytes, Len); +enc_struct(Env, Struct, Module, Bytes, Len) -> + [Module | StructList] = tuple_to_list(Struct), + case catch Module:tc() of + {tk_struct, _, _, TypeCodeList} -> + enc_struct1(Env, StructList, TypeCodeList, Bytes, Len); + What -> + orber:dbg("[~p] ~p:enc_struct([], ~p). Struct module doesn't exist or incorrect.", + [?LINE, ?MODULE, What], ?DEBUG_LEVEL), + corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) + end. enc_struct1(_Env, [], [], Bytes, Len) -> {Bytes, Len}; diff --git a/lib/orber/src/orber_socket.erl b/lib/orber/src/orber_socket.erl index af6df01b7d..84ed193ebb 100644 --- a/lib/orber/src/orber_socket.erl +++ b/lib/orber/src/orber_socket.erl @@ -496,27 +496,17 @@ check_port(Port, _, _) -> %%----------------------------------------------------------------- %% Check Options. -%% We need this as a work-around since the SSL-app doesn't allow us -%% to pass 'inet' as an option. Also needed for R9B :-( check_options(normal, Options, _Generation) -> - case orber:ip_version() of - inet -> - Options; - inet6 -> - %% Necessary for R9B. Should be [orber:ip_version()|Options]; - [inet6|Options] - end; + [orber:ip_version()|Options]; check_options(ssl, Options, Generation) -> case orber:ip_version() of inet when Generation > 2 -> [{ssl_imp, new}|Options]; inet -> - Options; + [{ssl_imp, old}|Options]; inet6 when Generation > 2 -> [{ssl_imp, new}, inet6|Options]; inet6 -> - %% Will fail until SSL supports this option. - %% Note, we want this happen! - [inet6|Options] + [{ssl_imp, old}, inet6|Options] end. diff --git a/lib/orber/test/Makefile b/lib/orber/test/Makefile index 4601e84d2c..4fad44dd7d 100644 --- a/lib/orber/test/Makefile +++ b/lib/orber/test/Makefile @@ -34,6 +34,7 @@ RELSYSDIR = $(RELEASE_PATH)/orber_test # Target Specs # ---------------------------------------------------- TEST_SPEC_FILE = orber.spec +COVER_FILE = orber.cover IDL_FILES = \ @@ -120,7 +121,11 @@ GEN_MOD_TEST_SERVER = \ orber_test_server_uni \ orber_test_server_uni_d \ orber_test_timeout_server \ - orber_parent_inherrit + orber_parent_inherrit \ + orber_test_server_rec_struct \ + orber_test_server_rec_struct_seq \ + orber_test_server_rec_union \ + orber_test_server_rec_union_seq GEN_HRL_TEST_SERVER = \ oe_orber_test_server.hrl \ @@ -218,7 +223,7 @@ release_docs_spec: release_tests_spec: tests $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ + $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) $(COVER_FILE) \ $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(SUITE_TARGET_FILES) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) diff --git a/lib/orber/test/cdrcoding_10_SUITE.erl b/lib/orber/test/cdrcoding_10_SUITE.erl index d5d030538f..666f474e90 100644 --- a/lib/orber/test/cdrcoding_10_SUITE.erl +++ b/lib/orber/test/cdrcoding_10_SUITE.erl @@ -27,7 +27,7 @@ -include("idl_output/Module.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -36,12 +36,11 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -49,13 +48,28 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [types, reply, cancel_request, close_connection, message_error]. +all() -> + cases(). + +groups() -> + [{types, [], + [do_register, null_type, void_type, principal_type, + objref_type, struct_type, union_type, string_type, + array_type, any_type, typecode_type, alias_type, + exception_type, do_unregister]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [{group, types}, reply, cancel_request, + close_connection, message_error]. %% request, locate_request, locate_reply]. %%----------------------------------------------------------------- @@ -69,14 +83,14 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> orber:jump_start(0), if is_list(Config) -> @@ -85,7 +99,7 @@ init_all(Config) when is_list(Config) -> exit("Config not a list") end. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> orber:jump_stop(), Config. @@ -94,11 +108,6 @@ finish_all(Config) when is_list(Config) -> %% Description: Just testing the complex types, the others are %% tested in the cdrlib SUITE. %%----------------------------------------------------------------- -types(doc) -> ["Description", "more description"]; -types(suite) -> [do_register, null_type, void_type, principal_type, - objref_type, struct_type, union_type, string_type, - array_type, any_type, typecode_type, alias_type, - exception_type, do_unregister]. %types(Config) when list(Config) -> % 'oe_orber_test':'oe_register'(), % null_type(), diff --git a/lib/orber/test/cdrcoding_11_SUITE.erl b/lib/orber/test/cdrcoding_11_SUITE.erl index d62fe6eb3a..273c94a79e 100644 --- a/lib/orber/test/cdrcoding_11_SUITE.erl +++ b/lib/orber/test/cdrcoding_11_SUITE.erl @@ -27,7 +27,7 @@ -include("idl_output/Module.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -36,12 +36,11 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -49,13 +48,28 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [types, reply, cancel_request, close_connection, message_error]. +all() -> + cases(). + +groups() -> + [{types, [], + [do_register, null_type, void_type, principal_type, + objref_type, struct_type, union_type, string_type, + array_type, any_type, typecode_type, alias_type, + exception_type, do_unregister]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [{group, types}, reply, cancel_request, + close_connection, message_error]. %% request, locate_request, locate_reply]. %%----------------------------------------------------------------- @@ -69,14 +83,14 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> orber:jump_start(0), if is_list(Config) -> @@ -85,7 +99,7 @@ init_all(Config) when is_list(Config) -> exit("Config not a list") end. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> orber:jump_stop(), Config. @@ -94,11 +108,6 @@ finish_all(Config) when is_list(Config) -> %% Description: Just testing the complex types, the others are %% tested in the cdrlib SUITE. %%----------------------------------------------------------------- -types(doc) -> ["Description", "more description"]; -types(suite) -> [do_register, null_type, void_type, principal_type, - objref_type, struct_type, union_type, string_type, - array_type, any_type, typecode_type, alias_type, - exception_type, do_unregister]. %types(Config) when list(Config) -> % 'oe_orber_test':'oe_register'(), % null_type(), diff --git a/lib/orber/test/cdrcoding_12_SUITE.erl b/lib/orber/test/cdrcoding_12_SUITE.erl index 18e8eaa08a..3a2d995b99 100644 --- a/lib/orber/test/cdrcoding_12_SUITE.erl +++ b/lib/orber/test/cdrcoding_12_SUITE.erl @@ -28,7 +28,7 @@ -module(cdrcoding_12_SUITE). -include("idl_output/Module.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -37,12 +37,11 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -50,13 +49,28 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> - [types, reply, cancel_request, close_connection, message_error]. +all() -> + cases(). + +groups() -> + [{types, [], + [do_register, null_type, void_type, principal_type, + objref_type, struct_type, union_type, string_type, + array_type, any_type, typecode_type, alias_type, + exception_type, do_unregister]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [{group, types}, reply, cancel_request, + close_connection, message_error]. %% request, locate_request, locate_reply]. %%----------------------------------------------------------------- @@ -70,14 +84,14 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> orber:jump_start(0), if is_list(Config) -> @@ -86,7 +100,7 @@ init_all(Config) when is_list(Config) -> exit("Config not a list") end. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> orber:jump_stop(), Config. @@ -95,11 +109,6 @@ finish_all(Config) when is_list(Config) -> %% Description: Just testing the complex types, the others are %% tested in the cdrlib SUITE. %%----------------------------------------------------------------- -types(doc) -> ["Description", "more description"]; -types(suite) -> [do_register, null_type, void_type, principal_type, - objref_type, struct_type, union_type, string_type, - array_type, any_type, typecode_type, alias_type, - exception_type, do_unregister]. do_register(doc) -> []; do_register(suite) -> []; diff --git a/lib/orber/test/cdrlib_SUITE.erl b/lib/orber/test/cdrlib_SUITE.erl index fa2d7f2a30..faf06904f0 100644 --- a/lib/orber/test/cdrlib_SUITE.erl +++ b/lib/orber/test/cdrlib_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -25,19 +25,19 @@ %%----------------------------------------------------------------- -module(cdrlib_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(3)). %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -45,10 +45,27 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> - [short, ushort, long, ulong, longlong, ulonglong, boolean, character, octet, - float, double, enum]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [short, ushort, long, ulong, longlong, ulonglong, + boolean, character, octet, float, double, enum]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%----------------------------------------------------------------- %% Init and cleanup functions. @@ -59,7 +76,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/orber/test/corba_SUITE.erl b/lib/orber/test/corba_SUITE.erl index dae8fcbefc..1b28228375 100644 --- a/lib/orber/test/corba_SUITE.erl +++ b/lib/orber/test/corba_SUITE.erl @@ -25,7 +25,7 @@ %%----------------------------------------------------------------- -module(corba_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -51,7 +51,7 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports @@ -64,18 +64,29 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for the CORBA/BOA/Object/orber interfaces", ""]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. - -cases() -> - [exception_info_api, corba_api, object_api, orber_api, - orber_objectkeys_api, orber_pseudo_objects, callback_ok_api, - callback_arity_api, callback_module_api, callback_function_api, - callback_precond_api, callback_postcond_api, callback_exit_api, - callback_badarith_api, callback_case_clause_api, - callback_function_clause_api]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [exception_info_api, corba_api, object_api, orber_api, + orber_objectkeys_api, orber_pseudo_objects, + callback_ok_api, callback_arity_api, + callback_module_api, callback_function_api, + callback_precond_api, callback_postcond_api, + callback_exit_api, callback_badarith_api, + callback_case_clause_api, callback_function_clause_api]. %% boa_api, request, locate_request, locate_reply]. @@ -90,14 +101,14 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> corba:orb_init([{orber_debug_level, 10}, {giop_version, {1,2}}, {iiop_port, 0}]), mnesia:delete_schema([node()]), @@ -112,7 +123,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> application:stop(orber), application:stop(mnesia), mnesia:delete_schema([node()]), diff --git a/lib/orber/test/csiv2_SUITE.erl b/lib/orber/test/csiv2_SUITE.erl index 8103fd81ac..e7c79b9e84 100644 --- a/lib/orber/test/csiv2_SUITE.erl +++ b/lib/orber/test/csiv2_SUITE.erl @@ -20,7 +20,7 @@ -module(csiv2_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -272,8 +272,9 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, - init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, % code_CertificateChain_api/1, % code_AttributeCertChain_api/1, % code_VerifyingCertChain_api/1, @@ -316,46 +317,26 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for multi orber interfaces using CSIv2"]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% NOTE - the fragment test cases must bu first since we explicitly set a request %% id. Otherwise, the request-id counter would be increased and we cannot know %% what it is. -cases() -> - [ -% code_CertificateChain_api, -% code_AttributeCertChain_api, -% code_VerifyingCertChain_api, -% code_AttributeCertificate_api, -% code_Certificate_api, -% code_TBSCertificate_api, -% code_CertificateSerialNumber_api, -% code_Version_api, -% code_AlgorithmIdentifier_api, -% code_Name_api, -% code_RDNSequence_api, -% code_RelativeDistinguishedName_api, -% code_AttributeTypeAndValue_api, -% code_Attribute_api, -% code_Validity_api, -% code_SubjectPublicKeyInfo_api, -% code_UniqueIdentifier_api, -% code_Extensions_api, -% code_Extension_api, -% code_AttributeCertificateInfo_api, -% code_AttCertVersion_api, -% code_Holder_api, -% code_AttCertIssuer_api, -% code_AttCertValidityPeriod_api, -% code_V2Form_api, -% code_IssuerSerial_api, -% code_ObjectDigestInfo_api, -% code_OpenSSL509_api, - ssl_server_peercert_api, - ssl_client_peercert_api]. +cases() -> + [ssl_server_peercert_api, ssl_client_peercert_api]. %%----------------------------------------------------------------- %% Init and cleanup functions. @@ -370,7 +351,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> oe_orber_test_server:oe_unregister(), orber:jump_stop(), Path = code:which(?MODULE), @@ -379,15 +360,15 @@ fin_per_testcase(_Case, Config) -> test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") +init_per_suite(Config) -> + case orber_test_lib:ssl_version() of + no_ssl -> + {skip,"SSL is not installed!"}; + _ -> + Config end. -finish_all(Config) -> +end_per_suite(Config) -> Config. %%----------------------------------------------------------------- diff --git a/lib/orber/test/data_types_SUITE.erl b/lib/orber/test/data_types_SUITE.erl index 1feb0b3b58..45a8af9415 100644 --- a/lib/orber/test/data_types_SUITE.erl +++ b/lib/orber/test/data_types_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% 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 @@ -25,7 +25,7 @@ -module(data_types_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -48,12 +48,12 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -61,10 +61,27 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing more or less complex data types"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [fixed_type, any_type]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -75,7 +92,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), Dog = ?config(watchdog, Config), diff --git a/lib/orber/test/generated_SUITE.erl b/lib/orber/test/generated_SUITE.erl index 1cd1674fc4..29f0a54aed 100644 --- a/lib/orber/test/generated_SUITE.erl +++ b/lib/orber/test/generated_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ -module(generated_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -71,7 +71,8 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports @@ -84,16 +85,37 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing IC generated files"]; -all(suite) -> - ['OrberApp_IFR', - erlang_binary, erlang_pid, erlang_port, erlang_ref, - 'CosNaming_Binding', 'CosNaming_BindingList', 'CosNaming_Name', - 'CosNaming_NameComponent', 'CosNaming_NamingContextExt_InvalidAddress', - 'CosNaming_NamingContext_AlreadyBound', 'CosNaming_NamingContext_CannotProceed', - 'CosNaming_NamingContext_InvalidName', 'CosNaming_NamingContext_NotEmpty', - 'CosNaming_NamingContext_NotFound', 'CosNaming_BindingIterator', - 'CosNaming_NamingContext', 'CosNaming_NamingContextExt']. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + ['OrberApp_IFR', erlang_binary, erlang_pid, erlang_port, + erlang_ref, 'CosNaming_Binding', + 'CosNaming_BindingList', 'CosNaming_Name', + 'CosNaming_NameComponent', + 'CosNaming_NamingContextExt_InvalidAddress', + 'CosNaming_NamingContext_AlreadyBound', + 'CosNaming_NamingContext_CannotProceed', + 'CosNaming_NamingContext_InvalidName', + 'CosNaming_NamingContext_NotEmpty', + 'CosNaming_NamingContext_NotFound', + 'CosNaming_BindingIterator', 'CosNaming_NamingContext', + 'CosNaming_NamingContextExt']. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%----------------------------------------------------------------- %% Init and cleanup functions. @@ -103,7 +125,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/orber/test/iiop_module_do_test_impl.erl b/lib/orber/test/iiop_module_do_test_impl.erl index bf171a3097..54fcd8239a 100644 --- a/lib/orber/test/iiop_module_do_test_impl.erl +++ b/lib/orber/test/iiop_module_do_test_impl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/orber/test/iiop_module_test_impl.erl b/lib/orber/test/iiop_module_test_impl.erl index fe334e1b26..2096c14a23 100644 --- a/lib/orber/test/iiop_module_test_impl.erl +++ b/lib/orber/test/iiop_module_test_impl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/orber/test/iiop_test_impl.erl b/lib/orber/test/iiop_test_impl.erl index fd92109c09..234f7c5f73 100644 --- a/lib/orber/test/iiop_test_impl.erl +++ b/lib/orber/test/iiop_test_impl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 diff --git a/lib/orber/test/interceptors_SUITE.erl b/lib/orber/test/interceptors_SUITE.erl index 27e23a9433..487cfd0aec 100644 --- a/lib/orber/test/interceptors_SUITE.erl +++ b/lib/orber/test/interceptors_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ -module(interceptors_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -65,7 +65,8 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports @@ -78,10 +79,27 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing Orber Interceptors"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [local_pseudo, local_default, local_local, local_global]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -96,7 +114,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> oe_orber_test_server:oe_unregister(), orber:jump_stop(), Path = code:which(?MODULE), diff --git a/lib/orber/test/iop_ior_10_SUITE.erl b/lib/orber/test/iop_ior_10_SUITE.erl index 1000c7f113..50d657ea4e 100644 --- a/lib/orber/test/iop_ior_10_SUITE.erl +++ b/lib/orber/test/iop_ior_10_SUITE.erl @@ -25,7 +25,7 @@ %%----------------------------------------------------------------- -module(iop_ior_10_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/src/orber_iiop.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -33,7 +33,8 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports @@ -46,10 +47,27 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [encoding, create_and_get_ops]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -59,7 +77,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/orber/test/iop_ior_11_SUITE.erl b/lib/orber/test/iop_ior_11_SUITE.erl index 35d01789ee..38112cc335 100644 --- a/lib/orber/test/iop_ior_11_SUITE.erl +++ b/lib/orber/test/iop_ior_11_SUITE.erl @@ -25,7 +25,7 @@ %%----------------------------------------------------------------- -module(iop_ior_11_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/src/orber_iiop.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -33,7 +33,8 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports @@ -46,10 +47,27 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [encoding, create_and_get_ops]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -59,7 +77,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/orber/test/iop_ior_12_SUITE.erl b/lib/orber/test/iop_ior_12_SUITE.erl index 42db130e54..3baea074c2 100644 --- a/lib/orber/test/iop_ior_12_SUITE.erl +++ b/lib/orber/test/iop_ior_12_SUITE.erl @@ -26,7 +26,7 @@ -module(iop_ior_12_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/src/orber_iiop.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -34,7 +34,8 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports @@ -47,10 +48,27 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [encoding, create_and_get_ops]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -60,7 +78,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/orber/test/lname_SUITE.erl b/lib/orber/test/lname_SUITE.erl index d1f0e7cf0e..5e283d7bba 100644 --- a/lib/orber/test/lname_SUITE.erl +++ b/lib/orber/test/lname_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -25,7 +25,7 @@ %%----------------------------------------------------------------- -module(lname_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/COSS/CosNaming/lname.hrl"). @@ -34,7 +34,8 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports @@ -47,10 +48,27 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [lname_component, lname]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -60,7 +78,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/orber/test/multi_ORB_SUITE.erl b/lib/orber/test/multi_ORB_SUITE.erl index d1931f5393..6ac514eb77 100644 --- a/lib/orber/test/multi_ORB_SUITE.erl +++ b/lib/orber/test/multi_ORB_SUITE.erl @@ -20,7 +20,7 @@ -module(multi_ORB_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -50,8 +50,9 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, basic_PI_api/1, multi_orber_api/1, - init_per_testcase/2, fin_per_testcase/2, multi_pseudo_orber_api/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, basic_PI_api/1, multi_orber_api/1, + init_per_testcase/2, end_per_testcase/2, multi_pseudo_orber_api/1, light_orber_api/1, light_orber2_api/1, ssl_1_multi_orber_api/1, ssl_2_multi_orber_api/1, ssl_reconfigure_api/1, iiop_timeout_api/1, iiop_timeout_added_api/1, setup_connection_timeout_api/1, @@ -86,75 +87,93 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for multi orber interfaces", - "This suite test intra-ORB communication. There are three scenarios:", - "* No security at all (multi_orber_api)", - "* Two secure orbs using ssl (ssl_multi_orb_api)", - "* One secure and one orb with no security. (ssl_multi_orb_api)"]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% NOTE - the fragment test cases must be first since we explicitly set a request %% id. Otherwise, the request-id counter would be increased and we cannot know %% what it is. -cases() -> - [fragments_server_api, - fragments_max_server_api, - fragments_max_server_added_api, - fragments_client_api, - flags_added_api, - bad_fragment_id_client_api, - bad_giop_header_api, - bad_id_cancel_request_api, - implicit_context_api, - pseudo_implicit_context_api, +cases() -> + [fragments_server_api, fragments_max_server_api, + fragments_max_server_added_api, fragments_client_api, + flags_added_api, bad_fragment_id_client_api, + bad_giop_header_api, bad_id_cancel_request_api, + implicit_context_api, pseudo_implicit_context_api, pseudo_two_implicit_context_api, implicit_context_roundtrip_api, - oneway_implicit_context_api, + oneway_implicit_context_api, oneway_pseudo_implicit_context_api, oneway_pseudo_two_implicit_context_api, - proxy_interface_api, - proxy_interface_ipv6_api, - local_interface_api, - local_interface_ctx_override_api, - local_interface_acl_override_api, - close_connections_api, + proxy_interface_api, proxy_interface_ipv6_api, + local_interface_api, local_interface_ctx_override_api, + local_interface_acl_override_api, close_connections_api, close_connections_local_interface_api, close_connections_local_interface_ctx_override_api, close_connections_alt_iiop_addr_api, close_connections_multiple_profiles_api, - multiple_accept_api, - max_requests_api, - max_requests_added_api, - max_connections_api, - max_packet_size_exceeded_api, - max_packet_size_ok_api, - light_ifr_api, - multi_pseudo_orber_api, - multi_orber_api, - light_orber_api, - light_orber2_api, - basic_PI_api, - iiop_timeout_api, - iiop_timeout_added_api, - setup_connection_timeout_api, - setup_multi_connection_timeout_api, - setup_multi_connection_timeout_attempts_api, - setup_multi_connection_timeout_random_api, + multiple_accept_api, max_requests_api, + max_requests_added_api, max_connections_api, + max_packet_size_exceeded_api, max_packet_size_ok_api, + light_ifr_api, multi_pseudo_orber_api, multi_orber_api, + light_orber_api, light_orber2_api, basic_PI_api, + iiop_timeout_api, iiop_timeout_added_api, + setup_connection_timeout_api, + setup_multi_connection_timeout_api, + setup_multi_connection_timeout_attempts_api, + setup_multi_connection_timeout_random_api, ssl_1_multi_orber_api, ssl_1_multi_orber_generation_3_api, ssl_2_multi_orber_api, ssl_2_multi_orber_generation_3_api, - ssl_reconfigure_generation_3_api, - ssl_reconfigure_api - ]. + ssl_reconfigure_generation_3_api, ssl_reconfigure_api]. %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- - +init_per_testcase(TC,Config) + when TC =:= ssl_1_multi_orber_api; + TC =:= ssl_2_multi_orber_api; + TC =:= ssl_reconfigure_api -> + init_ssl(Config); +init_per_testcase(TC,Config) + when TC =:= ssl_1_multi_orber_generation_3_api; + TC =:= ssl_2_multi_orber_generation_3_api; + TC =:= ssl_reconfigure_generation_3_api -> + init_ssl_3(Config); init_per_testcase(_Case, Config) -> + init_all(Config). + +init_ssl(Config) -> + case orber_test_lib:ssl_version() of + no_ssl -> + {skip,"SSL is not installed!"}; + _ -> + init_all(Config) + end. + +init_ssl_3(Config) -> + case orber_test_lib:ssl_version() of + 3 -> + init_all(Config); + 2 -> + {skip,"Could not find the correct SSL version!"}; + no_ssl -> + {skip,"SSL is not installed!"} + end. + +init_all(Config) -> Path = code:which(?MODULE), code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), Dog=test_server:timetrap(?default_timeout), @@ -163,7 +182,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> oe_orber_test_server:oe_unregister(), orber:jump_stop(), Path = code:which(?MODULE), @@ -172,7 +191,7 @@ fin_per_testcase(_Case, Config) -> test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> if is_list(Config) -> Config; @@ -180,7 +199,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> Config. %%----------------------------------------------------------------- @@ -1580,17 +1599,11 @@ ssl_1_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", "secure orbs which must raise a NO_PERMISSION exception."]; ssl_1_multi_orber_api(suite) -> []; ssl_1_multi_orber_api(_Config) -> - case os:type() of - vxworks -> - {skipped, "No SSL-support for VxWorks."}; - _ -> - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, - 1, [{iiop_ssl_port, 0}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, - 1, [{iiop_ssl_port, 0}]), - ssl_suite(ServerOptions, ClientOptions), - ok - end. + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + 1, [{iiop_ssl_port, 0}]), + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + 1, [{iiop_ssl_port, 0}]), + ssl_suite(ServerOptions, ClientOptions). ssl_1_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", "This case set up two secure orbs and test if they can", @@ -1598,24 +1611,14 @@ ssl_1_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL dep "secure orbs which must raise a NO_PERMISSION exception."]; ssl_1_multi_orber_generation_3_api(suite) -> []; ssl_1_multi_orber_generation_3_api(_Config) -> - case os:type() of - vxworks -> - {skipped, "No SSL-support for VxWorks."}; - _ -> - case orber_test_lib:ssl_version() of - 3 -> - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, - 1, [{ssl_generation, 3}, - {iiop_ssl_port, 0}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, - 1, [{ssl_generation, 3}, - {iiop_ssl_port, 0}]), - ssl_suite(ServerOptions, ClientOptions), - ok; - _ -> - {skipped, "Required SSL generation not available"} - end - end. + + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + 1, [{ssl_generation, 3}, + {iiop_ssl_port, 0}]), + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + 1, [{ssl_generation, 3}, + {iiop_ssl_port, 0}]), + ssl_suite(ServerOptions, ClientOptions). %%----------------------------------------------------------------- @@ -1628,17 +1631,12 @@ ssl_2_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", "secure orbs which must raise a NO_PERMISSION exception."]; ssl_2_multi_orber_api(suite) -> []; ssl_2_multi_orber_api(_Config) -> - case os:type() of - vxworks -> - {skipped, "No SSL-support for VxWorks."}; - _ -> - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, - 2, [{iiop_ssl_port, 0}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, - 2, [{iiop_ssl_port, 0}]), - ssl_suite(ServerOptions, ClientOptions), - ok - end. + + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + 2, [{iiop_ssl_port, 0}]), + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + 2, [{iiop_ssl_port, 0}]), + ssl_suite(ServerOptions, ClientOptions). ssl_2_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", "This case set up two secure orbs and test if they can", @@ -1646,24 +1644,14 @@ ssl_2_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL dep "secure orbs which must raise a NO_PERMISSION exception."]; ssl_2_multi_orber_generation_3_api(suite) -> []; ssl_2_multi_orber_generation_3_api(_Config) -> - case os:type() of - vxworks -> - {skipped, "No SSL-support for VxWorks."}; - _ -> - case orber_test_lib:ssl_version() of - 3 -> - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, - 2, [{ssl_generation, 3}, - {iiop_ssl_port, 0}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, - 2, [{ssl_generation, 3}, - {iiop_ssl_port, 0}]), - ssl_suite(ServerOptions, ClientOptions), - ok; - _ -> - {skipped, "Required SSL generation not available"} - end - end. + + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + 2, [{ssl_generation, 3}, + {iiop_ssl_port, 0}]), + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + 2, [{ssl_generation, 3}, + {iiop_ssl_port, 0}]), + ssl_suite(ServerOptions, ClientOptions). %%----------------------------------------------------------------- %% API tests for ORB to ORB, ssl security depth 2 %%----------------------------------------------------------------- @@ -1682,69 +1670,57 @@ ssl_reconfigure_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth "secure orbs which must raise a NO_PERMISSION exception."]; ssl_reconfigure_generation_3_api(suite) -> []; ssl_reconfigure_generation_3_api(_Config) -> - case orber_test_lib:ssl_version() of - 3 -> - ssl_reconfigure([{ssl_generation, 3}]); - - _ -> - {skipped, "Required SSL generation not available"} - end. + ssl_reconfigure([{ssl_generation, 3}]). ssl_reconfigure(ExtraSSLOptions) -> - case os:type() of - vxworks -> - {skipped, "No SSL-support for VxWorks."}; - _ -> - IP = orber_test_lib:get_host(), - Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = - ?match({ok,_,_}, - orber_test_lib:js_node([{iiop_port, 0}, - {flags, ?ORB_ENV_LOCAL_INTERFACE}, - {ip_address, IP}|ExtraSSLOptions])), - orber_test_lib:remote_apply(ServerNode, ssl, start, []), - orber_test_lib:remote_apply(ServerNode, crypto, start, []), - orber_test_lib:remote_apply(ServerNode, ssl, seed, ["testing"]), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, - [ssl])), - ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, - [Loopback, normal, [{iiop_port, 5648}, - {iiop_ssl_port, 5649}, - {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]])), - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, - 2, [{flags, ?ORB_ENV_LOCAL_INTERFACE}, - {iiop_port, 5648}, + + IP = orber_test_lib:get_host(), + Loopback = orber_test_lib:get_loopback_interface(), + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, + orber_test_lib:js_node([{iiop_port, 0}, + {flags, ?ORB_ENV_LOCAL_INTERFACE}, + {ip_address, IP}|ExtraSSLOptions])), + orber_test_lib:remote_apply(ServerNode, ssl, start, []), + orber_test_lib:remote_apply(ServerNode, crypto, start, []), + orber_test_lib:remote_apply(ServerNode, ssl, seed, ["testing"]), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, + [ssl])), + ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, + [Loopback, normal, [{iiop_port, 5648}, {iiop_ssl_port, 5649}, - {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]), - ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, - [Loopback, ssl, ServerOptions])), - - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, - 2, [{iiop_ssl_port, 0}|ExtraSSLOptions]), - {ok, ClientNode, _ClientHost} = - ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), - - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, - install_test_data, - [ssl])), - orber_test_lib:remote_apply(ClientNode, ssl, start, []), - orber_test_lib:remote_apply(ServerNode, crypto, start, []), - orber_test_lib:remote_apply(ClientNode, ssl, seed, ["testing"]), - Obj = ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, - string_to_object, ["corbaname:iiop:1.1@"++Loopback++":5648/NameService#mamba", - [{context, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {configuration, ClientOptions}}]}]])), - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_server, - print, [Obj])), - - ok - end. + {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]])), + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + 2, [{flags, ?ORB_ENV_LOCAL_INTERFACE}, + {iiop_port, 5648}, + {iiop_ssl_port, 5649}, + {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]), + ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, + [Loopback, ssl, ServerOptions])), + + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + 2, [{iiop_ssl_port, 0}|ExtraSSLOptions]), + {ok, ClientNode, _ClientHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), + + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, + install_test_data, + [ssl])), + orber_test_lib:remote_apply(ClientNode, ssl, start, []), + orber_test_lib:remote_apply(ServerNode, crypto, start, []), + orber_test_lib:remote_apply(ClientNode, ssl, seed, ["testing"]), + Obj = ?match(#'IOP_IOR'{}, + orber_test_lib:remote_apply(ClientNode, corba, + string_to_object, ["corbaname:iiop:1.1@"++Loopback++":5648/NameService#mamba", + [{context, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {configuration, ClientOptions}}]}]])), + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_server, + print, [Obj])). diff --git a/lib/orber/test/naming_context_SUITE.erl b/lib/orber/test/naming_context_SUITE.erl index 4406e01d5a..5250beacbe 100644 --- a/lib/orber/test/naming_context_SUITE.erl +++ b/lib/orber/test/naming_context_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -25,7 +25,7 @@ %%----------------------------------------------------------------- -module(naming_context_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). -include_lib("orber/include/corba.hrl"). @@ -35,7 +35,7 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports @@ -43,7 +43,8 @@ -export([name_context/1, check_list/1, name_context_ext/1]). --export([init_all/1, finish_all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_suite/1, end_per_suite/1, init_per_testcase/2, + end_per_testcase/2]). %%----------------------------------------------------------------- @@ -75,12 +76,22 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -cases() -> +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> [name_context, check_list, name_context_ext]. %%----------------------------------------------------------------- @@ -95,7 +106,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:del_path(filename:join(filename:dirname(Path), "idl_output")), orber:jump_stop(), @@ -103,10 +114,10 @@ fin_per_testcase(_Case, Config) -> test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> Config. -finish_all(Config) -> +end_per_suite(Config) -> Config. %%----------------------------------------------------------------- diff --git a/lib/orber/test/orber.cover b/lib/orber/test/orber.cover new file mode 100644 index 0000000000..807a7c2c6e --- /dev/null +++ b/lib/orber/test/orber.cover @@ -0,0 +1,2 @@ +{incl_app,orber,details}. + diff --git a/lib/orber/test/orber.spec b/lib/orber/test/orber.spec index 9d19ea7fc1..0dd30deade 100644 --- a/lib/orber/test/orber.spec +++ b/lib/orber/test/orber.spec @@ -1,19 +1 @@ -%% -%% %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% -%% -{topcase, {dir, "../orber_test"}}. +{suites,"../orber_test",all}. diff --git a/lib/orber/test/orber_SUITE.erl b/lib/orber/test/orber_SUITE.erl index f54da02c0e..a55705e550 100644 --- a/lib/orber/test/orber_SUITE.erl +++ b/lib/orber/test/orber_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -18,15 +18,16 @@ %% %% -module(orber_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(15)). -define(application, orber). % Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). % Test cases must be exported. -export([app_test/1, undefined_functions/1, install_load_order/1, @@ -35,17 +36,33 @@ %% %% all/1 %% -all(doc) -> - []; -all(suite) -> - [app_test, undefined_functions, - install_load_order, install_local_content]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [app_test, undefined_functions, install_load_order, + install_local_content]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/orber/test/orber_acl_SUITE.erl b/lib/orber/test/orber_acl_SUITE.erl index 2c2a768af2..9e69457d6e 100644 --- a/lib/orber/test/orber_acl_SUITE.erl +++ b/lib/orber/test/orber_acl_SUITE.erl @@ -25,7 +25,7 @@ %%----------------------------------------------------------------- -module(orber_acl_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(5)). @@ -47,7 +47,7 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports @@ -59,15 +59,26 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Testing API for ACL (Access Control List)"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [ipv4_verify, ipv4_range, ipv4_interfaces, ipv4_bm, ipv6_verify, ipv6_range, ipv6_interfaces, ipv6_bm]. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- -init_all(Config) -> +init_per_suite(Config) -> if list(Config) -> Config; @@ -75,7 +86,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> Config. @@ -84,7 +95,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/orber/test/orber_firewall_ipv4_in_SUITE.erl b/lib/orber/test/orber_firewall_ipv4_in_SUITE.erl index 3ac0cb7921..e2c73c2fd0 100644 --- a/lib/orber/test/orber_firewall_ipv4_in_SUITE.erl +++ b/lib/orber/test/orber_firewall_ipv4_in_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -20,7 +20,7 @@ -module(orber_firewall_ipv4_in_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -49,8 +49,9 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, - init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, deny_port_api/1, deny_port_range_api/1, deny_host_api/1, deny_peerhost_api/1, allow_port_range_api/1, allow_host_api/1, allow_peerhost_api/1, check_address_api/1]). @@ -60,17 +61,28 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for orber's firewall functionallity."]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% NOTE - the fragment test cases must bu first since we explicitly set a request %% id. Otherwise, the request-id counter would be increased and we cannot know %% what it is. -cases() -> - [deny_port_api, deny_port_range_api, deny_host_api, deny_peerhost_api, - allow_port_range_api, allow_host_api, allow_peerhost_api, check_address_api]. +cases() -> + [deny_port_api, deny_port_range_api, deny_host_api, + deny_peerhost_api, allow_port_range_api, allow_host_api, + allow_peerhost_api, check_address_api]. init_per_testcase(_Case, Config) -> @@ -78,12 +90,12 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> if is_list(Config) -> orber:jump_start([{iiop_port, 0}, @@ -93,7 +105,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> orber:jump_stop(), Config. diff --git a/lib/orber/test/orber_firewall_ipv4_out_SUITE.erl b/lib/orber/test/orber_firewall_ipv4_out_SUITE.erl index 193fc72f7c..ac6c7327a1 100644 --- a/lib/orber/test/orber_firewall_ipv4_out_SUITE.erl +++ b/lib/orber/test/orber_firewall_ipv4_out_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -20,7 +20,7 @@ -module(orber_firewall_ipv4_out_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -49,8 +49,9 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, - init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, deny_port_api/1, deny_port_range_api/1, deny_host_api/1, allow_port_api/1, allow_port_range_api/1, allow_host_api/1, local_interface_api/1]). @@ -60,15 +61,25 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for orber's firewall functionallity."]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% NOTE - the fragment test cases must bu first since we explicitly set a request %% id. Otherwise, the request-id counter would be increased and we cannot know %% what it is. -cases() -> +cases() -> [deny_port_api, deny_port_range_api, deny_host_api, allow_port_api, allow_port_range_api, allow_host_api, local_interface_api]. @@ -79,12 +90,12 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> if is_list(Config) -> orber:jump_start([{iiop_port, 0}, @@ -94,7 +105,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> orber:jump_stop(), Config. diff --git a/lib/orber/test/orber_firewall_ipv6_in_SUITE.erl b/lib/orber/test/orber_firewall_ipv6_in_SUITE.erl index 83f48cba0c..2888565c54 100644 --- a/lib/orber/test/orber_firewall_ipv6_in_SUITE.erl +++ b/lib/orber/test/orber_firewall_ipv6_in_SUITE.erl @@ -20,7 +20,7 @@ -module(orber_firewall_ipv6_in_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -49,8 +49,9 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, - init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, deny_port_api/1, deny_port_range_api/1, deny_host_api/1, deny_peerhost_api/1, allow_port_range_api/1, allow_host_api/1, allow_peerhost_api/1, check_address_api/1]). @@ -60,18 +61,28 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for orber's firewall functionallity."]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% NOTE - the fragment test cases must bu first since we explicitly set a request %% id. Otherwise, the request-id counter would be increased and we cannot know %% what it is. -cases() -> - [deny_port_api, deny_port_range_api, deny_host_api, deny_peerhost_api, - allow_port_range_api, allow_host_api, allow_peerhost_api, - check_address_api]. +cases() -> + [deny_port_api, deny_port_range_api, deny_host_api, + deny_peerhost_api, allow_port_range_api, allow_host_api, + allow_peerhost_api, check_address_api]. init_per_testcase(_Case, Config) -> @@ -82,13 +93,13 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> orber:jump_stop(), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> case orber_test_lib:version_ok() of true -> if @@ -101,7 +112,7 @@ init_all(Config) -> Reason end. -finish_all(Config) -> +end_per_suite(Config) -> Config. diff --git a/lib/orber/test/orber_firewall_ipv6_out_SUITE.erl b/lib/orber/test/orber_firewall_ipv6_out_SUITE.erl index e1856b9a47..f0a865adcb 100644 --- a/lib/orber/test/orber_firewall_ipv6_out_SUITE.erl +++ b/lib/orber/test/orber_firewall_ipv6_out_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -20,7 +20,7 @@ -module(orber_firewall_ipv6_out_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -49,8 +49,9 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, - init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, deny_port_api/1, deny_port_range_api/1, deny_host_api/1, allow_port_api/1, allow_port_range_api/1, allow_host_api/1, local_interface_api/1]). @@ -60,15 +61,25 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for orber's firewall functionallity."]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% NOTE - the fragment test cases must bu first since we explicitly set a request %% id. Otherwise, the request-id counter would be increased and we cannot know %% what it is. -cases() -> +cases() -> [deny_port_api, deny_port_range_api, deny_host_api, allow_port_api, allow_port_range_api, allow_host_api, local_interface_api]. @@ -82,13 +93,13 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> orber:jump_stop(), Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> case orber_test_lib:version_ok() of true -> if @@ -101,7 +112,7 @@ init_all(Config) -> Reason end. -finish_all(Config) -> +end_per_suite(Config) -> Config. diff --git a/lib/orber/test/orber_nat_SUITE.erl b/lib/orber/test/orber_nat_SUITE.erl index 5b295dd1aa..264a8ec523 100644 --- a/lib/orber/test/orber_nat_SUITE.erl +++ b/lib/orber/test/orber_nat_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -20,7 +20,7 @@ -module(orber_nat_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -50,8 +50,9 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1, cases/0, init_all/1, finish_all/1, - init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, nat_ip_address/1, nat_ip_address_multiple/1, nat_ip_address_local/1, nat_ip_address_local_local/1, nat_iiop_port/1, nat_iiop_port_local/1, @@ -68,32 +69,40 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["API tests for multi orber interfaces", - "This suite test intra-ORB communication. There are three scenarios:", - "* No security at all (multi_orber_api)", - "* Two secure orbs using ssl (ssl_multi_orb_api)", - "* One secure and one orb with no security. (ssl_multi_orb_api)"]; -all(suite) -> {req, - [mnesia], - {conf, init_all, cases(), finish_all}}. - -cases() -> - [ - nat_ip_address, - nat_ip_address_multiple, - nat_ip_address_local, - nat_iiop_port, - nat_iiop_port_local, - nat_ip_address_local_local, - nat_iiop_port_local_local, - nat_iiop_ssl_port, - nat_iiop_ssl_port_local - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + cases(). + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +cases() -> + [nat_ip_address, nat_ip_address_multiple, + nat_ip_address_local, nat_iiop_port, + nat_iiop_port_local, nat_ip_address_local_local, + nat_iiop_port_local_local, nat_iiop_ssl_port, + nat_iiop_ssl_port_local]. %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- - +init_per_testcase(TC, Config) + when TC =:= nat_iiop_ssl_port; + TC =:= nat_iiop_ssl_port_local -> + case orber_test_lib:ssl_version() of + no_ssl -> + {skip,"SSL not installed!"}; + _ -> + init_per_testcase(dummy_tc, Config) + end; init_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), @@ -104,7 +113,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> oe_orber_test_server:oe_unregister(), orber:jump_stop(), Path = code:which(?MODULE), @@ -113,7 +122,7 @@ fin_per_testcase(_Case, Config) -> test_server:timetrap_cancel(Dog), ok. -init_all(Config) -> +init_per_suite(Config) -> if is_list(Config) -> Config; @@ -121,7 +130,7 @@ init_all(Config) -> exit("Config not a list") end. -finish_all(Config) -> +end_per_suite(Config) -> Config. %%----------------------------------------------------------------- @@ -266,107 +275,99 @@ nat_iiop_ssl_port(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", "Make sure NAT works for SSL"]; nat_iiop_ssl_port(suite) -> []; nat_iiop_ssl_port(_Config) -> - case os:type() of - vxworks -> - {skipped, "No SSL-support for VxWorks."}; - _ -> - IP = orber_test_lib:get_host(), - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, - 1, [{iiop_ssl_port, 0}, - {flags, ?ORB_ENV_ENABLE_NAT}, - {ip_address, IP}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, - 1, [{iiop_ssl_port, 0}]), - {ok, ServerNode, _ServerHost} = - ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)), - ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), - NATSSLServerPort = SSLServerPort+1, - {ok, Ref} = ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, - [IP, ssl, NATSSLServerPort])), - orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, - [nat_iiop_ssl_port, - {local, NATSSLServerPort, [{4001, 43}]}]), - - {ok, ClientNode, _ClientHost} = - ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, - [ssl])), - - IOR1 = ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, - string_to_object, - ["corbaname::1.2@"++IP++":"++ - integer_to_list(ServerPort)++"/NameService#mamba"])), - - ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, - iop_ior:get_key(IOR1)), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - uninstall_test_data, - [ssl])), - ?match(ok, - orber_test_lib:remote_apply(ServerNode, orber, - remove_listen_interface, [Ref])), - ok - end. + + IP = orber_test_lib:get_host(), + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + 1, [{iiop_ssl_port, 0}, + {flags, ?ORB_ENV_ENABLE_NAT}, + {ip_address, IP}]), + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + 1, [{iiop_ssl_port, 0}]), + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)), + ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), + SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), + NATSSLServerPort = SSLServerPort+1, + {ok, Ref} = ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, + [IP, ssl, NATSSLServerPort])), + orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, + [nat_iiop_ssl_port, + {local, NATSSLServerPort, [{4001, 43}]}]), + + {ok, ClientNode, _ClientHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, + [ssl])), + + IOR1 = ?match(#'IOP_IOR'{}, + orber_test_lib:remote_apply(ClientNode, corba, + string_to_object, + ["corbaname::1.2@"++IP++":"++ + integer_to_list(ServerPort)++"/NameService#mamba"])), + + ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, + #host_data{protocol = ssl, + ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, + iop_ior:get_key(IOR1)), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, + [ssl])), + ?match(ok, + orber_test_lib:remote_apply(ServerNode, orber, + remove_listen_interface, [Ref])), + ok. nat_iiop_ssl_port_local(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", "Make sure NAT works for SSL"]; nat_iiop_ssl_port_local(suite) -> []; nat_iiop_ssl_port_local(_Config) -> - case os:type() of - vxworks -> - {skipped, "No SSL-support for VxWorks."}; - _ -> - IP = orber_test_lib:get_host(), - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, - 1, [{iiop_ssl_port, 0}, - {flags, - (?ORB_ENV_LOCAL_INTERFACE bor - ?ORB_ENV_ENABLE_NAT)}, - {ip_address, IP}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, - 1, [{iiop_ssl_port, 0}]), - {ok, ServerNode, _ServerHost} = - ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)), - ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), - NATSSLServerPort = SSLServerPort+1, - {ok, Ref} = ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, - [IP, ssl, NATSSLServerPort])), - orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, - [nat_iiop_ssl_port, - {local, NATSSLServerPort, [{NATSSLServerPort, NATSSLServerPort}]}]), - - {ok, ClientNode, _ClientHost} = - ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, - [ssl])), - - IOR1 = ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, - string_to_object, - ["corbaname::1.2@"++IP++":"++ - integer_to_list(ServerPort)++"/NameService#mamba"])), - - ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, - iop_ior:get_key(IOR1)), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - uninstall_test_data, - [ssl])), - ?match(ok, - orber_test_lib:remote_apply(ServerNode, orber, - remove_listen_interface, [Ref])), - ok - end. + + IP = orber_test_lib:get_host(), + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + 1, [{iiop_ssl_port, 0}, + {flags, + (?ORB_ENV_LOCAL_INTERFACE bor + ?ORB_ENV_ENABLE_NAT)}, + {ip_address, IP}]), + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + 1, [{iiop_ssl_port, 0}]), + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)), + ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), + SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), + NATSSLServerPort = SSLServerPort+1, + {ok, Ref} = ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, + [IP, ssl, NATSSLServerPort])), + orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, + [nat_iiop_ssl_port, + {local, NATSSLServerPort, [{NATSSLServerPort, NATSSLServerPort}]}]), + + {ok, ClientNode, _ClientHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, + [ssl])), + + IOR1 = ?match(#'IOP_IOR'{}, + orber_test_lib:remote_apply(ClientNode, corba, + string_to_object, + ["corbaname::1.2@"++IP++":"++ + integer_to_list(ServerPort)++"/NameService#mamba"])), + + ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, + #host_data{protocol = ssl, + ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, + iop_ior:get_key(IOR1)), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, + [ssl])), + ?match(ok, + orber_test_lib:remote_apply(ServerNode, orber, + remove_listen_interface, [Ref])), + ok. diff --git a/lib/orber/test/orber_test_lib.erl b/lib/orber/test/orber_test_lib.erl index a694dc58c4..5053a5fddc 100644 --- a/lib/orber/test/orber_test_lib.erl +++ b/lib/orber/test/orber_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -95,16 +95,21 @@ %% %%------------------------------------------------------------ ssl_version() -> - case catch erlang:system_info(otp_release) of - Version when is_list(Version) -> - if - "R12B" < Version -> - 3; - true -> - 2 - end; - _ -> - 2 + try + ssl:module_info(), + case catch erlang:system_info(otp_release) of + Version when is_list(Version) -> + if + "R12B" < Version -> + 3; + true -> + 2 + end; + _ -> + 2 + end + catch error:undef -> + no_ssl end. %%------------------------------------------------------------ @@ -126,13 +131,22 @@ version_ok() -> _ -> case gen_tcp:listen(0, [{reuseaddr, true}, inet6]) of {ok, LSock} -> - gen_tcp:close(LSock), - true; + {ok, Port} = inet:port(LSock), + case gen_tcp:connect(Hostname, Port, [inet6]) of + {error, _} -> + gen_tcp:close(LSock), + {skipped, "Inet cannot handle IPv6"}; + {ok, Socket} -> + gen_tcp:close(Socket), + gen_tcp:close(LSock), + true + end; {error, _} -> {skipped, "Inet cannot handle IPv6"} end end end. + %%------------------------------------------------------------ %% function : get_host %% Arguments: Family - inet | inet6 @@ -1280,6 +1294,22 @@ test_coding(Obj, Local) -> ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server: testing_iiop_server_marshal(Obj, "string")), + + RecS = #orber_test_server_rec_struct{chain = [#orber_test_server_rec_struct{chain = []}]}, + ?match(RecS, orber_test_server:testing_iiop_rec_struct(Obj, RecS)), + + RecU = #orber_test_server_rec_union{label = 'RecursiveType', + value = [#orber_test_server_rec_union{label = 'RecursiveType', + value = []}]}, + ?match(RecU, orber_test_server:testing_iiop_rec_union(Obj, RecU)), + +%% RecA1 = #any{typecode = unsupported, value = RecS}, +%% RecA2 = #any{typecode = unsupported, value = RecU}, +%% ?match(RecA1, +%% orber_test_server:testing_iiop_rec_any(Obj, RecA1)), +%% ?match(RecA2, +%% orber_test_server:testing_iiop_rec_any(Obj, RecA2)), + ok. %%--------------- Testing Post- & Pre-cond ------------------- diff --git a/lib/orber/test/orber_test_server.idl b/lib/orber/test/orber_test_server.idl index a88211c941..438c10e19b 100644 --- a/lib/orber/test/orber_test_server.idl +++ b/lib/orber/test/orber_test_server.idl @@ -28,7 +28,7 @@ module orber_parent { }; module orber_test { - + // interface server interface server : orber_parent::inherrit { typedef string array[2]; @@ -89,6 +89,23 @@ module orber_test { const fixed52 fixed52negconst2 = -123.00d; const fixed52 fixed52negconst3 = -023.00d; + struct rec_struct; // Forward declaration + typedef sequence<rec_struct> rec_struct_seq; + struct rec_struct { + rec_struct_seq chain; + }; + + + union rec_union; // Forward declaration + typedef sequence<rec_union>rec_union_seq; + + enum MyEnum {RecursiveType, NameType}; + + union rec_union switch (MyEnum) { + case RecursiveType : rec_union_seq chain; + case NameType : string aName; + }; + void stop_normal(); void stop_brutal(); @@ -123,6 +140,12 @@ module orber_test { void testing_iiop_context(); void testing_iiop_server_marshal(inout StrLength6 Str); + // Recursive types + any testing_iiop_rec_any(in any RecType); + rec_struct testing_iiop_rec_struct(in rec_struct RecS); + rec_union testing_iiop_rec_union(in rec_union RecU); + + oneway void testing_iiop_oneway_delay(in long Time); void testing_iiop_twoway_delay(in long Time); diff --git a/lib/orber/test/orber_test_server_impl.erl b/lib/orber/test/orber_test_server_impl.erl index 35296cb619..10a9caf242 100644 --- a/lib/orber/test/orber_test_server_impl.erl +++ b/lib/orber/test/orber_test_server_impl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -55,6 +55,9 @@ testing_iiop_void/2, testing_iiop_context/2, testing_iiop_server_marshal/3, + testing_iiop_rec_any/3, + testing_iiop_rec_struct/3, + testing_iiop_rec_union/3, relay_call/3, relay_cast/3, %% Testing pseudo calls. @@ -197,6 +200,16 @@ testing_iiop_context(_Self, State) -> testing_iiop_server_marshal(_Self, State, _String) -> {reply, {ok, false}, State}. +testing_iiop_rec_any(_Self, State, RAny) -> + {reply, RAny, State}. + +testing_iiop_rec_struct(_Self, State, RecS) -> + {reply, RecS, State}. + +testing_iiop_rec_union(_Self, State, RecU) -> + {reply, RecU, State}. + + testing_iiop_oneway_delay(_Self, State, Time) -> timer:sleep(Time), {noreply, State}. diff --git a/lib/orber/test/orber_test_timeout_server_impl.erl b/lib/orber/test/orber_test_timeout_server_impl.erl index 138eb51d92..67ea897fdd 100644 --- a/lib/orber/test/orber_test_timeout_server_impl.erl +++ b/lib/orber/test/orber_test_timeout_server_impl.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 diff --git a/lib/orber/test/orber_web_SUITE.erl b/lib/orber/test/orber_web_SUITE.erl index ffa7468853..ed5c0cbfa0 100644 --- a/lib/orber/test/orber_web_SUITE.erl +++ b/lib/orber/test/orber_web_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ -module(orber_web_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/include/corba.hrl"). -include_lib("orber/src/orber_iiop.hrl"). @@ -65,12 +65,12 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -78,10 +78,28 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["This suite is for testing the Orber Web API"]; -all(suite) -> - [menu, configure, info, nameservice, ifr_select, ifr_data, - create, delete_ctx, add_ctx, delete_obj, server]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [menu, configure, info, nameservice, ifr_select, + ifr_data, create, delete_ctx, add_ctx, delete_obj, + server]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%----------------------------------------------------------------- %% Init and cleanup functions. @@ -95,7 +113,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> oe_orber_test_server:oe_unregister(), orber:jump_stop(), Path = code:which(?MODULE), diff --git a/lib/orber/test/tc_SUITE.erl b/lib/orber/test/tc_SUITE.erl index 807a663219..9e6ee4eb90 100644 --- a/lib/orber/test/tc_SUITE.erl +++ b/lib/orber/test/tc_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ %%----------------------------------------------------------------- -module(tc_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("orber/src/orber_iiop.hrl"). -define(default_timeout, ?t:minutes(3)). @@ -128,12 +128,12 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%----------------------------------------------------------------- %% Internal exports %%----------------------------------------------------------------- --export([]). -compile(export_all). %%----------------------------------------------------------------- @@ -141,19 +141,32 @@ %% Args: %% Returns: %%----------------------------------------------------------------- -all(doc) -> ["Description", "more description"]; -all(suite) -> - [null, void, - short, ushort, - long, ulong, - longlong, ulonglong, - boolean, char, wchar, octet, - float, double, longdouble, - any, typecode, principal, object_reference, - struct, union, enum, string, wstring, sequence, array, - alias, exception, fixed, value, value_box, native, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [null, void, short, ushort, long, ulong, longlong, + ulonglong, boolean, char, wchar, octet, float, double, + longdouble, any, typecode, principal, object_reference, + struct, union, enum, string, wstring, sequence, array, + alias, exception, fixed, value, value_box, native, abstract_interface, indirection, get_tc]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- @@ -163,7 +176,7 @@ init_per_testcase(_Case, Config) -> [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/orber/vsn.mk b/lib/orber/vsn.mk index 584a52ab84..b0c5a253a2 100644 --- a/lib/orber/vsn.mk +++ b/lib/orber/vsn.mk @@ -1 +1 @@ -ORBER_VSN = 3.6.18 +ORBER_VSN = 3.6.19 diff --git a/lib/os_mon/test/Makefile b/lib/os_mon/test/Makefile index c87285e38b..f14a791806 100644 --- a/lib/os_mon/test/Makefile +++ b/lib/os_mon/test/Makefile @@ -85,7 +85,7 @@ release_spec: release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) os_mon.spec $(EMAKEFILE) $(SOURCE) $(RELSYSDIR) + $(INSTALL_DATA) os_mon.spec os_mon.cover $(EMAKEFILE) $(SOURCE) $(RELSYSDIR) ## tar chf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/os_mon/test/cpu_sup_SUITE.erl b/lib/os_mon/test/cpu_sup_SUITE.erl index 45f9d981d1..174317527c 100644 --- a/lib/os_mon/test/cpu_sup_SUITE.erl +++ b/lib/os_mon/test/cpu_sup_SUITE.erl @@ -17,10 +17,10 @@ %% %CopyrightEnd% %% -module(cpu_sup_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -41,29 +41,43 @@ end_per_suite(Config) when is_list(Config) -> ?line ok = application:stop(os_mon), Config. +init_per_testcase(unavailable, Config) -> + terminate(Config), + init_per_testcase(dummy, Config); init_per_testcase(_Case, Config) -> Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. +end_per_testcase(unavailable, Config) -> + restart(Config), + end_per_testcase(dummy, Config); end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -all(suite) -> - case ?t:os_type() of +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + case test_server:os_type() of {unix, sunos} -> - [load_api, util_api, util_values, port, - {conf, terminate, [unavailable], restart}]; + [load_api, util_api, util_values, port, unavailable]; {unix, linux} -> - [load_api, util_api, util_values, port, - {conf, terminate, [unavailable], restart}]; - {unix, _OSname} -> - [load_api]; - _OS -> - [unavailable] + [load_api, util_api, util_values, port, unavailable]; + {unix, _OSname} -> [load_api]; + _OS -> [unavailable] end. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + load_api(suite) -> []; load_api(doc) -> diff --git a/lib/os_mon/test/disksup_SUITE.erl b/lib/os_mon/test/disksup_SUITE.erl index 987d631c36..6e015ef74a 100644 --- a/lib/os_mon/test/disksup_SUITE.erl +++ b/lib/os_mon/test/disksup_SUITE.erl @@ -17,10 +17,10 @@ %% %CopyrightEnd% %% -module(disksup_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -50,20 +50,28 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), ok. -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> Bugs = [otp_5910], - case ?t:os_type() of + case test_server:os_type() of {unix, sunos} -> - [api, config, alarm, port, - {conf, terminate, [unavailable], restart}] ++ Bugs; - {unix, _OSname} -> - [api, alarm] ++ Bugs; - {win32, _OSname} -> - [api, alarm] ++ Bugs; - _OS -> - [unavailable] + [api, config, alarm, port, unavailable] ++ Bugs; + {unix, _OSname} -> [api, alarm] ++ Bugs; + {win32, _OSname} -> [api, alarm] ++ Bugs; + _OS -> [unavailable] end. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + api(suite) -> []; api(doc) -> diff --git a/lib/os_mon/test/memsup_SUITE.erl b/lib/os_mon/test/memsup_SUITE.erl index 01a7f6c7f2..afc14d1c83 100644 --- a/lib/os_mon/test/memsup_SUITE.erl +++ b/lib/os_mon/test/memsup_SUITE.erl @@ -17,10 +17,10 @@ %% %CopyrightEnd% %% -module(memsup_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -49,19 +49,30 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), Config. -all(suite) -> - All = case ?t:os_type() of +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + All = case test_server:os_type() of {unix, sunos} -> - [api, alarm1, alarm2, process, - config, timeout, unavailable, port]; + [api, alarm1, alarm2, process, config, timeout, + unavailable, port]; {unix, linux} -> [api, alarm1, alarm2, process, timeout]; - _OS -> - [api, alarm1, alarm2, process] + _OS -> [api, alarm1, alarm2, process] end, Bugs = [otp_5910], All ++ Bugs. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + api(suite) -> []; api(doc) -> diff --git a/lib/os_mon/test/os_mon.cover b/lib/os_mon/test/os_mon.cover new file mode 100644 index 0000000000..aa07391351 --- /dev/null +++ b/lib/os_mon/test/os_mon.cover @@ -0,0 +1,2 @@ +{incl_app,os_mon,details}. + diff --git a/lib/os_mon/test/os_mon.spec b/lib/os_mon/test/os_mon.spec index bdae523795..d292b258f3 100644 --- a/lib/os_mon/test/os_mon.spec +++ b/lib/os_mon/test/os_mon.spec @@ -1 +1 @@ -{topcase, {dir, "../os_mon_test"}}. +{suites,"../os_mon_test",all}. diff --git a/lib/os_mon/test/os_mon_SUITE.erl b/lib/os_mon/test/os_mon_SUITE.erl index ce52271ff8..dd0ab0fbba 100644 --- a/lib/os_mon/test/os_mon_SUITE.erl +++ b/lib/os_mon/test/os_mon_SUITE.erl @@ -17,11 +17,12 @@ %% %CopyrightEnd% %% -module(os_mon_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). %% Test cases -export([app_file/1, config/1]). @@ -33,17 +34,35 @@ init_per_testcase(_Case, Config) -> Dog = test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - case ?t:os_type() of +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + case test_server:os_type() of {unix, sunos} -> [app_file, config]; _OS -> [app_file] end. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + app_file(suite) -> []; app_file(doc) -> diff --git a/lib/os_mon/test/os_mon_mib_SUITE.erl b/lib/os_mon/test/os_mon_mib_SUITE.erl index a1d463030a..01feb3a57c 100644 --- a/lib/os_mon/test/os_mon_mib_SUITE.erl +++ b/lib/os_mon/test/os_mon_mib_SUITE.erl @@ -24,13 +24,14 @@ -define(line,erlang:display({line,?LINE}),). -define(config(A,B), config(A,B)). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("os_mon/include/OTP-OS-MON-MIB.hrl"). -include_lib("snmp/include/snmp_types.hrl"). -endif. % Test server specific exports --export([all/1, init_per_suite/1, end_per_suite/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2]). @@ -38,8 +39,8 @@ -export([update_load_table/1]). -export([get_mem_sys_mark/1, get_mem_proc_mark/1, get_disk_threshold/1, - get_load_table/1, get_next_load_table/1, get_disk_table/1, - get_next_disk_table/1, real_snmp_request/1, load_unload/1]). + get_load_table/1, get_disk_table/1, + real_snmp_request/1, load_unload/1]). -export([sys_tot_mem/1, sys_used_mem/1, large_erl_process/1, large_erl_process_mem/1, cpu_load/1, cpu_load5/1, cpu_load15/1, @@ -47,7 +48,7 @@ large_erl_process_mem64/1, disk_descr/1, disk_kbytes/1, disk_capacity/1]). --export([tickets/1]). +-export([]). -export([otp_6351/1, otp_7441/1]). -define(TRAP_UDP, 5000). @@ -77,17 +78,32 @@ end_per_testcase(_Case, Config) when is_list(Config) -> test_server:timetrap_cancel(Dog), Config. -all(doc) -> - ["Test os_mon mibs and provided instrumentation functions."]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> +all() -> [load_unload, get_mem_sys_mark, get_mem_proc_mark, - get_disk_threshold, get_load_table, get_next_load_table, - get_disk_table, get_next_disk_table, real_snmp_request, - update_load_table, tickets]. + get_disk_threshold, get_load_table, + {group, get_next_load_table}, get_disk_table, + {group, get_next_disk_table}, real_snmp_request, + update_load_table, {group, tickets}]. + +groups() -> + [{tickets, [], [otp_6351, otp_7441]}, + {get_next_load_table, [], + [sys_tot_mem, sys_used_mem, large_erl_process, + large_erl_process_mem, cpu_load, cpu_load5, cpu_load15, + os_wordsize, sys_tot_mem64, sys_used_mem64, + large_erl_process_mem64]}, + {get_next_disk_table, [], + [disk_descr, disk_kbytes, disk_capacity]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -tickets(suite) -> - [otp_6351, otp_7441]. -endif. %%--------------------------------------------------------------------- @@ -338,21 +354,6 @@ get_load_table(Config) when is_list(Config) -> ok. %%--------------------------------------------------------------------- -get_next_load_table(doc) -> - ["Simulates get_next calls to test the instrumentation function " - "for the loadTable"]; -get_next_load_table(suite) -> - [ sys_tot_mem, - sys_used_mem, - large_erl_process, - large_erl_process_mem, - cpu_load, - cpu_load5, - cpu_load15, - os_wordsize, - sys_tot_mem64, - sys_used_mem64, - large_erl_process_mem64]. sys_tot_mem(doc) -> []; @@ -592,11 +593,6 @@ get_disk_table(Config) when is_list(Config) -> ok. %%--------------------------------------------------------------------- -get_next_disk_table(doc) -> - ["Simulates get_next calls to test the instrumentation function " - "for the diskTable."]; -get_next_disk_table(suite) -> - [disk_descr, disk_kbytes, disk_capacity]. disk_descr(doc) -> []; diff --git a/lib/os_mon/test/os_sup_SUITE.erl b/lib/os_mon/test/os_sup_SUITE.erl index 25041f968d..873db06317 100644 --- a/lib/os_mon/test/os_sup_SUITE.erl +++ b/lib/os_mon/test/os_sup_SUITE.erl @@ -17,10 +17,10 @@ %% %CopyrightEnd% %% -module(os_sup_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -63,17 +63,28 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), ok. -all(suite) -> - case ?t:os_type() of - {unix, sunos} -> - [message, config, port]; - {win32, _OSname} -> - [message]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + case test_server:os_type() of + {unix, sunos} -> [message, config, port]; + {win32, _OSname} -> [message]; OS -> - Str = io_lib:format("os_sup not available for ~p", [OS]), + Str = io_lib:format("os_sup not available for ~p", + [OS]), {skip, lists:flatten(Str)} end. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + message(suite) -> []; message(doc) -> diff --git a/lib/parsetools/doc/src/notes.xml b/lib/parsetools/doc/src/notes.xml index 544850308e..77b3a1a657 100644 --- a/lib/parsetools/doc/src/notes.xml +++ b/lib/parsetools/doc/src/notes.xml @@ -30,6 +30,21 @@ </header> <p>This document describes the changes made to the Parsetools application.</p> +<section><title>Parsetools 2.0.5</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> The formating of Yecc's error messages has been + improved. (Thanks to Joe Armstrong.) </p> + <p> + Own Id: OTP-8919</p> + </item> + </list> + </section> + +</section> + <section><title>Parsetools 2.0.4</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/parsetools/test/Makefile b/lib/parsetools/test/Makefile index 19354b87b2..2d9d0a71e5 100644 --- a/lib/parsetools/test/Makefile +++ b/lib/parsetools/test/Makefile @@ -71,7 +71,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) parsetools.spec $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) parsetools.spec parsetools.cover $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) # @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/parsetools/test/leex_SUITE.erl b/lib/parsetools/test/leex_SUITE.erl index 069f780b5e..066d221ae7 100644 --- a/lib/parsetools/test/leex_SUITE.erl +++ b/lib/parsetools/test/leex_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 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 @@ -30,17 +30,19 @@ -define(privdir, "leex_SUITE_priv"). -define(t, test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(datadir, ?config(data_dir, Config)). -define(privdir, ?config(priv_dir, Config)). -endif. --export([all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). --export([checks/1, - file/1, compile/1, syntax/1, - examples/1, - pt/1, man/1, ex/1, ex2/1, not_yet/1]). +-export([ + file/1, compile/1, syntax/1, + + pt/1, man/1, ex/1, ex2/1, not_yet/1]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -49,15 +51,33 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> [checks, examples]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, checks}, {group, examples}]. + +groups() -> + [{checks, [], [file, compile, syntax]}, + {examples, [], [pt, man, ex, ex2, not_yet]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -checks(suite) -> - [file, compile, syntax]. file(doc) -> "Bad files and options."; @@ -330,8 +350,6 @@ syntax(Config) when is_list(Config) -> leex:file(Filename, Ret), ok. -examples(suite) -> - [pt,man,ex,ex2,not_yet]. pt(doc) -> "Pushing back characters."; diff --git a/lib/parsetools/test/parsetools.cover b/lib/parsetools/test/parsetools.cover new file mode 100644 index 0000000000..13f84e3ba6 --- /dev/null +++ b/lib/parsetools/test/parsetools.cover @@ -0,0 +1,2 @@ +{incl_app,parsetools,details}. + diff --git a/lib/parsetools/test/parsetools.spec b/lib/parsetools/test/parsetools.spec index 5b34633378..870d57baf1 100644 --- a/lib/parsetools/test/parsetools.spec +++ b/lib/parsetools/test/parsetools.spec @@ -1 +1 @@ -{topcase, {dir, "../parsetools_test"}}. +{suites,"../parsetools_test",all}. diff --git a/lib/parsetools/test/yecc_SUITE.erl b/lib/parsetools/test/yecc_SUITE.erl index 8153be7e61..8e27ddb13d 100644 --- a/lib/parsetools/test/yecc_SUITE.erl +++ b/lib/parsetools/test/yecc_SUITE.erl @@ -29,24 +29,26 @@ -define(privdir, "yecc_SUITE_priv"). -define(t, test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(datadir, ?config(data_dir, Config)). -define(privdir, ?config(priv_dir, Config)). -endif. --export([all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). -export([app_test/1, - checks/1, - file/1, syntax/1, compile/1, rules/1, expect/1, - conflicts/1, - examples/1, - empty/1, prec/1, yeccpre/1, lalr/1, old_yecc/1, - other_examples/1, - bugs/1, - otp_5369/1, otp_6362/1, otp_7945/1, otp_8483/1, otp_8486/1, - improvements/1, - otp_7292/1, otp_7969/1, otp_8919/1]). + + file/1, syntax/1, compile/1, rules/1, expect/1, + conflicts/1, + + empty/1, prec/1, yeccpre/1, lalr/1, old_yecc/1, + other_examples/1, + + otp_5369/1, otp_6362/1, otp_7945/1, otp_8483/1, otp_8486/1, + + otp_7292/1, otp_7969/1, otp_8919/1]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -55,12 +57,38 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> [app_test, checks, examples, bugs, improvements]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [app_test, {group, checks}, {group, examples}, + {group, bugs}, {group, improvements}]. + +groups() -> + [{checks, [], + [file, syntax, compile, rules, expect, conflicts]}, + {examples, [], + [empty, prec, yeccpre, lalr, old_yecc, other_examples]}, + {bugs, [], + [otp_5369, otp_6362, otp_7945, otp_8483, otp_8486]}, + {improvements, [], [otp_7292, otp_7969, otp_8919]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + app_test(doc) -> ["Tests the applications consistency."]; @@ -70,8 +98,6 @@ app_test(Config) when is_list(Config) -> ?line ok=?t:app_test(parsetools), ok. -checks(suite) -> - [file, syntax, compile, rules, expect, conflicts]. file(doc) -> "Bad files and options."; @@ -730,8 +756,6 @@ rules(Config) when is_list(Config) -> ?line run(Config, Ts), ok. -examples(suite) -> - [empty, prec, yeccpre, lalr, old_yecc, other_examples]. expect(doc) -> "Check of expect."; @@ -1283,8 +1307,6 @@ other_examples(Config) when is_list(Config) -> ?line run(Config, Ts), ok. -bugs(suite) -> - [otp_5369, otp_6362, otp_7945, otp_8483, otp_8486]. otp_5369(doc) -> "OTP-5369. A bug in parse_and_scan reported on erlang questions."; @@ -1540,9 +1562,6 @@ otp_8486(Config) when is_list(Config) -> ?line run(Config, Ts), ok. -improvements(suite) -> - [otp_7292, otp_7969, otp_8919]. - otp_7292(doc) -> "OTP-7292. Header declarations for edoc."; otp_7292(suite) -> []; diff --git a/lib/parsetools/vsn.mk b/lib/parsetools/vsn.mk index 46915baed6..812bf21f03 100644 --- a/lib/parsetools/vsn.mk +++ b/lib/parsetools/vsn.mk @@ -1 +1 @@ -PARSETOOLS_VSN = 2.0.4 +PARSETOOLS_VSN = 2.0.5 diff --git a/lib/percept/src/percept.erl b/lib/percept/src/percept.erl index f5e0f7e469..3a2d9f7601 100644 --- a/lib/percept/src/percept.erl +++ b/lib/percept/src/percept.erl @@ -185,10 +185,27 @@ stop_webserver() -> undefined -> {error, not_started}; Pid -> - Pid ! {self(), get_port}, - receive Port -> ok end, - Pid ! quit, - stop_webserver(Port) + do_stop([], Pid) + end. + +do_stop([], Pid)-> + Pid ! {self(), get_port}, + Port = receive P -> P end, + do_stop(Port, Pid); +do_stop(Port, [])-> + case whereis(percept_httpd) of + undefined -> + {error, not_started}; + Pid -> + do_stop(Port, Pid) + end; +do_stop(Port, Pid)-> + case find_service_pid_from_port(inets:services_info(), Port) of + undefined -> + {error, not_started}; + Pid2 -> + Pid ! quit, + inets:stop(httpd, Pid2) end. %% @spec stop_webserver(integer()) -> ok | {error, not_started} @@ -196,12 +213,7 @@ stop_webserver() -> %% @hidden stop_webserver(Port) -> - case find_service_pid_from_port(inets:services_info(), Port) of - undefined -> - {error, not_started}; - Pid -> - inets:stop(httpd, Pid) - end. + do_stop(Port,[]). %%========================================================================== %% diff --git a/lib/percept/src/percept_db.erl b/lib/percept/src/percept_db.erl index edb0d79a29..52e9afb78f 100644 --- a/lib/percept/src/percept_db.erl +++ b/lib/percept/src/percept_db.erl @@ -33,7 +33,7 @@ ]). -include("percept.hrl"). - +-define(STOP_TIMEOUT, 1000). %%========================================================================== %% %% Type definitions @@ -77,17 +77,32 @@ start() -> case erlang:whereis(percept_db) of undefined -> - Pid = spawn( fun() -> init_percept_db() end), - erlang:register(percept_db, Pid), - {started, Pid}; + {started, do_start()}; PerceptDB -> - erlang:unregister(percept_db), - PerceptDB ! {action, stop}, - Pid = spawn( fun() -> init_percept_db() end), - erlang:register(percept_db, Pid), - {restarted, Pid} + {restarted, restart(PerceptDB)} end. +%% @spec restart(pid()) -> pid() +%% @private +%% @doc restarts the percept database. + +-spec restart(pid())-> pid(). + +restart(PerceptDB)-> + stop_sync(PerceptDB), + do_start(). + +%% @spec do_start(pid()) -> pid() +%% @private +%% @doc starts the percept database. + +-spec do_start()-> pid(). + +do_start()-> + Pid = spawn( fun() -> init_percept_db() end), + erlang:register(percept_db, Pid), + Pid. + %% @spec stop() -> not_started | {stopped, Pid} %% Pid = pid() %% @doc Stops the percept database. @@ -103,6 +118,22 @@ stop() -> {stopped, Pid} end. +%% @spec stop_sync(pid()) -> true +%% @private +%% @doc Stops the percept database, with a synchronous call. + +-spec stop_sync(pid())-> true. + +stop_sync(Pid)-> + MonitorRef = erlang:monitor(process, Pid), + stop(), + receive + {'DOWN', MonitorRef, _Type, Pid, _Info}-> + true + after ?STOP_TIMEOUT-> + exit(Pid, kill) + end. + %% @spec insert(tuple()) -> ok %% @doc Inserts a trace or profile message to the database. diff --git a/lib/percept/test/Makefile b/lib/percept/test/Makefile index 0984b02c81..0420ce40f2 100644 --- a/lib/percept/test/Makefile +++ b/lib/percept/test/Makefile @@ -82,7 +82,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) percept.spec $(EMAKEFILE) $(SOURCE) $(RELSYSDIR) + $(INSTALL_DATA) percept.spec percept.cover $(EMAKEFILE) $(SOURCE) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/percept/test/egd_SUITE.erl b/lib/percept/test/egd_SUITE.erl index fde02b47d5..39d87efcf8 100644 --- a/lib/percept/test/egd_SUITE.erl +++ b/lib/percept/test/egd_SUITE.erl @@ -18,10 +18,10 @@ %% -module(egd_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -54,16 +54,22 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), ok. -all(suite) -> - % Test cases - [ - image_create_and_destroy, - image_shape, - image_primitives, - image_colors, - image_font, - image_png_compliant - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [image_create_and_destroy, image_shape, + image_primitives, image_colors, image_font, + image_png_compliant]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%---------------------------------------------------------------------- %% Tests diff --git a/lib/percept/test/percept.cover b/lib/percept/test/percept.cover new file mode 100644 index 0000000000..8a5ad0a55e --- /dev/null +++ b/lib/percept/test/percept.cover @@ -0,0 +1,2 @@ +{incl_app,percept,details}. + diff --git a/lib/percept/test/percept.spec b/lib/percept/test/percept.spec index 75aacc1fd6..f3ef76bd60 100644 --- a/lib/percept/test/percept.spec +++ b/lib/percept/test/percept.spec @@ -1,2 +1 @@ -{topcase, {dir, "../percept_test"}}. - +{suites,"../percept_test",all}. diff --git a/lib/percept/test/percept_SUITE.erl b/lib/percept/test/percept_SUITE.erl index ff7cccdaa8..411fcd78f3 100644 --- a/lib/percept/test/percept_SUITE.erl +++ b/lib/percept/test/percept_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -18,10 +18,10 @@ %% -module(percept_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -51,12 +51,20 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), ok. -all(suite) -> - % Test cases - [ webserver, - profile, - analyze, - analyze_dist]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [webserver, profile, analyze, analyze_dist]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%---------------------------------------------------------------------- %% Tests @@ -70,6 +78,10 @@ webserver(Config) when is_list(Config) -> % Explicit start inets? ?line {started, _, Port} = percept:start_webserver(), ?line ok = percept:stop_webserver(Port), + ?line {started, _, _} = percept:start_webserver(), + ?line ok = percept:stop_webserver(), + ?line {started, _, NewPort} = percept:start_webserver(), + ?line ok = percept:stop_webserver(NewPort), ?line application:stop(inets), ok. diff --git a/lib/percept/test/percept_db_SUITE.erl b/lib/percept/test/percept_db_SUITE.erl new file mode 100644 index 0000000000..79be9714ba --- /dev/null +++ b/lib/percept/test/percept_db_SUITE.erl @@ -0,0 +1,76 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2007-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(percept_db_SUITE). +-include("test_server.hrl"). + +%% Test server specific exports +-export([all/1]). +-export([init_per_suite/1, end_per_suite/1]). +-export([init_per_testcase/2, end_per_testcase/2]). + +%% Test cases +-export([ + start/1 + ]). + +%% Default timetrap timeout (set in init_per_testcase) +-define(default_timeout, ?t:minutes(2)). +-define(restarts, 10). +-define(alive_timeout, 500). + +init_per_suite(Config) when is_list(Config) -> + Config. + +end_per_suite(Config) when is_list(Config) -> + Config. + +init_per_testcase(_Case, Config) -> + Dog = ?t:timetrap(?default_timeout), + [{max_size, 300}, {watchdog,Dog} | Config]. + +end_per_testcase(_Case, Config) -> + Dog = ?config(watchdog, Config), + ?t:timetrap_cancel(Dog), + ok. + +all(suite) -> + % Test cases + [start]. + +%%---------------------------------------------------------------------- +%% Tests +%%---------------------------------------------------------------------- + +start(suite) -> + []; +start(doc) -> + ["Percept_db start and restart test."]; +start(Config) when is_list(Config) -> + ok = restart(?restarts), + {stopped, _DB} = percept_db:stop(), + ok. + +restart(0)-> + ok; +restart(N)-> + {_, DB} = percept_db:start(), + timer:sleep(?alive_timeout), + true = erlang:is_process_alive(DB), + restart(N-1). diff --git a/lib/public_key/doc/src/notes.xml b/lib/public_key/doc/src/notes.xml index 6e7381eb18..befbd3e586 100644 --- a/lib/public_key/doc/src/notes.xml +++ b/lib/public_key/doc/src/notes.xml @@ -34,6 +34,21 @@ <file>notes.xml</file> </header> +<section><title>Public_Key 0.10</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Improved dialyzer specs.</p> + <p> + Own Id: OTP-8964</p> + </item> + </list> + </section> + +</section> + <section><title>Public_Key 0.9</title> <section><title>Improvements and New Features</title> diff --git a/lib/public_key/doc/src/public_key.xml b/lib/public_key/doc/src/public_key.xml index c72719fac4..91e058f74e 100644 --- a/lib/public_key/doc/src/public_key.xml +++ b/lib/public_key/doc/src/public_key.xml @@ -64,8 +64,8 @@ <p><c>decrypt_der() = binary() </c></p> - <p><c>pki_asn1_type() = 'Certificate' | 'RSAPrivateKey'| - 'DSAPrivateKey' | 'DHParameter'</c></p> + <p><c>pki_asn1_type() = 'Certificate' | 'RSAPrivateKey'| 'RSAPublicKey' + 'DSAPrivateKey' | 'DSAPublicKey' | 'DHParameter' | 'SubjectPublicKeyInfo'</c></p> <p><c>pem_entry () = {pki_asn1_type(), der_encoded() | decrypt_der(), not_encrypted | {"DES-CBC" | "DES-EDE3-CBC", crypto:rand_bytes(8)}}.</c></p> @@ -207,17 +207,24 @@ <v> Password = string() </v> </type> <desc> - <p>Decodes a pem entry. pem_decode/1 returns a list of - pem entries.</p> + <p>Decodes a pem entry. pem_decode/1 returns a list of pem + entries. Note that if the pem entry is of type + 'SubjectPublickeyInfo' it will be further decoded to an + rsa_public_key() or dsa_public_key().</p> </desc> </func> <func> <name>pem_entry_encode(Asn1Type, Entity [,{CipherInfo, Password}]) -> pem_entry()</name> - <fsummary> Creates a pem entry that can be feed to pem_encode/1.</fsummary> + <fsummary> Creates a pem entry that can be fed to pem_encode/1.</fsummary> <type> - <v>Asn1Type = atom()</v> - <v>Entity = term()</v> + <v>Asn1Type = pki_asn1_type()</v> + <v>Entity = term() - The Erlang representation of + <c>Asn1Type</c>. If <c>Asn1Type</c> is 'SubjectPublicKeyInfo' + then <c>Entity</c> must be either an rsa_public_key() or a + dsa_public_key() and this function will create the appropriate + 'SubjectPublicKeyInfo' entry. + </v> <v>CipherInfo = {"DES-CBC" | "DES-EDE3-CBC", crypto:rand_bytes(8)}</v> <v>Password = string()</v> </type> diff --git a/lib/public_key/include/public_key.hrl b/lib/public_key/include/public_key.hrl index 4950597fb5..f29ab859ed 100644 --- a/lib/public_key/include/public_key.hrl +++ b/lib/public_key/include/public_key.hrl @@ -73,8 +73,9 @@ -type der_encoded() :: binary(). -type decrypt_der() :: binary(). --type pki_asn1_type() :: 'Certificate' | 'RSAPrivateKey' - | 'DSAPrivateKey' | 'DHParameter'. +-type pki_asn1_type() :: 'Certificate' | 'RSAPrivateKey' | 'RSAPublicKey' + | 'DSAPrivateKey' | 'DSAPublicKey' | 'DHParameter' + | 'SubjectPublicKeyInfo'. -type pem_entry() :: {pki_asn1_type(), der_encoded() | decrypt_der(), not_encrypted | {Cipher :: string(), Salt :: binary()}}. -type asn1_type() :: atom(). %% see "OTP-PUB-KEY.hrl diff --git a/lib/public_key/src/pubkey_cert_records.erl b/lib/public_key/src/pubkey_cert_records.erl index 20b322b4a4..7a387e487c 100644 --- a/lib/public_key/src/pubkey_cert_records.erl +++ b/lib/public_key/src/pubkey_cert_records.erl @@ -23,7 +23,7 @@ -include("public_key.hrl"). --export([decode_cert/1, transform/2]). +-export([decode_cert/1, transform/2, supportedPublicKeyAlgorithms/1]). %%==================================================================== %% Internal application API @@ -80,16 +80,24 @@ transform(Other,_) -> Other. %%-------------------------------------------------------------------- -%%% Internal functions +-spec supportedPublicKeyAlgorithms(Oid::tuple()) -> asn1_type(). +%% +%% Description: Returns the public key type for an algorithm +%% identifier tuple as found in SubjectPublicKeyInfo. +%% %%-------------------------------------------------------------------- - -%%% SubjectPublicKey supportedPublicKeyAlgorithms(?'rsaEncryption') -> 'RSAPublicKey'; supportedPublicKeyAlgorithms(?'id-dsa') -> 'DSAPublicKey'; supportedPublicKeyAlgorithms(?'dhpublicnumber') -> 'DHPublicKey'; supportedPublicKeyAlgorithms(?'id-keyExchangeAlgorithm') -> 'KEA-PublicKey'; supportedPublicKeyAlgorithms(?'id-ecPublicKey') -> 'ECPoint'. +%%-------------------------------------------------------------------- +%%% Internal functions +%%-------------------------------------------------------------------- + +%%% SubjectPublicKey + decode_supportedPublicKey(#'OTPSubjectPublicKeyInfo'{algorithm= PA = #'PublicKeyAlgorithm'{algorithm=Algo}, subjectPublicKey = {0,SPK0}}) -> diff --git a/lib/public_key/src/pubkey_pem.erl b/lib/public_key/src/pubkey_pem.erl index 31d881973a..78870e5cd7 100644 --- a/lib/public_key/src/pubkey_pem.erl +++ b/lib/public_key/src/pubkey_pem.erl @@ -93,11 +93,11 @@ encode_pem_entries(Entries) -> encode_pem_entry({Asn1Type, Der, not_encrypted}) -> StartStr = pem_start(Asn1Type), - [StartStr, "\n", b64encode_and_split(Der), pem_end(StartStr) ,"\n\n"]; + [StartStr, "\n", b64encode_and_split(Der), "\n", pem_end(StartStr) ,"\n\n"]; encode_pem_entry({Asn1Type, Der, {Cipher, Salt}}) -> StartStr = pem_start(Asn1Type), [StartStr,"\n", pem_decrypt(),"\n", pem_decrypt_info(Cipher, Salt),"\n", - b64encode_and_split(Der), pem_end(StartStr) ,"\n\n"]. + b64encode_and_split(Der), "\n", pem_end(StartStr) ,"\n\n"]. decode_pem_entries([], Entries) -> lists:reverse(Entries); @@ -145,16 +145,22 @@ split_bin(N, Bin) -> b64encode_and_split(Bin) -> split_lines(base64:encode(Bin)). +split_lines(<<Text:?ENCODED_LINE_LENGTH/binary>>) -> + [Text]; split_lines(<<Text:?ENCODED_LINE_LENGTH/binary, Rest/binary>>) -> [Text, $\n | split_lines(Rest)]; split_lines(Bin) -> - [Bin, $\n]. + [Bin]. %% Ignore white space at end of line join_entry([<<"-----END CERTIFICATE-----", _/binary>>| Lines], Entry) -> {lists:reverse(Entry), Lines}; join_entry([<<"-----END RSA PRIVATE KEY-----", _/binary>>| Lines], Entry) -> {lists:reverse(Entry), Lines}; +join_entry([<<"-----END PUBLIC KEY-----", _/binary>>| Lines], Entry) -> + {lists:reverse(Entry), Lines}; +join_entry([<<"-----END RSA PUBLIC KEY-----", _/binary>>| Lines], Entry) -> + {lists:reverse(Entry), Lines}; join_entry([<<"-----END DSA PRIVATE KEY-----", _/binary>>| Lines], Entry) -> {lists:reverse(Entry), Lines}; join_entry([<<"-----END DH PARAMETERS-----", _/binary>>| Lines], Entry) -> @@ -210,15 +216,22 @@ pem_start('Certificate') -> <<"-----BEGIN CERTIFICATE-----">>; pem_start('RSAPrivateKey') -> <<"-----BEGIN RSA PRIVATE KEY-----">>; +pem_start('RSAPublicKey') -> + <<"-----BEGIN RSA PUBLIC KEY-----">>; +pem_start('SubjectPublicKeyInfo') -> + <<"-----BEGIN PUBLIC KEY-----">>; pem_start('DSAPrivateKey') -> <<"-----BEGIN DSA PRIVATE KEY-----">>; pem_start('DHParameter') -> <<"-----BEGIN DH PARAMETERS-----">>. - pem_end(<<"-----BEGIN CERTIFICATE-----">>) -> <<"-----END CERTIFICATE-----">>; pem_end(<<"-----BEGIN RSA PRIVATE KEY-----">>) -> <<"-----END RSA PRIVATE KEY-----">>; +pem_end(<<"-----BEGIN RSA PUBLIC KEY-----">>) -> + <<"-----END RSA PUBLIC KEY-----">>; +pem_end(<<"-----BEGIN PUBLIC KEY-----">>) -> + <<"-----END PUBLIC KEY-----">>; pem_end(<<"-----BEGIN DSA PRIVATE KEY-----">>) -> <<"-----END DSA PRIVATE KEY-----">>; pem_end(<<"-----BEGIN DH PARAMETERS-----">>) -> @@ -230,6 +243,10 @@ asn1_type(<<"-----BEGIN CERTIFICATE-----">>) -> 'Certificate'; asn1_type(<<"-----BEGIN RSA PRIVATE KEY-----">>) -> 'RSAPrivateKey'; +asn1_type(<<"-----BEGIN RSA PUBLIC KEY-----">>) -> + 'RSAPublicKey'; +asn1_type(<<"-----BEGIN PUBLIC KEY-----">>) -> + 'SubjectPublicKeyInfo'; asn1_type(<<"-----BEGIN DSA PRIVATE KEY-----">>) -> 'DSAPrivateKey'; asn1_type(<<"-----BEGIN DH PARAMETERS-----">>) -> diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl index 30398df9cc..fad73e8e92 100644 --- a/lib/public_key/src/public_key.erl +++ b/lib/public_key/src/public_key.erl @@ -62,6 +62,7 @@ -type dss_digest_type() :: 'none' | 'sha'. -define(UINT32(X), X:32/unsigned-big-integer). +-define(DER_NULL, <<5, 0>>). %%==================================================================== %% API @@ -90,6 +91,17 @@ pem_encode(PemEntries) when is_list(PemEntries) -> %% Description: Decodes a pem entry. pem_decode/1 returns a list of %% pem entries. %%-------------------------------------------------------------------- +pem_entry_decode({'SubjectPublicKeyInfo', Der, _}) -> + {_, {'AlgorithmIdentifier', AlgId, Params}, {0, Key0}} + = der_decode('SubjectPublicKeyInfo', Der), + KeyType = pubkey_cert_records:supportedPublicKeyAlgorithms(AlgId), + case KeyType of + 'RSAPublicKey' -> + der_decode(KeyType, Key0); + 'DSAPublicKey' -> + {params, DssParams} = der_decode('DSAParams', Params), + {der_decode(KeyType, Key0), DssParams} + end; pem_entry_decode({Asn1Type, Der, not_encrypted}) when is_atom(Asn1Type), is_binary(Der) -> der_decode(Asn1Type, Der). @@ -114,6 +126,18 @@ pem_entry_decode({Asn1Type, CryptDer, {Cipher, Salt}} = PemEntry, % %% Description: Creates a pem entry that can be feed to pem_encode/1. %%-------------------------------------------------------------------- +pem_entry_encode('SubjectPublicKeyInfo', Entity=#'RSAPublicKey'{}) -> + Der = der_encode('RSAPublicKey', Entity), + Spki = {'SubjectPublicKeyInfo', + {'AlgorithmIdentifier', ?'rsaEncryption', ?DER_NULL}, {0, Der}}, + pem_entry_encode('SubjectPublicKeyInfo', Spki); +pem_entry_encode('SubjectPublicKeyInfo', + {DsaInt, Params=#'Dss-Parms'{}}) when is_integer(DsaInt) -> + KeyDer = der_encode('DSAPublicKey', DsaInt), + ParamDer = der_encode('DSAParams', {params, Params}), + Spki = {'SubjectPublicKeyInfo', + {'AlgorithmIdentifier', ?'id-dsa', ParamDer}, {0, KeyDer}}, + pem_entry_encode('SubjectPublicKeyInfo', Spki); pem_entry_encode(Asn1Type, Entity) when is_atom(Asn1Type) -> Der = der_encode(Asn1Type, Entity), {Asn1Type, Der, not_encrypted}. diff --git a/lib/public_key/test/pkits_SUITE.erl b/lib/public_key/test/pkits_SUITE.erl index 1d75e1aed2..fd976cb2f3 100644 --- a/lib/public_key/test/pkits_SUITE.erl +++ b/lib/public_key/test/pkits_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -25,8 +25,8 @@ -compile(export_all). -%%-include_lib("public_key/include/public_key.hrl"). --include("public_key.hrl"). +-include_lib("public_key/include/public_key.hrl"). +%%-include("public_key.hrl"). -define(error(Format,Args), error(Format,Args,?FILE,?LINE)). -define(warning(Format,Args), warning(Format,Args,?FILE,?LINE)). @@ -43,25 +43,24 @@ -define(NIST6, "2.16.840.1.101.3.2.1.48.6"). %% -all(doc) -> - ["PKITS tests for RFC3280 compliance"]; -all(suite) -> - [signature_verification, - validity_periods, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [signature_verification, validity_periods, verifying_name_chaining, - %% basic_certificate_revocation_tests, verifying_paths_with_self_issued_certificates, - verifying_basic_constraints, - key_usage, -%% certificate_policies, -%% require_explicit_policy, -%% policy_mappings, -%% inhibit_policy_mapping, -%% inhibit_any_policy, - name_constraints, -%% distribution_points, -%% delta_crls, - private_certificate_extensions]. + verifying_basic_constraints, key_usage, + name_constraints, private_certificate_extensions]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + signature_verification(doc) -> [""]; signature_verification(suite) -> []; @@ -129,7 +128,6 @@ private_certificate_extensions(Config) when is_list(Config) -> run(private_certificate_extensions()). run() -> - catch crypto:start(), Tests = [signature_verification(), validity_periods(), @@ -581,17 +579,21 @@ init_per_testcase(_Func, Config) -> put(datadir, Datadir), Config. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> %% Nodes = select_nodes(all, Config, ?FILE, ?LINE), %% rpc:multicall(Nodes, mnesia, lkill, []), Config. init_per_suite(Config) -> - crypto:start(), - Config. + case application:start(crypto) of + ok -> + Config; + _ -> + {skip, "Crypto did not start"} + end. end_per_suite(_Config) -> - crypto:stop(). + application:stop(crypto). error(Format, Args, File0, Line) -> File = filename:basename(File0), diff --git a/lib/public_key/test/public_key.cover b/lib/public_key/test/public_key.cover index 8477c76ef6..ec00814578 100644 --- a/lib/public_key/test/public_key.cover +++ b/lib/public_key/test/public_key.cover @@ -1,2 +1,4 @@ +{incl_app,public_key,details}. -{exclude, ['OTP-PUB-KEY']}.
\ No newline at end of file + +{excl_mods, public_key, ['OTP-PUB-KEY']}. diff --git a/lib/public_key/test/public_key.spec b/lib/public_key/test/public_key.spec index dee9ad44ed..1749822c2d 100644 --- a/lib/public_key/test/public_key.spec +++ b/lib/public_key/test/public_key.spec @@ -1,2 +1 @@ -{topcase, {dir, "../public_key_test"}}. - +{suites,"../public_key_test",all}. diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl index 88cfbcf2b6..d130196c15 100644 --- a/lib/public_key/test/public_key_SUITE.erl +++ b/lib/public_key/test/public_key_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -23,10 +23,10 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("test_server/include/test_server_line.hrl"). --include("public_key.hrl"). +-include_lib("public_key/include/public_key.hrl"). -define(TIMEOUT, 120000). % 2 min @@ -41,9 +41,12 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - crypto:start(), - Config. - + case application:start(crypto) of + ok -> + Config; + _ -> + {skip, "Crypto did not start"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ %% Config - [tuple()] @@ -51,7 +54,7 @@ init_per_suite(Config) -> %% Description: Cleanup after the whole suite %%-------------------------------------------------------------------- end_per_suite(_Config) -> - crypto:stop(). + application:stop(crypto). %%-------------------------------------------------------------------- %% Function: init_per_testcase(TestCase, Config) -> Config @@ -96,18 +99,21 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test the public_key rsa functionality"]; - -all(suite) -> - [app, - pk_decode_encode, - encrypt_decrypt, - sign_verify, - pkix, - pkix_path_validation, - deprecated - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [app, pk_decode_encode, encrypt_decrypt, sign_verify, + pkix, pkix_path_validation, deprecated]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Test cases starts here. %%-------------------------------------------------------------------- @@ -136,6 +142,15 @@ pk_decode_encode(Config) when is_list(Config) -> DSAKey = public_key:der_decode('DSAPrivateKey', DerDSAKey), DSAKey = public_key:pem_entry_decode(Entry0), + + {ok, DSAPubPem} = file:read_file(filename:join(Datadir, "dsa_pub.pem")), + [{'SubjectPublicKeyInfo', _, _} = PubEntry0] = + public_key:pem_decode(DSAPubPem), + DSAPubKey = public_key:pem_entry_decode(PubEntry0), + true = check_entry_type(DSAPubKey, 'DSAPublicKey'), + PubEntry0 = public_key:pem_entry_encode('SubjectPublicKeyInfo', DSAPubKey), + DSAPubPemNoEndNewLines = strip_ending_newlines(DSAPubPem), + DSAPubPemEndNoNewLines = strip_ending_newlines(public_key:pem_encode([PubEntry0])), [{'RSAPrivateKey', DerRSAKey, not_encrypted} = Entry1 ] = erl_make_certs:pem_to_der(filename:join(Datadir, "client_key.pem")), @@ -150,6 +165,22 @@ pk_decode_encode(Config) when is_list(Config) -> true = check_entry_type(public_key:pem_entry_decode(Entry2, "abcd1234"), 'RSAPrivateKey'), + {ok, RSAPubPem} = file:read_file(filename:join(Datadir, "rsa_pub.pem")), + [{'SubjectPublicKeyInfo', _, _} = PubEntry1] = + public_key:pem_decode(RSAPubPem), + RSAPubKey = public_key:pem_entry_decode(PubEntry1), + true = check_entry_type(RSAPubKey, 'RSAPublicKey'), + PubEntry1 = public_key:pem_entry_encode('SubjectPublicKeyInfo', RSAPubKey), + RSAPubPemNoEndNewLines = strip_ending_newlines(RSAPubPem), + RSAPubPemNoEndNewLines = strip_ending_newlines(public_key:pem_encode([PubEntry1])), + + {ok, RSARawPem} = file:read_file(filename:join(Datadir, "rsa_pub_key.pem")), + [{'RSAPublicKey', _, _} = PubEntry2] = + public_key:pem_decode(RSARawPem), + RSAPubKey = public_key:pem_entry_decode(PubEntry2), + RSARawPemNoEndNewLines = strip_ending_newlines(RSARawPem), + RSARawPemNoEndNewLines = strip_ending_newlines(public_key:pem_encode([PubEntry2])), + Salt0 = crypto:rand_bytes(8), Entry3 = public_key:pem_entry_encode('RSAPrivateKey', RSAKey0, {{"DES-EDE3-CBC", Salt0}, "1234abcd"}), @@ -429,9 +460,16 @@ check_entry_type(#'DSAPrivateKey'{}, 'DSAPrivateKey') -> true; check_entry_type(#'RSAPrivateKey'{}, 'RSAPrivateKey') -> true; +check_entry_type(#'RSAPublicKey'{}, 'RSAPublicKey') -> + true; +check_entry_type({_Int, #'Dss-Parms'{}}, 'DSAPublicKey') when is_integer(_Int) -> + true; check_entry_type(#'DHParameter'{}, 'DHParameter') -> true; check_entry_type(#'Certificate'{}, 'Certificate') -> true; check_entry_type(_,_) -> false. + +strip_ending_newlines(Bin) -> + string:strip(binary_to_list(Bin), right, 10). diff --git a/lib/public_key/test/public_key_SUITE_data/dsa_pub.pem b/lib/public_key/test/public_key_SUITE_data/dsa_pub.pem new file mode 100644 index 0000000000..d3635e5b20 --- /dev/null +++ b/lib/public_key/test/public_key_SUITE_data/dsa_pub.pem @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtzCCASwGByqGSM44BAEwggEfAoGBALez5tklY5CdFeTMos899pA6i4u4uCts +zgBzrdBk6cl5FVqzdzWMGTQiynnTpGsrOESinzP06Ip+pG15We2OORwgvCxD/W95 +aCiN0/+MdiXqlsmboBARMzsa+SmBENN3gF/+tuuEAFzOXU1q2cmEywRLyfbM2KIB +VE/TChWYw2eRAhUA1R64VvcQ90XA8SOKVDmMA0dBzukCgYEAlLMYP0pbgBlgHQVO +3/avAHlWNrIq52Lxk7SdPJWgMvPjTK9Z6sv88kxsCcydtjvO439j1yqcwk50GQc+ +86ktBWWz93/HkIdnFyqafef4mmWvm2Uq6ClQKS+A0Asfaj8Mys+HUMiI+qsfdjRb +yIpwb7MX1nsVdsKzALnZNMW27A0DgYQAAoGAfEIAb3mLjtFfiF/tsZb4/DGHdWSb +6Ir0hFkoBUZ9ymBO70wlfZVSQGs240kZtOMpAOpJL1Dy8oH6PUQ+JyacwZIo8fdq +19/Kwm6CPrpaEhzErmMvwT2CZJYZ+HOk55ljLkVCiyG7MzEj2+odLKym9yoQsbsJ +olHzIRpkLk45y4c= +-----END PUBLIC KEY----- diff --git a/lib/public_key/test/public_key_SUITE_data/rsa_pub.pem b/lib/public_key/test/public_key_SUITE_data/rsa_pub.pem new file mode 100644 index 0000000000..cbe81343f7 --- /dev/null +++ b/lib/public_key/test/public_key_SUITE_data/rsa_pub.pem @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANRiyZg0uci74Nc6mnqZ8AoDl88aT7x6 +JA0MfgHIHzteEj7Qg+lE5QxMGAafurVE5vqoHkDfwk4uzzsCAJuz91MCAwEAAQ== +-----END PUBLIC KEY----- diff --git a/lib/public_key/test/public_key_SUITE_data/rsa_pub_key.pem b/lib/public_key/test/public_key_SUITE_data/rsa_pub_key.pem new file mode 100644 index 0000000000..3b9d7568ff --- /dev/null +++ b/lib/public_key/test/public_key_SUITE_data/rsa_pub_key.pem @@ -0,0 +1,4 @@ +-----BEGIN RSA PUBLIC KEY----- +MEgCQQDUYsmYNLnIu+DXOpp6mfAKA5fPGk+8eiQNDH4ByB87XhI+0IPpROUMTBgG +n7q1ROb6qB5A38JOLs87AgCbs/dTAgMBAAE= +-----END RSA PUBLIC KEY----- diff --git a/lib/reltool/test/Makefile b/lib/reltool/test/Makefile index 5109058797..e4ab216298 100644 --- a/lib/reltool/test/Makefile +++ b/lib/reltool/test/Makefile @@ -73,7 +73,7 @@ release_spec: opt release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) reltool.spec $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) reltool.spec reltool.cover $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) $(INSTALL_SCRIPT) rtt $(INSTALL_PROGS) $(RELSYSDIR) $(INSTALL_DATA) $(INSTALL_PROGS) $(RELSYSDIR) # chmod -f -R u+w $(RELSYSDIR) diff --git a/lib/reltool/test/reltool.cover b/lib/reltool/test/reltool.cover new file mode 100644 index 0000000000..ca425b9f98 --- /dev/null +++ b/lib/reltool/test/reltool.cover @@ -0,0 +1,2 @@ +{incl_app,reltool,details}. + diff --git a/lib/reltool/test/reltool.spec b/lib/reltool/test/reltool.spec index 252232e09d..2995720105 100644 --- a/lib/reltool/test/reltool.spec +++ b/lib/reltool/test/reltool.spec @@ -1,2 +1 @@ -{topcase, {dir, "../reltool_test"}}. - +{suites,"../reltool_test",all}. diff --git a/lib/reltool/test/reltool_app_SUITE.erl b/lib/reltool/test/reltool_app_SUITE.erl index f8433f73d0..537a06315a 100644 --- a/lib/reltool/test/reltool_app_SUITE.erl +++ b/lib/reltool/test/reltool_app_SUITE.erl @@ -58,22 +58,22 @@ init_per_testcase(Case, Config) -> end_per_testcase(Func,Config) -> reltool_test_lib:end_per_testcase(Func,Config). -fin_per_testcase(Case, Config) -> - reltool_test_lib:end_per_testcase(Case, Config). - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all() -> - all(suite). - -all(suite) -> - [ - fields, - modules, - export_all, - app_depend, - undef_funcs - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [fields, modules, export_all, app_depend, undef_funcs]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index faf1bdbba2..b9b53b5a59 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -18,8 +18,9 @@ -module(reltool_server_SUITE). --export([all/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -compile(export_all). @@ -42,25 +43,26 @@ init_per_testcase(Func,Config) -> reltool_test_lib:init_per_testcase(Func,Config). end_per_testcase(Func,Config) -> reltool_test_lib:end_per_testcase(Func,Config). -fin_per_testcase(Func,Config) -> %% For test_server - reltool_test_lib:end_per_testcase(Func,Config). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% SUITE specification -all() -> - all(suite). -all(suite) -> - [ - start_server, - set_config, - create_release, - create_script, - create_target, - create_embedded, - create_standalone, - create_old_target - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [start_server, set_config, create_release, + create_script, create_target, create_embedded, + create_standalone, create_old_target]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% The test cases diff --git a/lib/reltool/test/reltool_test_lib.erl b/lib/reltool/test/reltool_test_lib.erl index 5390b0a75e..b8bcbcd009 100644 --- a/lib/reltool/test/reltool_test_lib.erl +++ b/lib/reltool/test/reltool_test_lib.erl @@ -97,7 +97,7 @@ wx_init_per_suite(Config) -> exit({skipped, "Can not test on MacOSX"}); {unix, _} -> io:format("DISPLAY ~s~n", [os:getenv("DISPLAY")]), - case proplists:get_value(xserver, Config, none) of + case ct:get_config(xserver, none) of none -> ignore; Server -> os:putenv("DISPLAY", Server) end; @@ -295,7 +295,7 @@ eval_test_case(Mod, Fun, Config) -> test_case_evaluator(Mod, Fun, [Config]) -> NewConfig = Mod:init_per_testcase(Fun, Config), R = apply(Mod, Fun, [NewConfig]), - Mod:fin_per_testcase(Fun, NewConfig), + Mod:end_per_testcase(Fun, NewConfig), exit({test_case_ok, R}). wait_for_evaluator(Pid, Mod, Fun, Config) -> @@ -311,12 +311,12 @@ wait_for_evaluator(Pid, Mod, Fun, Config) -> {'EXIT', Pid, {skipped, Reason}} -> log("<WARNING> Test case ~w skipped, because ~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {skip, {Mod, Fun}, Reason}; {'EXIT', Pid, Reason} -> log("<ERROR> Eval process ~w exited, because\n\t~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {crash, {Mod, Fun}, Reason} end. diff --git a/lib/reltool/test/reltool_wx_SUITE.erl b/lib/reltool/test/reltool_wx_SUITE.erl index 2e2b355e07..56b0a3ed4a 100644 --- a/lib/reltool/test/reltool_wx_SUITE.erl +++ b/lib/reltool/test/reltool_wx_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 2009-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 @@ -18,8 +18,9 @@ -module(reltool_wx_SUITE). --export([all/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -compile(export_all). @@ -36,16 +37,22 @@ init_per_testcase(Func,Config) -> reltool_test_lib:init_per_testcase(Func,Config). end_per_testcase(Func,Config) -> reltool_test_lib:end_per_testcase(Func,Config). -fin_per_testcase(Func,Config) -> %% For test_server - reltool_test_lib:end_per_testcase(Func,Config). %% SUITE specification -all() -> - all(suite). -all(suite) -> - [ - start_all_windows - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [start_all_windows]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% The test cases diff --git a/lib/reltool/test/rtt.erl b/lib/reltool/test/rtt.erl index 6755b8400f..437009e26a 100644 --- a/lib/reltool/test/rtt.erl +++ b/lib/reltool/test/rtt.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 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 diff --git a/lib/runtime_tools/test/Makefile b/lib/runtime_tools/test/Makefile index 873d395277..7dc7a015e1 100644 --- a/lib/runtime_tools/test/Makefile +++ b/lib/runtime_tools/test/Makefile @@ -57,7 +57,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) runtime_tools.spec $(ERL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) runtime_tools.spec runtime_tools.cover $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(EMAKEFILE) runtime_tools.cover $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/runtime_tools/test/dbg_SUITE.erl b/lib/runtime_tools/test/dbg_SUITE.erl index ff96af5e86..8e01e75aba 100644 --- a/lib/runtime_tools/test/dbg_SUITE.erl +++ b/lib/runtime_tools/test/dbg_SUITE.erl @@ -19,30 +19,51 @@ -module(dbg_SUITE). %% Test functions --export([all/1, big/1, tiny/1, simple/1, message/1, distributed/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + big/1, tiny/1, simple/1, message/1, distributed/1, ip_port/1, file_port/1, file_port2/1, file_port_schedfix/1, ip_port_busy/1, wrap_port/1, wrap_port_time/1, with_seq_trace/1, dead_suspend/1, local_trace/1, saved_patterns/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([tracee1/1, tracee2/1]). -export([dummy/0, exported/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(1)). init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> [big, tiny, simple, message, distributed, - ip_port, file_port, file_port2, file_port_schedfix, - ip_port_busy, wrap_port, wrap_port_time, - with_seq_trace, dead_suspend, local_trace, saved_patterns]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [big, tiny, simple, message, distributed, ip_port, + file_port, file_port2, file_port_schedfix, ip_port_busy, + wrap_port, wrap_port_time, with_seq_trace, dead_suspend, + local_trace, saved_patterns]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + big(suite) -> []; big(doc) -> ["Rudimentary interface test"]; diff --git a/lib/runtime_tools/test/erts_alloc_config_SUITE.erl b/lib/runtime_tools/test/erts_alloc_config_SUITE.erl index 32483dbe73..d4957c060e 100644 --- a/lib/runtime_tools/test/erts_alloc_config_SUITE.erl +++ b/lib/runtime_tools/test/erts_alloc_config_SUITE.erl @@ -21,10 +21,12 @@ %-define(line_trace, 1). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %-compile(export_all). --export([all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). %% Testcases -export([basic/1]). @@ -34,15 +36,33 @@ -define(DEFAULT_TIMEOUT, ?t:minutes(2)). -all(doc) -> []; -all(suite) -> [basic]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Case, Config) when is_list(Config) -> [{testcase, Case}, {watchdog, ?t:timetrap(?DEFAULT_TIMEOUT)}, {erl_flags_env, save_env()} | Config]. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> ?t:timetrap_cancel(?config(watchdog, Config)), restore_env(?config(erl_flags_env, Config)), ok. diff --git a/lib/runtime_tools/test/inviso_SUITE.erl b/lib/runtime_tools/test/inviso_SUITE.erl index 1c5c887b62..817ebfbbba 100644 --- a/lib/runtime_tools/test/inviso_SUITE.erl +++ b/lib/runtime_tools/test/inviso_SUITE.erl @@ -29,49 +29,40 @@ -module(inviso_SUITE). -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("kernel/include/file.hrl"). -define(l,?line). -all(suite) -> - [ - basic_dist_trace_1, - basic_dist_trace_2, - basic_dist_trace_3, - basic_dist_trace_ti_1, - basic_dist_trace_ti_2, - basic_dist_trace_ti_3, - suspend_dist_trace_ti_1, - suspend_dist_trace_ti_2, - meta_cleanfunc_dist_1, - basic_handlerfun_dist_1, - delete_log_dist_1, - autostart_dist_1, - autostart_dist_2, - autostart_dist_3, - running_alone_dist_1, - running_alone_dist_2, - running_alone_dist_3, - running_alone_dist_4, - running_alone_dist_5, - overload_dist_1, - overload_dist_2, - overload_dist_3, - overload_dist_4, - overload_dist_5, - subscribe_dist_1, - lfm_trace_dist_1, - lfm_trace_ti_dist_2, - handle_logfile_sort_wrapset, - fetch_log_dist_trace_1, - fetch_log_dist_trace_2, - fetch_log_dist_trace_3, - fetch_log_dist_error_1, - fetch_log_dist_error_2, - expand_regexp_dist_1, - only_loaded_dist_1 - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic_dist_trace_1, basic_dist_trace_2, + basic_dist_trace_3, basic_dist_trace_ti_1, + basic_dist_trace_ti_2, basic_dist_trace_ti_3, + suspend_dist_trace_ti_1, suspend_dist_trace_ti_2, + meta_cleanfunc_dist_1, basic_handlerfun_dist_1, + delete_log_dist_1, autostart_dist_1, autostart_dist_2, + autostart_dist_3, running_alone_dist_1, + running_alone_dist_2, running_alone_dist_3, + running_alone_dist_4, running_alone_dist_5, + overload_dist_1, overload_dist_2, overload_dist_3, + overload_dist_4, overload_dist_5, subscribe_dist_1, + lfm_trace_dist_1, lfm_trace_ti_dist_2, + handle_logfile_sort_wrapset, fetch_log_dist_trace_1, + fetch_log_dist_trace_2, fetch_log_dist_trace_3, + fetch_log_dist_error_1, fetch_log_dist_error_2, + expand_regexp_dist_1, only_loaded_dist_1]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_suite(Config) -> @@ -133,7 +124,7 @@ init_per_testcase(_Case,Config) -> insert_timetraphandle_config(TH,NewConfig2). %% ----------------------------------------------------------------------------- -fin_per_testcase(Case,Config) -> +end_per_testcase(Case,Config) -> ?l test_server:stop_node(get_remotenode_config(inviso1,Config)), ?l test_server:stop_node(get_remotenode_config(inviso2,Config)), @@ -142,14 +133,14 @@ fin_per_testcase(Case,Config) -> true; Pid when is_pid(Pid) -> % But if it exists... exit(Pid,kill), % Remove it! - io:format("Had to kill the control component in fin_per_testcase,~p.~n",[Case]) + io:format("Had to kill the control component in end_per_testcase,~p.~n",[Case]) end, case whereis(inviso_rt) of undefined -> % Should not exist. true; Pid2 when is_pid(Pid2) -> % But if it exists... exit(Pid2,kill), % Remove it! - io:format("Had to kill local runtime component in fin_per_testcase,~p.~n",[Case]) + io:format("Had to kill local runtime component in end_per_testcase,~p.~n",[Case]) end, ?l process_killer([inviso_test_proc, inviso_tab_proc, diff --git a/lib/runtime_tools/test/runtime_tools.cover b/lib/runtime_tools/test/runtime_tools.cover index 2d62ebe6ac..ef850bc377 100644 --- a/lib/runtime_tools/test/runtime_tools.cover +++ b/lib/runtime_tools/test/runtime_tools.cover @@ -1 +1,3 @@ -{exclude,[observer_backend]}. +{incl_app,runtime_tools,details}. + +{excl_mods, runtime_tools, [observer_backend]}. diff --git a/lib/runtime_tools/test/runtime_tools.spec b/lib/runtime_tools/test/runtime_tools.spec index a60a533ce2..0a24232be8 100644 --- a/lib/runtime_tools/test/runtime_tools.spec +++ b/lib/runtime_tools/test/runtime_tools.spec @@ -1 +1 @@ -{topcase, {dir, "../runtime_tools_test"}}. +{suites,"../runtime_tools_test",all}. diff --git a/lib/runtime_tools/test/runtime_tools_SUITE.erl b/lib/runtime_tools/test/runtime_tools_SUITE.erl index 84e255e126..4d46d75b62 100644 --- a/lib/runtime_tools/test/runtime_tools_SUITE.erl +++ b/lib/runtime_tools/test/runtime_tools_SUITE.erl @@ -17,10 +17,11 @@ %% %CopyrightEnd% %% -module(runtime_tools_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([init_per_testcase/2, end_per_testcase/2]). %% Test cases @@ -38,9 +39,27 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), ok. -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [app_file]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + app_file(suite) -> []; app_file(doc) -> diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 3d76fdeaf6..835a1ab0d3 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -40,45 +40,71 @@ <section> <title>Improvements and new features</title> <!-- - <p>-</p> + <p>-</p> --> <list type="bulleted"> <item> - <p>[agent] Added a "complete" set of (snmp) table and variable - print functions, for each mib handled by the SNMP (agent) - application. This will be usefull when debugging a running agent.</p> - <p>See - <seealso marker="snmpa#print_mib_info">print_mib_info/0</seealso>, - <seealso marker="snmpa#print_mib_tables">print_mib_tables/0</seealso> - and - <seealso marker="snmpa#print_mib_variables">print_mib_variables/0</seealso> + <p>[compiler] Added support for textual convention + <c>AGENT-CAPABILITIES</c> and "full" support for textual + convention MODULE-COMPLIANCE, both defined by the SNMPv2-CONF + mib.</p> + <p>The <c>reference</c> and <c>modules</c> part(s) are + stored in the <c>assocList</c> of the mib-entry (<c>me</c>) + record. + Only handled <em>if</em> the option(s) <c>agent_capabilities</c> + and <c>module_compliance</c> (respectively) are provided to the + compiler. </p> + <p>See <seealso marker="snmpc#compile">compile/2</seealso> for more info. </p> + <p>For backward compatibillity, the MIBs provided with + this application are <em>not</em> compiled with these + options. </p> + <p>Own Id: OTP-8966</p> + </item> + + <item> + <p>[agent] Added a "complete" set of (snmp) table and variable + print functions, for each mib handled by the SNMP (agent) + application. This will be usefull when debugging a running agent.</p> + <p>See + <seealso marker="snmpa#print_mib_info">print_mib_info/0</seealso>, + <seealso marker="snmpa#print_mib_tables">print_mib_tables/0</seealso> + and + <seealso marker="snmpa#print_mib_variables">print_mib_variables/0</seealso> + for more info. </p> <p>Own Id: OTP-8977</p> </item> </list> - </section> <section> - <title>Reported Fixed Bugs and Malfunctions</title> + <title>Fixed Bugs and Malfunctions</title> <p>-</p> <!-- <list type="bulleted"> <item> <p>When the function FilterMod:accept_recv/2 - returned false the SNMP agent stopped collecting - messages from UDP.</p> + returned false the SNMP agent stopped collecting + messages from UDP.</p> <p>Own Id: OTP-8761</p> </item> </list> --> </section> + + <section> + <title>Incompatibilities</title> + <p>-</p> + </section> + + <section> <title>Incompatibilities</title> <p>-</p> </section> + </section> <!-- 4.19 --> @@ -94,6 +120,7 @@ </section> <!-- 4.18 --> + <section> <title>SNMP Development Toolkit 4.17.1</title> <p>Version 4.17.1 supports code replacement in runtime from/to diff --git a/lib/snmp/doc/src/snmpc.xml b/lib/snmp/doc/src/snmpc.xml index fbd0950c69..e33828326a 100644 --- a/lib/snmp/doc/src/snmpc.xml +++ b/lib/snmp/doc/src/snmpc.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2004</year><year>2010</year> + <year>2004</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -37,6 +37,7 @@ <p>The module <c>snmpc</c> contains interface functions to the SNMP toolkit MIB compiler.</p> + <marker id="compile"></marker> </description> <funcs> @@ -47,7 +48,7 @@ <type> <v>File = string()</v> <v>Options = [opt()]</v> - <v>opt() = db() | relaxed_row_name_assign_check() | deprecated() | description() | reference() | group_check() | i() | il() | imports() | module() | module_identity() | outdir() | no_defs() | verbosity() | warnings()</v> + <v>opt() = db() | relaxed_row_name_assign_check() | deprecated() | description() | reference() | group_check() | i() | il() | imports() | module() | module_identity() | module_compliance() | agent_capabilities() | outdir() | no_defs() | verbosity() | warnings()</v> <v>db() = {db, volatile|persistent|mnesia}</v> <v>deprecated() = {deprecated, bool()}</v> <v>relaxed_row_name_assign_check() = relaxed_row_name_assign_check</v> @@ -59,6 +60,8 @@ <v>imports() = imports</v> <v>module() = {module, atom()}</v> <v>module_identity() = module_identity</v> + <v>module_compliance() = module_compliance</v> + <v>agent_capabilities() = agent_capabilities</v> <v>no_defs() = no_defs</v> <v>outdir() = {outdir, dir()}</v> <v>verbosity() = {verbosity, silence|warning|info|log|debug|trace}</v> @@ -77,6 +80,7 @@ be used for the default instrumentation. </p> <p>Default is <c>volatile</c>. </p> </item> + <item> <p>The option <c>deprecated</c> specifies if a deprecated definition should be kept or not. If the option is @@ -84,6 +88,7 @@ definitions. </p> <p>Default is <c>true</c>. </p> </item> + <item> <p>The option <c>relaxed_row_name_assign_check</c>, if present, specifies that the row name assign check shall not be done @@ -94,12 +99,14 @@ <p>By default it is not included, but if this option is present it will be. </p> </item> + <item> <p>The option <c>description</c> specifies if the text of the DESCRIPTION field will be included or not. </p> <p>By default it is not included, but if this option is present it will be. </p> </item> + <item> <p>The option <c>reference</c> specifies if the text of the REFERENCE field, when found in a table definition, @@ -108,18 +115,21 @@ it will be. The reference text will be placed in the allocList field of the mib-entry record (#me{}) for the table. </p> </item> + <item> <p>The option <c>group_check</c> specifies whether the mib compiler should check the OBJECT-GROUP macro and the NOTIFICATION-GROUP macro for correctness or not. </p> <p>Default is <c>true</c>. </p> </item> + <item> <p>The option <c>i</c> specifies the path to search for imported (compiled) MIB files. The directories should be strings with a trailing directory delimiter. </p> <p>Default is <c>["./"]</c>. </p> </item> + <item> <p>The option <c>il</c> (include_lib) also specifies a list of directories to search for imported MIBs. It @@ -132,11 +142,13 @@ <c><![CDATA[<snmp-home>/priv/mibs/]]></c> are always listed last in the include path. </p> </item> + <item> <p>The option <c>imports</c>, if present, specifies that the IMPORT statement of the MIB shall be included in the compiled mib. </p> </item> + <item> <p>The option <c>module</c>, if present, specifies the name of a module which implements all instrumentation @@ -145,11 +157,29 @@ functions must be the same as the corresponding managed object it implements. </p> </item> + <item> <p>The option <c>module_identity</c>, if present, specifies that the info part of the MODULE-IDENTITY statement of the MIB shall be included in the compiled mib. </p> </item> + + <item> + <p>The option <c>module_compliance</c>, if present, specifies + that the MODULE-COMPLIANCE statement of the MIB shall be included + (with a mib-entry record) in the compiled mib. The mib-entry record + of the module-compliance will contain <c>reference</c> and <c>module</c> + part(s) this info in the <c>assocList</c> field). </p> + </item> + + <item> + <p>The option <c>agent_capabilities</c>, if present, specifies + that the AGENT-CAPABILITIES statement of the MIB shall be included + (with a mib-entry record) in the compiled mib. The mib-entry record + of the agent-capabilitie will contain <c>reference</c> and <c>modules</c> + part(s) this info in the <c>assocList</c> field). </p> + </item> + <item> <p>The option <c>no_defs</c>, if present, specifies that if a managed object does not have an instrumentation @@ -157,6 +187,7 @@ be used, instead this is reported as an error, and the compilation aborts. </p> </item> + <item> <p>The option <c>verbosity</c> specifies the verbosity of the SNMP mib compiler. I.e. if warning, info, log, debug @@ -166,11 +197,13 @@ option <c>verbosity</c> is <c>silence</c>, warning messages will still be shown. </p> </item> + <item> <p>The option <c>warnings</c> specifies whether warning messages should be shown. </p> <p>Default is <c>true</c>. </p> </item> + </list> <p>The MIB compiler understands both SMIv1 and SMIv2 MIBs. It uses the <c>MODULE-IDENTITY</c> statement to determine if the MIB is @@ -185,8 +218,11 @@ have to be specified to <c>erlc</c> using the syntax <c>+term</c>. See <c>erlc(1)</c> for details. </p> + + <marker id="is_consistent"></marker> </desc> </func> + <func> <name>is_consistent(Mibs) -> ok | {error, Reason}</name> <fsummary>Check for OID conflicts between MIBs</fsummary> @@ -198,8 +234,11 @@ <p>Checks for multiple usage of object identifiers and traps between MIBs. </p> + + <marker id="mib_to_hrl"></marker> </desc> </func> + <func> <name>mib_to_hrl(MibName) -> ok | {error, Reason}</name> <fsummary>Generate constants for the objects in the MIB</fsummary> diff --git a/lib/snmp/include/snmp_types.hrl b/lib/snmp/include/snmp_types.hrl index 1fd6d153c9..4adb24361c 100644 --- a/lib/snmp/include/snmp_types.hrl +++ b/lib/snmp/include/snmp_types.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -192,7 +192,7 @@ %%---------------------------------------------------------------------- -record(mib, {misc = [], - mib_format_version = "3.1", + mib_format_version = "3.2", name = "", module_identity, %% Not in SMIv1, and only with +module_identity mes = [], diff --git a/lib/snmp/mibs/Makefile.in b/lib/snmp/mibs/Makefile.in index b85a8b0767..7aefb0ea34 100644 --- a/lib/snmp/mibs/Makefile.in +++ b/lib/snmp/mibs/Makefile.in @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 1996-2009. All Rights Reserved. +# Copyright Ericsson AB 1996-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 @@ -108,20 +108,28 @@ TARGET_FILES = \ # FLAGS # ---------------------------------------------------- -SNMP_FLAGS += -pa ../ebin +version +SNMP_FLAGS += -pa ../ebin +version ifneq ($(MIBS_VERBOSITY),) -SNMP_FLAGS += +'{verbosity,$(MIBS_VERBOSITY)}' +SNMP_FLAGS += +'{verbosity, $(MIBS_VERBOSITY)}' endif -ifneq ($(MIBS_REFERENCE),) +ifeq ($(MIBS_REFERENCE),true) SNMP_FLAGS += +reference endif -ifneq ($(MIBS_OPTIONS),) +ifeq ($(MIBS_OPTIONS),true) SNMP_FLAGS += +options endif +ifeq ($(MIBS_MC),true) +SNMP_FLAGS += +module_compliance +endif + +ifeq ($(MIBS_AC),true) +SNMP_FLAGS += +agent_capabilities +endif + # ---------------------------------------------------- # Targets @@ -148,6 +156,14 @@ conf: cd ..; $(MAKE) conf info: + @echo "MIBS_REFERENCE = $(MIBS_REFERENCE)" + @echo "" + @echo "MIBS_OPTIONS = $(MIBS_OPTIONS)" + @echo "" + @echo "MIBS_MC = $(MIBS_MC)" + @echo "" + @echo "MIBS_AC = $(MIBS_AC)" + @echo "" @echo "SNMP_FLAGS = $(SNMP_FLAGS)" @echo "" @echo "MIBS = $(MIBS)" diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 24f3b2e755..525093a256 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -24,6 +24,7 @@ [ {"4.18", [ + {load_module, snmp_misc, soft_purge, soft_purge, []}, {load_module, snmpa, soft_purge, soft_purge, [snmp_community_mib, snmp_framework_mib, @@ -43,7 +44,7 @@ [snmpa_mib_lib]}, {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, - {load_module, snmps_mib_lib, soft_purge, soft_purge, []} + {load_module, snmpa_mib_lib, soft_purge, soft_purge, []} ] } ], @@ -53,6 +54,7 @@ [ {"4.18", [ + {load_module, snmp_misc, soft_purge, soft_purge, []}, {load_module, snmpa, soft_purge, soft_purge, [snmp_community_mib, snmp_framework_mib, @@ -72,7 +74,7 @@ [snmpa_mib_lib]}, {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, - {load_module, snmps_mib_lib, soft_purge, soft_purge, []} + {load_module, snmpa_mib_lib, soft_purge, soft_purge, []} ] } ] diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index a7f2cdc2bc..c4b3d7090f 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -112,6 +112,8 @@ compile(FileName) -> %% description %% reference %% imports +%% agent_capabilities +%% module_compliance %% module_identity %% {module, string()} %% no_defs @@ -203,6 +205,10 @@ get_options([imports|Opts], Formats, Args) -> get_options(Opts, ["~n imports"|Formats], Args); get_options([module_identity|Opts], Formats, Args) -> get_options(Opts, ["~n module_identity"|Formats], Args); +get_options([module_compliance|Opts], Formats, Args) -> + get_options(Opts, ["~n module_compliance"|Formats], Args); +get_options([agent_capabilities|Opts], Formats, Args) -> + get_options(Opts, ["~n agent_capabilities"|Formats], Args); get_options([relaxed_row_name_assign_check|Opts], Formats, Args) -> get_options(Opts, ["~n relaxed_row_name_assign_check"|Formats], Args); get_options([_|Opts], Formats, Args) -> @@ -288,6 +294,10 @@ check_options([imports| T]) -> check_options(T); check_options([module_identity| T]) -> check_options(T); +check_options([module_compliance| T]) -> + check_options(T); +check_options([agent_capabilities| T]) -> + check_options(T); check_options([relaxed_row_name_assign_check| T]) -> check_options(T); check_options([{module, M} | T]) when is_atom(M) -> @@ -315,6 +325,12 @@ get_description(Options) -> get_reference(Options) -> get_bool_option(reference, Options). +get_agent_capabilities(Options) -> + get_bool_option(agent_capabilities, Options). + +get_module_compliance(Options) -> + get_bool_option(module_compliance, Options). + get_relaxed_row_name_assign_check(Options) -> lists:member(relaxed_row_name_assign_check, Options). @@ -387,10 +403,12 @@ get_verbosity(Options) -> init(From, MibFileName, Options) -> {A,B,C} = now(), random:seed(A,B,C), - put(options, Options), - put(verbosity, get_verbosity(Options)), - put(description, get_description(Options)), - put(reference, get_reference(Options)), + put(options, Options), + put(verbosity, get_verbosity(Options)), + put(description, get_description(Options)), + put(reference, get_reference(Options)), + put(agent_capabilities, get_agent_capabilities(Options)), + put(module_compliance, get_module_compliance(Options)), File = filename:rootname(MibFileName, ".mib"), put(filename, filename:basename(File ++ ".mib")), R = case catch c_impl(File) of @@ -921,10 +939,96 @@ definitions_loop([{#mc_notification{name = TrapName, snmpc_lib:add_cdata(#cdata.traps, [Notif]), definitions_loop(T, Data); -definitions_loop([{#mc_module_compliance{name = Name},Line}|T], Data) -> - ?vlog2("defloop -> module_compliance:" - "~n Name: ~p", [Name], Line), +definitions_loop([{#mc_agent_capabilities{name = Name, + status = Status, + description = Desc, + reference = Ref, + modules = Mods, + name_assign = {Parent, SubIdx}},Line}|T], Data) -> + ?vlog2("defloop -> agent_capabilities ~p:" + "~n Status: ~p" + "~n Desc: ~p" + "~n Ref: ~p" + "~n Mods: ~p" + "~n Parent: ~p" + "~n SubIndex: ~p", + [Name, Status, Desc, Ref, Mods, Parent, SubIdx], Line), + ensure_macro_imported('AGENT-CAPABILITIES', Line), + case get(agent_capabilities) of + true -> + update_status(Name, Status), + snmpc_lib:register_oid(Line, Name, Parent, SubIdx), + NewME = snmpc_lib:makeInternalNode2(false, Name), + Description = make_description(Desc), + Reference = + case Ref of + undefined -> + []; + _ -> + [{reference, Ref}] + end, + Modules = + case Mods of + undefined -> + []; + [] -> + []; + _ -> + [{modules, Mods}] + end, + AssocList = Reference ++ Modules, + NewME2 = NewME#me{description = Description, + assocList = AssocList}, + snmpc_lib:add_cdata(#cdata.mes, [NewME2]); + _ -> + ok + end, + definitions_loop(T, Data); + +definitions_loop([{#mc_module_compliance{name = Name, + status = Status, + description = Desc, + reference = Ref, + modules = Mods, + name_assign = {Parent, SubIdx}},Line}|T], Data) -> + ?vlog2("defloop -> module_compliance: ~p" + "~n Status: ~p" + "~n Desc: ~p" + "~n Ref: ~p" + "~n Mods: ~p" + "~n Parent: ~p" + "~n SubIndex: ~p", + [Name, Status, Desc, Ref, Mods, Parent, SubIdx], Line), ensure_macro_imported('MODULE-COMPLIANCE', Line), + case get(module_compliance) of + true -> + update_status(Name, Status), + snmpc_lib:register_oid(Line, Name, Parent, SubIdx), + NewME = snmpc_lib:makeInternalNode2(false, Name), + Description = make_description(Desc), + Reference = + case Ref of + undefined -> + []; + _ -> + [{reference, Ref}] + end, + Modules = + case Mods of + undefined -> + []; + [] -> + []; + _ -> + [{modules, Mods}] + end, + AssocList = Reference ++ Modules, + NewME2 = NewME#me{description = Description, + assocList = AssocList}, + snmpc_lib:add_cdata(#cdata.mes, [NewME2]); + _ -> + ok + end, definitions_loop(T, Data); definitions_loop([{#mc_object_group{name = Name, @@ -1328,22 +1432,26 @@ save(Filename, MibName, Options) -> parse(FileName) -> +%% ?vtrace("parse -> start tokenizer for ~p", [FileName]), case snmpc_tok:start_link(reserved_words(), [{file, FileName ++ ".mib"}, {forget_stringdata, true}]) of {error,ReasonStr} -> snmpc_lib:error(lists:flatten(ReasonStr),[]); {ok, TokPid} -> +%% ?vtrace("parse -> tokenizer start, now get tokens", []), Toks = snmpc_tok:get_all_tokens(TokPid), +%% ?vtrace("parse -> tokens: ~p", [Toks]), set_version(Toks), - %% io:format("parse -> lexical analysis: ~n~p~n", [Toks]), - %% t("parse -> lexical analysis: ~n~p", [Toks]), + %% ?vtrace("parse -> lexical analysis: ~n~p", [Toks]), CDataArg = case lists:keysearch(module, 1, get(options)) of {value, {module, M}} -> {module, M}; _ -> {file, FileName ++ ".funcs"} end, put(cdata,snmpc_lib:make_cdata(CDataArg)), +%% ?vtrace("parse -> stop tokenizer and then do the actual parse", +%% []), snmpc_tok:stop(TokPid), Res = if is_list(Toks) -> @@ -1351,7 +1459,7 @@ parse(FileName) -> true -> Toks end, - %% t("parse -> parsed: ~n~p", [Res]), +%% ?vtrace("parse -> parsed result: ~n~p", [Res]), case Res of {ok, PData} -> {ok, PData}; @@ -1443,6 +1551,10 @@ reserved_words() -> 'NOTIFICATION-GROUP', 'NOTIFICATIONS', 'MODULE-COMPLIANCE', + 'AGENT-CAPABILITIES', + 'PRODUCT-RELEASE', + 'SUPPORTS', + 'INCLUDES', 'MODULE', 'MANDATORY-GROUPS', 'GROUP', diff --git a/lib/snmp/src/compile/snmpc.hrl b/lib/snmp/src/compile/snmpc.hrl index eb896cde6b..1c0808d065 100644 --- a/lib/snmp/src/compile/snmpc.hrl +++ b/lib/snmp/src/compile/snmpc.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -103,16 +103,75 @@ ). +-record(mc_agent_capabilities, + {name, + product_release, + status, + description, + reference, + modules, + name_assign + } + ). + +-record(mc_ac_module, + {name, + groups, + variation + } + ). + +-record(mc_ac_object_variation, + {name, + syntax, + write_syntax, + access, + creation, + default_value, + description + } + ). + +-record(mc_ac_notification_variation, + {name, + access, + description + } + ). + + -record(mc_module_compliance, {name, status, description, reference, - module, + modules, name_assign } ). +-record(mc_mc_compliance_group, + {name, + description + } + ). + +-record(mc_mc_object, + {name, + syntax, + write_syntax, + access, + description + } + ). + +-record(mc_mc_module, + {name, + mandatory, + compliance + } + ). + -record(mc_object_group, {name, diff --git a/lib/snmp/src/compile/snmpc_lib.erl b/lib/snmp/src/compile/snmpc_lib.erl index 4490412e84..4f71c47bfa 100644 --- a/lib/snmp/src/compile/snmpc_lib.erl +++ b/lib/snmp/src/compile/snmpc_lib.erl @@ -306,7 +306,10 @@ import_mib({{'SNMPv2-TC', ImportsFromMib},Line}) -> Macros = ['TEXTUAL-CONVENTION'], import_built_in_loop(ImportsFromMib,Nodes,Types,Macros,'SNMPv2-TC',Line); import_mib({{'SNMPv2-CONF', ImportsFromMib},Line}) -> - Macros = ['OBJECT-GROUP','NOTIFICATION-GROUP','MODULE-COMPLIANCE'], + Macros = ['OBJECT-GROUP', + 'NOTIFICATION-GROUP', + 'MODULE-COMPLIANCE', + 'AGENT-CAPABILITIES'], import_built_in_loop(ImportsFromMib,[],[],Macros,'SNMPv2-CONF',Line); import_mib({{'RFC1155-SMI', ImportsFromMib},Line}) -> Nodes = [makeInternalNode(internet, [1,3,6,1]), diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index 1957f52936..74b9ddaa25 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -59,6 +59,7 @@ newtypename objectidentifier objectname objecttypev1 +prodrel range_num referpart size @@ -79,7 +80,7 @@ revisions listofdefinitionsv2 mibid last_updated -oranization +organization contact_info revision revision_string @@ -101,19 +102,31 @@ textualconvention objectgroup notificationgroup modulecompliance -modulepart -modules -module -modulenamepart -mandatorypart -compliancepart -compliances -compliance -compliancegroup -object +mc_modulepart +mc_modules +mc_module +mc_modulenamepart +mc_mandatorypart +mc_compliancepart +mc_compliances +mc_compliance +mc_compliancegroup +mc_object +mc_accesspart +agentcapabilities +ac_status +ac_modulepart +ac_modules +ac_module +ac_modulenamepart +ac_variationpart +ac_variations +ac_variation +ac_accesspart +ac_access +ac_creationpart syntaxpart writesyntaxpart -accesspart fsyntax defbitsvalue defbitsnames @@ -161,6 +174,12 @@ integer variable atom string quote '{' '}' '::=' ':' '=' ',' '.' '(' ')' ';' '|' 'CONTACT-INFO' 'MODULE-IDENTITY' 'NOTIFICATION-TYPE' +'PRODUCT-RELEASE' +'AGENT-CAPABILITIES' +'INCLUDES' +'SUPPORTS' +'VARIATION' +'CREATION-REQUIRES' 'MODULE-COMPLIANCE' 'OBJECT-GROUP' 'NOTIFICATION-GROUP' @@ -212,8 +231,8 @@ mib -> mibname 'DEFINITIONS' implies 'BEGIN' defs = Defs}. v1orv2 -> moduleidentity listofdefinitionsv2 : - {v2_mib, ['$1'|lists:reverse('$2')]}. -v1orv2 -> listofdefinitions : {v1_mib, lists:reverse('$1')}. + {v2_mib, ['$1'|lreverse(v1orv2_mod, '$2')]}. +v1orv2 -> listofdefinitions : {v1_mib, lreverse(v1orv2_list, '$1')}. definition -> objectidentifier : '$1'. definition -> objecttypev1 : '$1'. @@ -231,7 +250,7 @@ imports -> imports_from_one_mib : ['$1']. imports -> imports_from_one_mib imports : ['$1' | '$2']. imports_from_one_mib -> listofimports 'FROM' variable : - {{val('$3'), lists:reverse('$1')}, line_of('$2')}. + {{val('$3'), lreverse(imports_from_one_mib, '$1')}, line_of('$2')}. listofimports -> import_stuff : ['$1']. listofimports -> listofimports ',' import_stuff : ['$3' | '$1']. @@ -251,6 +270,8 @@ import_stuff -> 'MODULE-IDENTITY' : ensure_ver(2,'$1'), {builtin, 'MODULE-IDENTITY'}. import_stuff -> 'NOTIFICATION-TYPE' : ensure_ver(2,'$1'), {builtin, 'NOTIFICATION-TYPE'}. +import_stuff -> 'AGENT-CAPABILITIES' + : ensure_ver(2,'$1'), {builtin, 'AGENT-CAPABILITIES'}. import_stuff -> 'MODULE-COMPLIANCE' : ensure_ver(2,'$1'), {builtin, 'MODULE-COMPLIANCE'}. import_stuff -> 'NOTIFICATION-GROUP' @@ -296,7 +317,7 @@ import_stuff -> 'TAddress' traptype -> objectname 'TRAP-TYPE' 'ENTERPRISE' objectname varpart description referpart implies integer : - Trap = make_trap('$1', '$4', lists:reverse('$5'), + Trap = make_trap('$1', '$4', lreverse(traptype, '$5'), '$6', '$7', val('$9')), {Trap, line_of('$2')}. @@ -324,7 +345,7 @@ newtype -> newtypename implies syntax : {NT, line_of('$2')}. tableentrydefinition -> newtypename implies 'SEQUENCE' '{' fields '}' : - Seq = make_sequence('$1', lists:reverse('$5')), + Seq = make_sequence('$1', lreverse(tableentrydefinition, '$5')), {Seq, line_of('$3')}. % returns: list of {<fieldname>, <asn1_type>} @@ -408,9 +429,9 @@ variables -> variables ',' objectname : ['$3' | '$1']. implies -> '::=' : '$1'. implies -> ':' ':' '=' : w("Sloppy asignment on line ~p", [line_of('$1')]), '$1'. -descriptionfield -> string : lists:reverse(val('$1')). +descriptionfield -> string : lreverse(descriptionfield, val('$1')). descriptionfield -> '$empty' : undefined. -description -> 'DESCRIPTION' string : lists:reverse(val('$2')). +description -> 'DESCRIPTION' string : lreverse(description, val('$2')). description -> '$empty' : undefined. displaypart -> 'DISPLAY-HINT' string : display_hint('$2') . @@ -418,7 +439,7 @@ displaypart -> '$empty' : undefined . % returns: {indexes, undefined} % | {indexes, IndexList} where IndexList is a list of aliasnames. -indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lists:reverse('$3')}. +indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lreverse(indexpartv1, '$3')}. indexpartv1 -> '$empty' : {indexes, undefined}. indextypesv1 -> indextypev1 : ['$1']. @@ -436,14 +457,16 @@ parentintegers -> atom '(' integer ')' parentintegers : [val('$3') | '$5']. defvalpart -> 'DEFVAL' '{' integer '}' : {defval, val('$3')}. defvalpart -> 'DEFVAL' '{' atom '}' : {defval, val('$3')}. defvalpart -> 'DEFVAL' '{' '{' defbitsvalue '}' '}' : {defval, '$4'}. -defvalpart -> 'DEFVAL' '{' quote atom '}' - : {defval, make_defval_for_string(line_of('$1'), lists:reverse(val('$3')), - val('$4'))}. -defvalpart -> 'DEFVAL' '{' quote variable '}' - : {defval, make_defval_for_string(line_of('$1'), lists:reverse(val('$3')), - val('$4'))}. -defvalpart -> 'DEFVAL' '{' string '}' - : {defval, lists:reverse(val('$3'))}. +defvalpart -> 'DEFVAL' '{' quote atom '}' : + {defval, make_defval_for_string(line_of('$1'), + lreverse(defvalpart_quote_atom, val('$3')), + val('$4'))}. +defvalpart -> 'DEFVAL' '{' quote variable '}' : + {defval, make_defval_for_string(line_of('$1'), + lreverse(defvalpart_quote_variable, val('$3')), + val('$4'))}. +defvalpart -> 'DEFVAL' '{' string '}' : + {defval, lreverse(defvalpart_string, val('$3'))}. defvalpart -> '$empty' : undefined. defbitsvalue -> defbitsnames : '$1'. @@ -461,7 +484,7 @@ accessv1 -> atom: accessv1('$1'). statusv1 -> atom : statusv1('$1'). -referpart -> 'REFERENCE' string : lists:reverse(val('$2')). +referpart -> 'REFERENCE' string : lreverse(referpart, val('$2')). referpart -> '$empty' : undefined. @@ -471,7 +494,7 @@ referpart -> '$empty' : undefined. %%---------------------------------------------------------------------- moduleidentity -> mibid 'MODULE-IDENTITY' 'LAST-UPDATED' last_updated - 'ORGANIZATION' oranization + 'ORGANIZATION' organization 'CONTACT-INFO' contact_info 'DESCRIPTION' descriptionfield revisionpart nameassign : @@ -480,20 +503,20 @@ moduleidentity -> mibid 'MODULE-IDENTITY' {MI, line_of('$2')}. mibid -> atom : val('$1'). -last_updated -> string : lists:reverse(val('$1')) . -oranization -> string : lists:reverse(val('$1')) . -contact_info -> string : lists:reverse(val('$1')) . +last_updated -> string : lreverse(last_updated, val('$1')) . +organization -> string : lreverse(organization, val('$1')) . +contact_info -> string : lreverse(contact_info, val('$1')) . revisionpart -> '$empty' : [] . -revisionpart -> revisions : lists:reverse('$1') . +revisionpart -> revisions : lreverse(revisionpart, '$1') . revisions -> revision : ['$1'] . revisions -> revisions revision : ['$2' | '$1'] . revision -> 'REVISION' revision_string 'DESCRIPTION' revision_desc : make_revision('$2', '$4') . -revision_string -> string : lists:reverse(val('$1')) . -revision_desc -> string : lists:reverse(val('$1')) . +revision_string -> string : lreverse(revision_string, val('$1')) . +revision_desc -> string : lreverse(revision_desc, val('$1')) . definitionv2 -> objectidentifier : '$1'. definitionv2 -> objecttypev2 : '$1'. @@ -505,6 +528,7 @@ definitionv2 -> notification : '$1'. definitionv2 -> objectgroup : '$1'. definitionv2 -> notificationgroup : '$1'. definitionv2 -> modulecompliance : '$1'. +definitionv2 -> agentcapabilities : '$1'. listofdefinitionsv2 -> '$empty' : [] . listofdefinitionsv2 -> listofdefinitionsv2 definitionv2 : ['$2' | '$1']. @@ -535,46 +559,127 @@ notificationgroup -> objectname 'NOTIFICATION-GROUP' 'NOTIFICATIONS' '{' {NG, line_of('$2')}. modulecompliance -> objectname 'MODULE-COMPLIANCE' 'STATUS' statusv2 - description referpart modulepart nameassign : + description referpart mc_modulepart nameassign : +%% io:format("modulecompliance -> " +%% "~n '$1': ~p" +%% "~n '$4': ~p" +%% "~n '$5': ~p" +%% "~n '$6': ~p" +%% "~n '$7': ~p" +%% "~n '$8': ~p" +%% "~n", ['$1', '$4', '$5', '$6', '$7', '$8']), MC = make_module_compliance('$1', '$4', '$5', '$6', '$7', '$8'), +%% io:format("modulecompliance -> " +%% "~n MC: ~p" +%% "~n", [MC]), {MC, line_of('$2')}. -modulepart -> '$empty'. -modulepart -> modules. -modules -> module. -modules -> modules module. +agentcapabilities -> objectname 'AGENT-CAPABILITIES' + 'PRODUCT-RELEASE' prodrel + 'STATUS' ac_status + description referpart ac_modulepart nameassign : + AC = make_agent_capabilities('$1', '$4', '$6', '$7', + '$8', '$9', '$10'), + {AC, line_of('$2')}. + +prodrel -> string : lreverse(prodrel, val('$1')). + +ac_status -> atom : ac_status('$1'). + +ac_modulepart -> ac_modules : + lreverse(ac_modulepart, '$1'). +ac_modulepart -> '$empty' : + []. + +ac_modules -> ac_module : + ['$1']. +ac_modules -> ac_module ac_modules : + ['$1' | '$2']. + +ac_module -> 'SUPPORTS' ac_modulenamepart 'INCLUDES' '{' objects '}' ac_variationpart : + make_ac_module('$2', '$5', '$7'). + +ac_modulenamepart -> mibname : '$1'. +ac_modulenamepart -> '$empty' : undefined. + +ac_variationpart -> '$empty' : + []. +ac_variationpart -> ac_variations : + lreverse(ac_variationpart, '$1'). + +ac_variations -> ac_variation : + ['$1']. +ac_variations -> ac_variation ac_variations : + ['$1' | '$2']. + +%% ac_variation -> ac_objectvariation. +%% ac_variation -> ac_notificationvariation. + +ac_variation -> 'VARIATION' objectname syntaxpart writesyntaxpart ac_accesspart ac_creationpart defvalpart description : + make_ac_variation('$2', '$3', '$4', '$5', '$6', '$7', '$8'). + +ac_accesspart -> 'ACCESS' ac_access : '$2'. +ac_accesspart -> '$empty' : undefined. + +ac_access -> atom: ac_access('$1'). + +ac_creationpart -> 'CREATION-REQUIRES' '{' objects '}' : + lreverse(ac_creationpart, '$3'). +ac_creationpart -> '$empty' : + []. + +mc_modulepart -> '$empty' : + []. +mc_modulepart -> mc_modules : + lreverse(mc_modulepart, '$1'). + +mc_modules -> mc_module : + ['$1']. +mc_modules -> mc_module mc_modules : + ['$1' | '$2']. -module -> 'MODULE' modulenamepart mandatorypart compliancepart. +mc_module -> 'MODULE' mc_modulenamepart mc_mandatorypart mc_compliancepart : + make_mc_module('$2', '$3', '$4'). -modulenamepart -> mibname. -modulenamepart -> '$empty'. +mc_modulenamepart -> mibname : '$1'. +mc_modulenamepart -> '$empty' : undefined. -mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}'. -mandatorypart -> '$empty'. +mc_mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}' : + lreverse(mc_mandatorypart, '$3'). +mc_mandatorypart -> '$empty' : + []. -compliancepart -> compliances. -compliancepart -> '$empty'. +mc_compliancepart -> mc_compliances : + lreverse(mc_compliancepart, '$1'). +mc_compliancepart -> '$empty' : + []. -compliances -> compliance. -compliances -> compliances compliance. +mc_compliances -> mc_compliance : + ['$1']. +mc_compliances -> mc_compliance mc_compliances : + ['$1' | '$2']. -compliance -> compliancegroup. -compliance -> object. +mc_compliance -> mc_compliancegroup : + '$1'. +mc_compliance -> mc_object : + '$1'. -compliancegroup -> 'GROUP' objectname description. +mc_compliancegroup -> 'GROUP' objectname description : + make_mc_compliance_group('$2', '$3'). -object -> 'OBJECT' objectname syntaxpart writesyntaxpart accesspart description. +mc_object -> 'OBJECT' objectname syntaxpart writesyntaxpart mc_accesspart description : + make_mc_object('$2', '$3', '$4', '$5', '$6'). -syntaxpart -> 'SYNTAX' syntax. -syntaxpart -> '$empty'. +syntaxpart -> 'SYNTAX' syntax : '$2'. +syntaxpart -> '$empty' : undefined. -writesyntaxpart -> 'WRITE-SYNTAX' syntax. -writesyntaxpart -> '$empty'. +writesyntaxpart -> 'WRITE-SYNTAX' syntax : '$2'. +writesyntaxpart -> '$empty' : undefined. -accesspart -> 'MIN-ACCESS' accessv2. -accesspart -> '$empty'. +mc_accesspart -> 'MIN-ACCESS' accessv2 : '$2'. +mc_accesspart -> '$empty' : undefined. objecttypev2 -> objectname 'OBJECT-TYPE' 'SYNTAX' syntax @@ -589,7 +694,7 @@ objecttypev2 -> objectname 'OBJECT-TYPE' '$11', '$12', Kind, '$15'), {OT, line_of('$2')}. -indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lists:reverse('$3')}. +indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lreverse(indexpartv2, '$3')}. indexpartv2 -> 'AUGMENTS' '{' entry '}' : {augments, '$3'}. indexpartv2 -> '$empty' : {indexes, undefined}. @@ -614,7 +719,7 @@ notification -> objectname 'NOTIFICATION-TYPE' objectspart Not = make_notification('$1','$3','$5', '$7', '$8', '$9'), {Not, line_of('$2')}. -objectspart -> 'OBJECTS' '{' objects '}' : lists:reverse('$3'). +objectspart -> 'OBJECTS' '{' objects '}' : lreverse(objectspart, '$3'). objectspart -> '$empty' : []. objects -> objectname : ['$1']. @@ -655,6 +760,14 @@ statusv2(Tok) -> "syntax error before: " ++ atom_to_list(Else)) end. +ac_status(Tok) -> + case val(Tok) of + current -> current; + obsolete -> obsolete; + Else -> return_error(line_of(Tok), + "syntax error before: " ++ atom_to_list(Else)) + end. + accessv1(Tok) -> case val(Tok) of 'read-only' -> 'read-only'; @@ -676,6 +789,18 @@ accessv2(Tok) -> "syntax error before: " ++ atom_to_list(Else)) end. +ac_access(Tok) -> + case val(Tok) of + 'not-implemented' -> 'not-implemented'; % only for notifications + 'accessible-for-notify' -> 'accessible-for-notify'; + 'read-only' -> 'read-only'; + 'read-write' -> 'read-write'; + 'read-create' -> 'read-create'; + 'write-only' -> 'write-only'; % for backward-compatibility only + Else -> return_error(line_of(Tok), + "syntax error before: " ++ atom_to_list(Else)) + end. + %% --------------------------------------------------------------------- %% Various basic record build functions %% --------------------------------------------------------------------- @@ -744,14 +869,79 @@ make_notification(Name, Vars, Status, Desc, Ref, NA) -> reference = Ref, name_assign = NA}. -make_module_compliance(Name, Status, Desc, Ref, Mod, NA) -> +make_agent_capabilities(Name, ProdRel, Status, Desc, Ref, Mods, NA) -> + #mc_agent_capabilities{name = Name, + product_release = ProdRel, + status = Status, + description = Desc, + reference = Ref, + modules = Mods, + name_assign = NA}. + +make_ac_variation(Name, + undefined = _Syntax, + undefined = _WriteSyntax, + Access, + undefined = _Creation, + undefined = _DefVal, + Desc) -> +%% io:format("make_ac_variation -> entry with" +%% "~n Name: ~p" +%% "~n Access: ~p" +%% "~n Desc: ~p" +%% "~n", [Name, Access, Desc]), + #mc_ac_notification_variation{name = Name, + access = Access, + description = Desc}; + +make_ac_variation(Name, Syntax, WriteSyntax, Access, Creation, DefVal, Desc) -> +%% io:format("make_ac_variation -> entry with" +%% "~n Name: ~p" +%% "~n Syntax: ~p" +%% "~n WriteSyntax: ~p" +%% "~n Access: ~p" +%% "~n Creation: ~p" +%% "~n DefVal: ~p" +%% "~n Desc: ~p" +%% "~n", [Name, Syntax, WriteSyntax, Access, Creation, DefVal, Desc]), + #mc_ac_object_variation{name = Name, + syntax = Syntax, + write_syntax = WriteSyntax, + access = Access, + creation = Creation, + default_value = DefVal, + description = Desc}. + +make_ac_module(Name, Grps, Var) -> + #mc_ac_module{name = Name, + groups = Grps, + variation = Var}. + + +make_module_compliance(Name, Status, Desc, Ref, Mods, NA) -> #mc_module_compliance{name = Name, status = Status, description = Desc, reference = Ref, - module = Mod, + modules = Mods, name_assign = NA}. +make_mc_module(Name, Mand, Compl) -> + #mc_mc_module{name = Name, + mandatory = Mand, + compliance = Compl}. + +make_mc_compliance_group(Name, Desc) -> + #mc_mc_compliance_group{name = Name, + description = Desc}. + +make_mc_object(Name, Syntax, WriteSyntax, Access, Desc) -> + #mc_mc_object{name = Name, + syntax = Syntax, + write_syntax = WriteSyntax, + access = Access, + description = Desc}. + make_object_group(Name, Objs, Status, Desc, Ref, NA) -> #mc_object_group{name = Name, objects = Objs, @@ -968,6 +1158,12 @@ filter_v2imports(_,Type) -> {type, Type}. w(F, A) -> ?vwarning(F, A). -%i(F, A) -> -% io:format("~w:" ++ F ++ "~n", [?MODULE|A]). +lreverse(_Tag, L) when is_list(L) -> + lists:reverse(L); +lreverse(Tag, X) -> + exit({bad_list, Tag, X}). + + +%% i(F, A) -> +%% io:format("~w:" ++ F ++ "~n", [?MODULE|A]). diff --git a/lib/snmp/src/compile/snmpc_tok.erl b/lib/snmp/src/compile/snmpc_tok.erl index 6b99e7ae43..e238b256d0 100644 --- a/lib/snmp/src/compile/snmpc_tok.erl +++ b/lib/snmp/src/compile/snmpc_tok.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -37,6 +37,8 @@ -export([null_get_line/0, format_error/1, terminate/2, handle_call/3, init/1, test/0]). +-include("snmpc_lib.hrl"). + %%---------------------------------------------------------------------- %% Reserved_words: list of KeyWords. Example: ['IF', 'BEGIN', ..., 'GOTO'] @@ -130,6 +132,10 @@ test() -> 'current','deprecated','not-accessible','obsolete', 'read-create','read-only','read-write', 'IMPORTS', 'FROM', 'MODULE-COMPLIANCE', + 'AGENT-CAPABILITIES', + 'PRODUCT-RELEASE', + 'SUPPORTS', + 'INCLUDES', 'DisplayString', 'PhysAddress', 'MacAddress', @@ -225,6 +231,7 @@ get_all_tokens(Str,Toks) -> case catch tokenise(Str) of {error, ErrorInfo} -> {error, ErrorInfo}; {Token, RestChars} when is_tuple(Token) -> + %% ?vtrace("get_all_tokens -> Token: ~p", [Token]), get_all_tokens(RestChars, [Token|Toks]) end. diff --git a/lib/snmp/test/klas3.erl b/lib/snmp/test/klas3.erl index a5ce2af8c5..ec78d19dbb 100644 --- a/lib/snmp/test/klas3.erl +++ b/lib/snmp/test/klas3.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 diff --git a/lib/snmp/test/modules.mk b/lib/snmp/test/modules.mk index 6a0c3e9481..eacc749b53 100644 --- a/lib/snmp/test/modules.mk +++ b/lib/snmp/test/modules.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2004-2010. All Rights Reserved. +# Copyright Ericsson AB 2004-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 @@ -62,6 +62,8 @@ COMPILER_MIB_FILES = \ OTP8574-MIB MIB_FILES = \ + AC-TEST-MIB.mib \ + MC-TEST-MIB.mib \ OLD-SNMPEA-MIB.mib \ OLD-SNMPEA-MIB-v2.mib \ Klas1.mib \ diff --git a/lib/snmp/test/sa.erl b/lib/snmp/test/sa.erl index ad3ccce08f..fee50c0e8c 100644 --- a/lib/snmp/test/sa.erl +++ b/lib/snmp/test/sa.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 diff --git a/lib/snmp/test/snmp.cover b/lib/snmp/test/snmp.cover index 027dce68c1..a2e7dd978f 100644 --- a/lib/snmp/test/snmp.cover +++ b/lib/snmp/test/snmp.cover @@ -1,5 +1,7 @@ %% -*- erlang -*- -{exclude, +{incl_app,snmp,details}. + +{excl_mods,snmp, [snmp_index, snmpa_error_io, snmpa_authentication_service, diff --git a/lib/snmp/test/snmp.spec b/lib/snmp/test/snmp.spec index 0af52c139e..88ae0145f0 100644 --- a/lib/snmp/test/snmp.spec +++ b/lib/snmp/test/snmp.spec @@ -1 +1 @@ -{topcase, {dir, "../snmp_test"}}. +{suites,"../snmp_test",all}. diff --git a/lib/snmp/test/snmp_SUITE.erl b/lib/snmp/test/snmp_SUITE.erl index f560e36663..b6d72da2fa 100644 --- a/lib/snmp/test/snmp_SUITE.erl +++ b/lib/snmp/test/snmp_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -19,27 +19,14 @@ -module(snmp_SUITE). --export([all/1, - init_per_testcase/2, fin_per_testcase/2 +-export([all/0, + suite/0, + groups/0, + init_per_suite/1, end_per_suite/1, + init_per_group/2, end_per_group/2, + init_per_testcase/2, end_per_testcase/2 ]). --export([app/1, compiler/1, misc/1, agent/1, manager/1]). - --export([ - app_test/1, - appup_test/1, - compiler_test/1, - conf_test/1, - pdus_test/1, - log_test/1, - note_store_test/1, - mibs_test/1, - nfilter_test/1, - agent_test/1, - manager_config_test/1, - manager_user_test/1, - manager_test/1 - ]). %% %% ----- @@ -48,110 +35,60 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(doc) -> - ["Test suites for the snmp application.", - "There are eight different sub test-suites."]; - -all(suite) -> - [ - app, - compiler, - misc, - agent, - manager - - ]. - -app(suite) -> - [ - app_test, - appup_test - ]. - -compiler(suite) -> - [ - compiler_test - ]. - -misc(suite) -> - [ - conf_test, - pdus_test, - log_test, - note_store_test - ]. - -agent(suite) -> - [ - mibs_test, - nfilter_test, - agent_test - ]. - -manager(suite) -> - [ - manager_config_test, - manager_user_test, - manager_test - ]. - - -app_test(suite) -> - [{snmp_app_test, all}]. - - -appup_test(suite) -> - [{snmp_appup_test, all}]. - - -compiler_test(suite) -> - [{snmp_compiler_test, all}]. - - -conf_test(suite) -> - [{snmp_conf_test, all}]. - - -pdus_test(suite) -> - [{snmp_pdus_test, all}]. - - -log_test(suite) -> - [{snmp_log_test, all}]. - - -note_store_test(suite) -> - [{snmp_note_store_test, all}]. - - -mibs_test(suite) -> - [{snmp_agent_mibs_test, all}]. - - -nfilter_test(suite) -> - [{snmp_agent_nfilter_test, all}]. - - -agent_test(suite) -> - [{snmp_agent_test, all}]. - - -manager_config_test(suite) -> - [{snmp_manager_config_test, all}]. - - -manager_user_test(suite) -> - [{snmp_manager_user_test, all}]. +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [{group, app}, + {group, compiler}, + {group, misc}, + {group, agent}, + {group, manager}]. + +groups() -> + [{app, [], [{group, app_test}, + {group, appup_test}]}, + {compiler, [], [{group, compiler_test}]}, + {misc, [], [{group, conf_test}, + {group, pdus_test}, + {group, log_test}, + {group, note_store_test}]}, + {agent, [], [{group, mibs_test}, + {group, nfilter_test}, + {group, agent_test}]}, + {manager, [], [{group, manager_config_test}, + {group, manager_user_test}, + {group, manager_test}]}, + {app_test, [], [{snmp_app_test, all}]}, + {appup_test, [], [{snmp_appup_test, all}]}, + {compiler_test, [], [{snmp_compiler_test, all}]}, + {conf_test, [], [{snmp_conf_test, all}]}, + {pdus_test, [], [{snmp_pdus_test, all}]}, + {log_test, [], [{snmp_log_test, all}]}, + {note_store_test, [], [{snmp_note_store_test, all}]}, + {mibs_test, [], [{snmp_agent_mibs_test, all}]}, + {nfilter_test, [], [{snmp_agent_nfilter_test, all}]}, + {agent_test, [], [{snmp_agent_test, all}]}, + {manager_config_test, [], [{snmp_manager_config_test, all}]}, + {manager_user_test, [], [{snmp_manager_user_test, all}]}, + {manager_test, [], [{snmp_manager_test, all}]}]. + +init_per_suite(Config) -> + Config. +end_per_suite(_Config) -> + ok. -manager_test(suite) -> - [{snmp_manager_test, all}]. +init_per_group(_GroupName, Config) -> + Config. +end_per_group(_GroupName, Config) -> + Config. diff --git a/lib/snmp/test/snmp_agent_bl_test.erl b/lib/snmp/test/snmp_agent_bl_test.erl index 4608d90201..b17489a755 100644 --- a/lib/snmp/test/snmp_agent_bl_test.erl +++ b/lib/snmp/test/snmp_agent_bl_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -89,7 +89,7 @@ init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. diff --git a/lib/snmp/test/snmp_agent_mibs_test.erl b/lib/snmp/test/snmp_agent_mibs_test.erl index 5f1ff53a79..3e48130fac 100644 --- a/lib/snmp/test/snmp_agent_mibs_test.erl +++ b/lib/snmp/test/snmp_agent_mibs_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -26,7 +26,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/include/snmp_types.hrl"). -include_lib("snmp/include/SNMP-COMMUNITY-MIB.hrl"). @@ -39,12 +39,12 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, - init_all/1, finish_all/1, + all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + init_per_suite/1, end_per_suite/1, start_and_stop/1, - size_check/1, + size_check_ets/1, size_check_dets/1, size_check_mnesia/1, @@ -58,8 +58,6 @@ %%---------------------------------------------------------------------- %% Internal exports %%---------------------------------------------------------------------- --export([ - ]). %%---------------------------------------------------------------------- %% Macros @@ -100,20 +98,20 @@ init_per_testcase(cache_test, Config) when is_list(Config) -> init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(size_check_dets, Config) when is_list(Config) -> +end_per_testcase(size_check_dets, Config) when is_list(Config) -> Dir = ?config(dets_dir, Config), ?line ok = ?DEL_DIR(Dir), lists:keydelete(dets_dir, 1, Config); -fin_per_testcase(size_check_mnesia, Config) when is_list(Config) -> +end_per_testcase(size_check_mnesia, Config) when is_list(Config) -> mnesia_stop(), Dir = ?config(mnesia_dir, Config), ?line ok = ?DEL_DIR(Dir), lists:keydelete(mnesia_dir, 1, Config); -fin_per_testcase(cache_test, Config) when is_list(Config) -> +end_per_testcase(cache_test, Config) when is_list(Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), Config; -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. @@ -121,20 +119,25 @@ fin_per_testcase(_Case, Config) when is_list(Config) -> %% Test case definitions %%====================================================================== -all(suite) -> - {conf, init_all, cases(), finish_all}. +all() -> +cases(). + +groups() -> + [{size_check, [], + [size_check_ets, size_check_dets, size_check_mnesia]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -cases() -> - [ - start_and_stop, - load_unload, - size_check, - me_lookup, - which_mib, - cache_test - ]. +cases() -> +[start_and_stop, load_unload, {group, size_check}, + me_lookup, which_mib, cache_test]. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> %% Data dir points wrong DataDir0 = ?config(data_dir, Config), DataDir1 = filename:split(filename:absname(DataDir0)), @@ -142,7 +145,7 @@ init_all(Config) when is_list(Config) -> DataDir = filename:join(lists:reverse(DataDir2) ++ [?snmp_test_data]), [{snmp_data_dir, DataDir ++ "/"}|Config]. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> lists:keydelete(snmp_data_dir, 1, Config). @@ -217,12 +220,6 @@ load_unload(Config) when is_list(Config) -> %% --------------------------------------------------------------------- -size_check(suite) -> - [ - size_check_ets, - size_check_dets, - size_check_mnesia - ]. size_check_ets(suite) -> []; diff --git a/lib/snmp/test/snmp_agent_ms_test.erl b/lib/snmp/test/snmp_agent_ms_test.erl index 3a3a790e6a..1f34f1c8d1 100644 --- a/lib/snmp/test/snmp_agent_ms_test.erl +++ b/lib/snmp/test/snmp_agent_ms_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -83,39 +83,165 @@ _ -> V3 end). -all(suite) -> {req, - [mnesia, distribution, - {local_slave_nodes, 2}, {time, 360}], - [{conf, init_all, cases(), finish_all}]}. +all() -> +[cases()]. + +groups() -> + [{mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {test_v1, [], v1_cases()}, {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets, [], [{group, otp_4394}]}, + {otp_4394, [], [otp_4394_test]}]. + +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - app_info, - test_v1, test_v2, test_v1_v2, - test_multi_threaded, - mib_storage, - tickets]; - _Else -> - [ - app_info, - test_v1, test_v2, test_v1_v2, test_v3, - test_multi_threaded, - mib_storage, - tickets - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets}]; + _Else -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets}] +end. %%%----------------------------------------------------------------- @@ -460,144 +586,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -1099,20 +1137,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [simple, - db_notify_client, - v1_processing, big, big2, loop_mib, - api, subagent, mnesia, multiple_reqs, - sa_register, v1_trap, sa_error, next_across_sa, undo, reported_bugs, - standard_mibs, sparse_table, cnt_64, - opaque, - % opaque]. - - change_target_addr_config]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1129,15 +1161,15 @@ finish_v1(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. %v2_cases() -> [loop_mib_2]; -v2_cases() -> - [simple_2, v2_processing, big_2, big2_2, loop_mib_2, - api_2, subagent_2, mnesia_2, - multiple_reqs_2, sa_register_2, v2_trap, v2_inform, sa_error_2, - next_across_sa_2, undo_2, reported_bugs_2, standard_mibs_2, - v2_types, implied, sparse_table_2, cnt_64_2, opaque_2, v2_caps]. +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1154,10 +1186,9 @@ finish_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1174,16 +1205,16 @@ finish_v1_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. %v3_cases() -> [loop_mib_3]; -v3_cases() -> - [simple_3, v3_processing, - big_3, big2_3, api_3, subagent_3, mnesia_3, loop_mib_3, - multiple_reqs_3, sa_register_3, v3_trap, v3_inform, sa_error_3, - next_across_sa_3, undo_3, reported_bugs_3, standard_mibs_3, - v3_security, - v2_types_3, implied_3, sparse_table_3, cnt_64_3, opaque_3, v2_caps_3]. +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1221,10 +1252,9 @@ finish_v3(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1739,21 +1769,19 @@ mnesia_2(X) -> mnesia(X). mnesia_3(X) -> mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1939,8 +1967,6 @@ v2_trap(Config) when list(Config) -> v3_trap(X) -> v2_trap(X). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2112,7 +2138,6 @@ v3_processing(Config) when list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> [v3_crypto_basic, v3_md5_auth, v3_sha_auth, v3_des_priv]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -3591,22 +3616,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [snmp_standard_mib, snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, snmp_notification_mib, - snmp_view_based_acm_mib]. - -standard_mibs_2(suite) -> - [snmpv2_mib_2, snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, snmp_notification_mib_2, - snmp_view_based_acm_mib_2]. - -standard_mibs_3(suite) -> - [snmpv2_mib_3,snmp_framework_mib_3, snmp_mpd_mib_3, - snmp_target_mib_3, snmp_notification_mib_3, - snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -4527,27 +4538,12 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [otp_1128, otp_1129, otp_1131, otp_1162, - otp_1222, otp_1298, otp_1331, otp_1338, - otp_1342, otp_2776, otp_2979, otp_3187, otp_3725]. -reported_bugs_2(suite) -> - [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, - otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, - otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]. -reported_bugs_3(suite) -> - [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, - otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, - otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, - otp_3542]. %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets(suite) -> - [otp_4394]. %%----------------------------------------------------------------- %% Ticket: OTP-1128 @@ -4971,10 +4967,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when list(Config) -> ?DBG("init_otp_4394 -> entry with" diff --git a/lib/snmp/test/snmp_agent_mt_test.erl b/lib/snmp/test/snmp_agent_mt_test.erl index 8d5a57f58d..4f125c0017 100644 --- a/lib/snmp/test/snmp_agent_mt_test.erl +++ b/lib/snmp/test/snmp_agent_mt_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -83,39 +83,165 @@ _ -> V3 end). -all(suite) -> {req, - [mnesia, distribution, - {local_slave_nodes, 2}, {time, 360}], - [{conf, init_all, cases(), finish_all}]}. +all() -> +[cases()]. + +groups() -> + [{mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {test_v1, [], v1_cases()}, {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets, [], [{group, otp_4394}]}, + {otp_4394, [], [otp_4394_test]}]. + +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - app_info, - test_v1, test_v2, test_v1_v2, - test_multi_threaded, - mib_storage, - tickets]; - _Else -> - [ - app_info, - test_v1, test_v2, test_v1_v2, test_v3, - test_multi_threaded, - mib_storage, - tickets - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets}]; + _Else -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets}] +end. %%%----------------------------------------------------------------- @@ -460,144 +586,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -1099,20 +1137,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [simple, - db_notify_client, - v1_processing, big, big2, loop_mib, - api, subagent, mnesia, multiple_reqs, - sa_register, v1_trap, sa_error, next_across_sa, undo, reported_bugs, - standard_mibs, sparse_table, cnt_64, - opaque, - % opaque]. - - change_target_addr_config]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1129,15 +1161,15 @@ finish_v1(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. %v2_cases() -> [loop_mib_2]; -v2_cases() -> - [simple_2, v2_processing, big_2, big2_2, loop_mib_2, - api_2, subagent_2, mnesia_2, - multiple_reqs_2, sa_register_2, v2_trap, v2_inform, sa_error_2, - next_across_sa_2, undo_2, reported_bugs_2, standard_mibs_2, - v2_types, implied, sparse_table_2, cnt_64_2, opaque_2, v2_caps]. +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1154,10 +1186,9 @@ finish_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1174,16 +1205,16 @@ finish_v1_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. %v3_cases() -> [loop_mib_3]; -v3_cases() -> - [simple_3, v3_processing, - big_3, big2_3, api_3, subagent_3, mnesia_3, loop_mib_3, - multiple_reqs_3, sa_register_3, v3_trap, v3_inform, sa_error_3, - next_across_sa_3, undo_3, reported_bugs_3, standard_mibs_3, - v3_security, - v2_types_3, implied_3, sparse_table_3, cnt_64_3, opaque_3, v2_caps_3]. +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1221,10 +1252,9 @@ finish_v3(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1739,21 +1769,19 @@ mnesia_2(X) -> mnesia(X). mnesia_3(X) -> mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1939,8 +1967,6 @@ v2_trap(Config) when list(Config) -> v3_trap(X) -> v2_trap(X). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2112,7 +2138,6 @@ v3_processing(Config) when list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> [v3_crypto_basic, v3_md5_auth, v3_sha_auth, v3_des_priv]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -3591,22 +3616,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [snmp_standard_mib, snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, snmp_notification_mib, - snmp_view_based_acm_mib]. - -standard_mibs_2(suite) -> - [snmpv2_mib_2, snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, snmp_notification_mib_2, - snmp_view_based_acm_mib_2]. - -standard_mibs_3(suite) -> - [snmpv2_mib_3,snmp_framework_mib_3, snmp_mpd_mib_3, - snmp_target_mib_3, snmp_notification_mib_3, - snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -4527,27 +4538,12 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [otp_1128, otp_1129, otp_1131, otp_1162, - otp_1222, otp_1298, otp_1331, otp_1338, - otp_1342, otp_2776, otp_2979, otp_3187, otp_3725]. -reported_bugs_2(suite) -> - [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, - otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, - otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]. -reported_bugs_3(suite) -> - [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, - otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, - otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, - otp_3542]. %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets(suite) -> - [otp_4394]. %%----------------------------------------------------------------- %% Ticket: OTP-1128 @@ -4971,10 +4967,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when list(Config) -> ?DBG("init_otp_4394 -> entry with" diff --git a/lib/snmp/test/snmp_agent_nfilter_test.erl b/lib/snmp/test/snmp_agent_nfilter_test.erl index 269c7c96c9..f08060cee3 100644 --- a/lib/snmp/test/snmp_agent_nfilter_test.erl +++ b/lib/snmp/test/snmp_agent_nfilter_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). @@ -33,8 +33,8 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2 + all/0, + init_per_testcase/2, end_per_testcase/2 ]). %%---------------------------------------------------------------------- @@ -58,14 +58,14 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%====================================================================== %% Test case definitions %%====================================================================== -all(_) -> - ?SKIP(not_yet_implemented). +all() -> + {skip,not_yet_implemented}. %%====================================================================== diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl index 9d2e9969c4..692d29fda0 100644 --- a/lib/snmp/test/snmp_agent_test.erl +++ b/lib/snmp/test/snmp_agent_test.erl @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -85,18 +85,171 @@ end). -all(suite) -> - Reqs = [mnesia, distribution, {local_slave_nodes, 2}, {time, 360}], - Conf1 = [{conf, init_all, cases(), finish_all}], - Conf2 = [tickets2], - {req, Reqs, Conf1 ++ Conf2}. +all() -> + Reqs = [mnesia, distribution, {local_slave_nodes, 2}, + {time, 360}], + Conf1 = [{group, all_tcs}], + Conf2 = [{group, tickets2}], + Conf1 ++ Conf2. + +groups() -> + [{all_tcs, [], cases()}, + {mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {misc, [], misc_cases()}, {test_v1, [], v1_cases()}, + {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets1, [], [{group, otp_4394}, {group, otp_7157}]}, + {tickets2, [], [otp8395]}, + {otp_4394, [], [otp_4394_test]}, + {otp_7157, [], + begin Reqs = [], Conf = [otp_7157_test], Conf end}]. + +init_per_group(all_tcs, Config) -> + init_all(Config); +init_per_group(otp_7157, Config) -> + init_otp_7157(Config); +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(misc, Config) -> + init_misc(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(all_tcs, Config) -> + finish_all(Config); +end_per_group(otp_7157, Config) -> + finish_otp_7157(Config); +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(misc, Config) -> + finish_misc(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(otp8395 = Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [Case, Config]), - Config2 = init_per_testcase2(Case, init_suite(Config)), + Config2 = init_per_testcase2(Case, init_per_suite(Config)), otp8395({init, Config2}); init_per_testcase(otp_7157_test = _Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" @@ -123,10 +276,10 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Dog = ?WD_START(?MINS(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(otp8395, Config) when is_list(Config) -> +end_per_testcase(otp8395, Config) when is_list(Config) -> otp8395({fin, Config}); -fin_per_testcase(_Case, Config) when is_list(Config) -> - ?DBG("fin_per_testcase -> entry with" +end_per_testcase(_Case, Config) when is_list(Config) -> + ?DBG("end_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [_Case, Config]), Dog = ?config(watchdog, Config), @@ -134,8 +287,8 @@ fin_per_testcase(_Case, Config) when is_list(Config) -> Config. -init_suite(Config) -> - ?DBG("init_suite -> entry with" +init_per_suite(Config) -> + ?DBG("init_per_suite -> entry with" "~n Config: ~p", [Config]), %% Suite root dir for test suite @@ -170,12 +323,12 @@ init_suite(Config) -> {mib_dir, MibDir}, {std_mib_dir, StdMibDir} | Config1], - ?DBG("init_suite -> done when" + ?DBG("init_per_suite -> done when" "~n Config2: ~p", [Config2]), Config2. %% end_per_suite(Config) -> -end_suite(Config) -> +end_per_suite(Config) -> Config. fix_data_dir(Config) -> @@ -220,35 +373,22 @@ init_per_testcase2(Case, Config) -> {sub_agent_top_dir, SubAgentTopDir}, {manager_top_dir, ManagerTopDir} | Config]. -fin_per_testcase2(_Case, Config) -> +end_per_testcase2(_Case, Config) -> Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - misc, - test_v1, - test_v2, - test_v1_v2, - test_multi_threaded, - mib_storage, - tickets1 - ]; - _Else -> - [ - misc, - test_v1, - test_v2, - test_v1_v2, - test_v3, - test_multi_threaded, - mib_storage, - tickets1 - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [{group, misc}, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets1}]; + _Else -> + [{group, misc}, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets1}] +end. %%%----------------------------------------------------------------- @@ -355,144 +495,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when is_list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -975,8 +1027,6 @@ mib_of(Oid, ExpectedMibName) -> end. -misc(suite) -> - {req, [], {conf, init_misc, misc_cases(), finish_misc}}. init_misc(Config) -> init_v1(Config). @@ -984,11 +1034,8 @@ init_misc(Config) -> finish_misc(Config) -> finish_v1(Config). -misc_cases() -> - [ - app_info, - info_test - ]. +misc_cases() -> +[app_info, info_test]. app_info(suite) -> []; app_info(Config) when is_list(Config) -> @@ -1021,34 +1068,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [ - simple, - db_notify_client, - v1_processing, - big, - big2, - loop_mib, - api, - subagent, - mnesia, - multiple_reqs, - sa_register, - v1_trap, - sa_error, - next_across_sa, - undo, - reported_bugs, - standard_mibs, - sparse_table, - cnt_64, - opaque, - - change_target_addr_config - ]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when is_list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1065,34 +1092,14 @@ finish_v1(Config) when is_list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. - -v2_cases() -> - [ - simple_2, - v2_processing, - big_2, - big2_2, - loop_mib_2, - api_2, - subagent_2, - mnesia_2, - multiple_reqs_2, - sa_register_2, - v2_trap, - v2_inform, - sa_error_2, - next_across_sa_2, - undo_2, - reported_bugs_2, - standard_mibs_2, - v2_types, - implied, - sparse_table_2, - cnt_64_2, - opaque_2, - v2_caps - ]. + +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when is_list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1109,11 +1116,9 @@ finish_v2(Config) when is_list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> - {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when is_list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1130,35 +1135,15 @@ finish_v1_v2(Config) when is_list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. - -v3_cases() -> - [ - simple_3, - v3_processing, - big_3, - big2_3, - api_3, - subagent_3, - mnesia_3, - loop_mib_3, - multiple_reqs_3, - sa_register_3, - v3_trap, - v3_inform, - sa_error_3, - next_across_sa_3, - undo_3, - reported_bugs_3, - standard_mibs_3, - v3_security, - v2_types_3, - implied_3, - sparse_table_3, - cnt_64_3, - opaque_3, - v2_caps_3 - ]. + +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when is_list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1196,11 +1181,9 @@ finish_v3(Config) when is_list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> - {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when is_list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1690,21 +1673,19 @@ mnesia_2(X) -> ?P(mnesia_2), mnesia(X). mnesia_3(X) -> ?P(mnesia_3), mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1929,8 +1910,6 @@ v3_trap(Config) when is_list(Config) -> ?P(v3_trap), trap2(Config). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2190,13 +2169,6 @@ v3_processing(Config) when is_list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> - [ - v3_crypto_basic, - v3_md5_auth, - v3_sha_auth, - v3_des_priv - ]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -4044,36 +4016,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [ - snmp_standard_mib, - snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, - snmp_notification_mib, - snmp_view_based_acm_mib - ]. - -standard_mibs_2(suite) -> - [ - snmpv2_mib_2, - snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, - snmp_notification_mib_2, - snmp_view_based_acm_mib_2 - ]. - -standard_mibs_3(suite) -> - [ - snmpv2_mib_3, - snmp_framework_mib_3, - snmp_mpd_mib_3, - snmp_target_mib_3, - snmp_notification_mib_3, - snmp_view_based_acm_mib_3, - snmp_user_based_sm_mib_3 - ]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -5117,70 +5061,14 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [ - otp_1128, - otp_1129, - otp_1131, - otp_1162, - otp_1222, - otp_1298, - otp_1331, - otp_1338, - otp_1342, - otp_2776, - otp_2979, - otp_3187, - otp_3725 - ]. - -reported_bugs_2(suite) -> - [ - otp_1128_2, - otp_1129_2, - otp_1131_2, - otp_1162_2, - otp_1222_2, - otp_1298_2, - otp_1331_2, - otp_1338_2, - otp_1342_2, - otp_2776_2, - otp_2979_2, - otp_3187_2 - ]. - -reported_bugs_3(suite) -> - [ - otp_1128_3, - otp_1129_3, - otp_1131_3, - otp_1162_3, - otp_1222_3, - otp_1298_3, - otp_1331_3, - otp_1338_3, - otp_1342_3, - otp_2776_3, - otp_2979_3, - otp_3187_3, - otp_3542 - ]. + + %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets1(suite) -> - [ - otp_4394, - otp_7157 - ]. -tickets2(suite) -> - [ - otp8395 - ]. @@ -5661,10 +5549,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when is_list(Config) -> ?DBG("init_otp_4394 -> entry with" @@ -5758,10 +5642,6 @@ otp_4394_test1() -> %%----------------------------------------------------------------- -otp_7157(suite) -> - Reqs = [], - Conf = [{conf, init_otp_7157, [otp_7157_test], finish_otp_7157}], - {req, Reqs, Conf}. init_otp_7157(Config) when is_list(Config) -> %% <CONDITIONAL-SKIP> diff --git a/lib/snmp/test/snmp_agent_v1_test.erl b/lib/snmp/test/snmp_agent_v1_test.erl index 52ac6cf58f..737bb25cc3 100644 --- a/lib/snmp/test/snmp_agent_v1_test.erl +++ b/lib/snmp/test/snmp_agent_v1_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -103,7 +103,7 @@ init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. diff --git a/lib/snmp/test/snmp_agent_v2_test.erl b/lib/snmp/test/snmp_agent_v2_test.erl index eca66dc30d..dc94c18ad9 100644 --- a/lib/snmp/test/snmp_agent_v2_test.erl +++ b/lib/snmp/test/snmp_agent_v2_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -83,39 +83,165 @@ _ -> V3 end). -all(suite) -> {req, - [mnesia, distribution, - {local_slave_nodes, 2}, {time, 360}], - [{conf, init_all, cases(), finish_all}]}. +all() -> +[cases()]. + +groups() -> + [{mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {test_v1, [], v1_cases()}, {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets, [], [{group, otp_4394}]}, + {otp_4394, [], [otp_4394_test]}]. + +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - app_info, - test_v1, test_v2, test_v1_v2, - test_multi_threaded, - mib_storage, - tickets]; - _Else -> - [ - app_info, - test_v1, test_v2, test_v1_v2, test_v3, - test_multi_threaded, - mib_storage, - tickets - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets}]; + _Else -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets}] +end. %%%----------------------------------------------------------------- @@ -460,144 +586,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -1099,20 +1137,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [simple, - db_notify_client, - v1_processing, big, big2, loop_mib, - api, subagent, mnesia, multiple_reqs, - sa_register, v1_trap, sa_error, next_across_sa, undo, reported_bugs, - standard_mibs, sparse_table, cnt_64, - opaque, - % opaque]. - - change_target_addr_config]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1129,15 +1161,15 @@ finish_v1(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. %v2_cases() -> [loop_mib_2]; -v2_cases() -> - [simple_2, v2_processing, big_2, big2_2, loop_mib_2, - api_2, subagent_2, mnesia_2, - multiple_reqs_2, sa_register_2, v2_trap, v2_inform, sa_error_2, - next_across_sa_2, undo_2, reported_bugs_2, standard_mibs_2, - v2_types, implied, sparse_table_2, cnt_64_2, opaque_2, v2_caps]. +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1154,10 +1186,9 @@ finish_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1174,16 +1205,16 @@ finish_v1_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. %v3_cases() -> [loop_mib_3]; -v3_cases() -> - [simple_3, v3_processing, - big_3, big2_3, api_3, subagent_3, mnesia_3, loop_mib_3, - multiple_reqs_3, sa_register_3, v3_trap, v3_inform, sa_error_3, - next_across_sa_3, undo_3, reported_bugs_3, standard_mibs_3, - v3_security, - v2_types_3, implied_3, sparse_table_3, cnt_64_3, opaque_3, v2_caps_3]. +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1221,10 +1252,9 @@ finish_v3(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1739,21 +1769,19 @@ mnesia_2(X) -> mnesia(X). mnesia_3(X) -> mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1939,8 +1967,6 @@ v2_trap(Config) when list(Config) -> v3_trap(X) -> v2_trap(X). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2112,7 +2138,6 @@ v3_processing(Config) when list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> [v3_crypto_basic, v3_md5_auth, v3_sha_auth, v3_des_priv]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -3591,22 +3616,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [snmp_standard_mib, snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, snmp_notification_mib, - snmp_view_based_acm_mib]. - -standard_mibs_2(suite) -> - [snmpv2_mib_2, snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, snmp_notification_mib_2, - snmp_view_based_acm_mib_2]. - -standard_mibs_3(suite) -> - [snmpv2_mib_3,snmp_framework_mib_3, snmp_mpd_mib_3, - snmp_target_mib_3, snmp_notification_mib_3, - snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -4527,27 +4538,12 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [otp_1128, otp_1129, otp_1131, otp_1162, - otp_1222, otp_1298, otp_1331, otp_1338, - otp_1342, otp_2776, otp_2979, otp_3187, otp_3725]. -reported_bugs_2(suite) -> - [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, - otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, - otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]. -reported_bugs_3(suite) -> - [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, - otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, - otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, - otp_3542]. %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets(suite) -> - [otp_4394]. %%----------------------------------------------------------------- %% Ticket: OTP-1128 @@ -4971,10 +4967,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when list(Config) -> ?DBG("init_otp_4394 -> entry with" diff --git a/lib/snmp/test/snmp_agent_v3_test.erl b/lib/snmp/test/snmp_agent_v3_test.erl index 823c914136..266be72878 100644 --- a/lib/snmp/test/snmp_agent_v3_test.erl +++ b/lib/snmp/test/snmp_agent_v3_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -83,39 +83,165 @@ _ -> V3 end). -all(suite) -> {req, - [mnesia, distribution, - {local_slave_nodes, 2}, {time, 360}], - [{conf, init_all, cases(), finish_all}]}. +all() -> +[cases()]. + +groups() -> + [{mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {test_v1, [], v1_cases()}, {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets, [], [{group, otp_4394}]}, + {otp_4394, [], [otp_4394_test]}]. + +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - app_info, - test_v1, test_v2, test_v1_v2, - test_multi_threaded, - mib_storage, - tickets]; - _Else -> - [ - app_info, - test_v1, test_v2, test_v1_v2, test_v3, - test_multi_threaded, - mib_storage, - tickets - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets}]; + _Else -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets}] +end. %%%----------------------------------------------------------------- @@ -460,144 +586,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -1099,20 +1137,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [simple, - db_notify_client, - v1_processing, big, big2, loop_mib, - api, subagent, mnesia, multiple_reqs, - sa_register, v1_trap, sa_error, next_across_sa, undo, reported_bugs, - standard_mibs, sparse_table, cnt_64, - opaque, - % opaque]. - - change_target_addr_config]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1129,15 +1161,15 @@ finish_v1(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. %v2_cases() -> [loop_mib_2]; -v2_cases() -> - [simple_2, v2_processing, big_2, big2_2, loop_mib_2, - api_2, subagent_2, mnesia_2, - multiple_reqs_2, sa_register_2, v2_trap, v2_inform, sa_error_2, - next_across_sa_2, undo_2, reported_bugs_2, standard_mibs_2, - v2_types, implied, sparse_table_2, cnt_64_2, opaque_2, v2_caps]. +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1154,10 +1186,9 @@ finish_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1174,16 +1205,16 @@ finish_v1_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. %v3_cases() -> [loop_mib_3]; -v3_cases() -> - [simple_3, v3_processing, - big_3, big2_3, api_3, subagent_3, mnesia_3, loop_mib_3, - multiple_reqs_3, sa_register_3, v3_trap, v3_inform, sa_error_3, - next_across_sa_3, undo_3, reported_bugs_3, standard_mibs_3, - v3_security, - v2_types_3, implied_3, sparse_table_3, cnt_64_3, opaque_3, v2_caps_3]. +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1221,10 +1252,9 @@ finish_v3(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1739,21 +1769,19 @@ mnesia_2(X) -> mnesia(X). mnesia_3(X) -> mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1939,8 +1967,6 @@ v2_trap(Config) when list(Config) -> v3_trap(X) -> v2_trap(X). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2112,7 +2138,6 @@ v3_processing(Config) when list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> [v3_crypto_basic, v3_md5_auth, v3_sha_auth, v3_des_priv]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -3591,22 +3616,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [snmp_standard_mib, snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, snmp_notification_mib, - snmp_view_based_acm_mib]. - -standard_mibs_2(suite) -> - [snmpv2_mib_2, snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, snmp_notification_mib_2, - snmp_view_based_acm_mib_2]. - -standard_mibs_3(suite) -> - [snmpv2_mib_3,snmp_framework_mib_3, snmp_mpd_mib_3, - snmp_target_mib_3, snmp_notification_mib_3, - snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -4527,27 +4538,12 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [otp_1128, otp_1129, otp_1131, otp_1162, - otp_1222, otp_1298, otp_1331, otp_1338, - otp_1342, otp_2776, otp_2979, otp_3187, otp_3725]. -reported_bugs_2(suite) -> - [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, - otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, - otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]. -reported_bugs_3(suite) -> - [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, - otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, - otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, - otp_3542]. %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets(suite) -> - [otp_4394]. %%----------------------------------------------------------------- %% Ticket: OTP-1128 @@ -4971,10 +4967,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when list(Config) -> ?DBG("init_otp_4394 -> entry with" diff --git a/lib/snmp/test/snmp_app_test.erl b/lib/snmp/test/snmp_app_test.erl index 5c5a5285a0..64dd638f83 100644 --- a/lib/snmp/test/snmp_app_test.erl +++ b/lib/snmp/test/snmp_app_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -23,8 +23,9 @@ -module(snmp_app_test). -export([ - all/1, init_suite/1, fin_suite/1, - init_per_testcase/2, fin_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, init_per_suite/1, + end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, fields/1, modules/1, @@ -32,7 +33,7 @@ app_depend/1, undef_funcs/1, - start_and_stop/1, + start_and_stop_empty/1, start_and_stop_with_agent/1, start_and_stop_with_manager/1, @@ -44,25 +45,34 @@ -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - fields, - modules, - exportall, - app_depend, - undef_funcs, - start_and_stop - ], - {conf, init_suite, Cases, fin_suite}. - -init_suite(Config) when is_list(Config) -> +all() -> +Cases = [fields, modules, exportall, app_depend, + undef_funcs, {group, start_and_stop}], + Cases. + +groups() -> + [{start_and_stop, [], + [start_and_stop_empty, start_and_stop_with_agent, + start_and_stop_with_manager, + start_and_stop_with_agent_and_manager, + start_epmty_and_then_agent_and_manager_and_stop, + start_with_agent_and_then_manager_and_stop, + start_with_manager_and_then_agent_and_stop]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) when is_list(Config) -> ?DISPLAY_SUITE_INFO(), PrivDir = ?config(priv_dir, Config), TopDir = filename:join(PrivDir, app), @@ -97,9 +107,9 @@ is_app(App) -> {error, {invalid_format, Error}} end. -fin_suite(suite) -> []; -fin_suite(doc) -> []; -fin_suite(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. @@ -112,7 +122,7 @@ init_per_testcase(undef_funcs, Config) -> init_per_testcase(_Case, Config) -> Config. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Config. @@ -319,16 +329,6 @@ undef_funcs_make_name(App, PostFix) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -start_and_stop(suite) -> - [ - start_and_stop_empty, - start_and_stop_with_agent, - start_and_stop_with_manager, - start_and_stop_with_agent_and_manager, - start_epmty_and_then_agent_and_manager_and_stop, - start_with_agent_and_then_manager_and_stop, - start_with_manager_and_then_agent_and_stop - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/snmp/test/snmp_appup_mgr.erl b/lib/snmp/test/snmp_appup_mgr.erl index 271d6a2847..6648ce9dbe 100644 --- a/lib/snmp/test/snmp_appup_mgr.erl +++ b/lib/snmp/test/snmp_appup_mgr.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 diff --git a/lib/snmp/test/snmp_appup_test.erl b/lib/snmp/test/snmp_appup_test.erl index 18509526cf..b93f960814 100644 --- a/lib/snmp/test/snmp_appup_test.erl +++ b/lib/snmp/test/snmp_appup_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -23,32 +23,40 @@ -module(snmp_appup_test). -export([ - all/1, init_suite/1, fin_suite/1, - init_per_testcase/2, fin_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, init_per_suite/1, + end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, appup_file/1 ]). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("snmp_test_lib.hrl"). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - appup_file - ], - {conf, init_suite, Cases, fin_suite}. +all() -> +Cases = [appup_file], + Cases. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -init_suite(suite) -> []; -init_suite(doc) -> []; -init_suite(Config) when is_list(Config) -> +init_per_suite(suite) -> []; +init_per_suite(doc) -> []; +init_per_suite(Config) when is_list(Config) -> PrivDir = ?config(priv_dir, Config), TopDir = filename:join(PrivDir, appup), case file:make_dir(TopDir) of @@ -76,9 +84,9 @@ file_name(App, Ext) -> filename:join([LibDir, "ebin", atom_to_list(App) ++ Ext]). -fin_suite(suite) -> []; -fin_suite(doc) -> []; -fin_suite(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. @@ -88,7 +96,7 @@ fin_suite(Config) when is_list(Config) -> init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index ad77b01362..2e6020ae7a 100644 --- a/lib/snmp/test/snmp_compiler_test.erl +++ b/lib/snmp/test/snmp_compiler_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -28,7 +28,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/include/snmp_types.hrl"). @@ -37,15 +37,17 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, + all/0, + groups/0, init_per_group/2, end_per_group/2, + init_per_testcase/2, end_per_testcase/2, description/1, oid_conflicts/1, imports/1, module_identity/1, + agent_capabilities/1, + module_compliance/1, - tickets/1, otp_6150/1, otp_8574/1, otp_8595/1 @@ -78,9 +80,9 @@ init_per_testcase(_Case, Config) when is_list(Config) -> MibDir = join(lists:reverse(["snmp_test_data"|RL])), CompDir = join(Dir, "comp_dir/"), ?line ok = file:make_dir(CompDir), - [{comp_dir, CompDir},{mib_dir, MibDir}|Config]. + [{comp_dir, CompDir}, {mib_dir, MibDir} | Config]. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> CompDir = ?config(comp_dir, Config), ?line ok = ?DEL_DIR(CompDir), lists:keydelete(comp_dir, 1, Config). @@ -90,21 +92,27 @@ fin_per_testcase(_Case, Config) when is_list(Config) -> %% Test case definitions %%====================================================================== -all(suite) -> +all() -> [ - description, - oid_conflicts, - imports, + description, + oid_conflicts, + imports, module_identity, - tickets + agent_capabilities, + module_compliance, + {group, tickets} ]. -tickets(suite) -> - [ - otp_6150, - otp_8574, - otp_8595 - ]. +groups() -> + [{tickets, [], [otp_6150, otp_8574, otp_8595]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%====================================================================== @@ -169,6 +177,88 @@ module_identity(Config) when is_list(Config) -> ?SKIP(not_yet_implemented). +agent_capabilities(suite) -> + []; +agent_capabilities(Config) when is_list(Config) -> + put(tname,agent_capabilities), + p("starting with Config: ~p~n", [Config]), + + SnmpPrivDir = code:priv_dir(snmp), + SnmpMibsDir = join(SnmpPrivDir, "mibs"), + OtpMibsPrivDir = code:priv_dir(otp_mibs), + OtpMibsMibsDir = join(OtpMibsPrivDir, "mibs"), + Dir = ?config(mib_dir, Config), + AcMib = join(Dir,"AC-TEST-MIB.mib"), + ?line {ok, MibFile1} = snmpc:compile(AcMib, [options, + version, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib1} = snmp_misc:read_mib(MibFile1), + ?line {ok, MibFile2} = snmpc:compile(AcMib, [options, + version, + agent_capabilities, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib2} = snmp_misc:read_mib(MibFile2), + MEDiff = Mib2#mib.mes -- Mib1#mib.mes, + %% This is a rather pathetic test, but it is somthing... + io:format("agent_capabilities -> " + "~n MEDiff: ~p" + "~n Mib1: ~p" + "~n Mib2: ~p" + "~n", [MEDiff, Mib1, Mib2]), + case length(MEDiff) of + 2 -> + ok; + _BadLen -> + exit({unexpected_mes, MEDiff}) + end, + ok. + + +module_compliance(suite) -> + []; +module_compliance(Config) when is_list(Config) -> + put(tname,module_compliance), + p("starting with Config: ~p~n", [Config]), + + SnmpPrivDir = code:priv_dir(snmp), + SnmpMibsDir = join(SnmpPrivDir, "mibs"), + OtpMibsPrivDir = code:priv_dir(otp_mibs), + OtpMibsMibsDir = join(OtpMibsPrivDir, "mibs"), + Dir = ?config(mib_dir, Config), + AcMib = join(Dir,"MC-TEST-MIB.mib"), + ?line {ok, MibFile1} = snmpc:compile(AcMib, [options, + version, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib1} = snmp_misc:read_mib(MibFile1), + ?line {ok, MibFile2} = snmpc:compile(AcMib, [options, + version, + module_compliance, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib2} = snmp_misc:read_mib(MibFile2), + MEDiff = Mib2#mib.mes -- Mib1#mib.mes, + %% This is a rather pathetic test, but it is somthing... + io:format("agent_capabilities -> " + "~n MEDiff: ~p" + "~n Mib1: ~p" + "~n Mib2: ~p" + "~n", [MEDiff, Mib1, Mib2]), + case length(MEDiff) of + 1 -> + ok; + _BadLen -> + exit({unexpected_mes, MEDiff}) + end, + ok. + + otp_6150(suite) -> []; otp_6150(Config) when is_list(Config) -> @@ -257,7 +347,7 @@ LAST-UPDATED \"0005290000Z\" Ericsson Utvecklings AB Open System Box 1505 -SE-125 25 �LVSJ�\" +SE-125 25 ÄLVSJÖ\" DESCRIPTION \" Objects for management \" diff --git a/lib/snmp/test/snmp_conf_test.erl b/lib/snmp/test/snmp_conf_test.erl index d2f9631947..c4341d8d7e 100644 --- a/lib/snmp/test/snmp_conf_test.erl +++ b/lib/snmp/test/snmp_conf_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -26,7 +26,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/include/STANDARD-MIB.hrl"). @@ -37,8 +37,8 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, check_mandatory/1, check_integer1/1, @@ -80,32 +80,28 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%====================================================================== %% Test case definitions %%====================================================================== -all(suite) -> - [ - check_mandatory, - check_integer1, - check_integer2, - check_string1, - check_string2, - check_atom, - check_ip, - check_taddress, - check_packet_size, - check_oid, - check_sec_model1, - check_sec_model2, - check_sec_level, - check_timer, - - read, - read_files - ]. +all() -> +[check_mandatory, check_integer1, check_integer2, + check_string1, check_string2, check_atom, check_ip, + check_taddress, check_packet_size, check_oid, + check_sec_model1, check_sec_model2, check_sec_level, + check_timer, read, read_files]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%====================================================================== diff --git a/lib/snmp/test/snmp_log_test.erl b/lib/snmp/test/snmp_log_test.erl index 91bdc3e849..b692017407 100644 --- a/lib/snmp/test/snmp_log_test.erl +++ b/lib/snmp/test/snmp_log_test.erl @@ -29,7 +29,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -40,19 +40,19 @@ %% External exports %%---------------------------------------------------------------------- -export([ - init_per_testcase/2, fin_per_testcase/2, + init_per_testcase/2, end_per_testcase/2, - all/1, + all/0,groups/0,init_per_group/2,end_per_group/2, open_and_close/1, - open_write_and_close/1, + open_write_and_close1/1, open_write_and_close2/1, open_write_and_close3/1, open_write_and_close4/1, - log_to_io/1, + log_to_io1/1, log_to_io2/1, - log_to_txt/1, + log_to_txt1/1, log_to_txt2/1, log_to_txt3/1 @@ -97,7 +97,7 @@ init_per_testcase(Case, Config) when is_list(Config) -> Dog = ?WD_START(?MINS(5)), [{log_dir, CaseDir}, {watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> %% Leave the dirs created above (enable debugging of the test case(s)) Dog = ?config(watchdog, Config), ?WD_STOP(Dog), @@ -108,37 +108,30 @@ fin_per_testcase(_Case, Config) when is_list(Config) -> %% Test case definitions %%====================================================================== %% ?SKIP(not_yet_implemented). -all(suite) -> - [ - open_and_close, - open_write_and_close, - log_to_io, - log_to_txt - ]. - - -open_write_and_close(suite) -> - [ - open_write_and_close1, - open_write_and_close2, - open_write_and_close3, - open_write_and_close4 - ]. - - -log_to_io(suite) -> - [ - log_to_io1, - log_to_io2 - ]. - - -log_to_txt(suite) -> - [ - log_to_txt1, - log_to_txt2, - log_to_txt3 - ]. +all() -> +[open_and_close, {group, open_write_and_close}, + {group, log_to_io}, {group, log_to_txt}]. + +groups() -> + [{open_write_and_close, [], + [open_write_and_close1, open_write_and_close2, + open_write_and_close3, open_write_and_close4]}, + {log_to_io, [], [log_to_io1, log_to_io2]}, + {log_to_txt, [], + [log_to_txt1, log_to_txt2, log_to_txt3]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + + + + + + %%====================================================================== diff --git a/lib/snmp/test/snmp_manager_config_test.erl b/lib/snmp/test/snmp_manager_config_test.erl index d5dc1387f7..a72dd0cc22 100644 --- a/lib/snmp/test/snmp_manager_config_test.erl +++ b/lib/snmp/test/snmp_manager_config_test.erl @@ -31,7 +31,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/src/manager/snmpm_usm.hrl"). @@ -42,10 +42,10 @@ %% -compile(export_all). -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, - start_and_stop/1, + simple_start_and_stop/1, start_without_mandatory_opts1/1, @@ -58,36 +58,36 @@ start_with_invalid_agents_conf_file1/1, start_with_invalid_usm_conf_file1/1, - normal_op/1, + - system/1, + simple_system_op/1, - users/1, + register_user_using_file/1, register_user_using_function/1, register_user_failed_using_function1/1, - agents/1, + register_agent_using_file/1, register_agent_using_function/1, register_agent_failed_using_function1/1, - usm_users/1, + register_usm_user_using_file/1, register_usm_user_using_function/1, register_usm_user_failed_using_function1/1, update_usm_user_info/1, - counter/1, + create_and_increment/1, - stats_counter/1, + stats_create_and_increment/1, - tickets/1, + otp_7219/1, - otp_8395/1, + otp_8395_1/1, otp_8395_2/1, otp_8395_3/1, @@ -150,8 +150,8 @@ init_per_testcase(Case, Config) when is_list(Config) -> {manager_log_dir, MgrLogDir} | Config]. -fin_per_testcase(Case, Config) when is_list(Config) -> - p("fin_per_testcase -> Case: ~p", [Case]), +end_per_testcase(Case, Config) when is_list(Config) -> + p("end_per_testcase -> Case: ~p", [Case]), %% The cleanup is removed due to some really discusting NFS behaviour... %% CaseTopDir = ?config(manager_dir, Config), %% ?line ok = ?DEL_DIR(CaseTopDir), @@ -163,33 +163,55 @@ fin_per_testcase(Case, Config) when is_list(Config) -> %%====================================================================== % all(doc) -> % "The top snmp manager config test case"; -all(suite) -> - [ - start_and_stop, - normal_op, - tickets - ]. +all() -> +[{group, start_and_stop}, {group, normal_op}, + {group, tickets}]. + +groups() -> + [{start_and_stop, [], + [simple_start_and_stop, start_without_mandatory_opts1, + start_without_mandatory_opts2, + start_with_all_valid_opts, start_with_unknown_opts, + start_with_incorrect_opts, + start_with_invalid_manager_conf_file1, + start_with_invalid_users_conf_file1, + start_with_invalid_agents_conf_file1, + start_with_invalid_usm_conf_file1]}, + {normal_op, [], + [{group, system}, {group, agents}, {group, users}, + {group, usm_users}, {group, counter}, + {group, stats_counter}]}, + {system, [], [simple_system_op]}, + {users, [], + [register_user_using_file, register_user_using_function, + register_user_failed_using_function1]}, + {agents, [], + [register_agent_using_file, + register_agent_using_function, + register_agent_failed_using_function1]}, + {usm_users, [], + [register_usm_user_using_file, + register_usm_user_using_function, + register_usm_user_failed_using_function1, + update_usm_user_info]}, + {counter, [], [create_and_increment]}, + {stats_counter, [], [stats_create_and_increment]}, + {tickets, [], [otp_7219, {group, otp_8395}]}, + {otp_8395, [], + [otp_8395_1, otp_8395_2, otp_8395_3, otp_8395_4]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%====================================================================== %% Test functions %%====================================================================== -start_and_stop(doc) -> - "A collection of start and stop tests"; -start_and_stop(suite) -> - [ - simple_start_and_stop, - start_without_mandatory_opts1, - start_without_mandatory_opts2, - start_with_all_valid_opts, - start_with_unknown_opts, - start_with_incorrect_opts, - start_with_invalid_manager_conf_file1, - start_with_invalid_users_conf_file1, - start_with_invalid_agents_conf_file1, - start_with_invalid_usm_conf_file1 - ]. %% @@ -1641,29 +1663,12 @@ start_with_invalid_usm_conf_file1(Conf) when is_list(Conf) -> %% --- %% -normal_op(doc) -> - "A collection of tests for normal operation"; -normal_op(suite) -> - [ - system, - agents, - users, - usm_users, - counter, - stats_counter - ]. %% %% --- %% -system(doc) -> - "Various system related operations with the snmp manager config"; -system(suite) -> - [ - simple_system_op - ]. simple_system_op(suite) -> []; simple_system_op(doc) -> @@ -1702,14 +1707,6 @@ simple_system_op(Conf) when is_list(Conf) -> %% --- %% -users(doc) -> - "Various users related operations with the snmp manager config"; -users(suite) -> - [ - register_user_using_file, - register_user_using_function, - register_user_failed_using_function1 - ]. %% @@ -1764,14 +1761,6 @@ register_user_failed_using_function1(Conf) when is_list(Conf) -> %% --- %% -agents(doc) -> - "Various agents related operations with the snmp manager config"; -agents(suite) -> - [ - register_agent_using_file, - register_agent_using_function, - register_agent_failed_using_function1 - ]. %% @@ -1950,15 +1939,6 @@ register_agent_failed_using_function1(Conf) when is_list(Conf) -> %% --- %% -usm_users(doc) -> - "Various USM users related operations with the snmp manager config"; -usm_users(suite) -> - [ - register_usm_user_using_file, - register_usm_user_using_function, - register_usm_user_failed_using_function1, - update_usm_user_info - ]. %% @@ -2208,12 +2188,6 @@ update_usm_user_info(Conf) when is_list(Conf) -> %% --- %% -counter(doc) -> - "Various counter related operations with the snmp manager config"; -counter(suite) -> - [ - create_and_increment - ]. %% @@ -2258,13 +2232,6 @@ create_and_increment(Conf) when is_list(Conf) -> %% --- %% -stats_counter(doc) -> - "Various statistic counter related operations with the " - "snmp manager config"; -stats_counter(suite) -> - [ - stats_create_and_increment - ]. %% @@ -2323,11 +2290,6 @@ loop(N, _, F) when (N > 0) andalso is_function(F) -> %% Ticket test-cases %%====================================================================== -tickets(suite) -> - [ - otp_7219, - otp_8395 - ]. otp_7219(suite) -> @@ -2379,13 +2341,6 @@ otp_7219(Config) when is_list(Config) -> -otp_8395(suite) -> - [ - otp_8395_1, - otp_8395_2, - otp_8395_3, - otp_8395_4 - ]. otp_8395_1(suite) -> []; otp_8395_1(doc) -> diff --git a/lib/snmp/test/snmp_manager_test.erl b/lib/snmp/test/snmp_manager_test.erl index cef96417dc..50836db731 100644 --- a/lib/snmp/test/snmp_manager_test.erl +++ b/lib/snmp/test/snmp_manager_test.erl @@ -31,7 +31,7 @@ %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include("snmp_test_data/Test2.hrl"). @@ -43,10 +43,10 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, - start_and_stop_tests/1, + simple_start_and_stop1/1, simple_start_and_stop2/1, simple_start_and_monitor_crash1/1, @@ -54,49 +54,49 @@ notify_started01/1, notify_started02/1, - user_tests/1, + register_user1/1, - agent_tests/1, + register_agent1/1, register_agent2/1, - misc_tests/1, + info/1, - request_tests/1, + - get_tests/1, + simple_sync_get1/1, simple_sync_get2/1, simple_async_get1/1, simple_async_get2/1, - get_next_tests/1, + simple_sync_get_next1/1, simple_sync_get_next2/1, simple_async_get_next1/1, simple_async_get_next2/1, - set_tests/1, + simple_sync_set1/1, simple_sync_set2/1, simple_async_set1/1, simple_async_set2/1, - bulk_tests/1, + simple_sync_get_bulk1/1, simple_sync_get_bulk2/1, simple_async_get_bulk1/1, simple_async_get_bulk2/1, - misc_request_tests/1, + misc_async1/1, misc_async2/1, discovery/1, - event_tests/1, + trap1/1, trap2/1, @@ -109,10 +109,10 @@ report/1, - tickets/1, - otp8015/1, + + otp8015_1/1, - otp8395/1, + otp8395_1/1 ]). @@ -289,18 +289,18 @@ init_per_testcase3(Case, Config) -> Config end. -fin_per_testcase(Case, Config) when is_list(Config) -> +end_per_testcase(Case, Config) when is_list(Config) -> ?DBG("fin [~w] Nodes [1]: ~p", [Case, erlang:nodes()]), Dog = ?config(watchdog, Config), ?WD_STOP(Dog), Conf1 = lists:keydelete(watchdog, 1, Config), - Conf2 = fin_per_testcase2(Case, Conf1), + Conf2 = end_per_testcase2(Case, Conf1), ?DBG("fin [~w] Nodes [2]: ~p", [Case, erlang:nodes()]), %% TopDir = ?config(top_dir, Conf2), %% ?DEL_DIR(TopDir), Conf2. -fin_per_testcase2(Case, Config) -> +end_per_testcase2(Case, Config) -> OldApiCases = [ simple_sync_get1, @@ -359,118 +359,64 @@ fin_per_testcase2(Case, Config) -> %% Test case definitions %%====================================================================== -all(suite) -> - [ - start_and_stop_tests, - misc_tests, - user_tests, - agent_tests, - request_tests, - event_tests, - discovery, - tickets - ]. - -start_and_stop_tests(suite) -> - [ - simple_start_and_stop1, - simple_start_and_stop2, - simple_start_and_monitor_crash1, - simple_start_and_monitor_crash2, - notify_started01, - notify_started02 - ]. - -misc_tests(suite) -> - [ - info - ]. - -user_tests(suite) -> - [ - register_user1 - ]. - -agent_tests(suite) -> - [ - register_agent1, - register_agent2 - ]. - -request_tests(suite) -> - [ - get_tests, - get_next_tests, - set_tests, - bulk_tests, - misc_request_tests - ]. - -get_tests(suite) -> - [ - simple_sync_get1, - simple_sync_get2, - simple_async_get1, - simple_async_get2 - ]. - -get_next_tests(suite) -> - [ - simple_sync_get_next1, - simple_sync_get_next2, - simple_async_get_next1, - simple_async_get_next2 - ]. - -set_tests(suite) -> - [ - simple_sync_set1, - simple_sync_set2, - simple_async_set1, - simple_async_set2 - ]. - -bulk_tests(suite) -> - [ - simple_sync_get_bulk1, - simple_sync_get_bulk2, - simple_async_get_bulk1, - simple_async_get_bulk2 - ]. - -misc_request_tests(suite) -> - [ - misc_async1, - misc_async2 - ]. - -event_tests(suite) -> - [ - trap1, - trap2, - inform1, - inform2, - inform3, - inform4, - inform_swarm, - report - ]. - -tickets(suite) -> - [ - otp8015, - otp8395 - ]. - -otp8015(suite) -> - [ - otp8015_1 - ]. - -otp8395(suite) -> - [ - otp8395_1 - ]. +all() -> +[{group, start_and_stop_tests}, {group, misc_tests}, + {group, user_tests}, {group, agent_tests}, + {group, request_tests}, {group, event_tests}, discovery, + {group, tickets}]. + +groups() -> + [{start_and_stop_tests, [], + [simple_start_and_stop1, simple_start_and_stop2, + simple_start_and_monitor_crash1, + simple_start_and_monitor_crash2, notify_started01, + notify_started02]}, + {misc_tests, [], [info]}, + {user_tests, [], [register_user1]}, + {agent_tests, [], [register_agent1, register_agent2]}, + {request_tests, [], + [{group, get_tests}, {group, get_next_tests}, + {group, set_tests}, {group, bulk_tests}, + {group, misc_request_tests}]}, + {get_tests, [], + [simple_sync_get1, simple_sync_get2, simple_async_get1, + simple_async_get2]}, + {get_next_tests, [], + [simple_sync_get_next1, simple_sync_get_next2, + simple_async_get_next1, simple_async_get_next2]}, + {set_tests, [], + [simple_sync_set1, simple_sync_set2, simple_async_set1, + simple_async_set2]}, + {bulk_tests, [], + [simple_sync_get_bulk1, simple_sync_get_bulk2, + simple_async_get_bulk1, simple_async_get_bulk2]}, + {misc_request_tests, [], [misc_async1, misc_async2]}, + {event_tests, [], + [trap1, trap2, inform1, inform2, inform3, inform4, + inform_swarm, report]}, + {tickets, [], [{group, otp8015}, {group, otp8395}]}, + {otp8015, [], [otp8015_1]}, {otp8395, [], [otp8395_1]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + + + + + + + + + + + + + + %%====================================================================== diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index 07b56bde39..b0e192344d 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 diff --git a/lib/snmp/test/snmp_manager_user_old.erl b/lib/snmp/test/snmp_manager_user_old.erl index b53514d699..edffc80dd4 100755 --- a/lib/snmp/test/snmp_manager_user_old.erl +++ b/lib/snmp/test/snmp_manager_user_old.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 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 diff --git a/lib/snmp/test/snmp_manager_user_test.erl b/lib/snmp/test/snmp_manager_user_test.erl index 0f47d70873..fefa1ad713 100644 --- a/lib/snmp/test/snmp_manager_user_test.erl +++ b/lib/snmp/test/snmp_manager_user_test.erl @@ -26,7 +26,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). @@ -36,10 +36,10 @@ %% -compile(export_all). -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, +all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + - register_user/1, simple_register_and_unregister1/1, simple_register_and_unregister2/1, simple_register_and_unregister3/1, @@ -62,7 +62,7 @@ register_monitor_request_and_crash3/1, register_monitor_request_and_crash4/1, - tickets/1, + otp7902/1 ]). @@ -123,8 +123,8 @@ init_per_testcase(Case, Config) when is_list(Config) -> {manager_log_dir, MgrLogDir} | Config]. -fin_per_testcase(Case, Config) when is_list(Config) -> - p("fin_per_testcase -> Case: ~p", [Case]), +end_per_testcase(Case, Config) when is_list(Config) -> + p("end_per_testcase -> Case: ~p", [Case]), % MgrTopDir = ?config(manager_dir, Config), % ?DEL_DIR(MgrTopDir), Config. @@ -134,42 +134,41 @@ fin_per_testcase(Case, Config) when is_list(Config) -> %% Test case definitions %%====================================================================== -all(suite) -> - [ - register_user, - tickets - ]. - -register_user(suite) -> - [ - simple_register_and_unregister1, - simple_register_and_unregister2, - simple_register_and_unregister3, - register_and_crash1, - register_and_crash2, - register_and_crash3, - register_request_and_crash1, - register_request_and_crash2, - register_request_and_crash3, - simple_register_monitor_and_unregister1, - simple_register_monitor_and_unregister2, - simple_register_monitor_and_unregister3, - register_monitor_and_crash1, - register_monitor_and_crash2, - register_monitor_and_crash3, - register_monitor_and_crash4, - register_monitor_and_crash5, - register_monitor_request_and_crash1, - register_monitor_request_and_crash2, - register_monitor_request_and_crash3, - register_monitor_request_and_crash4 - ]. - - -tickets(suite) -> - [ - otp7902 - ]. +all() -> +[{group, register_user}, {group, tickets}]. + +groups() -> + [{register_user, [], + [simple_register_and_unregister1, + simple_register_and_unregister2, + simple_register_and_unregister3, register_and_crash1, + register_and_crash2, register_and_crash3, + register_request_and_crash1, + register_request_and_crash2, + register_request_and_crash3, + simple_register_monitor_and_unregister1, + simple_register_monitor_and_unregister2, + simple_register_monitor_and_unregister3, + register_monitor_and_crash1, + register_monitor_and_crash2, + register_monitor_and_crash3, + register_monitor_and_crash4, + register_monitor_and_crash5, + register_monitor_request_and_crash1, + register_monitor_request_and_crash2, + register_monitor_request_and_crash3, + register_monitor_request_and_crash4]}, + {tickets, [], [otp7902]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + + + %%====================================================================== diff --git a/lib/snmp/test/snmp_manager_user_test_lib.erl b/lib/snmp/test/snmp_manager_user_test_lib.erl index a49fe93178..bf8fff7c4c 100644 --- a/lib/snmp/test/snmp_manager_user_test_lib.erl +++ b/lib/snmp/test/snmp_manager_user_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 diff --git a/lib/snmp/test/snmp_note_store_test.erl b/lib/snmp/test/snmp_note_store_test.erl index 8686a47468..24ba88f986 100644 --- a/lib/snmp/test/snmp_note_store_test.erl +++ b/lib/snmp/test/snmp_note_store_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -25,7 +25,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("snmp_test_lib.hrl"). @@ -33,8 +33,8 @@ %% External exports %%---------------------------------------------------------------------- -export([ - init_per_testcase/2, fin_per_testcase/2, - all/1, + init_per_testcase/2, end_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, start_and_stop/1, notes/1, info/1, @@ -63,20 +63,24 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%====================================================================== %% Test case definitions %%====================================================================== -all(suite) -> - [ - start_and_stop, - notes, - info, - garbage_in - - ]. +all() -> +[start_and_stop, notes, info, garbage_in]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%====================================================================== diff --git a/lib/snmp/test/snmp_pdus_test.erl b/lib/snmp/test/snmp_pdus_test.erl index 6dc5b779aa..ef510ad62e 100644 --- a/lib/snmp/test/snmp_pdus_test.erl +++ b/lib/snmp/test/snmp_pdus_test.erl @@ -25,7 +25,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/include/snmp_types.hrl"). @@ -34,11 +34,11 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - tickets/1, + all/0,groups/0,init_per_group/2,end_per_group/2, + otp7575/1, otp8563/1, - init_per_testcase/2, fin_per_testcase/2 + init_per_testcase/2, end_per_testcase/2 ]). @@ -64,23 +64,26 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%====================================================================== %% Test case definitions %%====================================================================== -all(suite) -> - [ - tickets - ]. - -tickets(suite) -> - [ - otp7575, - otp8563 - ]. +all() -> +[{group, tickets}]. + +groups() -> + [{tickets, [], [otp7575, otp8563]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + diff --git a/lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib b/lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib new file mode 100644 index 0000000000..58defbe1cf --- /dev/null +++ b/lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib @@ -0,0 +1,131 @@ +--
+-- AC-TEST-MIB.mib
+-- MIB generated by MG-SOFT Visual MIB Builder Version 5.0 Build 250
+-- Tuesday, November 30, 2010 at 23:03:18
+--
+
+ AC-TEST-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ otpExpr
+ FROM OTP-REG
+ OBJECT-GROUP, AGENT-CAPABILITIES
+ FROM SNMPv2-CONF
+ Integer32, OBJECT-TYPE, MODULE-IDENTITY, OBJECT-IDENTITY
+ FROM SNMPv2-SMI;
+
+
+ acTestModule MODULE-IDENTITY
+ LAST-UPDATED "201011302230Z" -- November 30, 2010 at 22:30 GMT
+ ORGANIZATION
+ "Ac Test Co."
+ CONTACT-INFO
+ "[email protected]."
+ DESCRIPTION
+ "Ac Test module."
+ ::= { reg 1 }
+
+
+
+--
+-- Node definitions
+--
+
+ acTest OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Test area."
+ ::= { otpExpr 4321 }
+
+
+ reg OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Registrations."
+ ::= { acTest 1 }
+
+
+ mib OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Objects."
+ ::= { acTest 2 }
+
+
+ someObject OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Description."
+ ::= { mib 1 }
+
+
+ oneMore OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Description."
+ ::= { mib 2 }
+
+
+ grp OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Groups
+ ."
+ ::= { acTest 3 }
+
+
+ basicGrp OBJECT-GROUP
+ OBJECTS { someObject }
+ STATUS current
+ DESCRIPTION
+ "Basic set of objects."
+ ::= { grp 1 }
+
+
+ allObjects OBJECT-GROUP
+ OBJECTS { someObject, oneMore }
+ STATUS current
+ DESCRIPTION
+ "Complete set."
+ ::= { grp 2 }
+
+
+ cap OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Capabilities."
+ ::= { acTest 5 }
+
+
+ basicAgent AGENT-CAPABILITIES
+ PRODUCT-RELEASE
+ "Product release v1."
+ STATUS current
+ DESCRIPTION
+ "Basic agent."
+ SUPPORTS AC-TEST-MIB
+ INCLUDES { basicGrp }
+ ::= { cap 1 }
+
+
+ fullAgent AGENT-CAPABILITIES
+ PRODUCT-RELEASE
+ "Product release v2."
+ STATUS current
+ DESCRIPTION
+ "Full featured agent."
+ SUPPORTS AC-TEST-MIB
+ INCLUDES { allObjects }
+ ::= { cap 2 }
+
+
+
+ END
+
+--
+-- AC-TEST-MIB.mib
+--
diff --git a/lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib b/lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib new file mode 100644 index 0000000000..cadaa6f891 --- /dev/null +++ b/lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib @@ -0,0 +1,173 @@ +MC-TEST-MIB DEFINITIONS ::= BEGIN + +IMPORTS + otpExpr + FROM OTP-REG + MODULE-IDENTITY, OBJECT-TYPE, + mib-2, NOTIFICATION-TYPE, OBJECT-IDENTITY + FROM SNMPv2-SMI + TDomain, TAddress, DisplayString, TEXTUAL-CONVENTION, + AutonomousType, RowPointer, TimeStamp, + RowStatus, StorageType + FROM SNMPv2-TC + MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP + FROM SNMPv2-CONF; + +mcTestModule MODULE-IDENTITY + LAST-UPDATED "9605160000Z" + ORGANIZATION "MC Test Co." + CONTACT-INFO + "[email protected]." + DESCRIPTION + "MC Test module." + ::= { reg 1 } + +mcObjects OBJECT IDENTIFIER ::= { mcTestModule 1 } + +-- MIB contains one group + +mcMisc OBJECT IDENTIFIER ::= { mcObjects 1 } +mcGeneral OBJECT IDENTIFIER ::= { mcObjects 2 } + + +mcTest OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Test area." + ::= { otpExpr 4322 } + + +reg OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Registrations." + ::= { mcTest 1 } + + +mcTable OBJECT-TYPE + SYNTAX SEQUENCE OF McEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains one row per physical entity. There is + always at least one row for an 'overall' physical entity." + ::= { mcMisc 1 } + +mcEntry OBJECT-TYPE + SYNTAX McEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table entry..." + INDEX { mcIndex } + ::= { mcTable 1 } + +McEntry ::= SEQUENCE { + mcIndex INTEGER, + mcName DisplayString, + mcStorageType StorageType, + mcRowStatus RowStatus +} + +mcIndex OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The index for this entry." + ::= { mcEntry 1 } + +mcName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Name of... " + ::= { mcEntry 2 } + + +mcStorageType OBJECT-TYPE + SYNTAX StorageType + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The storage type for this conceptual row." + DEFVAL { nonVolatile } + ::= { mcEntry 3 } + +mcRowStatus OBJECT-TYPE + SYNTAX RowStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this conceptual row..." + ::= { mcEntry 4 } + + +-- last change time stamp for the whole MIB +mcTimeStamp OBJECT-TYPE + SYNTAX TimeStamp + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The sysUpTime value when of the last time *anything* in the + MIB was changed. " + ::= { mcGeneral 1 } + +-- Entity MIB Trap Definitions +mcTraps OBJECT IDENTIFIER ::= { mcTestModule 2 } +mcTrapPrefix OBJECT IDENTIFIER ::= { mcTraps 0 } + +mcConfigChange NOTIFICATION-TYPE + STATUS current + DESCRIPTION + "An mcConfigChange trap is sent when the value of + entLastChangeTime changes..." + ::= { mcTrapPrefix 1 } + +-- conformance information +mcConformance OBJECT IDENTIFIER ::= { mcTestModule 3 } + +mcCompliances OBJECT IDENTIFIER ::= { mcConformance 1 } +mcGroups OBJECT IDENTIFIER ::= { mcConformance 2 } + +-- compliance statements + + +mcCompliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for SNMP entities which implement + the MC Test MIB." + MODULE -- this module + MANDATORY-GROUPS { mcGeneralGroup, + mcNotificationsGroup } + ::= { mcCompliances 1 } + +-- MIB groupings + +mcGeneralGroup OBJECT-GROUP + OBJECTS { + mcName, + mcStorageType, + mcRowStatus, + mcTimeStamp + } + STATUS current + DESCRIPTION + "The collection of objects which are used to represent + general information..." + ::= { mcGroups 1 } + +mcNotificationsGroup NOTIFICATION-GROUP + NOTIFICATIONS { mcConfigChange } + STATUS current + DESCRIPTION + "The collection of notifications..." + ::= { mcGroups 2 } + + +END + + + diff --git a/lib/snmp/test/snmp_test_manager.erl b/lib/snmp/test/snmp_test_manager.erl index 9d9c52ef8d..4cc6d36acc 100644 --- a/lib/snmp/test/snmp_test_manager.erl +++ b/lib/snmp/test/snmp_test_manager.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 diff --git a/lib/snmp/test/snmp_test_server.erl b/lib/snmp/test/snmp_test_server.erl index d0a5185452..ffbd2126a3 100644 --- a/lib/snmp/test/snmp_test_server.erl +++ b/lib/snmp/test/snmp_test_server.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -33,7 +33,7 @@ fatal_skip/3, init_per_testcase/2, - fin_per_testcase/2 + end_per_testcase/2 ]). -include("snmp_test_lib.hrl"). @@ -229,7 +229,7 @@ eval(Mod, Fun, Config) -> Eval = fun() -> do_eval(Self, Mod, Fun, Config2) end, Pid = spawn_link(Eval), R = wait_for_evaluator(Pid, Mod, Fun, Config2, []), - Mod:fin_per_testcase(Fun, Config2), + Mod:end_per_testcase(Fun, Config2), global:unregister_name(?TEST_CASE_SUP), process_flag(trap_exit, Flag), R. @@ -361,7 +361,7 @@ init_per_testcase(_Case, Config) -> global:register_name(?GLOBAL_LOGGER, group_leader()), Config. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> global:unregister_name(?GLOBAL_LOGGER), ok. diff --git a/lib/snmp/test/snmp_test_suite.erl b/lib/snmp/test/snmp_test_suite.erl index a6e203eba3..77aaa508ad 100644 --- a/lib/snmp/test/snmp_test_suite.erl +++ b/lib/snmp/test/snmp_test_suite.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -29,7 +29,7 @@ behaviour_info(callbacks) -> [ {all, 1}, {init_per_testcase, 2}, - {fin_per_testcase, 2} + {end_per_testcase, 2} ]; behaviour_info(_Other) -> undefined. diff --git a/lib/snmp/test/test1.erl b/lib/snmp/test/test1.erl index b26b03d4ce..23cfaf6aaa 100644 --- a/lib/snmp/test/test1.erl +++ b/lib/snmp/test/test1.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 diff --git a/lib/snmp/test/test2.erl b/lib/snmp/test/test2.erl index dc010cfa11..a33208af7b 100644 --- a/lib/snmp/test/test2.erl +++ b/lib/snmp/test/test2.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index ac9a192f5d..b55c8718ec 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -1,3 +1,22 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-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% + SNMP_VSN = 4.19 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" diff --git a/lib/ssh/doc/src/notes.xml b/lib/ssh/doc/src/notes.xml index 9bedd446f4..af667b1a71 100644 --- a/lib/ssh/doc/src/notes.xml +++ b/lib/ssh/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2004</year><year>2010</year> + <year>2004</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -29,6 +29,45 @@ <file>notes.xml</file> </header> +<section><title>Ssh 2.0.4</title> + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p>In some cases SSH returned {error, normal} when a channel was terminated + unexpectedly. This has now been changed to {error, channel_closed}.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-8987 Aux Id: seq11748</p> + </item> + <item> + <p> + SSH did not handle the error reason enetunreach + when trying to open a IPv6 connection.</p> + <p> + Own Id: OTP-9031</p> + </item> + </list> + </section> + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + It is now possible to use SSH to sign and verify binary data.</p> + <p> + Own Id: OTP-8986</p> + </item> + <item> + <p> + SSH now ensures that the .ssh directory exists before trying + to access files located in that directory.</p> + <p> + Own Id: OTP-9010</p> + </item> + </list> + </section> +</section> + <section><title>Ssh 2.0.3</title> <section><title>Fixed Bugs and Malfunctions</title> <list> diff --git a/lib/ssh/doc/src/ssh.xml b/lib/ssh/doc/src/ssh.xml index 71e6b2cd3d..2c5096a25f 100644 --- a/lib/ssh/doc/src/ssh.xml +++ b/lib/ssh/doc/src/ssh.xml @@ -283,6 +283,22 @@ </func> <func> + <name>sign_data(Data, Algorithm) -> Signature | {error, Reason}</name> + <fsummary> </fsummary> + <type> + <v> Data = binary()</v> + <v> Algorithm = "ssh-rsa"</v> + <v> Signature = binary()</v> + <v> Reason = term()</v> + </type> + <desc> + <p>Signs the supplied binary using the SSH key. + </p> + </desc> + </func> + + + <func> <name>start() -> </name> <name>start(Type) -> ok | {error, Reason}</name> <fsummary>Starts the Ssh application. </fsummary> @@ -339,6 +355,22 @@ by the listener up and running.</p> </desc> </func> + + <func> + <name>verify_data(Data, Signature, Algorithm) -> ok | {error, Reason}</name> + <fsummary> </fsummary> + <type> + <v> Data = binary()</v> + <v> Algorithm = "ssh-rsa"</v> + <v> Signature = binary()</v> + <v> Reason = term()</v> + </type> + <desc> + <p>Verifies the supplied binary against the binary signature. + </p> + </desc> + </func> + </funcs> </erlref> diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src index 9c806bcd03..501da8ceb9 100644 --- a/lib/ssh/src/ssh.appup.src +++ b/lib/ssh/src/ssh.appup.src @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -19,11 +19,33 @@ {"%VSN%", [ - {"2.0.2", [{load_module, ssh_file, soft_purge, soft_purge, []}]}, + {"2.0.3", [{load_module, ssh_file, soft_purge, soft_purge, []}, + {load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_rsa, soft_purge, soft_purge, []}, + {load_module, ssh_acceptor, soft_purge, soft_purge, []}, + {load_module, ssh_transport, soft_purge, soft_purge, []}, + {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]}, + {"2.0.2", [{load_module, ssh_file, soft_purge, soft_purge, []}, + {load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_rsa, soft_purge, soft_purge, []}, + {load_module, ssh_acceptor, soft_purge, soft_purge, []}, + {load_module, ssh_transport, soft_purge, soft_purge, []}, + {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]}, {"2.0.1", [{restart_application, ssh}]} ], [ - {"2.0.2", [{load_module, ssh_file, soft_purge, soft_purge, []}]}, + {"2.0.3", [{load_module, ssh_file, soft_purge, soft_purge, []}, + {load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_rsa, soft_purge, soft_purge, []}, + {load_module, ssh_acceptor, soft_purge, soft_purge, []}, + {load_module, ssh_transport, soft_purge, soft_purge, []}, + {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]}, + {"2.0.2", [{load_module, ssh_file, soft_purge, soft_purge, []}, + {load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_rsa, soft_purge, soft_purge, []}, + {load_module, ssh_acceptor, soft_purge, soft_purge, []}, + {load_module, ssh_transport, soft_purge, soft_purge, []}, + {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]}, {"2.0.1", [{restart_application, ssh}]} ] }. diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 994c77436a..cada109df0 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -30,6 +30,8 @@ stop_listener/1, stop_listener/2, stop_daemon/1, stop_daemon/2, shell/1, shell/2, shell/3]). +-export([sign_data/2, verify_data/3]). + %%-------------------------------------------------------------------- %% Function: start([, Type]) -> ok %% @@ -94,11 +96,17 @@ connect(Host, Port, Options, Timeout) -> do_demonitor(MRef, Manager), {error, Other}; {'DOWN', MRef, _, Manager, Reason} when is_pid(Manager) -> + error_logger:warning_report([{ssh, connect}, + {diagnose, + "Connection was closed before properly set up."}, + {host, Host}, + {port, Port}, + {reason, Reason}]), receive %% Clear EXIT message from queue {'EXIT', Manager, _What} -> - {error, Reason} + {error, channel_closed} after 0 -> - {error, Reason} + {error, channel_closed} end after Timeout -> do_demonitor(MRef, Manager), @@ -239,6 +247,43 @@ shell(Host, Port, Options) -> Error end. + +%%-------------------------------------------------------------------- +%% Function: sign_data(Data, Algorithm) -> binary() | +%% {error, Reason} +%% +%% Data = binary() +%% Algorithm = "ssh-rsa" +%% +%% Description: Use SSH key to sign data. +%%-------------------------------------------------------------------- +sign_data(Data, Algorithm) when is_binary(Data) -> + case ssh_file:private_identity_key(Algorithm,[]) of + {ok, Key} when Algorithm == "ssh-rsa" -> + ssh_rsa:sign(Key, Data); + Error -> + Error + end. + +%%-------------------------------------------------------------------- +%% Function: verify_data(Data, Signature, Algorithm) -> ok | +%% {error, Reason} +%% +%% Data = binary() +%% Signature = binary() +%% Algorithm = "ssh-rsa" +%% +%% Description: Use SSH signature to verify data. +%%-------------------------------------------------------------------- +verify_data(Data, Signature, Algorithm) when is_binary(Data), is_binary(Signature) -> + case ssh_file:public_identity_key(Algorithm, []) of + {ok, Key} when Algorithm == "ssh-rsa" -> + ssh_rsa:verify(Key, Data, Signature); + Error -> + Error + end. + + %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- diff --git a/lib/ssh/src/ssh_acceptor.erl b/lib/ssh/src/ssh_acceptor.erl index 9060626ab3..59fbd24cf5 100644 --- a/lib/ssh/src/ssh_acceptor.erl +++ b/lib/ssh/src/ssh_acceptor.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -55,6 +55,10 @@ acceptor_init(Parent, Port, Address, SockOpts, Opts, AcceptTimeout) -> do_socket_listen(Callback, Port, Opts) -> case Callback:listen(Port, Opts) of + {error, nxdomain} -> + Callback:listen(Port, lists:delete(inet6, Opts)); + {error, enetunreach} -> + Callback:listen(Port, lists:delete(inet6, Opts)); {error, eafnosupport} -> Callback:listen(Port, lists:delete(inet6, Opts)); Other -> diff --git a/lib/ssh/src/ssh_connection_manager.erl b/lib/ssh/src/ssh_connection_manager.erl index 6bf89224cf..9bfd5270da 100644 --- a/lib/ssh/src/ssh_connection_manager.erl +++ b/lib/ssh/src/ssh_connection_manager.erl @@ -147,7 +147,7 @@ close(ConnectionManager, ChannelId) -> try call(ConnectionManager, {close, ChannelId}) of ok -> ok; - {error,normal} -> + {error, channel_closed} -> ok catch exit:{noproc, _} -> @@ -158,7 +158,7 @@ stop(ConnectionManager) -> try call(ConnectionManager, stop) of ok -> ok; - {error,normal} -> + {error, channel_closed} -> ok catch exit:{noproc, _} -> @@ -604,7 +604,7 @@ call(Pid, Msg, Timeout) -> exit:{timeout, _} -> {error, timeout}; exit:{normal, _} -> - {error, normal} + {error, channel_closed} end. cast(Pid, Msg) -> diff --git a/lib/ssh/src/ssh_file.erl b/lib/ssh/src/ssh_file.erl index 13722656db..ff23f714cd 100755 --- a/lib/ssh/src/ssh_file.erl +++ b/lib/ssh/src/ssh_file.erl @@ -27,14 +27,16 @@ -include("PKCS-1.hrl"). -include("DSS.hrl"). +-include_lib("kernel/include/file.hrl"). + -export([public_host_dsa_key/2,private_host_dsa_key/2, public_host_rsa_key/2,private_host_rsa_key/2, public_host_key/2,private_host_key/2, lookup_host_key/3, add_host_key/3, % del_host_key/2, lookup_user_key/3, ssh_dir/2, file_name/3]). --export([private_identity_key/2]). -%% , public_identity_key/2, +-export([private_identity_key/2, + public_identity_key/2]). %% identity_keys/2]). -export([encode_public_key/1, decode_public_key_v2/2]). @@ -43,6 +45,9 @@ -define(DBG_PATHS, true). +-define(PERM_700, 8#700). +-define(PERM_644, 8#644). + %% API public_host_dsa_key(Type, Opts) -> File = file_name(Type, "ssh_host_dsa_key.pub", Opts), @@ -113,8 +118,10 @@ do_lookup_host_key(Host, Alg, Opts) -> add_host_key(Host, Key, Opts) -> Host1 = add_ip(replace_localhost(Host)), - case file:open(file_name(user, "known_hosts", Opts),[write,append]) of + KnownHosts = file_name(user, "known_hosts", Opts), + case file:open(KnownHosts, [write,append]) of {ok, Fd} -> + ok = file:change_mode(KnownHosts, ?PERM_644), Res = add_key_fd(Fd, Host1, Key), file:close(Fd), Res; @@ -140,6 +147,11 @@ private_identity_key(Alg, Opts) -> Path = file_name(user, identity_key_filename(Alg), Opts), read_private_key_v2(Path, Alg). +public_identity_key(Alg, Opts) -> + Path = file_name(user, identity_key_filename(Alg) ++ ".pub", Opts), + read_public_key_v2(Path, Alg). + + read_public_key_v2(File, Type) -> case file:read_file(File) of {ok,Bin} -> @@ -532,4 +544,7 @@ file_name(Type, Name, Opts) -> default_user_dir()-> {ok,[[Home|_]]} = init:get_argument(home), - filename:join(Home, ".ssh"). + UserDir = filename:join(Home, ".ssh"), + ok = filelib:ensure_dir(filename:join(UserDir, "dummy")), + ok = file:change_mode(UserDir, ?PERM_700), + UserDir. diff --git a/lib/ssh/src/ssh_rsa.erl b/lib/ssh/src/ssh_rsa.erl index e27cdcf7bd..91b8285b2e 100755 --- a/lib/ssh/src/ssh_rsa.erl +++ b/lib/ssh/src/ssh_rsa.erl @@ -202,8 +202,7 @@ rsassa_pkcs1_v1_5_verify(Public=#ssh_key { public={N,_E}}, Mb, Sb) -> case emsa_pkcs1_v1_5_encode(Mb, K) of EM -> ok; _S -> - io:format("S: ~p~n", [_S]), - {error, invalid_signature} % exit(invalid_signature) + {error, invalid_signature} end. diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl index e79ccdda0c..de3e29e2f1 100644 --- a/lib/ssh/src/ssh_transport.erl +++ b/lib/ssh/src/ssh_transport.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -169,6 +169,8 @@ do_connect(Callback, Address, Port, SocketOpts, Timeout) -> Callback:connect(Address, Port, lists:delete(inet6, Opts), Timeout); {error, eafnosupport} -> Callback:connect(Address, Port, lists:delete(inet6, Opts), Timeout); + {error, enetunreach} -> + Callback:connect(Address, Port, lists:delete(inet6, Opts), Timeout); Other -> Other end. diff --git a/lib/ssh/vsn.mk b/lib/ssh/vsn.mk index db03168ad9..51f9f47446 100644 --- a/lib/ssh/vsn.mk +++ b/lib/ssh/vsn.mk @@ -1,5 +1,5 @@ #-*-makefile-*- ; force emacs to enter makefile-mode -SSH_VSN = 2.0.3 +SSH_VSN = 2.0.4 APP_VSN = "ssh-$(SSH_VSN)" diff --git a/lib/ssl/doc/src/notes.xml b/lib/ssl/doc/src/notes.xml index 756c0d1b1f..8f81ccb567 100644 --- a/lib/ssl/doc/src/notes.xml +++ b/lib/ssl/doc/src/notes.xml @@ -31,7 +31,94 @@ <p>This document describes the changes made to the SSL application. </p> - <section><title>SSL 4.1</title> + <section><title>SSL 4.1.3</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Fixed error in cache-handling fix from ssl-4.1.2</p> + <p> + Own Id: OTP-9018 Aux Id: seq11739 </p> + </item> + <item> + <p> + Verification of a critical extended_key_usage-extension + corrected</p> + <p> + Own Id: OTP-9029 Aux Id: seq11541 </p> + </item> + </list> + </section> + +</section> + +<section><title>SSL 4.1.2</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + The ssl application caches certificate files, it will now + invalidate cache entries if the diskfile is changed.</p> + <p> + Own Id: OTP-8965 Aux Id: seq11739 </p> + </item> + <item> + <p> + Now runs the terminate function before returning from the + call made by ssl:close/1, as before the caller of + ssl:close/1 could get problems with the reuseaddr option.</p> + <p> + Own Id: OTP-8992</p> + </item> + </list> + </section> + +</section> + +<section><title>SSL 4.1.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Correct handling of client certificate verify message + When checking the client certificate verify message the + server used the wrong algorithm identifier to determine + the signing algorithm, causing a function clause error in + the public_key application when the key-exchange + algorithm and the public key algorithm of the client + certificate happen to differ.</p> + <p> + Own Id: OTP-8897</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + For testing purposes ssl now also support some anonymous + cipher suites when explicitly configured to do so.</p> + <p> + Own Id: OTP-8870</p> + </item> + <item> + <p> + Sends an error alert instead of crashing if a crypto + function for the selected cipher suite fails.</p> + <p> + Own Id: OTP-8930 Aux Id: seq11720 </p> + </item> + </list> + </section> + +</section> + +<section><title>SSL 4.1</title> <section><title>Improvements and New Features</title> <list> diff --git a/lib/ssl/doc/src/ssl.xml b/lib/ssl/doc/src/ssl.xml index ec272379bb..daf7b77527 100644 --- a/lib/ssl/doc/src/ssl.xml +++ b/lib/ssl/doc/src/ssl.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1999</year><year>2010</year> + <year>1999</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -72,10 +72,10 @@ {verify_fun, {fun(), term()}} | {fail_if_no_peer_cert, boolean()} {depth, integer()} | - {cert, der_bin()}| {certfile, path()} | - {key, der_bin()} | {keyfile, path()} | {password, string()} | - {cacerts, [der_bin()]} | {cacertfile, path()} | - |{dh, der_bin()} | {dhfile, path()} | {ciphers, ciphers()} | + {cert, der_encoded()}| {certfile, path()} | + {key, der_encoded()} | {keyfile, path()} | {password, string()} | + {cacerts, [der_encoded()]} | {cacertfile, path()} | + |{dh, der_encoded()} | {dhfile, path()} | {ciphers, ciphers()} | {ssl_imp, ssl_imp()} | {reuse_sessions, boolean()} | {reuse_session, fun()} </c></p> @@ -95,7 +95,7 @@ <p><c>path() = string() - representing a file path.</c></p> - <p><c>der_bin() = binary() -Asn1 DER encoded entity as an erlang binary.</c></p> + <p><c>der_encoded() = binary() -Asn1 DER encoded entity as an erlang binary.</c></p> <p><c>host() = hostname() | ipaddress()</c></p> @@ -136,14 +136,14 @@ <taglist> - <tag>{cert, der_bin()}</tag> + <tag>{cert, der_encoded()}</tag> <item> The DER encoded users certificate. If this option is supplied it will override the certfile option.</item> <tag>{certfile, path()}</tag> <item>Path to a file containing the user's certificate.</item> - <tag>{key, der_bin()}</tag> + <tag>{key, der_encoded()}</tag> <item> The DER encoded users private key. If this option is supplied it will override the keyfile option.</item> @@ -158,7 +158,7 @@ Only used if the private keyfile is password protected. </item> - <tag>{cacerts, [der_bin()]}</tag> + <tag>{cacerts, [der_encoded()]}</tag> <item> The DER encoded trusted certificates. If this option is supplied it will override the cacertfile option.</item> @@ -301,7 +301,7 @@ fun(OtpCert :: #'OTPCertificate'{}, Event :: {bad_cert, Reason :: atom()} | <taglist> - <tag>{dh, der_bin()}</tag> + <tag>{dh, der_encoded()}</tag> <item>The DER encoded Diffie Hellman parameters. If this option is supplied it will override the dhfile option. </item> diff --git a/lib/ssl/src/inet_ssl_dist.erl b/lib/ssl/src/inet_ssl_dist.erl index f62aefd35a..6c0fbc0618 100644 --- a/lib/ssl/src/inet_ssl_dist.erl +++ b/lib/ssl/src/inet_ssl_dist.erl @@ -1,8 +1,8 @@ -%%<copyright> -%% <year>2000-2008</year> -%% <holder>Ericsson AB, All Rights Reserved</holder> -%%</copyright> -%%<legalnotice> +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2000-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 @@ -14,8 +14,9 @@ %% the License for the specific language governing rights and limitations %% under the License. %% -%% The Initial Developer of the Original Code is Ericsson AB. -%%</legalnotice> +%% %CopyrightEnd% +%% + %% -module(inet_ssl_dist). @@ -135,6 +136,9 @@ accept_connection(AcceptPid, Socket, MyNode, Allowed, SetupTime) -> [self(), AcceptPid, Socket, MyNode, Allowed, SetupTime]). +%% Suppress dialyzer warning, we do not really care about old ssl code +%% as we intend to remove it. +-spec(do_accept(_,_,_,_,_,_) -> no_return()). do_accept(Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) -> process_flag(priority, max), receive @@ -167,8 +171,8 @@ do_accept(Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) -> ssl_prim:getll(S) end, f_address = fun get_remote_id/2, - mf_tick = {?MODULE, tick}, - mf_getstat = {?MODULE,getstat} + mf_tick = fun ?MODULE:tick/1, + mf_getstat = fun ?MODULE:getstat/1 }, dist_util:handshake_other_started(HSData); {false,IP} -> @@ -204,6 +208,9 @@ setup(Node, Type, MyNode, LongOrShortNames,SetupTime) -> LongOrShortNames, SetupTime]). +%% Suppress dialyzer warning, we do not really care about old ssl code +%% as we intend to remove it. +-spec(do_setup(_,_,_,_,_,_) -> no_return()). do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) -> process_flag(priority, max), ?trace("~p~n",[{inet_ssl_dist,self(),setup,Node}]), @@ -258,8 +265,8 @@ do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) -> protocol = ssl, family = inet} end, - mf_tick = {?MODULE, tick}, - mf_getstat = {?MODULE,getstat}, + mf_tick = fun ?MODULE:tick/1, + mf_getstat = fun ?MODULE:getstat/1, request_type = Type }, dist_util:handshake_we_started(HSData); diff --git a/lib/ssl/src/ssl.appup.src b/lib/ssl/src/ssl.appup.src index 51c5289bd2..e6a8c557fc 100644 --- a/lib/ssl/src/ssl.appup.src +++ b/lib/ssl/src/ssl.appup.src @@ -1,10 +1,14 @@ %% -*- erlang -*- {"%VSN%", [ + {"4.1.2", [{restart_application, ssl}]}, + {"4.1.1", [{restart_application, ssl}]}, {"4.1", [{restart_application, ssl}]}, {"4.0.1", [{restart_application, ssl}]} ], [ + {"4.1.2", [{restart_application, ssl}]}, + {"4.1.1", [{restart_application, ssl}]}, {"4.1", [{restart_application, ssl}]}, {"4.0.1", [{restart_application, ssl}]} ]}. diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl index 7e5929d708..b85188b878 100644 --- a/lib/ssl/src/ssl.erl +++ b/lib/ssl/src/ssl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -49,10 +49,31 @@ inet_ssl, %% inet options for internal ssl socket cb %% Callback info }). +-type option() :: socketoption() | ssloption() | transportoption(). +-type socketoption() :: [{property(), term()}]. %% See gen_tcp and inet +-type property() :: atom(). + +-type ssloption() :: {verify, verify_type()} | + {verify_fun, {fun(), InitialUserState::term()}} | + {fail_if_no_peer_cert, boolean()} | {depth, integer()} | + {cert, der_encoded()} | {certfile, path()} | {key, der_encoded()} | + {keyfile, path()} | {password, string()} | {cacerts, [der_encoded()]} | + {cacertfile, path()} | {dh, der_encoded()} | {dhfile, path()} | + {ciphers, ciphers()} | {ssl_imp, ssl_imp()} | {reuse_sessions, boolean()} | + {reuse_session, fun()}. + +-type verify_type() :: verify_none | verify_peer. +-type path() :: string(). +-type ciphers() :: [erl_cipher_suite()] | + string(). % (according to old API) +-type ssl_imp() :: new | old. + +-type transportoption() :: {CallbackModule::atom(), DataTag::atom(), ClosedTag::atom()}. + %%-------------------------------------------------------------------- --spec start() -> ok. --spec start(permanent | transient | temporary) -> ok. +-spec start() -> ok | {error, reason()}. +-spec start(permanent | transient | temporary) -> ok | {error, reason()}. %% %% Description: Utility function that starts the ssl, %% crypto and public_key applications. Default type @@ -77,9 +98,12 @@ stop() -> application:stop(ssl). %%-------------------------------------------------------------------- --spec connect(host() | port(), list()) -> {ok, #sslsocket{}}. --spec connect(host() | port(), list() | port_num(), timeout() | list()) -> {ok, #sslsocket{}}. --spec connect(host() | port(), port_num(), list(), timeout()) -> {ok, #sslsocket{}}. +-spec connect(host() | port(), [option()]) -> {ok, #sslsocket{}} | + {error, reason()}. +-spec connect(host() | port(), [option()] | port_num(), timeout() | list()) -> + {ok, #sslsocket{}} | {error, reason()}. +-spec connect(host() | port(), port_num(), list(), timeout()) -> + {ok, #sslsocket{}} | {error, reason()}. %% %% Description: Connect to a ssl server. @@ -126,7 +150,7 @@ connect(Host, Port, Options0, Timeout) -> end. %%-------------------------------------------------------------------- --spec listen(port_num(), list()) ->{ok, #sslsocket{}} | {error, reason()}. +-spec listen(port_num(), [option()]) ->{ok, #sslsocket{}} | {error, reason()}. %% %% Description: Creates a ssl listen socket. @@ -150,8 +174,10 @@ listen(Port, Options0) -> end. %%-------------------------------------------------------------------- --spec transport_accept(#sslsocket{}) -> {ok, #sslsocket{}}. --spec transport_accept(#sslsocket{}, timeout()) -> {ok, #sslsocket{}}. +-spec transport_accept(#sslsocket{}) -> {ok, #sslsocket{}} | + {error, reason()}. +-spec transport_accept(#sslsocket{}, timeout()) -> {ok, #sslsocket{}} | + {error, reason()}. %% %% Description: Performs transport accept on a ssl listen socket %%-------------------------------------------------------------------- @@ -189,9 +215,10 @@ transport_accept(#sslsocket{} = ListenSocket, Timeout) -> ssl_broker:transport_accept(Pid, ListenSocket, Timeout). %%-------------------------------------------------------------------- --spec ssl_accept(#sslsocket{}) -> {ok, #sslsocket{}} | {error, reason()}. --spec ssl_accept(#sslsocket{}, list() | timeout()) -> {ok, #sslsocket{}} | {error, reason()}. --spec ssl_accept(port(), list(), timeout()) -> {ok, #sslsocket{}} | {error, reason()}. +-spec ssl_accept(#sslsocket{}) -> ok | {error, reason()}. +-spec ssl_accept(#sslsocket{} | port(), timeout()| [option()]) -> + ok | {ok, #sslsocket{}} | {error, reason()}. +-spec ssl_accept(port(), [option()], timeout()) -> {ok, #sslsocket{}} | {error, reason()}. %% %% Description: Performs accept on a ssl listen socket. e.i. performs %% ssl handshake. diff --git a/lib/ssl/src/ssl_certificate_db.erl b/lib/ssl/src/ssl_certificate_db.erl index 2a5a7f3394..3eceefa304 100644 --- a/lib/ssl/src/ssl_certificate_db.erl +++ b/lib/ssl/src/ssl_certificate_db.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -27,7 +27,9 @@ -export([create/0, remove/1, add_trusted_certs/3, remove_trusted_certs/2, lookup_trusted_cert/3, issuer_candidate/1, - lookup_cached_certs/1, cache_pem_file/3]). + lookup_cached_certs/1, cache_pem_file/4, uncache_pem_file/2, lookup/2]). + +-type time() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}. %%==================================================================== %% Internal application API @@ -98,17 +100,35 @@ add_trusted_certs(Pid, File, [CertsDb, FileToRefDb, PidToFileDb]) -> insert(Pid, File, PidToFileDb), {ok, Ref}. %%-------------------------------------------------------------------- --spec cache_pem_file(pid(), string(), certdb_ref()) -> term(). +-spec cache_pem_file(pid(), string(), time(), certdb_ref()) -> term(). %% %% Description: Cache file as binary in DB %%-------------------------------------------------------------------- -cache_pem_file(Pid, File, [CertsDb, _FileToRefDb, PidToFileDb]) -> +cache_pem_file(Pid, File, Time, [CertsDb, _FileToRefDb, PidToFileDb]) -> {ok, PemBin} = file:read_file(File), Content = public_key:pem_decode(PemBin), - insert({file, File}, Content, CertsDb), + insert({file, File}, {Time, Content}, CertsDb), insert(Pid, File, PidToFileDb), {ok, Content}. +%-------------------------------------------------------------------- +-spec uncache_pem_file(string(), certdb_ref()) -> no_return(). +%% +%% Description: If a cached file is no longer valid (changed on disk) +%% we must terminate the connections using the old file content, and +%% when those processes are finish the cache will be cleaned. It is +%% a rare but possible case a new ssl client/server is started with +%% a filename with the same name as previously started client/server +%% but with different content. +%% -------------------------------------------------------------------- +uncache_pem_file(File, [_CertsDb, _FileToRefDb, PidToFileDb]) -> + Pids = select(PidToFileDb, [{{'$1', File},[],['$$']}]), + lists:foreach(fun([Pid]) -> + exit(Pid, shutdown) + end, Pids). + + + %%-------------------------------------------------------------------- -spec remove_trusted_certs(pid(), certdb_ref()) -> term(). @@ -174,6 +194,22 @@ issuer_candidate(PrevCandidateKey) -> end. %%-------------------------------------------------------------------- +-spec lookup(term(), term()) -> term() | undefined. +%% +%% Description: Looks up an element in a certificat <Db>. +%%-------------------------------------------------------------------- +lookup(Key, Db) -> + case ets:lookup(Db, Key) of + [] -> + undefined; + Contents -> + Pick = fun({_, Data}) -> Data; + ({_,_,Data}) -> Data + end, + [Pick(Data) || Data <- Contents] + end. + +%%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- certificate_db_name() -> @@ -191,16 +227,8 @@ ref_count(Key, Db,N) -> delete(Key, Db) -> _ = ets:delete(Db, Key). -lookup(Key, Db) -> - case ets:lookup(Db, Key) of - [] -> - undefined; - Contents -> - Pick = fun({_, Data}) -> Data; - ({_,_,Data}) -> Data - end, - [Pick(Data) || Data <- Contents] - end. +select(Db, MatchSpec)-> + ets:select(Db, MatchSpec). remove_certs(Ref, CertsDb) -> ets:match_delete(CertsDb, {{Ref, '_', '_'}, '_'}). diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index 6c9ac65b64..85245f4342 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -70,7 +70,6 @@ %% {{md5_hash, sha_hash}, {prev_md5, prev_sha}} (binary()) tls_handshake_hashes, % see above tls_cipher_texts, % list() received but not deciphered yet - own_cert, % binary() session, % #session{} from ssl_handshake.hrl session_cache, % session_cache_cb, % @@ -90,7 +89,8 @@ log_alert, % boolean() renegotiation, % {boolean(), From | internal | peer} recv_during_renegotiation, %boolean() - send_queue % queue() + send_queue, % queue() + terminated = false % }). -define(DEFAULT_DIFFIE_HELLMAN_PARAMS, @@ -304,8 +304,9 @@ init([Role, Host, Port, Socket, {SSLOpts0, _} = Options, try ssl_init(SSLOpts0, Role) of {ok, Ref, CacheRef, OwnCert, Key, DHParams} -> + Session = State0#state.session, State = State0#state{tls_handshake_hashes = Hashes0, - own_cert = OwnCert, + session = Session#session{own_certificate = OwnCert}, cert_db_ref = Ref, session_cache = CacheRef, private_key = Key, @@ -331,14 +332,13 @@ init([Role, Host, Port, Socket, {SSLOpts0, _} = Options, %%-------------------------------------------------------------------- hello(start, #state{host = Host, port = Port, role = client, ssl_options = SslOpts, + session = #session{own_certificate = Cert} = Session0, transport_cb = Transport, socket = Socket, connection_states = ConnectionStates, - renegotiation = {Renegotiation, _}} - = State0) -> - + renegotiation = {Renegotiation, _}} = State0) -> Hello = ssl_handshake:client_hello(Host, Port, ConnectionStates, - SslOpts, Renegotiation), + SslOpts, Renegotiation, Cert), Version = Hello#client_hello.client_version, Hashes0 = ssl_handshake:init_hashes(), @@ -347,13 +347,13 @@ hello(start, #state{host = Host, port = Port, role = client, Transport:send(Socket, BinMsg), State1 = State0#state{connection_states = CS2, negotiated_version = Version, %% Requested version - session = - #session{session_id = Hello#client_hello.session_id, - is_resumable = false}, + session = + Session0#session{session_id = Hello#client_hello.session_id, + is_resumable = false}, tls_handshake_hashes = Hashes1}, {Record, State} = next_record(State1), next_state(hello, Record, State); - + hello(start, #state{role = server} = State0) -> {Record, State} = next_record(State0), next_state(hello, Record, State); @@ -370,7 +370,6 @@ hello(#server_hello{cipher_suite = CipherSuite, negotiated_version = ReqVersion, renegotiation = {Renegotiation, _}, ssl_options = SslOptions} = State0) -> - case ssl_handshake:hello(Hello, SslOptions, ConnectionStates0, Renegotiation) of {Version, NewId, ConnectionStates} -> {KeyAlgorithm, _, _} = @@ -396,13 +395,11 @@ hello(#server_hello{cipher_suite = CipherSuite, hello(Hello = #client_hello{client_version = ClientVersion}, State = #state{connection_states = ConnectionStates0, - port = Port, session = Session0, + port = Port, session = #session{own_certificate = Cert} = Session0, renegotiation = {Renegotiation, _}, session_cache = Cache, session_cache_cb = CacheCb, - ssl_options = SslOpts, - own_cert = Cert}) -> - + ssl_options = SslOpts}) -> case ssl_handshake:hello(Hello, SslOpts, {Port, Session0, Cache, CacheCb, ConnectionStates0, Cert}, Renegotiation) of {Version, {Type, Session}, ConnectionStates} -> @@ -536,7 +533,7 @@ certify(#server_hello_done{}, connection_states = ConnectionStates0, negotiated_version = Version, premaster_secret = undefined, - role = client} = State0) -> + role = client} = State0) -> case ssl_handshake:master_secret(Version, Session, ConnectionStates0, client) of {MasterSecret, ConnectionStates1} -> @@ -613,7 +610,6 @@ certify_client_key_exchange(#client_diffie_hellman_public{dh_public = ClientPubl diffie_hellman_params = #'DHParameter'{prime = P, base = G}, diffie_hellman_keys = {_, ServerDhPrivateKey}} = State0) -> - case dh_master_secret(crypto:mpint(P), crypto:mpint(G), ClientPublicDhKey, ServerDhPrivateKey, State0) of #state{} = State1 -> {Record, State} = next_record(State1), @@ -656,8 +652,7 @@ cipher(#finished{verify_data = Data} = Finished, role = Role, session = #session{master_secret = MasterSecret} = Session0, - tls_handshake_hashes = Hashes0} = State) -> - + tls_handshake_hashes = Hashes0} = State) -> case ssl_handshake:verify_connection(Version, Finished, opposite_role(Role), MasterSecret, Hashes0) of @@ -678,15 +673,15 @@ cipher(Msg, State) -> %%-------------------------------------------------------------------- connection(#hello_request{}, #state{host = Host, port = Port, socket = Socket, + session = #session{own_certificate = Cert}, ssl_options = SslOpts, negotiated_version = Version, transport_cb = Transport, connection_states = ConnectionStates0, renegotiation = {Renegotiation, _}, tls_handshake_hashes = Hashes0} = State0) -> - Hello = ssl_handshake:client_hello(Host, Port, ConnectionStates0, - SslOpts, Renegotiation), + SslOpts, Renegotiation, Cert), {BinMsg, ConnectionStates1, Hashes1} = encode_handshake(Hello, Version, ConnectionStates0, Hashes0), @@ -777,8 +772,12 @@ handle_sync_event(start, _, connection, State) -> handle_sync_event(start, From, StateName, State) -> {next_state, StateName, State#state{from = From}}; -handle_sync_event(close, _, _StateName, State) -> - {stop, normal, ok, State}; +handle_sync_event(close, _, StateName, State) -> + %% Run terminate before returning + %% so that the reuseaddr inet-option will work + %% as intended. + (catch terminate(user_close, StateName, State)), + {stop, normal, ok, State#state{terminated = true}}; handle_sync_event({shutdown, How0}, _, StateName, #state{transport_cb = Transport, @@ -966,6 +965,11 @@ handle_info(Msg, StateName, State) -> %% necessary cleaning up. When it returns, the gen_fsm terminates with %% Reason. The return value is ignored. %%-------------------------------------------------------------------- +terminate(_, _, #state{terminated = true}) -> + %% Happens when user closes the connection using ssl:close/1 + %% we want to guarantee that Transport:close has been called + %% when ssl:close/1 returns. + ok; terminate(Reason, connection, #state{negotiated_version = Version, connection_states = ConnectionStates, transport_cb = Transport, @@ -975,14 +979,14 @@ terminate(Reason, connection, #state{negotiated_version = Version, notify_renegotiater(Renegotiate), BinAlert = terminate_alert(Reason, Version, ConnectionStates), Transport:send(Socket, BinAlert), - workaround_transport_delivery_problems(Socket, Transport), + workaround_transport_delivery_problems(Socket, Transport, Reason), Transport:close(Socket); -terminate(_Reason, _StateName, #state{transport_cb = Transport, +terminate(Reason, _StateName, #state{transport_cb = Transport, socket = Socket, send_queue = SendQueue, renegotiation = Renegotiate}) -> notify_senders(SendQueue), notify_renegotiater(Renegotiate), - workaround_transport_delivery_problems(Socket, Transport), + workaround_transport_delivery_problems(Socket, Transport, Reason), Transport:close(Socket). %%-------------------------------------------------------------------- @@ -1082,12 +1086,13 @@ init_private_key({rsa, PrivateKey}, _, _,_) -> init_private_key({dsa, PrivateKey},_,_,_) -> public_key:der_decode('DSAPrivateKey', PrivateKey). +-spec(handle_file_error(_,_,_,_,_,_) -> no_return()). handle_file_error(Line, Error, {badmatch, Reason}, File, Throw, Stack) -> file_error(Line, Error, Reason, File, Throw, Stack); handle_file_error(Line, Error, Reason, File, Throw, Stack) -> file_error(Line, Error, Reason, File, Throw, Stack). --spec(file_error/6 :: (_,_,_,_,_,_) -> no_return()). +-spec(file_error(_,_,_,_,_,_) -> no_return()). file_error(Line, Error, Reason, File, Throw, Stack) -> Report = io_lib:format("SSL: ~p: ~p:~p ~s~n ~p~n", [Line, Error, Reason, File, Stack]), @@ -1147,7 +1152,7 @@ certify_client(#state{client_certificate_requested = true, role = client, transport_cb = Transport, negotiated_version = Version, cert_db_ref = CertDbRef, - own_cert = OwnCert, + session = #session{own_certificate = OwnCert}, socket = Socket, tls_handshake_hashes = Hashes0} = State) -> Certificate = ssl_handshake:certificate(OwnCert, CertDbRef, client), @@ -1163,10 +1168,10 @@ verify_client_cert(#state{client_certificate_requested = true, role = client, connection_states = ConnectionStates0, transport_cb = Transport, negotiated_version = Version, - own_cert = OwnCert, socket = Socket, private_key = PrivateKey, - session = #session{master_secret = MasterSecret}, + session = #session{master_secret = MasterSecret, + own_certificate = OwnCert}, tls_handshake_hashes = Hashes0} = State) -> case ssl_handshake:client_certificate_verify(OwnCert, MasterSecret, @@ -1332,7 +1337,7 @@ certify_server(#state{transport_cb = Transport, connection_states = ConnectionStates, tls_handshake_hashes = Hashes, cert_db_ref = CertDbRef, - own_cert = OwnCert} = State) -> + session = #session{own_certificate = OwnCert}} = State) -> case ssl_handshake:certificate(OwnCert, CertDbRef, server) of CertMsg = #certificate{} -> {BinCertMsg, NewConnectionStates, NewHashes} = @@ -1359,7 +1364,6 @@ key_exchange(#state{role = server, key_algorithm = Algo, when Algo == dhe_dss; Algo == dhe_rsa; Algo == dh_anon -> - Keys = crypto:dh_generate_key([crypto:mpint(P), crypto:mpint(G)]), ConnectionState = ssl_record:pending_connection_state(ConnectionStates0, read), @@ -1408,8 +1412,6 @@ key_exchange(#state{role = client, State#state{connection_states = ConnectionStates1, tls_handshake_hashes = Hashes1}. --spec(rsa_key_exchange/2 :: (_,_) -> no_return()). - rsa_key_exchange(PremasterSecret, PublicKeyInfo = {Algorithm, _, _}) when Algorithm == ?rsaEncryption; Algorithm == ?md2WithRSAEncryption; @@ -1911,14 +1913,22 @@ next_state_connection(StateName, #state{send_queue = Queue0, next_state_is_connection(State) end. +%% In next_state_is_connection/1: clear tls_handshake_hashes, +%% premaster_secret and public_key_info (only needed during handshake) +%% to reduce memory foot print of a connection. next_state_is_connection(State = #state{recv_during_renegotiation = true, socket_options = #socket_options{active = false}}) -> - passive_receive(State#state{recv_during_renegotiation = false}, connection); + passive_receive(State#state{recv_during_renegotiation = false, + premaster_secret = undefined, + public_key_info = undefined, + tls_handshake_hashes = {<<>>, <<>>}}, connection); next_state_is_connection(State0) -> {Record, State} = next_record_if_active(State0), - next_state(connection, Record, State). + next_state(connection, Record, State#state{premaster_secret = undefined, + public_key_info = undefined, + tls_handshake_hashes = {<<>>, <<>>}}). register_session(_, _, _, #session{is_resumable = true} = Session) -> Session; %% Already registered @@ -2185,7 +2195,8 @@ notify_renegotiater({true, From}) when not is_atom(From) -> notify_renegotiater(_) -> ok. -terminate_alert(Reason, Version, ConnectionStates) when Reason == normal; Reason == shutdown -> +terminate_alert(Reason, Version, ConnectionStates) when Reason == normal; Reason == shutdown; + Reason == user_close -> {BinAlert, _} = encode_alert(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY), Version, ConnectionStates), BinAlert; @@ -2194,10 +2205,13 @@ terminate_alert(_, Version, ConnectionStates) -> Version, ConnectionStates), BinAlert. -workaround_transport_delivery_problems(Socket, Transport) -> +workaround_transport_delivery_problems(_,_, user_close) -> + ok; +workaround_transport_delivery_problems(Socket, Transport, _) -> %% Standard trick to try to make sure all %% data sent to to tcp port is really sent - %% before tcp port is closed. + %% before tcp port is closed so that the peer will + %% get a correct error message. inet:setopts(Socket, [{active, false}]), Transport:shutdown(Socket, write), Transport:recv(Socket, 0). diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl index c7a1c4965d..1f4c44d115 100644 --- a/lib/ssl/src/ssl_handshake.erl +++ b/lib/ssl/src/ssl_handshake.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -30,7 +30,7 @@ -include("ssl_internal.hrl"). -include_lib("public_key/include/public_key.hrl"). --export([master_secret/4, client_hello/5, server_hello/4, hello/4, +-export([master_secret/4, client_hello/6, server_hello/4, hello/4, hello_request/0, certify/6, certificate/3, client_certificate_verify/5, certificate_verify/5, certificate_request/2, key_exchange/2, server_key_exchange_hash/2, @@ -49,13 +49,13 @@ %%==================================================================== %%-------------------------------------------------------------------- -spec client_hello(host(), port_num(), #connection_states{}, - #ssl_options{}, boolean()) -> #client_hello{}. + #ssl_options{}, boolean(), der_cert()) -> #client_hello{}. %% %% Description: Creates a client hello message. %%-------------------------------------------------------------------- client_hello(Host, Port, ConnectionStates, #ssl_options{versions = Versions, ciphers = UserSuites} - = SslOpts, Renegotiation) -> + = SslOpts, Renegotiation, OwnCert) -> Fun = fun(Version) -> ssl_record:protocol_version(Version) @@ -65,7 +65,7 @@ client_hello(Host, Port, ConnectionStates, #ssl_options{versions = Versions, SecParams = Pending#connection_state.security_parameters, Ciphers = available_suites(UserSuites, Version), - Id = ssl_manager:client_session_id(Host, Port, SslOpts), + Id = ssl_manager:client_session_id(Host, Port, SslOpts, OwnCert), #client_hello{session_id = Id, client_version = Version, @@ -194,14 +194,12 @@ certify(#certificate{asn1_certificates = ASN1Certs}, CertDbRef, {fun(OtpCert, ExtensionOrError, {SslState, UserState}) -> case ssl_certificate:validate_extension(OtpCert, ExtensionOrError, - SslState) of - {valid, _} -> - apply_user_fun(Fun, OtpCert, - ExtensionOrError, UserState, - SslState); - {fail, Reason} -> - apply_user_fun(Fun, OtpCert, Reason, UserState, - SslState); + SslState) of + {valid, NewSslState} -> + {valid, {NewSslState, UserState}}; + {fail, Reason} -> + apply_user_fun(Fun, OtpCert, Reason, UserState, + SslState); {unknown, _} -> apply_user_fun(Fun, OtpCert, ExtensionOrError, UserState, SslState) @@ -571,7 +569,7 @@ select_session(Hello, Port, Session, Version, #ssl_options{ciphers = UserSuites} = SslOpts, Cache, CacheCb, Cert) -> SuggestedSessionId = Hello#client_hello.session_id, SessionId = ssl_manager:server_session_id(Port, SuggestedSessionId, - SslOpts), + SslOpts, Cert), Suites = available_suites(Cert, UserSuites, Version), case ssl_session:is_new(SuggestedSessionId, SessionId) of diff --git a/lib/ssl/src/ssl_handshake.hrl b/lib/ssl/src/ssl_handshake.hrl index 68a7802ef2..8ae4d2332e 100644 --- a/lib/ssl/src/ssl_handshake.hrl +++ b/lib/ssl/src/ssl_handshake.hrl @@ -36,6 +36,7 @@ -record(session, { session_id, peer_certificate, + own_certificate, compression_method, cipher_suite, master_secret, diff --git a/lib/ssl/src/ssl_internal.hrl b/lib/ssl/src/ssl_internal.hrl index 43a85c2d9d..715941e3ad 100644 --- a/lib/ssl/src/ssl_internal.hrl +++ b/lib/ssl/src/ssl_internal.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -19,7 +19,6 @@ %% - -ifndef(ssl_internal). -define(ssl_internal, true). diff --git a/lib/ssl/src/ssl_manager.erl b/lib/ssl/src/ssl_manager.erl index 3b02d96562..f845b1ecc0 100644 --- a/lib/ssl/src/ssl_manager.erl +++ b/lib/ssl/src/ssl_manager.erl @@ -29,8 +29,8 @@ %% Internal application API -export([start_link/1, connection_init/2, cache_pem_file/1, - lookup_trusted_cert/3, issuer_candidate/1, client_session_id/3, - server_session_id/3, + lookup_trusted_cert/3, issuer_candidate/1, client_session_id/4, + server_session_id/4, register_session/2, register_session/3, invalidate_session/2, invalidate_session/3]). @@ -43,6 +43,7 @@ -include("ssl_handshake.hrl"). -include("ssl_internal.hrl"). +-include_lib("kernel/include/file.hrl"). -record(state, { session_cache, @@ -76,16 +77,17 @@ start_link(Opts) -> connection_init(Trustedcerts, Role) -> call({connection_init, Trustedcerts, Role}). %%-------------------------------------------------------------------- --spec cache_pem_file(string()) -> {ok, term()}. +-spec cache_pem_file(string()) -> {ok, term()} | {error, reason()}. %% -%% Description: Cach a pem file and +%% Description: Cach a pem file and return its content. %%-------------------------------------------------------------------- -cache_pem_file(File) -> - case ssl_certificate_db:lookup_cached_certs(File) of - [{_,Content}] -> - {ok, Content}; - [] -> - call({cache_pem, File}) +cache_pem_file(File) -> + try file:read_file_info(File) of + {ok, #file_info{mtime = LastWrite}} -> + cache_pem_file(File, LastWrite) + catch + _:Reason -> + {error, Reason} end. %%-------------------------------------------------------------------- -spec lookup_trusted_cert(reference(), serialnumber(), issuer()) -> @@ -106,20 +108,21 @@ lookup_trusted_cert(Ref, SerialNumber, Issuer) -> issuer_candidate(PrevCandidateKey) -> ssl_certificate_db:issuer_candidate(PrevCandidateKey). %%-------------------------------------------------------------------- --spec client_session_id(host(), port_num(), #ssl_options{}) -> session_id(). +-spec client_session_id(host(), port_num(), #ssl_options{}, + der_cert() | undefined) -> session_id(). %% %% Description: Select a session id for the client. %%-------------------------------------------------------------------- -client_session_id(Host, Port, SslOpts) -> - call({client_session_id, Host, Port, SslOpts}). +client_session_id(Host, Port, SslOpts, OwnCert) -> + call({client_session_id, Host, Port, SslOpts, OwnCert}). %%-------------------------------------------------------------------- --spec server_session_id(host(), port_num(), #ssl_options{}) -> session_id(). +-spec server_session_id(host(), port_num(), #ssl_options{}, der_cert()) -> session_id(). %% %% Description: Select a session id for the server. %%-------------------------------------------------------------------- -server_session_id(Port, SuggestedSessionId, SslOpts) -> - call({server_session_id, Port, SuggestedSessionId, SslOpts}). +server_session_id(Port, SuggestedSessionId, SslOpts, OwnCert) -> + call({server_session_id, Port, SuggestedSessionId, SslOpts, OwnCert}). %%-------------------------------------------------------------------- -spec register_session(port_num(), #session{}) -> ok. @@ -201,28 +204,35 @@ handle_call({{connection_init, Trustedcerts, _Role}, Pid}, _From, end, {reply, Result, State}; -handle_call({{client_session_id, Host, Port, SslOpts}, _}, _, +handle_call({{client_session_id, Host, Port, SslOpts, OwnCert}, _}, _, #state{session_cache = Cache, session_cache_cb = CacheCb} = State) -> - Id = ssl_session:id({Host, Port, SslOpts}, Cache, CacheCb), + Id = ssl_session:id({Host, Port, SslOpts}, Cache, CacheCb, OwnCert), {reply, Id, State}; -handle_call({{server_session_id, Port, SuggestedSessionId, SslOpts}, _}, +handle_call({{server_session_id, Port, SuggestedSessionId, SslOpts, OwnCert}, _}, _, #state{session_cache_cb = CacheCb, session_cache = Cache, session_lifetime = LifeTime} = State) -> Id = ssl_session:id(Port, SuggestedSessionId, SslOpts, - Cache, CacheCb, LifeTime), + Cache, CacheCb, LifeTime, OwnCert), {reply, Id, State}; -handle_call({{cache_pem, File},Pid}, _, State = #state{certificate_db = Db}) -> - try ssl_certificate_db:cache_pem_file(Pid,File,Db) of +handle_call({{cache_pem, File, LastWrite}, Pid}, _, + #state{certificate_db = Db} = State) -> + try ssl_certificate_db:cache_pem_file(Pid, File, LastWrite, Db) of Result -> {reply, Result, State} catch _:Reason -> {reply, {error, Reason}, State} - end. + end; +handle_call({{recache_pem, File, LastWrite}, Pid}, From, + #state{certificate_db = Db} = State) -> + ssl_certificate_db:uncache_pem_file(File, Db), + cast({recache_pem, File, LastWrite, Pid, From}), + {noreply, State}. + %%-------------------------------------------------------------------- -spec handle_cast(msg(), #state{}) -> {noreply, #state{}}. %% Possible return values not used now. @@ -259,7 +269,21 @@ handle_cast({invalidate_session, Port, #session{session_id = ID}}, #state{session_cache = Cache, session_cache_cb = CacheCb} = State) -> CacheCb:delete(Cache, {Port, ID}), - {noreply, State}. + {noreply, State}; + +handle_cast({recache_pem, File, LastWrite, Pid, From}, + #state{certificate_db = [_, FileToRefDb, _]} = State0) -> + case ssl_certificate_db:lookup(File, FileToRefDb) of + undefined -> + {reply, Msg, State} = handle_call({{cache_pem, File, LastWrite}, Pid}, From, State0), + gen_server:reply(From, Msg), + {noreply, State}; + _ -> %% Send message to self letting cleanup messages be handled + %% first so that no reference to the old version of file + %% exists when we cache the new one. + cast({recache_pem, File, LastWrite, Pid, From}), + {noreply, State0} + end. %%-------------------------------------------------------------------- -spec handle_info(msg(), #state{}) -> {noreply, #state{}}. @@ -286,12 +310,14 @@ handle_info({'EXIT', _, _}, State) -> handle_info({'DOWN', _Ref, _Type, _Pid, ecacertfile}, State) -> {noreply, State}; +handle_info({'DOWN', _Ref, _Type, Pid, shutdown}, State) -> + handle_info({remove_trusted_certs, Pid}, State); handle_info({'DOWN', _Ref, _Type, Pid, _Reason}, State) -> erlang:send_after(?CERTIFICATE_CACHE_CLEANUP, self(), {remove_trusted_certs, Pid}), {noreply, State}; handle_info({remove_trusted_certs, Pid}, - State = #state{certificate_db = Db}) -> + #state{certificate_db = Db} = State) -> ssl_certificate_db:remove_trusted_certs(Pid, Db), {noreply, State}; @@ -362,3 +388,16 @@ session_validation({{{Host, Port}, _}, Session}, LifeTime) -> session_validation({{Port, _}, Session}, LifeTime) -> validate_session(Port, Session, LifeTime), LifeTime. + +cache_pem_file(File, LastWrite) -> + case ssl_certificate_db:lookup_cached_certs(File) of + [{_, {Mtime, Content}}] -> + case LastWrite of + Mtime -> + {ok, Content}; + _ -> + call({recache_pem, File, LastWrite}) + end; + [] -> + call({cache_pem, File, LastWrite}) + end. diff --git a/lib/ssl/src/ssl_session.erl b/lib/ssl/src/ssl_session.erl index 25e7445180..dc4b7a711c 100644 --- a/lib/ssl/src/ssl_session.erl +++ b/lib/ssl/src/ssl_session.erl @@ -28,7 +28,7 @@ -include("ssl_internal.hrl"). %% Internal application API --export([is_new/2, id/3, id/6, valid_session/2]). +-export([is_new/2, id/4, id/7, valid_session/2]). -define(GEN_UNIQUE_ID_MAX_TRIES, 10). @@ -48,13 +48,14 @@ is_new(_ClientSuggestion, _ServerDecision) -> true. %%-------------------------------------------------------------------- --spec id({host(), port_num(), #ssl_options{}}, cache_ref(), atom()) -> binary(). +-spec id({host(), port_num(), #ssl_options{}}, cache_ref(), atom(), + undefined | binary()) -> binary(). %% %% Description: Should be called by the client side to get an id %% for the client hello message. %%-------------------------------------------------------------------- -id(ClientInfo, Cache, CacheCb) -> - case select_session(ClientInfo, Cache, CacheCb) of +id(ClientInfo, Cache, CacheCb, OwnCert) -> + case select_session(ClientInfo, Cache, CacheCb, OwnCert) of no_session -> <<>>; SessionId -> @@ -63,19 +64,19 @@ id(ClientInfo, Cache, CacheCb) -> %%-------------------------------------------------------------------- -spec id(port_num(), binary(), #ssl_options{}, cache_ref(), - atom(), seconds()) -> binary(). + atom(), seconds(), binary()) -> binary(). %% %% Description: Should be called by the server side to get an id %% for the server hello message. %%-------------------------------------------------------------------- -id(Port, <<>>, _, Cache, CacheCb, _) -> +id(Port, <<>>, _, Cache, CacheCb, _, _) -> new_id(Port, ?GEN_UNIQUE_ID_MAX_TRIES, Cache, CacheCb); id(Port, SuggestedSessionId, #ssl_options{reuse_sessions = ReuseEnabled, reuse_session = ReuseFun}, - Cache, CacheCb, SecondLifeTime) -> + Cache, CacheCb, SecondLifeTime, OwnCert) -> case is_resumable(SuggestedSessionId, Port, ReuseEnabled, - ReuseFun, Cache, CacheCb, SecondLifeTime) of + ReuseFun, Cache, CacheCb, SecondLifeTime, OwnCert) of true -> SuggestedSessionId; false -> @@ -93,19 +94,20 @@ valid_session(#session{time_stamp = TimeStamp}, LifeTime) -> %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- -select_session({HostIP, Port, SslOpts}, Cache, CacheCb) -> +select_session({HostIP, Port, SslOpts}, Cache, CacheCb, OwnCert) -> Sessions = CacheCb:select_session(Cache, {HostIP, Port}), - select_session(Sessions, SslOpts). + select_session(Sessions, SslOpts, OwnCert). -select_session([], _) -> +select_session([], _, _) -> no_session; select_session(Sessions, #ssl_options{ciphers = Ciphers, - reuse_sessions = ReuseSession}) -> + reuse_sessions = ReuseSession}, OwnCert) -> IsResumable = fun(Session) -> ReuseSession andalso (Session#session.is_resumable) andalso lists:member(Session#session.cipher_suite, Ciphers) + andalso (OwnCert == Session#session.own_certificate) end, case [Id || [Id, Session] <- Sessions, IsResumable(Session)] of [] -> @@ -140,14 +142,16 @@ new_id(Port, Tries, Cache, CacheCb) -> end. is_resumable(SuggestedSessionId, Port, ReuseEnabled, ReuseFun, Cache, - CacheCb, SecondLifeTime) -> + CacheCb, SecondLifeTime, OwnCert) -> case CacheCb:lookup(Cache, {Port, SuggestedSessionId}) of #session{cipher_suite = CipherSuite, + own_certificate = SessionOwnCert, compression_method = Compression, is_resumable = Is_resumable, peer_certificate = PeerCert} = Session -> ReuseEnabled andalso Is_resumable + andalso (OwnCert == SessionOwnCert) andalso valid_session(Session, SecondLifeTime) andalso ReuseFun(SuggestedSessionId, PeerCert, Compression, CipherSuite); diff --git a/lib/ssl/src/ssl_ssl3.erl b/lib/ssl/src/ssl_ssl3.erl index c49f9f1e6d..f2926b2d2f 100644 --- a/lib/ssl/src/ssl_ssl3.erl +++ b/lib/ssl/src/ssl_ssl3.erl @@ -102,11 +102,6 @@ mac_hash(Method, Mac_write_secret, Seq_num, Type, Length, Fragment) -> %% hash(MAC_write_secret + pad_1 + seq_num + %% SSLCompressed.type + SSLCompressed.length + %% SSLCompressed.fragment)); - case Method of - ?NULL -> ok; - _ -> - ok - end, Mac = mac_hash(Method, Mac_write_secret, [<<?UINT64(Seq_num), ?BYTE(Type), ?UINT16(Length)>>, Fragment]), diff --git a/lib/ssl/src/ssl_tls1.erl b/lib/ssl/src/ssl_tls1.erl index 3784483e9c..5f9850c386 100644 --- a/lib/ssl/src/ssl_tls1.erl +++ b/lib/ssl/src/ssl_tls1.erl @@ -128,11 +128,6 @@ mac_hash(Method, Mac_write_secret, Seq_num, Type, {Major, Minor}, %% HMAC_hash(MAC_write_secret, seq_num + TLSCompressed.type + %% TLSCompressed.version + TLSCompressed.length + %% TLSCompressed.fragment)); - case Method of - ?NULL -> ok; - _ -> - ok - end, Mac = hmac_hash(Method, Mac_write_secret, [<<?UINT64(Seq_num), ?BYTE(Type), ?BYTE(Major), ?BYTE(Minor), ?UINT16(Length)>>, diff --git a/lib/ssl/test/Makefile b/lib/ssl/test/Makefile index c0a7f8d257..823401c863 100644 --- a/lib/ssl/test/Makefile +++ b/lib/ssl/test/Makefile @@ -126,7 +126,7 @@ release_spec: opt release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(HRL_FILES_NEEDED_IN_TEST) $(COVER_FILE) $(RELSYSDIR) - $(INSTALL_DATA) ssl.spec $(RELSYSDIR) + $(INSTALL_DATA) ssl.spec ssl.cover $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/ssl/test/make_certs.erl b/lib/ssl/test/make_certs.erl index 3c18a905b4..693289990c 100644 --- a/lib/ssl/test/make_certs.erl +++ b/lib/ssl/test/make_certs.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 diff --git a/lib/ssl/test/old_ssl_active_SUITE.erl b/lib/ssl/test/old_ssl_active_SUITE.erl index d1cec26827..a878c5af68 100644 --- a/lib/ssl/test/old_ssl_active_SUITE.erl +++ b/lib/ssl/test/old_ssl_active_SUITE.erl @@ -20,11 +20,10 @@ %% -module(old_ssl_active_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, - config/1, - finish/1, + end_per_testcase/2, cinit_return_chkclose/1, sinit_return_chkclose/1, cinit_big_return_chkclose/1, @@ -40,7 +39,7 @@ -import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7, test_server_only/6]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ssl_test_MACHINE.hrl"). -define(MANYCONNS, ssl_test_MACHINE:many_conns()). @@ -49,33 +48,35 @@ init_per_testcase(_Case, Config) -> WatchDog = ssl_test_lib:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of ssl.erl interface in active mode."; -all(suite) -> - {conf, - config, - [cinit_return_chkclose, - sinit_return_chkclose, - cinit_big_return_chkclose, - sinit_big_return_chkclose, - cinit_big_echo_chkclose, - cinit_huge_echo_chkclose, - sinit_big_echo_chkclose, - cinit_few_echo_chkclose, - cinit_many_echo_chkclose, - cinit_cnocert], - finish}. - -config(doc) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [cinit_return_chkclose, sinit_return_chkclose, + cinit_big_return_chkclose, sinit_big_return_chkclose, + cinit_big_echo_chkclose, cinit_huge_echo_chkclose, + sinit_big_echo_chkclose, cinit_few_echo_chkclose, + cinit_many_echo_chkclose, cinit_cnocert]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(doc) -> "Want to se what Config contains, and record the number of available " "file descriptors"; -config(suite) -> +init_per_suite(suite) -> []; -config(Config) -> +init_per_suite(Config) -> io:format("Config: ~p~n", [Config]), case os:type() of {unix, _} -> @@ -87,20 +88,25 @@ config(Config) -> %% operating system, version of OTP, Erts, kernel and stdlib. %% Check if SSL exists. If this case fails, all other cases are skipped - crypto:start(), - application:start(public_key), - case ssl:start() of - ok -> ssl:stop(); - {error, {already_started, _}} -> ssl:stop(); - Error -> ?t:fail({failed_starting_ssl,Error}) - end, - Config. - -finish(doc) -> + case catch crypto:start() of + ok -> + application:start(public_key), + case ssl:start() of + ok -> ssl:stop(); + {error, {already_started, _}} -> ssl:stop(); + Error -> ?t:fail({failed_starting_ssl,Error}) + end, + Config; + _Else -> + {skip,"Could not start crypto!"} + end. + +end_per_suite(doc) -> "This test case has no mission other than closing the conf case"; -finish(suite) -> +end_per_suite(suite) -> []; -finish(Config) -> +end_per_suite(Config) -> + crypto:stop(), Config. cinit_return_chkclose(doc) -> diff --git a/lib/ssl/test/old_ssl_active_once_SUITE.erl b/lib/ssl/test/old_ssl_active_once_SUITE.erl index 63eaa730e9..b68ff6c66a 100644 --- a/lib/ssl/test/old_ssl_active_once_SUITE.erl +++ b/lib/ssl/test/old_ssl_active_once_SUITE.erl @@ -20,11 +20,10 @@ %% -module(old_ssl_active_once_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, - config/1, - finish/1, + end_per_testcase/2, server_accept_timeout/1, cinit_return_chkclose/1, sinit_return_chkclose/1, @@ -40,7 +39,7 @@ -import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7, test_server_only/6]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ssl_test_MACHINE.hrl"). -define(MANYCONNS, ssl_test_MACHINE:many_conns()). @@ -49,50 +48,57 @@ init_per_testcase(_Case, Config) -> WatchDog = ssl_test_lib:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of ssl.erl interface in passive mode."; -all(suite) -> - {conf, - config, - [server_accept_timeout, - cinit_return_chkclose, - sinit_return_chkclose, - cinit_big_return_chkclose, - sinit_big_return_chkclose, - cinit_big_echo_chkclose, - cinit_huge_echo_chkclose, - sinit_big_echo_chkclose, - cinit_few_echo_chkclose, - cinit_many_echo_chkclose, - cinit_cnocert], - finish}. - -config(doc) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [server_accept_timeout, cinit_return_chkclose, + sinit_return_chkclose, cinit_big_return_chkclose, + sinit_big_return_chkclose, cinit_big_echo_chkclose, + cinit_huge_echo_chkclose, sinit_big_echo_chkclose, + cinit_few_echo_chkclose, cinit_many_echo_chkclose, + cinit_cnocert]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(doc) -> "Want to se what Config contains."; -config(suite) -> +init_per_suite(suite) -> []; -config(Config) -> +init_per_suite(Config) -> io:format("Config: ~p~n", [Config]), %% Check if SSL exists. If this case fails, all other cases are skipped - crypto:start(), - application:start(public_key), - case ssl:start() of - ok -> ssl:stop(); - {error, {already_started, _}} -> ssl:stop(); - Error -> ?t:fail({failed_starting_ssl,Error}) - end, - Config. - -finish(doc) -> + case catch crypto:start() of + ok -> + application:start(public_key), + case ssl:start() of + ok -> ssl:stop(); + {error, {already_started, _}} -> ssl:stop(); + Error -> ?t:fail({failed_starting_ssl,Error}) + end, + Config; + _Else -> + {skip,"Could not start crypto"} + end. + +end_per_suite(doc) -> "This test case has no mission other than closing the conf case"; -finish(suite) -> +end_per_suite(suite) -> []; -finish(Config) -> +end_per_suite(Config) -> + crypto:stop(), Config. server_accept_timeout(doc) -> diff --git a/lib/ssl/test/old_ssl_dist_SUITE.erl b/lib/ssl/test/old_ssl_dist_SUITE.erl index 97090c1409..6a072c9d98 100644 --- a/lib/ssl/test/old_ssl_dist_SUITE.erl +++ b/lib/ssl/test/old_ssl_dist_SUITE.erl @@ -29,28 +29,38 @@ %%%------------------------------------------------------------------- -module(old_ssl_dist_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(DEFAULT_TIMETRAP_SECS, 240). -define(AWAIT_SLL_NODE_UP_TIMEOUT, 30000). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([init_per_suite/1, end_per_suite/1, init_per_testcase/2, - fin_per_testcase/2]). + end_per_testcase/2]). -export([cnct2tstsrvr/1]). -export([basic/1]). -record(node_handle, {connection_handler, socket, name, nodename}). -all(doc) -> - []; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [basic]. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + init_per_suite(Config) -> add_ssl_opts_config(Config). @@ -61,7 +71,7 @@ init_per_testcase(Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:seconds(?DEFAULT_TIMETRAP_SECS)), [{watchdog, Dog},{testcase, Case}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. diff --git a/lib/ssl/test/old_ssl_misc_SUITE.erl b/lib/ssl/test/old_ssl_misc_SUITE.erl index 2767123a12..e1a21096bc 100644 --- a/lib/ssl/test/old_ssl_misc_SUITE.erl +++ b/lib/ssl/test/old_ssl_misc_SUITE.erl @@ -20,18 +20,17 @@ %% -module(old_ssl_misc_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, - config/1, - finish/1, + end_per_testcase/2, seed/1, app/1 ]). -import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7, test_server_only/6]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ssl_test_MACHINE.hrl"). -define(MANYCONNS, 5). @@ -40,41 +39,52 @@ init_per_testcase(_Case, Config) -> WatchDog = ssl_test_lib:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of misc in ssl.erl interface."; -all(suite) -> - {conf, - config, - [seed, app], - finish - }. +suite() -> [{ct_hooks,[ts_install_cth]}]. -config(doc) -> +all() -> + [seed, app]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(doc) -> "Want to se what Config contains."; -config(suite) -> +init_per_suite(suite) -> []; -config(Config) -> +init_per_suite(Config) -> io:format("Config: ~p~n", [Config]), %% Check if SSL exists. If this case fails, all other cases are skipped - crypto:start(), - application:start(public_key), - case ssl:start() of - ok -> ssl:stop(); - {error, {already_started, _}} -> ssl:stop(); - Error -> ?t:fail({failed_starting_ssl,Error}) - end, - Config. - -finish(doc) -> + case catch crypto:start() of + ok -> + application:start(public_key), + case ssl:start() of + ok -> ssl:stop(); + {error, {already_started, _}} -> ssl:stop(); + Error -> ?t:fail({failed_starting_ssl,Error}) + end, + Config; + _Else -> + {skip,"Could not start crypto!"} + end. + +end_per_suite(doc) -> "This test case has no mission other than closing the conf case"; -finish(suite) -> +end_per_suite(suite) -> []; -finish(Config) -> +end_per_suite(Config) -> + crypto:stop(), Config. seed(doc) -> diff --git a/lib/ssl/test/old_ssl_passive_SUITE.erl b/lib/ssl/test/old_ssl_passive_SUITE.erl index 96a7938583..8bdadd4ea6 100644 --- a/lib/ssl/test/old_ssl_passive_SUITE.erl +++ b/lib/ssl/test/old_ssl_passive_SUITE.erl @@ -20,11 +20,10 @@ %% -module(old_ssl_passive_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, + end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, - config/1, - finish/1, + end_per_testcase/2, server_accept_timeout/1, cinit_return_chkclose/1, sinit_return_chkclose/1, @@ -40,7 +39,7 @@ -import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7, test_server_only/6]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ssl_test_MACHINE.hrl"). -define(MANYCONNS, ssl_test_MACHINE:many_conns()). @@ -49,49 +48,56 @@ init_per_testcase(_Case, Config) -> WatchDog = ssl_test_lib:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of ssl.erl interface in passive mode."; -all(suite) -> - {conf, - config, - [server_accept_timeout, - cinit_return_chkclose, - sinit_return_chkclose, - cinit_big_return_chkclose, - sinit_big_return_chkclose, - cinit_big_echo_chkclose, - sinit_big_echo_chkclose, - cinit_few_echo_chkclose, - cinit_many_echo_chkclose, - cinit_cnocert], - finish}. - -config(doc) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [server_accept_timeout, cinit_return_chkclose, + sinit_return_chkclose, cinit_big_return_chkclose, + sinit_big_return_chkclose, cinit_big_echo_chkclose, + sinit_big_echo_chkclose, cinit_few_echo_chkclose, + cinit_many_echo_chkclose, cinit_cnocert]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(doc) -> "Want to se what Config contains."; -config(suite) -> +init_per_suite(suite) -> []; -config(Config) -> +init_per_suite(Config) -> io:format("Config: ~p~n", [Config]), %% Check if SSL exists. If this case fails, all other cases are skipped - crypto:start(), - application:start(public_key), - case ssl:start() of - ok -> ssl:stop(); - {error, {already_started, _}} -> ssl:stop(); - Error -> ?t:fail({failed_starting_ssl,Error}) - end, - Config. - -finish(doc) -> + case catch crypto:start() of + ok -> + application:start(public_key), + case ssl:start() of + ok -> ssl:stop(); + {error, {already_started, _}} -> ssl:stop(); + Error -> ?t:fail({failed_starting_ssl,Error}) + end, + Config; + _Else -> + {skip,"Could not start crypto"} + end. + +end_per_suite(doc) -> "This test case has no mission other than closing the conf case"; -finish(suite) -> +end_per_suite(suite) -> []; -finish(Config) -> +end_per_suite(Config) -> + crypto:stop(), Config. server_accept_timeout(doc) -> diff --git a/lib/ssl/test/old_ssl_peer_cert_SUITE.erl b/lib/ssl/test/old_ssl_peer_cert_SUITE.erl index e5b3975d41..54f06aec2f 100644 --- a/lib/ssl/test/old_ssl_peer_cert_SUITE.erl +++ b/lib/ssl/test/old_ssl_peer_cert_SUITE.erl @@ -20,11 +20,10 @@ %% -module(old_ssl_peer_cert_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, - config/1, - finish/1, + end_per_testcase/2, cinit_plain/1, cinit_both_verify/1, cinit_cnocert/1 @@ -32,7 +31,7 @@ -import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7, test_server_only/6]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ssl_test_MACHINE.hrl"). @@ -40,42 +39,52 @@ init_per_testcase(_Case, Config) -> WatchDog = ssl_test_lib:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of ssl verification and peer certificate retrieval."; -all(suite) -> - {conf, - config, - [cinit_plain, - cinit_both_verify, - cinit_cnocert], - finish}. - -config(doc) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [cinit_plain, cinit_both_verify, cinit_cnocert]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(doc) -> "Want to se what Config contains."; -config(suite) -> +init_per_suite(suite) -> []; -config(Config) -> +init_per_suite(Config) -> io:format("Config: ~p~n", [Config]), %% Check if SSL exists. If this case fails, all other cases are skipped - crypto:start(), - application:start(public_key), - case ssl:start() of - ok -> ssl:stop(); - {error, {already_started, _}} -> ssl:stop(); - Error -> ?t:fail({failed_starting_ssl,Error}) - end, - Config. - -finish(doc) -> + case catch crypto:start() of + ok -> + application:start(public_key), + case ssl:start() of + ok -> ssl:stop(); + {error, {already_started, _}} -> ssl:stop(); + Error -> ?t:fail({failed_starting_ssl,Error}) + end, + Config; + _Else -> + {skip,"Could not start crypto"} + end. + +end_per_suite(doc) -> "This test case has no mission other than closing the conf case"; -finish(suite) -> +end_per_suite(suite) -> []; -finish(Config) -> +end_per_suite(Config) -> + crypto:stop(), Config. cinit_plain(doc) -> diff --git a/lib/ssl/test/old_ssl_protocol_SUITE.erl b/lib/ssl/test/old_ssl_protocol_SUITE.erl index efdbf45a3d..779491ee69 100644 --- a/lib/ssl/test/old_ssl_protocol_SUITE.erl +++ b/lib/ssl/test/old_ssl_protocol_SUITE.erl @@ -20,13 +20,15 @@ %% -module(old_ssl_protocol_SUITE). --export([all/1, init_per_testcase/2, fin_per_testcase/2, config/1, - finish/1, sslv2/1, sslv3/1, tlsv1/1, sslv2_sslv3/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + sslv2/1, sslv3/1, tlsv1/1, sslv2_sslv3/1, sslv2_tlsv1/1, sslv3_tlsv1/1, sslv2_sslv3_tlsv1/1]). -import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7, test_server_only/6]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ssl_test_MACHINE.hrl"). @@ -34,41 +36,53 @@ init_per_testcase(_Case, Config) -> WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of configuration protocol_version."; -all(suite) -> - {conf, - config, - [sslv2, sslv3, tlsv1, sslv2_sslv3, sslv2_tlsv1, sslv3_tlsv1, - sslv2_sslv3_tlsv1], - finish}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -config(doc) -> +all() -> + [sslv2, sslv3, tlsv1, sslv2_sslv3, sslv2_tlsv1, + sslv3_tlsv1, sslv2_sslv3_tlsv1]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(doc) -> "Want to se what Config contains."; -config(suite) -> +init_per_suite(suite) -> []; -config(Config) -> +init_per_suite(Config) -> io:format("Config: ~p~n", [Config]), %% Check if SSL exists. If this case fails, all other cases are skipped - crypto:start(), - application:start(public_key), - case ssl:start() of - ok -> ssl:stop(); - {error, {already_started, _}} -> ssl:stop(); - Error -> ?t:fail({failed_starting_ssl,Error}) - end, - Config. - -finish(doc) -> + case catch crypto:start() of + ok -> + application:start(public_key), + case ssl:start() of + ok -> ssl:stop(); + {error, {already_started, _}} -> ssl:stop(); + Error -> ?t:fail({failed_starting_ssl,Error}) + end, + Config; + _Else -> + {skip,"Could not start crypto"} + end. + +end_per_suite(doc) -> "This test case has no other purpose than closing the conf case."; -finish(suite) -> +end_per_suite(suite) -> []; -finish(Config) -> +end_per_suite(Config) -> + crypto:stop(), Config. %%%%% diff --git a/lib/ssl/test/old_ssl_verify_SUITE.erl b/lib/ssl/test/old_ssl_verify_SUITE.erl index 7a8cd1578a..d388484141 100644 --- a/lib/ssl/test/old_ssl_verify_SUITE.erl +++ b/lib/ssl/test/old_ssl_verify_SUITE.erl @@ -20,18 +20,17 @@ %% -module(old_ssl_verify_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, - config/1, - finish/1, + end_per_testcase/2, cinit_both_verify/1, cinit_cnocert/1 ]). -import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7, test_server_only/6]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("ssl_test_MACHINE.hrl"). @@ -39,41 +38,52 @@ init_per_testcase(_Case, Config) -> WatchDog = ssl_test_lib:timetrap(?DEFAULT_TIMEOUT), [{watchdog, WatchDog}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test of ssl.erl interface in active mode."; -all(suite) -> - {conf, - config, - [cinit_both_verify, - cinit_cnocert], - finish}. +suite() -> [{ct_hooks,[ts_install_cth]}]. -config(doc) -> +all() -> + [cinit_both_verify, cinit_cnocert]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(doc) -> "Want to se what Config contains."; -config(suite) -> +init_per_suite(suite) -> []; -config(Config) -> +init_per_suite(Config) -> io:format("Config: ~p~n", [Config]), %% Check if SSL exists. If this case fails, all other cases are skipped - crypto:start(), - application:start(public_key), - case ssl:start() of - ok -> ssl:stop(); - {error, {already_started, _}} -> ssl:stop(); - Error -> ?t:fail({failed_starting_ssl,Error}) - end, - Config. - -finish(doc) -> + case catch crypto:start() of + ok -> + application:start(public_key), + case ssl:start() of + ok -> ssl:stop(); + {error, {already_started, _}} -> ssl:stop(); + Error -> ?t:fail({failed_starting_ssl,Error}) + end, + Config; + _Else -> + {skip,"Could not start crypto"} + end. + +end_per_suite(doc) -> "This test case has no mission other than closing the conf case"; -finish(suite) -> +end_per_suite(suite) -> []; -finish(Config) -> +end_per_suite(Config) -> + crypto:stop(), Config. cinit_both_verify(doc) -> diff --git a/lib/ssl/test/old_transport_accept_SUITE.erl b/lib/ssl/test/old_transport_accept_SUITE.erl index 71c1d9e181..21ee0690b1 100644 --- a/lib/ssl/test/old_transport_accept_SUITE.erl +++ b/lib/ssl/test/old_transport_accept_SUITE.erl @@ -19,16 +19,17 @@ %% -module(old_transport_accept_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). %% Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). -define(application, ssh). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, config/1, echo_once/1, echo_twice/1, @@ -43,15 +44,31 @@ init_per_testcase(_Case, Config) -> [{watchdog, WatchDog}, {protomod, gen_tcp}, {serialize_accept, true}| Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> WatchDog = ?config(watchdog, Config), test_server:timetrap_cancel(WatchDog). -all(doc) -> - "Test transport_accept and ssl_accept"; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [config, echo_once, echo_twice, close_before_ssl_accept]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + config(doc) -> "Want to se what Config contains."; config(suite) -> diff --git a/lib/ssl/test/ssl.cover b/lib/ssl/test/ssl.cover index e8daa363c5..60774cc0f1 100644 --- a/lib/ssl/test/ssl.cover +++ b/lib/ssl/test/ssl.cover @@ -1,19 +1,21 @@ -{exclude, [ssl_pkix_oid, - 'PKIX1Algorithms88', - 'PKIX1Explicit88', - 'PKIX1Implicit88', - 'PKIXAttributeCertificate', - 'SSL-PKIX', - ssl_pem, - ssl_pkix, - ssl_base64, - ssl_broker, - ssl_broker_int, - ssl_broker_sup, - ssl_debug, - ssl_server, - ssl_prim, - inet_ssl_dist, - 'OTP-PKIX' +{incl_app,ssl,details}. + +{excl_mods, ssl, [ssl_pkix_oid, + 'PKIX1Algorithms88', + 'PKIX1Explicit88', + 'PKIX1Implicit88', + 'PKIXAttributeCertificate', + 'SSL-PKIX', + ssl_pem, + ssl_pkix, + ssl_base64, + ssl_broker, + ssl_broker_int, + ssl_broker_sup, + ssl_debug, + ssl_server, + ssl_prim, + inet_ssl_dist, + 'OTP-PKIX' ]}. diff --git a/lib/ssl/test/ssl.spec b/lib/ssl/test/ssl.spec index 6ef4fb73db..fc7c1bbb82 100644 --- a/lib/ssl/test/ssl.spec +++ b/lib/ssl/test/ssl.spec @@ -1 +1 @@ -{topcase, {dir, "../ssl_test"}}. +{suites,"../ssl_test",all}. diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl index 8f9554f3ce..87d5fc8d71 100644 --- a/lib/ssl/test/ssl_basic_SUITE.erl +++ b/lib/ssl/test/ssl_basic_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -24,9 +24,10 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include_lib("public_key/include/public_key.hrl"). + -include("ssl_alert.hrl"). -define('24H_in_sec', 86400). @@ -47,20 +48,23 @@ %%-------------------------------------------------------------------- init_per_suite(Config0) -> Dog = ssl_test_lib:timetrap(?LONG_TIMEOUT *2), - crypto:start(), - application:start(public_key), - ssl:start(), - - %% make rsa certs using oppenssl - Result = - (catch make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0))), - test_server:format("Make certs ~p~n", [Result]), - - Config1 = ssl_test_lib:make_dsa_cert(Config0), - Config = ssl_test_lib:cert_options(Config1), - [{watchdog, Dog} | Config]. - + case application:start(crypto) of + ok -> + application:start(public_key), + ssl:start(), + + %% make rsa certs using oppenssl + Result = + (catch make_certs:all(?config(data_dir, Config0), + ?config(priv_dir, Config0))), + test_server:format("Make certs ~p~n", [Result]), + + Config1 = ssl_test_lib:make_dsa_cert(Config0), + Config = ssl_test_lib:cert_options(Config1), + [{watchdog, Dog} | Config]; + _ -> + {skip, "Crypto did not start"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ %% Config - [tuple()] @@ -69,7 +73,7 @@ init_per_suite(Config0) -> %%-------------------------------------------------------------------- end_per_suite(_Config) -> ssl:stop(), - crypto:stop(). + application:stop(crypto). %%-------------------------------------------------------------------- %% Function: init_per_testcase(TestCase, Config) -> Config @@ -84,6 +88,13 @@ end_per_suite(_Config) -> %% variable, but should NOT alter/remove any existing entries. %% Description: Initialization before each test case %%-------------------------------------------------------------------- +init_per_testcase(session_cache_process_list, Config) -> + init_customized_session_cache(list, Config); + +init_per_testcase(session_cache_process_mnesia, Config) -> + mnesia:start(), + init_customized_session_cache(mnesia, Config); + init_per_testcase(reuse_session_expired, Config0) -> Config = lists:keydelete(watchdog, 1, Config0), Dog = ssl_test_lib:timetrap(?EXPIRE * 1000 * 5), @@ -125,11 +136,24 @@ init_per_testcase(empty_protocol_versions, Config) -> ssl:start(), Config; +init_per_testcase(different_ca_peer_sign, Config0) -> + ssl_test_lib:make_mix_cert(Config0); + init_per_testcase(_TestCase, Config0) -> Config = lists:keydelete(watchdog, 1, Config0), Dog = test_server:timetrap(?TIMEOUT), [{watchdog, Dog} | Config]. +init_customized_session_cache(Type, Config0) -> + Config = lists:keydelete(watchdog, 1, Config0), + Dog = test_server:timetrap(?TIMEOUT), + ssl:stop(), + application:load(ssl), + application:set_env(ssl, session_cb, ?MODULE), + application:set_env(ssl, session_cb_init_args, [Type]), + ssl:start(), + [{watchdog, Dog} | Config]. + %%-------------------------------------------------------------------- %% Function: end_per_testcase(TestCase, Config) -> _ %% Case - atom() @@ -138,6 +162,16 @@ init_per_testcase(_TestCase, Config0) -> %% A list of key/value pairs, holding the test case configuration. %% Description: Cleanup after each test case %%-------------------------------------------------------------------- +end_per_testcase(session_cache_process_list, Config) -> + application:unset_env(ssl, session_cb), + end_per_testcase(default_action, Config); +end_per_testcase(session_cache_process_mnesia, Config) -> + application:unset_env(ssl, session_cb), + application:unset_env(ssl, session_cb_init_args), + mnesia:stop(), + ssl:stop(), + ssl:start(), + end_per_testcase(default_action, Config); end_per_testcase(reuse_session_expired, Config) -> application:unset_env(ssl, session_lifetime), end_per_testcase(default_action, Config); @@ -166,47 +200,66 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test the basic ssl functionality"]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> +all() -> [app, alerts, connection_info, protocol_versions, - empty_protocol_versions, controlling_process, controller_dies, - client_closes_socket, peercert, connect_dist, peername, sockname, - socket_options, misc_ssl_options, versions, cipher_suites, - upgrade, upgrade_with_timeout, tcp_connect, ipv6, ekeyfile, - ecertfile, ecacertfile, eoptions, shutdown, shutdown_write, - shutdown_both, shutdown_error, + empty_protocol_versions, controlling_process, + controller_dies, client_closes_socket, peercert, + connect_dist, peername, sockname, socket_options, + misc_ssl_options, versions, cipher_suites, upgrade, + upgrade_with_timeout, tcp_connect, ipv6, ekeyfile, + ecertfile, ecacertfile, eoptions, shutdown, + shutdown_write, shutdown_both, shutdown_error, ciphers_rsa_signed_certs, ciphers_rsa_signed_certs_ssl3, ciphers_rsa_signed_certs_openssl_names, ciphers_rsa_signed_certs_openssl_names_ssl3, - ciphers_dsa_signed_certs, - ciphers_dsa_signed_certs_ssl3, + ciphers_dsa_signed_certs, ciphers_dsa_signed_certs_ssl3, ciphers_dsa_signed_certs_openssl_names, ciphers_dsa_signed_certs_openssl_names_ssl3, anonymous_cipher_suites, default_reject_anonymous, send_close, - close_transport_accept, dh_params, server_verify_peer_passive, - server_verify_peer_active, server_verify_peer_active_once, + close_transport_accept, dh_params, + server_verify_peer_passive, server_verify_peer_active, + server_verify_peer_active_once, server_verify_none_passive, server_verify_none_active, - server_verify_none_active_once, server_verify_no_cacerts, - server_require_peer_cert_ok, server_require_peer_cert_fail, + server_verify_none_active_once, + server_verify_no_cacerts, server_require_peer_cert_ok, + server_require_peer_cert_fail, server_verify_client_once_passive, server_verify_client_once_active, - server_verify_client_once_active_once, client_verify_none_passive, - client_verify_none_active, client_verify_none_active_once, - reuse_session, reuse_session_expired, - server_does_not_want_to_reuse_session, client_renegotiate, - server_renegotiate, client_renegotiate_reused_session, - server_renegotiate_reused_session, client_no_wrap_sequence_number, - server_no_wrap_sequence_number, extended_key_usage, - no_authority_key_identifier, - invalid_signature_client, invalid_signature_server, cert_expired, - client_with_cert_cipher_suites_handshake, unknown_server_ca_fail, - der_input, unknown_server_ca_accept_verify_none, unknown_server_ca_accept_verify_peer, - unknown_server_ca_accept_backwardscompatibilty - ]. + server_verify_client_once_active_once, + client_verify_none_passive, client_verify_none_active, + client_verify_none_active_once, + reuse_session, + reuse_session_expired, + server_does_not_want_to_reuse_session, + client_renegotiate, server_renegotiate, + client_renegotiate_reused_session, + server_renegotiate_reused_session, + client_no_wrap_sequence_number, + server_no_wrap_sequence_number, extended_key_usage_verify_peer, + extended_key_usage_verify_none, + no_authority_key_identifier, invalid_signature_client, + invalid_signature_server, cert_expired, + client_with_cert_cipher_suites_handshake, + unknown_server_ca_fail, der_input, + unknown_server_ca_accept_verify_none, + unknown_server_ca_accept_verify_peer, + unknown_server_ca_accept_backwardscompatibilty, + %%different_ca_peer_sign, + no_reuses_session_server_restart_new_cert, + no_reuses_session_server_restart_new_cert_file, reuseaddr]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %% Test cases starts here. %%-------------------------------------------------------------------- @@ -321,7 +374,6 @@ basic_test(Config) -> ssl_test_lib:close(Server), ssl_test_lib:close(Client). - %%-------------------------------------------------------------------- controlling_process(doc) -> @@ -521,9 +573,7 @@ client_closes_socket(Config) when is_list(Config) -> _Client = spawn_link(Connect), - ssl_test_lib:check_result(Server, {error,closed}), - - ssl_test_lib:close(Server). + ssl_test_lib:check_result(Server, {error,closed}). %%-------------------------------------------------------------------- @@ -738,7 +788,6 @@ socket_options(Config) when is_list(Config) -> ssl_test_lib:check_result(Server, ok, Client, ok), ssl_test_lib:close(Server), - ssl_test_lib:close(Client), {ok, Listen} = ssl:listen(0, ServerOpts), {ok,[{mode,list}]} = ssl:getopts(Listen, [mode]), @@ -841,6 +890,7 @@ send_recv(Config) when is_list(Config) -> ssl_test_lib:close(Server), ssl_test_lib:close(Client). +%%-------------------------------------------------------------------- send_close(doc) -> [""]; @@ -867,8 +917,7 @@ send_close(Config) when is_list(Config) -> ok = ssl:send(SslS, "Hello world"), {ok,<<"Hello world">>} = ssl:recv(SslS, 11), gen_tcp:close(TcpS), - {error, _} = ssl:send(SslS, "Hello world"), - ssl_test_lib:close(Server). + {error, _} = ssl:send(SslS, "Hello world"). %%-------------------------------------------------------------------- close_transport_accept(doc) -> @@ -1043,8 +1092,7 @@ tcp_connect(Config) when is_list(Config) -> {Server, {error, Error}} -> test_server:format("Error ~p", [Error]) end - end, - ssl_test_lib:close(Server). + end. dummy(_Socket) -> @@ -1053,6 +1101,8 @@ dummy(_Socket) -> exit(kill). %%-------------------------------------------------------------------- +ipv6() -> + [{require, ipv6_hosts}]. ipv6(doc) -> ["Test ipv6."]; ipv6(suite) -> @@ -1060,7 +1110,7 @@ ipv6(suite) -> ipv6(Config) when is_list(Config) -> {ok, Hostname0} = inet:gethostname(), - case lists:member(list_to_atom(Hostname0), ?config(ipv6_hosts, Config)) of + case lists:member(list_to_atom(Hostname0), ct:get_config(ipv6_hosts)) of true -> ClientOpts = ?config(client_opts, Config), ServerOpts = ?config(server_opts, Config), @@ -1149,13 +1199,13 @@ ecertfile(Config) when is_list(Config) -> %%-------------------------------------------------------------------- -ecacertfile(doc) -> +ecacertfile(doc) -> ["Test what happens with an invalid cacert file"]; -ecacertfile(suite) -> +ecacertfile(suite) -> []; -ecacertfile(Config) when is_list(Config) -> +ecacertfile(Config) when is_list(Config) -> ClientOpts = [{reuseaddr, true}|?config(client_opts, Config)], ServerBadOpts = [{reuseaddr, true}|?config(server_bad_ca, Config)], {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), @@ -1532,7 +1582,7 @@ erlang_cipher_suite(Suite) -> Suite. cipher(CipherSuite, Version, Config, ClientOpts, ServerOpts) -> - process_flag(trap_exit, true), + %% process_flag(trap_exit, true), test_server:format("Testing CipherSuite ~p~n", [CipherSuite]), {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), @@ -1556,16 +1606,8 @@ cipher(CipherSuite, Version, Config, ClientOpts, ServerOpts) -> Result = ssl_test_lib:wait_for_result(Server, ok, Client, ok), ssl_test_lib:close(Server), - receive - {'EXIT', Server, normal} -> - ok - end, ssl_test_lib:close(Client), - receive - {'EXIT', Client, normal} -> - ok - end, - process_flag(trap_exit, false), + case Result of ok -> []; @@ -1607,7 +1649,6 @@ reuse_session(suite) -> []; reuse_session(Config) when is_list(Config) -> - process_flag(trap_exit, true), ClientOpts = ?config(client_opts, Config), ServerOpts = ?config(server_opts, Config), {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), @@ -1615,13 +1656,13 @@ reuse_session(Config) when is_list(Config) -> Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, {from, self()}, - {mfa, {?MODULE, session_info_result, []}}, - {options, ServerOpts}]), + {mfa, {?MODULE, session_info_result, []}}, + {options, ServerOpts}]), Port = ssl_test_lib:inet_port(Server), Client0 = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, - {mfa, {ssl_test_lib, no_result, []}}, + {mfa, {ssl_test_lib, no_result, []}}, {from, self()}, {options, ClientOpts}]), SessionInfo = receive @@ -1629,16 +1670,16 @@ reuse_session(Config) when is_list(Config) -> Info end, - Server ! listen, + Server ! {listen, {mfa, {ssl_test_lib, no_result, []}}}, %% Make sure session is registered test_server:sleep(?SLEEP), Client1 = - ssl_test_lib:start_client([{node, ClientNode}, - {port, Port}, {host, Hostname}, - {mfa, {?MODULE, session_info_result, []}}, - {from, self()}, {options, ClientOpts}]), + ssl_test_lib:start_client([{node, ClientNode}, + {port, Port}, {host, Hostname}, + {mfa, {?MODULE, session_info_result, []}}, + {from, self()}, {options, ClientOpts}]), receive {Client1, SessionInfo} -> ok; @@ -1648,10 +1689,10 @@ reuse_session(Config) when is_list(Config) -> test_server:fail(session_not_reused) end, - Server ! listen, + Server ! {listen, {mfa, {ssl_test_lib, no_result, []}}}, Client2 = - ssl_test_lib:start_client([{node, ClientNode}, + ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, {mfa, {?MODULE, session_info_result, []}}, {from, self()}, {options, [{reuse_sessions, false} @@ -1665,10 +1706,6 @@ reuse_session(Config) when is_list(Config) -> end, ssl_test_lib:close(Server), - ssl_test_lib:close(Client0), - ssl_test_lib:close(Client1), - ssl_test_lib:close(Client2), - Server1 = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, @@ -1680,7 +1717,7 @@ reuse_session(Config) when is_list(Config) -> Client3 = ssl_test_lib:start_client([{node, ClientNode}, {port, Port1}, {host, Hostname}, - {mfa, {?MODULE, session_info_result, []}}, + {mfa, {ssl_test_lib, no_result, []}}, {from, self()}, {options, ClientOpts}]), SessionInfo1 = @@ -1689,7 +1726,7 @@ reuse_session(Config) when is_list(Config) -> Info1 end, - Server1 ! listen, + Server1 ! {listen, {mfa, {ssl_test_lib, no_result, []}}}, %% Make sure session is registered test_server:sleep(?SLEEP), @@ -1705,14 +1742,16 @@ reuse_session(Config) when is_list(Config) -> test_server:fail( session_reused_when_session_reuse_disabled_by_server); {Client4, _Other} -> + test_server:format("OTHER: ~p ~n", [_Other]), ok end, - + ssl_test_lib:close(Server1), + ssl_test_lib:close(Client0), + ssl_test_lib:close(Client1), + ssl_test_lib:close(Client2), ssl_test_lib:close(Client3), - ssl_test_lib:close(Client4), - process_flag(trap_exit, false). - + ssl_test_lib:close(Client4). session_info_result(Socket) -> ssl:session_info(Socket). @@ -1725,7 +1764,6 @@ reuse_session_expired(suite) -> []; reuse_session_expired(Config) when is_list(Config) -> - process_flag(trap_exit, true), ClientOpts = ?config(client_opts, Config), ServerOpts = ?config(server_opts, Config), {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), @@ -1746,8 +1784,8 @@ reuse_session_expired(Config) when is_list(Config) -> {Server, Info} -> Info end, - - Server ! listen, + + Server ! {listen, {mfa, {ssl_test_lib, no_result, []}}}, %% Make sure session is registered test_server:sleep(?SLEEP), @@ -1767,7 +1805,7 @@ reuse_session_expired(Config) when is_list(Config) -> end, Server ! listen, - + %% Make sure session is unregistered due to expiration test_server:sleep((?EXPIRE+1) * 1000), @@ -1782,12 +1820,12 @@ reuse_session_expired(Config) when is_list(Config) -> {Client2, _} -> ok end, - + process_flag(trap_exit, false), ssl_test_lib:close(Server), ssl_test_lib:close(Client0), ssl_test_lib:close(Client1), - ssl_test_lib:close(Client2), - process_flag(trap_exit, false). + ssl_test_lib:close(Client2). + %%-------------------------------------------------------------------- server_does_not_want_to_reuse_session(doc) -> ["Test reuse of sessions (short handshake)"]; @@ -1820,10 +1858,11 @@ server_does_not_want_to_reuse_session(Config) when is_list(Config) -> Info end, - Server ! listen, + Server ! {listen, {mfa, {ssl_test_lib, no_result, []}}}, %% Make sure session is registered test_server:sleep(?SLEEP), + ssl_test_lib:close(Client0), Client1 = ssl_test_lib:start_client([{node, ClientNode}, @@ -1836,11 +1875,9 @@ server_does_not_want_to_reuse_session(Config) when is_list(Config) -> {Client1, _Other} -> ok end, - + ssl_test_lib:close(Server), - ssl_test_lib:close(Client0), - ssl_test_lib:close(Client1), - process_flag(trap_exit, false). + ssl_test_lib:close(Client1). %%-------------------------------------------------------------------- @@ -2007,6 +2044,7 @@ server_verify_none_active_once(Config) when is_list(Config) -> ssl_test_lib:check_result(Server, ok, Client, ok), ssl_test_lib:close(Server), ssl_test_lib:close(Client). + %%-------------------------------------------------------------------- server_verify_client_once_passive(doc) -> @@ -2034,7 +2072,7 @@ server_verify_client_once_passive(Config) when is_list(Config) -> ssl_test_lib:check_result(Server, ok, Client0, ok), ssl_test_lib:close(Client0), - Server ! listen, + Server ! {listen, {mfa, {ssl_test_lib, no_result, []}}}, Client1 = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, {from, self()}, @@ -2072,7 +2110,7 @@ server_verify_client_once_active(Config) when is_list(Config) -> ssl_test_lib:check_result(Server, ok, Client0, ok), ssl_test_lib:close(Client0), - Server ! listen, + Server ! {listen, {mfa, {ssl_test_lib, no_result, []}}}, Client1 = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, {from, self()}, @@ -2083,7 +2121,6 @@ server_verify_client_once_active(Config) when is_list(Config) -> ssl_test_lib:close(Server), ssl_test_lib:close(Client1). - %%-------------------------------------------------------------------- server_verify_client_once_active_once(doc) -> @@ -2111,18 +2148,17 @@ server_verify_client_once_active_once(Config) when is_list(Config) -> ssl_test_lib:check_result(Server, ok, Client0, ok), ssl_test_lib:close(Client0), - Server ! listen, - + Server ! {listen, {mfa, {ssl_test_lib, no_result, []}}}, Client1 = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, - {host, Hostname}, - {from, self()}, - {mfa, {?MODULE, result_ok, []}}, - {options, [{active, once} | ClientOpts]}]), + {host, Hostname}, + {from, self()}, + {mfa, {?MODULE, result_ok, []}}, + {options, [{active, once} | ClientOpts]}]), ssl_test_lib:check_result(Client1, ok), ssl_test_lib:close(Server), ssl_test_lib:close(Client1). - + %%-------------------------------------------------------------------- server_verify_no_cacerts(doc) -> @@ -2130,9 +2166,8 @@ server_verify_no_cacerts(doc) -> server_verify_no_cacerts(suite) -> []; - server_verify_no_cacerts(Config) when is_list(Config) -> - ServerOpts = ServerOpts = ?config(server_opts, Config), + ServerOpts = ?config(server_opts, Config), {_, ServerNode, _} = ssl_test_lib:run_where(Config), Server = ssl_test_lib:start_server_error([{node, ServerNode}, {port, 0}, {from, self()}, @@ -2293,8 +2328,6 @@ client_verify_none_active_once(Config) when is_list(Config) -> ssl_test_lib:close(Server), ssl_test_lib:close(Client). - - %%-------------------------------------------------------------------- client_renegotiate(doc) -> ["Test ssl:renegotiate/1 on client."]; @@ -2303,7 +2336,6 @@ client_renegotiate(suite) -> []; client_renegotiate(Config) when is_list(Config) -> - process_flag(trap_exit, true), ServerOpts = ?config(server_opts, Config), ClientOpts = ?config(client_opts, Config), @@ -2326,11 +2358,9 @@ client_renegotiate(Config) when is_list(Config) -> {options, [{reuse_sessions, false} | ClientOpts]}]), ssl_test_lib:check_result(Client, ok, Server, ok), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - process_flag(trap_exit, false), - ok. + ssl_test_lib:close(Client). + %%-------------------------------------------------------------------- server_renegotiate(doc) -> ["Test ssl:renegotiate/1 on server."]; @@ -2339,7 +2369,6 @@ server_renegotiate(suite) -> []; server_renegotiate(Config) when is_list(Config) -> - process_flag(trap_exit, true), ServerOpts = ?config(server_opts, Config), ClientOpts = ?config(client_opts, Config), @@ -2362,8 +2391,7 @@ server_renegotiate(Config) when is_list(Config) -> ssl_test_lib:check_result(Server, ok, Client, ok), ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - ok. + ssl_test_lib:close(Client). %%-------------------------------------------------------------------- client_renegotiate_reused_session(doc) -> @@ -2373,7 +2401,6 @@ client_renegotiate_reused_session(suite) -> []; client_renegotiate_reused_session(Config) when is_list(Config) -> - process_flag(trap_exit, true), ServerOpts = ?config(server_opts, Config), ClientOpts = ?config(client_opts, Config), @@ -2396,11 +2423,8 @@ client_renegotiate_reused_session(Config) when is_list(Config) -> {options, [{reuse_sessions, true} | ClientOpts]}]), ssl_test_lib:check_result(Client, ok, Server, ok), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - process_flag(trap_exit, false), - ok. + ssl_test_lib:close(Client). %%-------------------------------------------------------------------- server_renegotiate_reused_session(doc) -> ["Test ssl:renegotiate/1 on server when the ssl session will be reused."]; @@ -2409,7 +2433,6 @@ server_renegotiate_reused_session(suite) -> []; server_renegotiate_reused_session(Config) when is_list(Config) -> - process_flag(trap_exit, true), ServerOpts = ?config(server_opts, Config), ClientOpts = ?config(client_opts, Config), @@ -2432,9 +2455,7 @@ server_renegotiate_reused_session(Config) when is_list(Config) -> ssl_test_lib:check_result(Server, ok, Client, ok), ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - ok. - + ssl_test_lib:close(Client). %%-------------------------------------------------------------------- client_no_wrap_sequence_number(doc) -> ["Test that erlang client will renegotiate session when", @@ -2446,7 +2467,6 @@ client_no_wrap_sequence_number(suite) -> []; client_no_wrap_sequence_number(Config) when is_list(Config) -> - process_flag(trap_exit, true), ServerOpts = ?config(server_opts, Config), ClientOpts = ?config(client_opts, Config), @@ -2471,11 +2491,8 @@ client_no_wrap_sequence_number(Config) when is_list(Config) -> {renegotiate_at, N} | ClientOpts]}]), ssl_test_lib:check_result(Client, ok), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - process_flag(trap_exit, false), - ok. + ssl_test_lib:close(Client). %%-------------------------------------------------------------------- server_no_wrap_sequence_number(doc) -> ["Test that erlang server will renegotiate session when", @@ -2487,7 +2504,6 @@ server_no_wrap_sequence_number(suite) -> []; server_no_wrap_sequence_number(Config) when is_list(Config) -> - process_flag(trap_exit, true), ServerOpts = ?config(server_opts, Config), ClientOpts = ?config(client_opts, Config), @@ -2511,17 +2527,15 @@ server_no_wrap_sequence_number(Config) when is_list(Config) -> ssl_test_lib:check_result(Server, ok), ssl_test_lib:close(Server), - ssl_test_lib:close(Client), - ok. - + ssl_test_lib:close(Client). %%-------------------------------------------------------------------- -extended_key_usage(doc) -> - ["Test cert that has a critical extended_key_usage extension"]; +extended_key_usage_verify_peer(doc) -> + ["Test cert that has a critical extended_key_usage extension in verify_peer mode"]; -extended_key_usage(suite) -> +extended_key_usage_verify_peer(suite) -> []; -extended_key_usage(Config) when is_list(Config) -> +extended_key_usage_verify_peer(Config) when is_list(Config) -> ClientOpts = ?config(client_verification_opts, Config), ServerOpts = ?config(server_verification_opts, Config), PrivDir = ?config(priv_dir, Config), @@ -2537,13 +2551,13 @@ extended_key_usage(Config) when is_list(Config) -> ServerExtKeyUsageExt = {'Extension', ?'id-ce-extKeyUsage', true, [?'id-kp-serverAuth']}, ServerOTPTbsCert = ServerOTPCert#'OTPCertificate'.tbsCertificate, ServerExtensions = ServerOTPTbsCert#'OTPTBSCertificate'.extensions, - NewServerOTPTbsCert = ServerOTPTbsCert#'OTPTBSCertificate'{extensions = - [ServerExtKeyUsageExt | + NewServerOTPTbsCert = ServerOTPTbsCert#'OTPTBSCertificate'{extensions = + [ServerExtKeyUsageExt | ServerExtensions]}, - NewServerDerCert = public_key:pkix_sign(NewServerOTPTbsCert, Key), + NewServerDerCert = public_key:pkix_sign(NewServerOTPTbsCert, Key), ssl_test_lib:der_to_pem(NewServerCertFile, [{'Certificate', NewServerDerCert, not_encrypted}]), NewServerOpts = [{certfile, NewServerCertFile} | proplists:delete(certfile, ServerOpts)], - + ClientCertFile = proplists:get_value(certfile, ClientOpts), NewClientCertFile = filename:join(PrivDir, "client/new_cert.pem"), [{'Certificate', ClientDerCert, _}] = ssl_test_lib:pem_to_der(ClientCertFile), @@ -2551,28 +2565,90 @@ extended_key_usage(Config) when is_list(Config) -> ClientExtKeyUsageExt = {'Extension', ?'id-ce-extKeyUsage', true, [?'id-kp-clientAuth']}, ClientOTPTbsCert = ClientOTPCert#'OTPCertificate'.tbsCertificate, ClientExtensions = ClientOTPTbsCert#'OTPTBSCertificate'.extensions, - NewClientOTPTbsCert = ClientOTPTbsCert#'OTPTBSCertificate'{extensions = + NewClientOTPTbsCert = ClientOTPTbsCert#'OTPTBSCertificate'{extensions = [ClientExtKeyUsageExt | ClientExtensions]}, - NewClientDerCert = public_key:pkix_sign(NewClientOTPTbsCert, Key), + NewClientDerCert = public_key:pkix_sign(NewClientOTPTbsCert, Key), ssl_test_lib:der_to_pem(NewClientCertFile, [{'Certificate', NewClientDerCert, not_encrypted}]), NewClientOpts = [{certfile, NewClientCertFile} | proplists:delete(certfile, ClientOpts)], {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - - Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, - {from, self()}, + + Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, + {from, self()}, {mfa, {?MODULE, send_recv_result_active, []}}, {options, [{verify, verify_peer} | NewServerOpts]}]), Port = ssl_test_lib:inet_port(Server), - Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, + Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, {host, Hostname}, - {from, self()}, + {from, self()}, {mfa, {?MODULE, send_recv_result_active, []}}, {options, [{verify, verify_peer} | NewClientOpts]}]), - + ssl_test_lib:check_result(Server, ok, Client, ok), - + + ssl_test_lib:close(Server), + ssl_test_lib:close(Client). + +%%-------------------------------------------------------------------- +extended_key_usage_verify_none(doc) -> + ["Test cert that has a critical extended_key_usage extension in verify_none mode"]; + +extended_key_usage_verify_none(suite) -> + []; + +extended_key_usage_verify_none(Config) when is_list(Config) -> + ClientOpts = ?config(client_verification_opts, Config), + ServerOpts = ?config(server_verification_opts, Config), + PrivDir = ?config(priv_dir, Config), + + KeyFile = filename:join(PrivDir, "otpCA/private/key.pem"), + [KeyEntry] = ssl_test_lib:pem_to_der(KeyFile), + Key = public_key:pem_entry_decode(KeyEntry), + + ServerCertFile = proplists:get_value(certfile, ServerOpts), + NewServerCertFile = filename:join(PrivDir, "server/new_cert.pem"), + [{'Certificate', ServerDerCert, _}] = ssl_test_lib:pem_to_der(ServerCertFile), + ServerOTPCert = public_key:pkix_decode_cert(ServerDerCert, otp), + ServerExtKeyUsageExt = {'Extension', ?'id-ce-extKeyUsage', true, [?'id-kp-serverAuth']}, + ServerOTPTbsCert = ServerOTPCert#'OTPCertificate'.tbsCertificate, + ServerExtensions = ServerOTPTbsCert#'OTPTBSCertificate'.extensions, + NewServerOTPTbsCert = ServerOTPTbsCert#'OTPTBSCertificate'{extensions = + [ServerExtKeyUsageExt | + ServerExtensions]}, + NewServerDerCert = public_key:pkix_sign(NewServerOTPTbsCert, Key), + ssl_test_lib:der_to_pem(NewServerCertFile, [{'Certificate', NewServerDerCert, not_encrypted}]), + NewServerOpts = [{certfile, NewServerCertFile} | proplists:delete(certfile, ServerOpts)], + + ClientCertFile = proplists:get_value(certfile, ClientOpts), + NewClientCertFile = filename:join(PrivDir, "client/new_cert.pem"), + [{'Certificate', ClientDerCert, _}] = ssl_test_lib:pem_to_der(ClientCertFile), + ClientOTPCert = public_key:pkix_decode_cert(ClientDerCert, otp), + ClientExtKeyUsageExt = {'Extension', ?'id-ce-extKeyUsage', true, [?'id-kp-clientAuth']}, + ClientOTPTbsCert = ClientOTPCert#'OTPCertificate'.tbsCertificate, + ClientExtensions = ClientOTPTbsCert#'OTPTBSCertificate'.extensions, + NewClientOTPTbsCert = ClientOTPTbsCert#'OTPTBSCertificate'{extensions = + [ClientExtKeyUsageExt | + ClientExtensions]}, + NewClientDerCert = public_key:pkix_sign(NewClientOTPTbsCert, Key), + ssl_test_lib:der_to_pem(NewClientCertFile, [{'Certificate', NewClientDerCert, not_encrypted}]), + NewClientOpts = [{certfile, NewClientCertFile} | proplists:delete(certfile, ClientOpts)], + + {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), + + Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, + {from, self()}, + {mfa, {?MODULE, send_recv_result_active, []}}, + {options, [{verify, verify_none} | NewServerOpts]}]), + Port = ssl_test_lib:inet_port(Server), + Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, + {host, Hostname}, + {from, self()}, + {mfa, {?MODULE, send_recv_result_active, []}}, + {options, [{verify, verify_none} | NewClientOpts]}]), + + ssl_test_lib:check_result(Server, ok, Client, ok), + ssl_test_lib:close(Server), ssl_test_lib:close(Client). @@ -2885,9 +2961,7 @@ unknown_server_ca_fail(Config) when is_list(Config) -> | ClientOpts]}]), ssl_test_lib:check_result(Server, {error,"unknown ca"}, - Client, {error, "unknown ca"}), - ssl_test_lib:close(Server), - ssl_test_lib:close(Client). + Client, {error, "unknown ca"}). %%-------------------------------------------------------------------- unknown_server_ca_accept_verify_none(doc) -> @@ -3052,19 +3126,201 @@ der_input_opts(Opts) -> {Cert, {rsa, Key}, CaCerts, DHParams}. %%-------------------------------------------------------------------- -%%% Internal functions +%% different_ca_peer_sign(doc) -> +%% ["Check that a CA can have a different signature algorithm than the peer cert."]; + +%% different_ca_peer_sign(suite) -> +%% []; + +%% different_ca_peer_sign(Config) when is_list(Config) -> +%% ClientOpts = ?config(client_mix_opts, Config), +%% ServerOpts = ?config(server_mix_verify_opts, Config), + +%% {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), +%% Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, +%% {from, self()}, +%% {mfa, {?MODULE, send_recv_result_active_once, []}}, +%% {options, [{active, once}, +%% {verify, verify_peer} | ServerOpts]}]), +%% Port = ssl_test_lib:inet_port(Server), + +%% Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, +%% {host, Hostname}, +%% {from, self()}, +%% {mfa, {?MODULE, +%% send_recv_result_active_once, +%% []}}, +%% {options, [{active, once}, +%% {verify, verify_peer} +%% | ClientOpts]}]), + +%% ssl_test_lib:check_result(Server, ok, Client, ok), +%% ssl_test_lib:close(Server), +%% ssl_test_lib:close(Client). + + %%-------------------------------------------------------------------- -erlang_ssl_receive(Socket, Data) -> +no_reuses_session_server_restart_new_cert(doc) -> + ["Check that a session is not reused if the server is restarted with a new cert."]; + +no_reuses_session_server_restart_new_cert(suite) -> + []; + +no_reuses_session_server_restart_new_cert(Config) when is_list(Config) -> + + ClientOpts = ?config(client_opts, Config), + ServerOpts = ?config(server_opts, Config), + DsaServerOpts = ?config(server_dsa_opts, Config), + {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), + + Server = + ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, + {from, self()}, + {mfa, {?MODULE, session_info_result, []}}, + {options, ServerOpts}]), + Port = ssl_test_lib:inet_port(Server), + Client0 = + ssl_test_lib:start_client([{node, ClientNode}, + {port, Port}, {host, Hostname}, + {mfa, {ssl_test_lib, no_result, []}}, + {from, self()}, {options, ClientOpts}]), + SessionInfo = + receive + {Server, Info} -> + Info + end, + + %% Make sure session is registered + test_server:sleep(?SLEEP), + ssl_test_lib:close(Server), + ssl_test_lib:close(Client0), + + Server1 = + ssl_test_lib:start_server([{node, ServerNode}, {port, Port}, + {from, self()}, + {mfa, {ssl_test_lib, no_result, []}}, + {options, DsaServerOpts}]), + + Client1 = + ssl_test_lib:start_client([{node, ClientNode}, + {port, Port}, {host, Hostname}, + {mfa, {?MODULE, session_info_result, []}}, + {from, self()}, {options, ClientOpts}]), receive - {ssl, Socket, Data} -> - io:format("Received ~p~n",[Data]), - ok; - Other -> - test_server:fail({unexpected_message, Other}) - after ?SLEEP * 3 -> - test_server:fail({did_not_get, Data}) - end. + {Client1, SessionInfo} -> + test_server:fail(session_reused_when_server_has_new_cert); + {Client1, _Other} -> + ok + end, + ssl_test_lib:close(Server1), + ssl_test_lib:close(Client1). + +%%-------------------------------------------------------------------- +no_reuses_session_server_restart_new_cert_file(doc) -> + ["Check that a session is not reused if a server is restarted with a new " + "cert contained in a file with the same name as the old cert."]; + +no_reuses_session_server_restart_new_cert_file(suite) -> + []; + +no_reuses_session_server_restart_new_cert_file(Config) when is_list(Config) -> + ClientOpts = ?config(client_opts, Config), + ServerOpts = ?config(server_verification_opts, Config), + DsaServerOpts = ?config(server_dsa_opts, Config), + PrivDir = ?config(priv_dir, Config), + + NewServerOpts = new_config(PrivDir, ServerOpts), + {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), + + Server = + ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, + {from, self()}, + {mfa, {?MODULE, session_info_result, []}}, + {options, NewServerOpts}]), + Port = ssl_test_lib:inet_port(Server), + Client0 = + ssl_test_lib:start_client([{node, ClientNode}, + {port, Port}, {host, Hostname}, + {mfa, {ssl_test_lib, no_result, []}}, + {from, self()}, {options, ClientOpts}]), + SessionInfo = + receive + {Server, Info} -> + Info + end, + + %% Make sure session is registered and we get + %% new file time stamp when calling new_config! + test_server:sleep(?SLEEP* 2), + ssl_test_lib:close(Server), + ssl_test_lib:close(Client0), + NewServerOpts = new_config(PrivDir, DsaServerOpts), + + Server1 = + ssl_test_lib:start_server([{node, ServerNode}, {port, Port}, + {from, self()}, + {mfa, {ssl_test_lib, no_result, []}}, + {options, NewServerOpts}]), + Client1 = + ssl_test_lib:start_client([{node, ClientNode}, + {port, Port}, {host, Hostname}, + {mfa, {?MODULE, session_info_result, []}}, + {from, self()}, {options, ClientOpts}]), + receive + {Client1, SessionInfo} -> + test_server:fail(session_reused_when_server_has_new_cert); + {Client1, _Other} -> + ok + end, + ssl_test_lib:close(Server1), + ssl_test_lib:close(Client1). + +%%-------------------------------------------------------------------- +reuseaddr(doc) -> + [""]; + +reuseaddr(suite) -> + []; + +reuseaddr(Config) when is_list(Config) -> + ClientOpts = ?config(client_opts, Config), + ServerOpts = ?config(server_opts, Config), + {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), + Server = + ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, + {from, self()}, + {mfa, {ssl_test_lib, no_result, []}}, + {options, [{active, false} | ServerOpts]}]), + Port = ssl_test_lib:inet_port(Server), + Client = + ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, + {host, Hostname}, + {from, self()}, + {mfa, {ssl_test_lib, no_result, []}}, + {options, [{active, false} | ClientOpts]}]), + test_server:sleep(?SLEEP), + ssl_test_lib:close(Server), + + Server1 = + ssl_test_lib:start_server([{node, ServerNode}, {port, Port}, + {from, self()}, + {mfa, {?MODULE, send_recv_result, []}}, + {options, [{active, false} | ServerOpts]}]), + Client1 = + ssl_test_lib:start_client([{node, ClientNode}, {port, Port}, + {host, Hostname}, + {from, self()}, + {mfa, {?MODULE, send_recv_result, []}}, + {options, [{active, false} | ClientOpts]}]), + + ssl_test_lib:check_result(Server1, ok, Client1, ok), + ssl_test_lib:close(Server1), + ssl_test_lib:close(Client1). + +%%-------------------------------------------------------------------- +%%% Internal functions +%%-------------------------------------------------------------------- send_recv_result(Socket) -> ssl:send(Socket, "Hello world"), {ok,"Hello world"} = ssl:recv(Socket, 11), @@ -3087,7 +3343,6 @@ send_recv_result_active_once(Socket) -> result_ok(_Socket) -> ok. - renegotiate(Socket, Data) -> test_server:format("Renegotiating ~n", []), Result = ssl:renegotiate(Socket), @@ -3104,3 +3359,182 @@ renegotiate_reuse_session(Socket, Data) -> %% Make sure session is registerd test_server:sleep(?SLEEP), renegotiate(Socket, Data). + +new_config(PrivDir, ServerOpts0) -> + CaCertFile = proplists:get_value(cacertfile, ServerOpts0), + CertFile = proplists:get_value(certfile, ServerOpts0), + KeyFile = proplists:get_value(keyfile, ServerOpts0), + NewCaCertFile = filename:join(PrivDir, "new_ca.pem"), + NewCertFile = filename:join(PrivDir, "new_cert.pem"), + NewKeyFile = filename:join(PrivDir, "new_key.pem"), + file:copy(CaCertFile, NewCaCertFile), + file:copy(CertFile, NewCertFile), + file:copy(KeyFile, NewKeyFile), + ServerOpts1 = proplists:delete(cacertfile, ServerOpts0), + ServerOpts2 = proplists:delete(certfile, ServerOpts1), + ServerOpts = proplists:delete(keyfile, ServerOpts2), + + {ok, PEM} = file:read_file(NewCaCertFile), + test_server:format("CA file content: ~p~n", [public_key:pem_decode(PEM)]), + + [{cacertfile, NewCaCertFile}, {certfile, NewCertFile}, + {keyfile, NewKeyFile} | ServerOpts]. + +session_cache_process_list(doc) -> + ["Test reuse of sessions (short handshake)"]; + +session_cache_process_list(suite) -> + []; +session_cache_process_list(Config) when is_list(Config) -> + session_cache_process(list,Config). + +session_cache_process_mnesia(doc) -> + ["Test reuse of sessions (short handshake)"]; + +session_cache_process_mnesia(suite) -> + []; +session_cache_process_mnesia(Config) when is_list(Config) -> + session_cache_process(mnesia,Config). + +session_cache_process(Type,Config) when is_list(Config) -> + reuse_session(Config). + +init([Type]) -> + ets:new(ssl_test, [named_table, public, set]), + ets:insert(ssl_test, {type, Type}), + case Type of + list -> + spawn(fun() -> session_loop([]) end); + mnesia -> + mnesia:start(), + {atomic,ok} = mnesia:create_table(sess_cache, []), + sess_cache + end. + +session_cb() -> + [{type, Type}] = ets:lookup(ssl_test, type), + Type. + +terminate(Cache) -> + case session_cb() of + list -> + Cache ! terminate; + mnesia -> + catch {atomic,ok} = + mnesia:delete_table(sess_cache) + end. + +lookup(Cache, Key) -> + case session_cb() of + list -> + Cache ! {self(), lookup, Key}, + receive {Cache, Res} -> Res end; + mnesia -> + case mnesia:transaction(fun() -> + mnesia:read(sess_cache, + Key, read) + end) of + {atomic, [{sess_cache, Key, Value}]} -> + Value; + _ -> + undefined + end + end. + +update(Cache, Key, Value) -> + case session_cb() of + list -> + Cache ! {update, Key, Value}; + mnesia -> + {atomic, ok} = + mnesia:transaction(fun() -> + mnesia:write(sess_cache, + {sess_cache, Key, Value}, write) + end) + end. + +delete(Cache, Key) -> + case session_cb() of + list -> + Cache ! {delete, Key}; + mnesia -> + {atomic, ok} = + mnesia:transaction(fun() -> + mnesia:delete(sess_cache, Key) + end) + end. + +foldl(Fun, Acc, Cache) -> + case session_cb() of + list -> + Cache ! {self(),foldl,Fun,Acc}, + receive {Cache, Res} -> Res end; + mnesia -> + Foldl = fun() -> + mnesia:foldl(Fun, Acc, sess_cache) + end, + {atomic, Res} = mnesia:transaction(Foldl), + Res + end. + +select_session(Cache, PartialKey) -> + case session_cb() of + list -> + Cache ! {self(),select_session, PartialKey}, + receive + {Cache, Res} -> + Res + end; + mnesia -> + Sel = fun() -> + mnesia:select(Cache, + [{{sess_cache,{PartialKey,'$1'}, '$2'}, + [],['$$']}]) + end, + {atomic, Res} = mnesia:transaction(Sel), + Res + end. + +session_loop(Sess) -> + receive + terminate -> + ok; + {Pid, lookup, Key} -> + case lists:keysearch(Key,1,Sess) of + {value, {Key,Value}} -> + Pid ! {self(), Value}; + _ -> + Pid ! {self(), undefined} + end, + session_loop(Sess); + {update, Key, Value} -> + NewSess = [{Key,Value}| lists:keydelete(Key,1,Sess)], + session_loop(NewSess); + {delete, Key} -> + session_loop(lists:keydelete(Key,1,Sess)); + {Pid,foldl,Fun,Acc} -> + Res = lists:foldl(Fun, Acc,Sess), + Pid ! {self(), Res}, + session_loop(Sess); + {Pid,select_session,PKey} -> + Sel = fun({{PKey0, Id},Session}, Acc) when PKey == PKey0 -> + [[Id, Session]|Acc]; + (_,Acc) -> + Acc + end, + Sessions = lists:foldl(Sel, [], Sess), + Pid ! {self(), Sessions}, + session_loop(Sess) + end. + + +erlang_ssl_receive(Socket, Data) -> + receive + {ssl, Socket, Data} -> + io:format("Received ~p~n",[Data]), + ok; + Other -> + test_server:fail({unexpected_message, Other}) + after ?SLEEP * 3 -> + test_server:fail({did_not_get, Data}) + end. diff --git a/lib/ssl/test/ssl_packet_SUITE.erl b/lib/ssl/test/ssl_packet_SUITE.erl index 88d2d99ef8..1ecf55d6e8 100644 --- a/lib/ssl/test/ssl_packet_SUITE.erl +++ b/lib/ssl/test/ssl_packet_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -23,7 +23,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(BYTE(X), X:8/unsigned-big-integer). -define(UINT16(X), X:16/unsigned-big-integer). @@ -53,15 +53,18 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - crypto:start(), - application:start(public_key), - ssl:start(), - Result = - (catch make_certs:all(?config(data_dir, Config), - ?config(priv_dir, Config))), - test_server:format("Make certs ~p~n", [Result]), - ssl_test_lib:cert_options(Config). - + case application:start(crypto) of + ok -> + application:start(public_key), + ssl:start(), + Result = + (catch make_certs:all(?config(data_dir, Config), + ?config(priv_dir, Config))), + test_server:format("Make certs ~p~n", [Result]), + ssl_test_lib:cert_options(Config); + _ -> + {skip, "Crypto did not start"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ %% Config - [tuple()] @@ -70,7 +73,7 @@ init_per_suite(Config) -> %%-------------------------------------------------------------------- end_per_suite(_Config) -> ssl:stop(), - crypto:stop(). + application:stop(crypto). %%-------------------------------------------------------------------- %% Function: init_per_testcase(TestCase, Config) -> Config @@ -115,56 +118,56 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test that erlang:decode_packet/3 seems to be handled correctly." - "We only use the most basic packet types in our tests as testing of" - "the packet types are for inet to verify" - ]; - -all(suite) -> - [packet_raw_passive_many_small, - packet_0_passive_many_small, packet_1_passive_many_small, - packet_2_passive_many_small, packet_4_passive_many_small, - packet_raw_passive_some_big, packet_0_passive_some_big, - packet_1_passive_some_big, - packet_2_passive_some_big, packet_4_passive_some_big, - packet_raw_active_once_many_small, - packet_0_active_once_many_small, packet_1_active_once_many_small, - packet_2_active_once_many_small, packet_4_active_once_many_small, - packet_raw_active_once_some_big, - packet_0_active_once_some_big, packet_1_active_once_some_big, - packet_2_active_once_some_big, packet_4_active_once_some_big, - packet_raw_active_many_small, packet_0_active_many_small, - packet_1_active_many_small, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [packet_raw_passive_many_small, + packet_0_passive_many_small, + packet_1_passive_many_small, + packet_2_passive_many_small, + packet_4_passive_many_small, + packet_raw_passive_some_big, packet_0_passive_some_big, + packet_1_passive_some_big, packet_2_passive_some_big, + packet_4_passive_some_big, + packet_raw_active_once_many_small, + packet_0_active_once_many_small, + packet_1_active_once_many_small, + packet_2_active_once_many_small, + packet_4_active_once_many_small, + packet_raw_active_once_some_big, + packet_0_active_once_some_big, + packet_1_active_once_some_big, + packet_2_active_once_some_big, + packet_4_active_once_some_big, + packet_raw_active_many_small, + packet_0_active_many_small, packet_1_active_many_small, packet_2_active_many_small, packet_4_active_many_small, - packet_raw_active_some_big, packet_0_active_some_big, - packet_1_active_some_big, packet_2_active_some_big, - packet_4_active_some_big, - packet_send_to_large, + packet_raw_active_some_big, packet_0_active_some_big, + packet_1_active_some_big, packet_2_active_some_big, + packet_4_active_some_big, packet_send_to_large, packet_wait_passive, packet_wait_active, packet_baddata_passive, packet_baddata_active, packet_size_passive, packet_size_active, - packet_cdr_decode, - packet_cdr_decode_list, - packet_http_decode, - packet_http_decode_list, - packet_http_bin_decode_multi, - packet_http_error_passive, - packet_line_decode, - packet_line_decode_list, - packet_asn1_decode, - packet_asn1_decode_list, - packet_tpkt_decode, - packet_tpkt_decode_list, - %packet_fcgi_decode, - packet_sunrm_decode, - packet_sunrm_decode_list, - header_decode_one_byte, - header_decode_two_bytes, + packet_cdr_decode, packet_cdr_decode_list, + packet_http_decode, packet_http_decode_list, + packet_http_bin_decode_multi, packet_http_error_passive, + packet_line_decode, packet_line_decode_list, + packet_asn1_decode, packet_asn1_decode_list, + packet_tpkt_decode, packet_tpkt_decode_list, + packet_sunrm_decode, packet_sunrm_decode_list, + header_decode_one_byte, header_decode_two_bytes, header_decode_two_bytes_one_sent, - header_decode_two_bytes_two_sent + header_decode_two_bytes_two_sent]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. - ]. %% Test cases starts here. %%-------------------------------------------------------------------- diff --git a/lib/ssl/test/ssl_payload_SUITE.erl b/lib/ssl/test/ssl_payload_SUITE.erl index d80df0bfbd..f57d7fa0e8 100644 --- a/lib/ssl/test/ssl_payload_SUITE.erl +++ b/lib/ssl/test/ssl_payload_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -22,7 +22,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(TIMEOUT, 600000). @@ -37,12 +37,15 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - crypto:start(), - application:start(public_key), - ssl:start(), - make_certs:all(?config(data_dir, Config), ?config(priv_dir, Config)), - ssl_test_lib:cert_options(Config). - + case application:start(crypto) of + ok -> + application:start(public_key), + ssl:start(), + make_certs:all(?config(data_dir, Config), ?config(priv_dir, Config)), + ssl_test_lib:cert_options(Config); + _ -> + {skip, "Crypto did not start"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ %% Config - [tuple()] @@ -51,7 +54,7 @@ init_per_suite(Config) -> %%-------------------------------------------------------------------- end_per_suite(_Config) -> ssl:stop(), - crypto:stop(). + application:stop(crypto). %%-------------------------------------------------------------------- %% Function: init_per_testcase(TestCase, Config) -> Config @@ -96,24 +99,30 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test payload over ssl in all socket modes, active, active_once," - "and passive mode."]; - -all(suite) -> - [server_echos_passive_small, server_echos_active_once_small, - server_echos_active_small, - client_echos_passive_small, client_echos_active_once_small, - client_echos_active_small, - server_echos_passive_big, server_echos_active_once_big, - server_echos_active_big, - client_echos_passive_big, client_echos_active_once_big, - client_echos_active_big, - server_echos_passive_huge, server_echos_active_once_huge, - server_echos_active_huge, - client_echos_passive_huge, client_echos_active_once_huge, - client_echos_active_huge - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [server_echos_passive_small, + server_echos_active_once_small, + server_echos_active_small, client_echos_passive_small, + client_echos_active_once_small, + client_echos_active_small, server_echos_passive_big, + server_echos_active_once_big, server_echos_active_big, + client_echos_passive_big, client_echos_active_once_big, + client_echos_active_big, server_echos_passive_huge, + server_echos_active_once_huge, server_echos_active_huge, + client_echos_passive_huge, + client_echos_active_once_huge, client_echos_active_huge]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Test cases starts here. %%-------------------------------------------------------------------- diff --git a/lib/ssl/test/ssl_session_cache_SUITE.erl b/lib/ssl/test/ssl_session_cache_SUITE.erl index 0f39759d97..b47efe0941 100644 --- a/lib/ssl/test/ssl_session_cache_SUITE.erl +++ b/lib/ssl/test/ssl_session_cache_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2010. All Rights Reserved. +%% Copyright Ericsson AB 2010-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 @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(SLEEP, 500). -define(TIMEOUT, 60000). @@ -47,19 +47,23 @@ %%-------------------------------------------------------------------- init_per_suite(Config0) -> Dog = ssl_test_lib:timetrap(?LONG_TIMEOUT *2), - crypto:start(), - application:start(public_key), - ssl:start(), - - %% make rsa certs using oppenssl - Result = - (catch make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0))), - test_server:format("Make certs ~p~n", [Result]), - - Config1 = ssl_test_lib:make_dsa_cert(Config0), - Config = ssl_test_lib:cert_options(Config1), - [{watchdog, Dog} | Config]. + case application:start(crypto) of + ok -> + application:start(public_key), + ssl:start(), + + %% make rsa certs using oppenssl + Result = + (catch make_certs:all(?config(data_dir, Config0), + ?config(priv_dir, Config0))), + test_server:format("Make certs ~p~n", [Result]), + + Config1 = ssl_test_lib:make_dsa_cert(Config0), + Config = ssl_test_lib:cert_options(Config1), + [{watchdog, Dog} | Config]; + _ -> + {skip, "Crypto did not start"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ @@ -69,7 +73,7 @@ init_per_suite(Config0) -> %%-------------------------------------------------------------------- end_per_suite(_Config) -> ssl:stop(), - crypto:stop(). + application:stop(crypto). %%-------------------------------------------------------------------- %% Function: init_per_testcase(TestCase, Config) -> Config @@ -141,13 +145,20 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test session cach API"]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [session_cache_process_list, + session_cache_process_mnesia]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [ - session_cache_process_list, session_cache_process_mnesia - ]. +end_per_group(_GroupName, Config) -> + Config. session_cache_process_list(doc) -> ["Test reuse of sessions (short handshake)"]; diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl index e1e8214ed6..f6ccbe85e3 100644 --- a/lib/ssl/test/ssl_test_lib.erl +++ b/lib/ssl/test/ssl_test_lib.erl @@ -81,14 +81,20 @@ run_server(ListenSocket, Opts) -> no_result_msg -> ok; Msg -> - test_server:format("Msg: ~p ~n", [Msg]), + test_server:format("Server Msg: ~p ~n", [Msg]), Pid ! {self(), Msg} end, - receive + receive listen -> run_server(ListenSocket, Opts); + {listen, MFA} -> + run_server(ListenSocket, [MFA | proplists:delete(mfa, Opts)]); close -> - ok = rpc:call(Node, ssl, close, [AcceptSocket]) + test_server:format("Server closing ~p ~n", [self()]), + Result = rpc:call(Node, ssl, close, [AcceptSocket], 500), + test_server:format("Result ~p ~n", [Result]); + {ssl_closed, _} -> + ok end. %%% To enable to test with s_client -reconnect @@ -151,19 +157,30 @@ run_client(Opts) -> no_result_msg -> ok; Msg -> + test_server:format("Client Msg: ~p ~n", [Msg]), Pid ! {self(), Msg} end, - receive + receive close -> - ok = rpc:call(Node, ssl, close, [Socket]) + test_server:format("Client closing~n", []), + rpc:call(Node, ssl, close, [Socket]); + {ssl_closed, Socket} -> + ok end; {error, Reason} -> - test_server:format("Client: connection failed: ~p ~n", [Reason]), + test_server:format("Client: connection failed: ~p ~n", [Reason]), Pid ! {self(), {error, Reason}} end. close(Pid) -> - Pid ! close. + test_server:format("Close ~p ~n", [Pid]), + Monitor = erlang:monitor(process, Pid), + Pid ! close, + receive + {'DOWN', Monitor, process, Pid, Reason} -> + erlang:demonitor(Monitor), + test_server:format("Pid: ~p down due to:~p ~n", [Pid, Reason]) + end. check_result(Server, ServerMsg, Client, ClientMsg) -> receive @@ -208,47 +225,27 @@ check_result(Pid, Msg) -> test_server:fail(Reason) end. -check_result_ignore_renegotiation_reject(Pid, Msg) -> - receive - {Pid, fail_session_fatal_alert_during_renegotiation} -> - test_server:comment("Server rejected old renegotiation"), - ok; - {ssl_error, _, esslconnect} -> - test_server:comment("Server rejected old renegotiation"), - ok; - {Pid, Msg} -> - ok; - {Port, {data,Debug}} when is_port(Port) -> - io:format("openssl ~s~n",[Debug]), - check_result(Pid,Msg); - Unexpected -> - Reason = {{expected, {Pid, Msg}}, - {got, Unexpected}}, - test_server:fail(Reason) - end. - - wait_for_result(Server, ServerMsg, Client, ClientMsg) -> receive {Server, ServerMsg} -> receive {Client, ClientMsg} -> - ok; - Unexpected -> - Unexpected + ok + %% Unexpected -> + %% Unexpected end; {Client, ClientMsg} -> receive {Server, ServerMsg} -> - ok; - Unexpected -> - Unexpected + ok + %% Unexpected -> + %% Unexpected end; {Port, {data,Debug}} when is_port(Port) -> io:format("openssl ~s~n",[Debug]), - wait_for_result(Server, ServerMsg, Client, ClientMsg); - Unexpected -> - Unexpected + wait_for_result(Server, ServerMsg, Client, ClientMsg) + %% Unexpected -> + %% Unexpected end. @@ -258,9 +255,9 @@ wait_for_result(Pid, Msg) -> ok; {Port, {data,Debug}} when is_port(Port) -> io:format("openssl ~s~n",[Debug]), - wait_for_result(Pid,Msg); - Unexpected -> - Unexpected + wait_for_result(Pid,Msg) + %% Unexpected -> + %% Unexpected end. cert_options(Config) -> @@ -327,8 +324,8 @@ cert_options(Config) -> make_dsa_cert(Config) -> - {ServerCaCertFile, ServerCertFile, ServerKeyFile} = make_dsa_cert_files("server", Config), - {ClientCaCertFile, ClientCertFile, ClientKeyFile} = make_dsa_cert_files("client", Config), + {ServerCaCertFile, ServerCertFile, ServerKeyFile} = make_cert_files("server", Config, dsa, dsa, ""), + {ClientCaCertFile, ClientCertFile, ClientKeyFile} = make_cert_files("client", Config, dsa, dsa, ""), [{server_dsa_opts, [{ssl_imp, new},{reuseaddr, true}, {cacertfile, ServerCaCertFile}, {certfile, ServerCertFile}, {keyfile, ServerKeyFile}]}, @@ -342,22 +339,41 @@ make_dsa_cert(Config) -> | Config]. - -make_dsa_cert_files(RoleStr, Config) -> - CaInfo = {CaCert, _} = erl_make_certs:make_cert([{key, dsa}]), - {Cert, CertKey} = erl_make_certs:make_cert([{key, dsa}, {issuer, CaInfo}]), +make_mix_cert(Config) -> + {ServerCaCertFile, ServerCertFile, ServerKeyFile} = make_cert_files("server", Config, dsa, + rsa, "mix"), + {ClientCaCertFile, ClientCertFile, ClientKeyFile} = make_cert_files("client", Config, dsa, + rsa, "mix"), + [{server_mix_opts, [{ssl_imp, new},{reuseaddr, true}, + {cacertfile, ServerCaCertFile}, + {certfile, ServerCertFile}, {keyfile, ServerKeyFile}]}, + {server_mix_verify_opts, [{ssl_imp, new},{reuseaddr, true}, + {cacertfile, ClientCaCertFile}, + {certfile, ServerCertFile}, {keyfile, ServerKeyFile}, + {verify, verify_peer}]}, + {client_mix_opts, [{ssl_imp, new},{reuseaddr, true}, + {cacertfile, ClientCaCertFile}, + {certfile, ClientCertFile}, {keyfile, ClientKeyFile}]} + | Config]. + +make_cert_files(RoleStr, Config, Alg1, Alg2, Prefix) -> + Alg1Str = atom_to_list(Alg1), + Alg2Str = atom_to_list(Alg2), + CaInfo = {CaCert, _} = erl_make_certs:make_cert([{key, Alg1}]), + {Cert, CertKey} = erl_make_certs:make_cert([{key, Alg2}, {issuer, CaInfo}]), CaCertFile = filename:join([?config(priv_dir, Config), - RoleStr, "dsa_cacerts.pem"]), + RoleStr, Prefix ++ Alg1Str ++ "_cacerts.pem"]), CertFile = filename:join([?config(priv_dir, Config), - RoleStr, "dsa_cert.pem"]), + RoleStr, Prefix ++ Alg2Str ++ "_cert.pem"]), KeyFile = filename:join([?config(priv_dir, Config), - RoleStr, "dsa_key.pem"]), + RoleStr, Prefix ++ Alg2Str ++ "_key.pem"]), der_to_pem(CaCertFile, [{'Certificate', CaCert, not_encrypted}]), der_to_pem(CertFile, [{'Certificate', Cert, not_encrypted}]), der_to_pem(KeyFile, [CertKey]), {CaCertFile, CertFile, KeyFile}. + start_upgrade_server(Args) -> Result = spawn_link(?MODULE, run_upgrade_server, [Args]), receive @@ -395,10 +411,12 @@ run_upgrade_server(Opts) -> end, {Module, Function, Args} = proplists:get_value(mfa, Opts), Msg = rpc:call(Node, Module, Function, [SslAcceptSocket | Args]), + test_server:format("Upgrade Server Msg: ~p ~n", [Msg]), Pid ! {self(), Msg}, receive close -> - ok = rpc:call(Node, ssl, close, [SslAcceptSocket]) + test_server:format("Upgrade Server closing~n", []), + rpc:call(Node, ssl, close, [SslAcceptSocket]) end catch error:{badmatch, Error} -> Pid ! {self(), Error} @@ -428,10 +446,12 @@ run_upgrade_client(Opts) -> test_server:format("apply(~p, ~p, ~p)~n", [Module, Function, [SslSocket | Args]]), Msg = rpc:call(Node, Module, Function, [SslSocket | Args]), + test_server:format("Upgrade Client Msg: ~p ~n", [Msg]), Pid ! {self(), Msg}, receive close -> - ok = rpc:call(Node, ssl, close, [SslSocket]) + test_server:format("Upgrade Client closing~n", []), + rpc:call(Node, ssl, close, [SslSocket]) end. start_upgrade_server_error(Args) -> diff --git a/lib/ssl/test/ssl_to_openssl_SUITE.erl b/lib/ssl/test/ssl_to_openssl_SUITE.erl index afedeaf099..4ab8fe3273 100644 --- a/lib/ssl/test/ssl_to_openssl_SUITE.erl +++ b/lib/ssl/test/ssl_to_openssl_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(TIMEOUT, 120000). -define(LONG_TIMEOUT, 600000). @@ -50,16 +50,20 @@ init_per_suite(Config0) -> false -> {skip, "Openssl not found"}; _ -> - crypto:start(), - application:start(public_key), - ssl:start(), - Result = - (catch make_certs:all(?config(data_dir, Config0), - ?config(priv_dir, Config0))), - test_server:format("Make certs ~p~n", [Result]), - Config1 = ssl_test_lib:make_dsa_cert(Config0), - Config = ssl_test_lib:cert_options(Config1), - [{watchdog, Dog} | Config] + case application:start(crypto) of + ok -> + application:start(public_key), + ssl:start(), + Result = + (catch make_certs:all(?config(data_dir, Config0), + ?config(priv_dir, Config0))), + test_server:format("Make certs ~p~n", [Result]), + Config1 = ssl_test_lib:make_dsa_cert(Config0), + Config = ssl_test_lib:cert_options(Config1), + [{watchdog, Dog} | Config]; + _ -> + {skip, "Crypto did not start"} + end end. %%-------------------------------------------------------------------- @@ -70,7 +74,7 @@ init_per_suite(Config0) -> %%-------------------------------------------------------------------- end_per_suite(_Config) -> ssl:stop(), - crypto:stop(). + application:stop(crypto). %%-------------------------------------------------------------------- %% Function: init_per_testcase(TestCase, Config) -> Config @@ -139,11 +143,10 @@ end_per_testcase(_, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test erlangs ssl against openssl"]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> - [erlang_client_openssl_server, +all() -> + [erlang_client_openssl_server, erlang_server_openssl_client, tls1_erlang_client_openssl_server_dsa_cert, tls1_erlang_server_openssl_client_dsa_cert, @@ -154,22 +157,29 @@ all(suite) -> erlang_client_openssl_server_no_wrap_sequence_number, erlang_server_openssl_client_no_wrap_sequence_number, erlang_client_openssl_server_no_server_ca_cert, - ssl3_erlang_client_openssl_server, + ssl3_erlang_client_openssl_server, ssl3_erlang_server_openssl_client, ssl3_erlang_client_openssl_server_client_cert, ssl3_erlang_server_openssl_client_client_cert, ssl3_erlang_server_erlang_client_client_cert, - tls1_erlang_client_openssl_server, + tls1_erlang_client_openssl_server, tls1_erlang_server_openssl_client, tls1_erlang_client_openssl_server_client_cert, tls1_erlang_server_openssl_client_client_cert, tls1_erlang_server_erlang_client_client_cert, - ciphers_rsa_signed_certs, - ciphers_dsa_signed_certs, - erlang_client_bad_openssl_server, - expired_session, - ssl2_erlang_server_openssl_client - ]. + ciphers_rsa_signed_certs, ciphers_dsa_signed_certs, + erlang_client_bad_openssl_server, expired_session, + ssl2_erlang_server_openssl_client]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Test cases starts here. %%-------------------------------------------------------------------- @@ -1164,10 +1174,6 @@ cipher(CipherSuite, Version, Config, ClientOpts, ServerOpts) -> close_port(OpenSslPort), %% Clean close down! ssl_test_lib:close(Client), - receive - {'EXIT', Client, normal} -> - ok - end, Return = case Result of ok -> diff --git a/lib/ssl/vsn.mk b/lib/ssl/vsn.mk index ee692adb3b..a4be7bb889 100644 --- a/lib/ssl/vsn.mk +++ b/lib/ssl/vsn.mk @@ -1,2 +1,2 @@ -SSL_VSN = 4.1.1 +SSL_VSN = 4.1.3 diff --git a/lib/stdlib/doc/src/filelib.xml b/lib/stdlib/doc/src/filelib.xml index 4ff3b22f32..47d64f245c 100644 --- a/lib/stdlib/doc/src/filelib.xml +++ b/lib/stdlib/doc/src/filelib.xml @@ -36,14 +36,23 @@ <description> <p>This module contains utilities on a higher level than the <c>file</c> module.</p> + <p>The module supports Unicode file names, so that it will match against regular expressions given in Unicode and that it will find and process raw file names (i.e. files named in a way that does not confirm to the expected encoding).</p> + <p>If the VM operates in Unicode file naming mode on a machine with transparent file naming, the <c>fun()</c> provided to <c>fold_files/5</c> needs to be prepared to handle binary file names.</p> + <p>For more information about raw file names, see the <seealso marker="kernel:file">file</seealso> module.</p> </description> <section> <title>DATA TYPES</title> <code type="none"> -filename() = string() | atom() | DeepList -dirname() = filename() -DeepList = [char() | atom() | DeepList]</code> +filename() = = string() | atom() | DeepList | RawFilename + DeepList = [char() | atom() | DeepList] + RawFilename = binary() + If VM is in unicode filename mode, string() and char() are allowed to be > 255. + RawFilename is a filename not subject to Unicode translation, meaning that it + can contain characters not conforming to the Unicode encoding expected from the + filesystem (i.e. non-UTF-8 characters although the VM is started in Unicode + filename mode). +dirname() = filename()</code> </section> <funcs> @@ -90,6 +99,18 @@ DeepList = [char() | atom() | DeepList]</code> If <c>Recursive</c> is true all sub-directories to <c>Dir</c> are processed. The regular expression matching is done on just the filename without the directory part.</p> + + <p>If Unicode file name translation is in effect and the file + system is completely transparent, file names that cannot be + interpreted as Unicode may be encountered, in which case the + <c>fun()</c> must be prepared to handle raw file names + (i.e. binaries). If the regular expression contains + codepoints beyond 255, it will not match file names that do + not conform to the expected character encoding (i.e. are not + encoded in valid UTF-8).</p> + + <p>For more information about raw file names, see the + <seealso marker="kernel:file">file</seealso> module.</p> </desc> </func> <func> diff --git a/lib/stdlib/doc/src/filename.xml b/lib/stdlib/doc/src/filename.xml index fe6c6f898e..cdee6e4a81 100644 --- a/lib/stdlib/doc/src/filename.xml +++ b/lib/stdlib/doc/src/filename.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -43,13 +43,22 @@ only, even if the arguments contain back slashes. Use <c>join/1</c> to normalize a file name by removing redundant directory separators.</p> + <p>The module supports raw file names in the way that if a binary is present, or the file name cannot be interpreted according to the return value of + <seealso marker="kernel:file#native_name_encoding/0">file:native_name_encoding/0</seealso>, a raw file name will also be returned. For example filename:join/1 provided with a path component being a binary (and also not being possible to interpret under the current native file name encoding) will result in a raw file name being returned (the join operation will have been performed of course). For more information about raw file names, see the <seealso marker="kernel:file">file</seealso> module.</p> </description> <section> <title>DATA TYPES</title> <code type="none"> -name() = string() | atom() | DeepList -DeepList = [char() | atom() | DeepList]</code> +name() = string() | atom() | DeepList | RawFilename + DeepList = [char() | atom() | DeepList] + RawFilename = binary() + If VM is in unicode filename mode, string() and char() are allowed to be > 255. + RawFilename is a filename not subject to Unicode translation, meaning that it + can contain characters not conforming to the Unicode encoding expected from the + filesystem (i.e. non-UTF-8 characters although the VM is started in Unicode + filename mode). + </code> </section> <funcs> <func> diff --git a/lib/stdlib/doc/src/notes.xml b/lib/stdlib/doc/src/notes.xml index 6c618bc798..a8fe41f000 100644 --- a/lib/stdlib/doc/src/notes.xml +++ b/lib/stdlib/doc/src/notes.xml @@ -30,6 +30,144 @@ </header> <p>This document describes the changes made to the STDLIB application.</p> +<section><title>STDLIB 1.17.2.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Several type specifications for standard libraries were + wrong in the R14B01 release. This is now corrected. The + corrections concern types in re,io,filename and the + module erlang itself.</p> + <p> + Own Id: OTP-9008</p> + </item> + </list> + </section> + +</section> + +<section><title>STDLIB 1.17.2</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> When several clients accessed a Dets table + simultaneously, one of them calling + <c>dets:insert_new/2</c>, the Dets server could crash. + Alternatively, under the same conditions, <c>ok</c> was + sometimes returned instead of <c>true</c>. (Thanks to + John Hughes.) </p> + <p> + Own Id: OTP-8856</p> + </item> + <item> + <p> When several clients accessed a Dets table + simultaneously, inserted or updated objects were + sometimes lost due to the Dets file being truncated. + (Thanks to John Hughes.) </p> + <p> + Own Id: OTP-8898</p> + </item> + <item> + <p> When several clients accessed a Dets table + simultaneously, modifications of the Dets server's + internal state were sometimes thrown away. The symptoms + are diverse: error with reason <c>bad_object</c>; + inserted objects not returned by <c>lookup()</c>; et + cetera. (Thanks to John Hughes.) </p> + <p> + Own Id: OTP-8899</p> + </item> + <item> + <p> If a Dets table was closed after calling + <c>bchunk/2</c>, <c>match/1,3</c>, + <c>match_object/1,3</c>, or <c>select/1,3</c> and then + opened again, a subsequent call using the returned + continuation would normally return a reply. This bug has + fixed; now the call fails with reason <c>badarg</c>. </p> + <p> + Own Id: OTP-8903</p> + </item> + <item> + <p> Cover did not collect coverage data for files such as + Yecc parses containing include directives. The bug has + been fixed by modifying <c>epp</c>, the Erlang Code + Preprocessor. </p> + <p> + Own Id: OTP-8911</p> + </item> + <item> + <p> If a Dets table with fewer slots than keys was opened + and then closed after just a lookup, the contents were no + longer well-formed. This bug has been fixed. (Thanks to + Matthew Evans.) </p> + <p> + Own Id: OTP-8923</p> + </item> + <item> + <p> + In a supervisor, when it terminates a child, if that + child happens to have exited fractionally early, with + normal, the supervisor reports this as an error. This + should not be reported as an error.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-8938 Aux Id: seq11615 </p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + The documentation filelib:wildcard/1,2 now describes the + character set syntax for wildcards.</p> + <p> + Own Id: OTP-8879 Aux Id: seq11683 </p> + </item> + <item> + <p>Buffer overflows have been prevented in <c>erlc</c>, + <c>dialyzer</c>, <c>typer</c>, <c>run_test</c>, + <c>heart</c>, <c>escript</c>, and <c>erlexec</c>.</p> + (Thanks to Michael Santos.) + <p> + Own Id: OTP-8892</p> + </item> + <item> + <p> + Using a float for the number of copies for + <c>string:copies/2</c> resulted in an infinite loop. Now + it will fail with an exception instead. (Thanks to + Michael Santos.)</p> + <p> + Own Id: OTP-8915</p> + </item> + <item> + <p> + New ETS option <c>compressed</c>, to enable a more + compact storage format at the expence of heavier table + operations. For test and evaluation, <c>erl +ec</c> can + be used to force compression on all ETS tables.</p> + <p> + Own Id: OTP-8922 Aux Id: seq11658 </p> + </item> + <item> + <p> The default maximum number of slots of a Dets table + has been changed as to be equal to the maximum number of + slots. (Thanks to Richard Carlsson.) </p> + <p> + Own Id: OTP-8959</p> + </item> + </list> + </section> + +</section> + <section><title>STDLIB 1.17.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/stdlib/doc/src/unicode_usage.xml b/lib/stdlib/doc/src/unicode_usage.xml index f1b0659ea2..416df1f02c 100644 --- a/lib/stdlib/doc/src/unicode_usage.xml +++ b/lib/stdlib/doc/src/unicode_usage.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1999</year> - <year>2009</year> + <year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -168,6 +168,48 @@ Eshell V5.7 (abort with ^G) <image file="ushell2.gif"><icaption>Unicode characters in allowed and disallowed context</icaption></image> </section> <section> +<title>Unicode file names</title> +<p>Most modern operating systems support Unicode file names in some way or another. There are several different ways to do this and Erlang by default treats the different approaches differently:</p> +<taglist> +<tag>Mandatory Unicode file naming</tag> +<item> +<p>Windows and, for most common uses, MacOSX enforces Unicode support for file names. All files created in the filesystem have names that can consistently be interpreted. In MacOSX, all file names are retrieved in UTF-8 encoding, while Windows has selected an approach where each system call handling file names has a special Unicode aware variant, giving much the same effect. There are no file names on these systems that are not Unicode file names, why the default behavior of the Erlang VM is to work in "Unicode file name translation mode", meaning that a file name can be given as a Unicode list and that will be automatically translated to the proper name encoding for the underlying operating and file system.</p> +<p>Doing i.e. a <c>file:list_dir/1</c> on one of these systems may return Unicode lists with codepoints beyond 255, depending on the content of the actual filesystem.</p> +<p>As the feature is fairly new, you may still stumble upon non core applications that cannot handle being provided with file names containing characters with codepoints larger than 255, but the core Erlang system should have no problems with Unicode file names.</p> +</item> +<tag>Transparent file naming</tag> +<item> +<p>Most Unix operating systems have adopted a simpler approach, namely that Unicode file naming is not enforced, but by convention. Those systems usually use UTF-8 encoding for Unicode file names, but do not enforce it. On such a system, a file name containing characters having codepoints between 128 and 255 may be named either as plain ISO-latin-1 or using UTF-8 encoding. As no consistency is enforced, the Erlang VM can do no consistent translation of all file names. If the VM would automatically select encoding based on heuristics, one could get unexpected behavior on these systems, therefore file names not being encoded in UTF-8 are returned as "raw file names" if Unicode file naming support is turned on.</p> +<p>A raw file name is not a list, but a binary. Many non core applications still do not handle file names given as binaries, why such raw names are avoided by default. This means that systems having implemented Unicode file naming through transparent file systems and an UTF-8 convention, do not by default have Unicode file naming turned on. Explicitly turning Unicode file name handling on for these types of systems is considered experimental.</p> +</item> +</taglist> +<p>The Unicode file naming support was introduced with OTP release R14B01. A VM operating in Unicode file mode can work with files having names in any language or character set (as long as it's supported by the underlying OS and file system). The Unicode character list is used to denote file or directory names and if the file system content is listed, you will also be able to get Unicode lists as return value. The support lies in the kernel and stdlib modules, why most applications (that does not explicitly require the file names to be in the ISO-latin-1 range) will benefit from the Unicode support without change.</p> + +<p>On Operating systems with mandatory Unicode file names, this means that you more easily conform to the file names of other (non Erlang) applications, and you can also process file names that, at least on Windows, were completely inaccessible (due to having names that could not be represented in ISO-latin-1). Also you will avoid creating incomprehensible file names on MacOSX as the vfs layer of the OS will accept all your file names as UTF-8 and will not rewrite them.</p> + +<p>For most systems, turning on Unicode file name translation is no problem even if it uses transparent file naming. Very few systems have mixed file name encodings. A consistent UTF-8 named system will work perfectly in Unicode file name mode. It is still however considered experimental in R14B01. Unicode file name translation is turned on with the <c>+fnu</c> switch to the <c>erl</c> program. If the VM is started in Unicode file name translation mode, <c>file:native_name_encoding/0</c> will return the atom <c>utf8</c>.</p> + +<p>In Unicode file name mode, file names given to the BIF <c>open_port/2</c> with the option <c>{spawn_executable,...}</c> are also interpreted as Unicode. So is the parameter list given in the <c>args</c> option available when using <c>spawn_executable</c>. The UTF-8 translation of arguments can be avoided using binaries, see the discussion about raw file names below.</p> + +<p>It is worth noting that the file <c>encoding</c> options given when opening a file has nothing to do with the file <em>name</em> encoding convention. You can very well open files containing UTF-8 but having file names in ISO-latin-1 or vice versa.</p> + +<note>Erlang drivers and NIF shared objects still can not be named with names containing codepoints beyond 127. This is a known limitation to be removed in a future release. Erlang modules however can, but it is definitely not a good idea and is still considered experimental.</note> + +<section> +<title>Notes about raw file names and automatic file name conversion</title> +<p>Raw file names is introduced together with Unicode file name support in erts-5.8.2 (OTP R14B01). The reason "raw file names" is introduced in the system is to be able to consistently represent file names given in different encodings on the same system. Having the VM automatically translate a file name that is not in UTF-8 to a list of Unicode characters might seem practical, but this would open up for both duplicate file names and other inconsistent behavior. Consider a directory containing a file named "bj�rn" in ISO-latin-1, while the Erlang VM is operating in Unicode file name mode (and therefore expecting UTF-8 file naming). The ISO-latin-1 name is not valid UTF-8 and one could be tempted to think that automatic conversion in for example <c>file:list_dir/1</c> is a good idea. But what would happen if we later tried to open the file and have the name as a Unicode list (magically converted from the ISO-latin-1 file name)? The VM will convert the file name given to UTF-8, as this is the encoding expected. Effectively this means trying to open the file named <<"bj�rn"/utf8>>. This file does not exist, and even if it existed it would not be the same file as the one that was listed. We could even create two files named "bj�rn", one named in the UTF-8 encoding and one not. If <c>file:list_dir/1</c> would automatically convert the ISO-latin-1 file name to a list, we would get two identical file names as the result. To avoid this, we need to differentiate between file names being properly encoded according to the Unicode file naming convention (i.e. UTF-8) and file names being invalid under the encoding. This is done by representing invalid encoding as "raw" file names, i.e. as binaries.</p> +<p>The core system of Erlang (kernel and stdlib) accepts raw file names except for loadable drivers and executables invoked using <c>open_port({spawn, ...} ...)</c>. <c>open_port({spawn_executable, ...} ...)</c> however does accept them. As mentioned earlier, the arguments given in the option list to <c>open_port({spawn_executable, ...} ...)</c> undergo the same conversion as the file names, meaning that the executable will be provided with arguments in UTF-8 as well. This translation is avoided consistently with how the file names are treated, by giving the argument as a binary.</p> +<p>To force Unicode file name translation mode on systems where this is not the default is considered experimental in OTP R14B01 due to the raw file names possibly being a new experience to the programmer and that the non core applications of OTP are not tested for compliance with raw file names yet. Unicode file name translation is expected to be default in future releases.</p> +<p>If working with raw file names, one can still conform to the encoding convention of the Erlang VM by using the <c>file:native_name_encoding/0</c> function, which returns either the atom <c>latin1</c> or the atom <c>utf8</c> depending on the file name translation mode. On Linux, a VM started without explicitly stating the file name translation mode will default to <c>latin1</c> as the native file name encoding, why file names on the disk encoded as UTF-8 will be returned as a list of the names interpreted as ISO-latin-1. The "UTF-8 list" is not a practical type for displaying or operating on in Erlang, but it is backward compatible and usable in all functions requiring a file name. On Windows and MacOSX, the default behavior is that of file name translation, why the <c>file:native_name_encoding/0</c> by default returns <c>utf8</c> on those systems (the fact that Windows actually does not use UTF-8 on the file system level can safely be ignored by the Erlang programmer). The default behavior can be changed using the <c>+fnu</c> or <c>+fnl</c> options to the VM, see the <c>erl</c> command manual page.</p> +<p>Even if you are operating without Unicode file naming translation automatically done by the VM, you can access and create files with names in UTF-8 encoding by using raw file names encoded as UTF-8. Enforcing the UTF-8 encoding regardless of the mode the Erlang VM is started in might, in some circumstances be a good idea, as the convention of using UTF-8 file names is spreading.</p> +</section> +<section> +<title>Notes about MacOSX</title> +<p>MacOSXs vfs layer enforces UTF-8 file names in a quite aggressive way. Older versions did this by simply refusing to create non UTF-8 conforming file names, while newer versions replace offending bytes with the sequence "%HH", where HH is the original character in hexadecimal notation. As Unicode translation is enabled by default on MacOSX, the only way to come up against this is to either start the VM with the <c>+fnl</c> flag or to use a raw file name in <c>latin1</c> encoding. In that case, the file can not be opened with the same name as the one used to create this. The problem is by design in newer versions of MacOSX.</p> +<p>MacOSX also reorganizes the names of files so that the representation of accents etc is denormalized, i.e. the character <c>�</c> is represented as the codepoints [111,776], where 111 is the character <c>o</c> and 776 is a special accent character. This type of denormalized Unicode is otherwise very seldom used and Erlang normalizes those file names on retrieval, so that denormalized file names is not passed up to the Erlang application. In Erlang the file name "bj�rn" is retrieved as [98,106,246,114,110], not as [98,106,117,776,114,110], even though the file system might think differently.</p> +</section> +</section> +<section> <title>Unicode-aware modules</title> <p>Most of the modules in Erlang/OTP are of course Unicode-unaware in the sense that they have no notion of Unicode and really shouldn't have. Typically they handle non-textual or byte-oriented data (like <c>gen_tcp</c> etc).</p> <p>Modules that actually handle textual data (like <c>io_lib</c>, <c>string</c> etc) are sometimes subject to conversion or extension to be able to handle Unicode characters.</p> diff --git a/lib/stdlib/src/base64.erl b/lib/stdlib/src/base64.erl index ebef998ee1..a14a72ac6d 100644 --- a/lib/stdlib/src/base64.erl +++ b/lib/stdlib/src/base64.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -114,7 +114,7 @@ decode(List) when is_list(List) -> mime_decode(Bin) when is_binary(Bin) -> mime_decode_binary(<<>>, Bin); mime_decode(List) when is_list(List) -> - list_to_binary(mime_decode_l(List)). + mime_decode(list_to_binary(List)). -spec decode_l(string()) -> string(). @@ -125,7 +125,7 @@ decode_l(List) -> -spec mime_decode_l(string()) -> string(). mime_decode_l(List) -> - L = strip_illegal(List, []), + L = strip_illegal(List, [], 0), decode(L, []). %%------------------------------------------------------------------------- @@ -198,6 +198,9 @@ decode_binary(Result, <<>>) -> true = is_binary(Result), Result. +%% Skipping pad character if not at end of string. Also liberal about +%% excess padding and skipping of other illegal (non-base64 alphabet) +%% characters. See section 3.3 of RFC4648 mime_decode_binary(Result, <<0:8,T/bits>>) -> mime_decode_binary(Result, T); mime_decode_binary(Result0, <<C:8,T/bits>>) -> @@ -205,15 +208,27 @@ mime_decode_binary(Result0, <<C:8,T/bits>>) -> Bits when is_integer(Bits) -> mime_decode_binary(<<Result0/bits,Bits:6>>, T); eq -> - case tail_contains_equal(T) of - true -> - Split = byte_size(Result0) - 1, - <<Result:Split/bytes,_:4>> = Result0, - Result; - false -> - Split = byte_size(Result0) - 1, - <<Result:Split/bytes,_:2>> = Result0, - Result + case tail_contains_more(T, false) of + {<<>>, Eq} -> + %% No more valid data. + case bit_size(Result0) rem 8 of + 0 -> + %% '====' is not uncommon. + Result0; + 4 when Eq -> + %% enforce at least one more '=' only ignoring illegals and spacing + Split = byte_size(Result0) - 1, + <<Result:Split/bytes,_:4>> = Result0, + Result; + 2 -> + %% remove 2 bits + Split = byte_size(Result0) - 1, + <<Result:Split/bytes,_:2>> = Result0, + Result + end; + {More, _} -> + %% More valid data, skip the eq as invalid + mime_decode_binary(Result0, More) end; _ -> mime_decode_binary(Result0, T) @@ -262,31 +277,63 @@ strip_ws(<<$\s,T/binary>>) -> strip_ws(T); strip_ws(T) -> T. -strip_illegal([0|Cs], A) -> - strip_illegal(Cs, A); -strip_illegal([C|Cs], A) -> +%% Skipping pad character if not at end of string. Also liberal about +%% excess padding and skipping of other illegal (non-base64 alphabet) +%% characters. See section 3.3 of RFC4648 +strip_illegal([], A, _Cnt) -> + A; +strip_illegal([0|Cs], A, Cnt) -> + strip_illegal(Cs, A, Cnt); +strip_illegal([C|Cs], A, Cnt) -> case element(C, ?DECODE_MAP) of - bad -> strip_illegal(Cs, A); - ws -> strip_illegal(Cs, A); - eq -> strip_illegal_end(Cs, [$=|A]); - _ -> strip_illegal(Cs, [C|A]) - end; -strip_illegal([], A) -> A. + bad -> + strip_illegal(Cs, A, Cnt); + ws -> + strip_illegal(Cs, A, Cnt); + eq -> + case {tail_contains_more(Cs, false), Cnt rem 4} of + {{[], _}, 0} -> + A; %% Ignore extra = + {{[], true}, 2} -> + [$=|[$=|A]]; %% 'XX==' + {{[], _}, 3} -> + [$=|A]; %% 'XXX=' + {{[H|T], _}, _} -> + %% more data, skip equals + strip_illegal(T, [H|A], Cnt+1) + end; + _ -> + strip_illegal(Cs, [C|A], Cnt+1) + end. -strip_illegal_end([0|Cs], A) -> - strip_illegal_end(Cs, A); -strip_illegal_end([C|Cs], A) -> +%% Search the tail for more valid data and remember if we saw +%% another equals along the way. +tail_contains_more([], Eq) -> + {[], Eq}; +tail_contains_more(<<>>, Eq) -> + {<<>>, Eq}; +tail_contains_more([C|T]=More, Eq) -> case element(C, ?DECODE_MAP) of - bad -> strip_illegal(Cs, A); - ws -> strip_illegal(Cs, A); - eq -> [C|A]; - _ -> strip_illegal(Cs, [C|A]) + bad -> + tail_contains_more(T, Eq); + ws -> + tail_contains_more(T, Eq); + eq -> + tail_contains_more(T, true); + _ -> + {More, Eq} end; -strip_illegal_end([], A) -> A. - -tail_contains_equal(<<$=,_/binary>>) -> true; -tail_contains_equal(<<_,T/binary>>) -> tail_contains_equal(T); -tail_contains_equal(<<>>) -> false. +tail_contains_more(<<C:8,T/bits>> =More, Eq) -> + case element(C, ?DECODE_MAP) of + bad -> + tail_contains_more(T, Eq); + ws -> + tail_contains_more(T, Eq); + eq -> + tail_contains_more(T, true); + _ -> + {More, Eq} + end. %% accessors b64e(X) -> diff --git a/lib/stdlib/src/c.erl b/lib/stdlib/src/c.erl index 6d50a575eb..235ea939a8 100644 --- a/lib/stdlib/src/c.erl +++ b/lib/stdlib/src/c.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -42,31 +42,31 @@ -spec help() -> 'ok'. help() -> - format("bt(Pid) -- stack backtrace for a process\n" - "c(File) -- compile and load code in <File>\n" - "cd(Dir) -- change working directory\n" - "flush() -- flush any messages sent to the shell\n" - "help() -- help info\n" - "i() -- information about the system\n" - "ni() -- information about the networked system\n" - "i(X,Y,Z) -- information about pid <X,Y,Z>\n" - "l(Module) -- load or reload module\n" - "lc([File]) -- compile a list of Erlang modules\n" - "ls() -- list files in the current directory\n" - "ls(Dir) -- list files in directory <Dir>\n" - "m() -- which modules are loaded\n" - "m(Mod) -- information about module <Mod>\n" - "memory() -- memory allocation information\n" - "memory(T) -- memory allocation information of type <T>\n" - "nc(File) -- compile and load code in <File> on all nodes\n" - "nl(Module) -- load module on all nodes\n" - "pid(X,Y,Z) -- convert X,Y,Z to a Pid\n" - "pwd() -- print working directory\n" - "q() -- quit - shorthand for init:stop()\n" - "regs() -- information about registered processes\n" - "nregs() -- information about all registered processes\n" - "xm(M) -- cross reference check a module\n" - "y(File) -- generate a Yecc parser\n"). + io:put_chars(<<"bt(Pid) -- stack backtrace for a process\n" + "c(File) -- compile and load code in <File>\n" + "cd(Dir) -- change working directory\n" + "flush() -- flush any messages sent to the shell\n" + "help() -- help info\n" + "i() -- information about the system\n" + "ni() -- information about the networked system\n" + "i(X,Y,Z) -- information about pid <X,Y,Z>\n" + "l(Module) -- load or reload module\n" + "lc([File]) -- compile a list of Erlang modules\n" + "ls() -- list files in the current directory\n" + "ls(Dir) -- list files in directory <Dir>\n" + "m() -- which modules are loaded\n" + "m(Mod) -- information about module <Mod>\n" + "memory() -- memory allocation information\n" + "memory(T) -- memory allocation information of type <T>\n" + "nc(File) -- compile and load code in <File> on all nodes\n" + "nl(Module) -- load module on all nodes\n" + "pid(X,Y,Z) -- convert X,Y,Z to a Pid\n" + "pwd() -- print working directory\n" + "q() -- quit - shorthand for init:stop()\n" + "regs() -- information about registered processes\n" + "nregs() -- information about all registered processes\n" + "xm(M) -- cross reference check a module\n" + "y(File) -- generate a Yecc parser\n">>). %% c(FileName) %% Compile a file/module. @@ -659,7 +659,7 @@ portformat(Name, Id, Cmd) -> pwd() -> case file:get_cwd() of {ok, Str} -> - ok = io:format("~s\n", [Str]); + ok = io:format("~ts\n", [fixup_one_bin(Str)]); {error, _} -> ok = io:format("Cannot determine current directory\n") end. @@ -684,11 +684,27 @@ ls() -> ls(Dir) -> case file:list_dir(Dir) of {ok, Entries} -> - ls_print(sort(Entries)); + ls_print(sort(fixup_bin(Entries))); {error,_E} -> format("Invalid directory\n") end. +fixup_one_bin(X) when is_binary(X) -> + L = binary_to_list(X), + [ if + El > 127 -> + $?; + true -> + El + end || El <- L]; +fixup_one_bin(X) -> + X. +fixup_bin([H|T]) -> + [fixup_one_bin(H) | fixup_bin(T)]; +fixup_bin([]) -> + []. + + ls_print([]) -> ok; ls_print(L) -> Width = min([max(lengths(L, [])), 40]) + 5, @@ -698,7 +714,7 @@ ls_print(X, Width, Len) when Width + Len >= 80 -> io:nl(), ls_print(X, Width, 0); ls_print([H|T], Width, Len) -> - io:format("~-*s",[Width,H]), + io:format("~-*ts",[Width,H]), ls_print(T, Width, Len+Width); ls_print([], _, _) -> io:nl(). diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index 0c2d3db8ec..cfb9f0ca98 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -60,6 +60,10 @@ value_option(Flag, Default, On, OnVal, Off, OffVal, Opts) -> (_Opt, Def) -> Def end, Default, Opts). +%% The maximum number of arguments allowed for a function. + +-define(MAX_ARGUMENTS, 255). + %% The error and warning info structures, {Line,Module,Descriptor}, %% are kept in their seperate fields in the lint state record together %% with the name of the file (when a new file is entered, marked by @@ -226,6 +230,9 @@ format_error({obsolete_guard, {F, A}}) -> io_lib:format("~p/~p obsolete", [F, A]); format_error({reserved_for_future,K}) -> io_lib:format("atom ~w: future reserved keyword - rename or quote", [K]); +format_error({too_many_arguments,Arity}) -> + io_lib:format("too many arguments (~w) - " + "maximum allowed is ~w", [Arity,?MAX_ARGUMENTS]); %% --- patterns and guards --- format_error(illegal_pattern) -> "illegal pattern"; format_error(illegal_bin_pattern) -> @@ -1307,13 +1314,18 @@ define_function(Line, Name, Arity, St0) -> true -> add_error(Line, {redefine_function,NA}, St1); false -> - St2 = St1#lint{defined=gb_sets:add_element(NA, St1#lint.defined)}, - case imported(Name, Arity, St2) of - {yes,_M} -> add_error(Line, {define_import,NA}, St2); - no -> St2 + St2 = function_check_max_args(Line, Arity, St1), + St3 = St2#lint{defined=gb_sets:add_element(NA, St2#lint.defined)}, + case imported(Name, Arity, St3) of + {yes,_M} -> add_error(Line, {define_import,NA}, St3); + no -> St3 end end. +function_check_max_args(Line, Arity, St) when Arity > ?MAX_ARGUMENTS -> + add_error(Line, {too_many_arguments,Arity}, St); +function_check_max_args(_, _, St) -> St. + %% clauses([Clause], VarTable, State) -> {VarTable, State}. clauses(Cs, Vt, St) -> diff --git a/lib/stdlib/src/erl_posix_msg.erl b/lib/stdlib/src/erl_posix_msg.erl index fe981b23a7..909cc1d102 100644 --- a/lib/stdlib/src/erl_posix_msg.erl +++ b/lib/stdlib/src/erl_posix_msg.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -24,143 +24,146 @@ -spec message(atom()) -> string(). -message(e2big) -> "argument list too long"; -message(eacces) -> "permission denied"; -message(eaddrinuse) -> "address already in use"; -message(eaddrnotavail) -> "can't assign requested address"; -message(eadv) -> "advertise error"; -message(eafnosupport) -> "address family not supported by protocol family"; -message(eagain) -> "resource temporarily unavailable"; -message(ealign) -> "EALIGN"; -message(ealready) -> "operation already in progress"; -message(ebade) -> "bad exchange descriptor"; -message(ebadf) -> "bad file number"; -message(ebadfd) -> "file descriptor in bad state"; -message(ebadmsg) -> "not a data message"; -message(ebadr) -> "bad request descriptor"; -message(ebadrpc) -> "RPC structure is bad"; -message(ebadrqc) -> "bad request code"; -message(ebadslt) -> "invalid slot"; -message(ebfont) -> "bad font file format"; -message(ebusy) -> "file busy"; -message(echild) -> "no children"; -message(echrng) -> "channel number out of range"; -message(ecomm) -> "communication error on send"; -message(econnaborted) -> "software caused connection abort"; -message(econnrefused) -> "connection refused"; -message(econnreset) -> "connection reset by peer"; -message(edeadlk) -> "resource deadlock avoided"; -message(edeadlock) -> "resource deadlock avoided"; -message(edestaddrreq) -> "destination address required"; -message(edirty) -> "mounting a dirty fs w/o force"; -message(edom) -> "math argument out of range"; -message(edotdot) -> "cross mount point"; -message(edquot) -> "disk quota exceeded"; -message(eduppkg) -> "duplicate package name"; -message(eexist) -> "file already exists"; -message(efault) -> "bad address in system call argument"; -message(efbig) -> "file too large"; -message(ehostdown) -> "host is down"; -message(ehostunreach) -> "host is unreachable"; -message(eidrm) -> "identifier removed"; -message(einit) -> "initialization error"; -message(einprogress) -> "operation now in progress"; -message(eintr) -> "interrupted system call"; -message(einval) -> "invalid argument"; -message(eio) -> "I/O error"; -message(eisconn) -> "socket is already connected"; -message(eisdir) -> "illegal operation on a directory"; -message(eisnam) -> "is a name file"; -message(elbin) -> "ELBIN"; -message(el2hlt) -> "level 2 halted"; -message(el2nsync) -> "level 2 not synchronized"; -message(el3hlt) -> "level 3 halted"; -message(el3rst) -> "level 3 reset"; -message(elibacc) -> "can not access a needed shared library"; -message(elibbad) -> "accessing a corrupted shared library"; -message(elibexec) -> "can not exec a shared library directly"; -message(elibmax) -> - "attempting to link in more shared libraries than system limit"; -message(elibscn) -> ".lib section in a.out corrupted"; -message(elnrng) -> "link number out of range"; -message(eloop) -> "too many levels of symbolic links"; -message(emfile) -> "too many open files"; -message(emlink) -> "too many links"; -message(emsgsize) -> "message too long"; -message(emultihop) -> "multihop attempted"; -message(enametoolong) -> "file name too long"; -message(enavail) -> "not available"; -message(enet) -> "ENET"; -message(enetdown) -> "network is down"; -message(enetreset) -> "network dropped connection on reset"; -message(enetunreach) -> "network is unreachable"; -message(enfile) -> "file table overflow"; -message(enoano) -> "anode table overflow"; -message(enobufs) -> "no buffer space available"; -message(enocsi) -> "no CSI structure available"; -message(enodata) -> "no data available"; -message(enodev) -> "no such device"; -message(enoent) -> "no such file or directory"; -message(enoexec) -> "exec format error"; -message(enolck) -> "no locks available"; -message(enolink) -> "link has be severed"; -message(enomem) -> "not enough memory"; -message(enomsg) -> "no message of desired type"; -message(enonet) -> "machine is not on the network"; -message(enopkg) -> "package not installed"; -message(enoprotoopt) -> "bad proocol option"; -message(enospc) -> "no space left on device"; -message(enosr) -> "out of stream resources or not a stream device"; -message(enosym) -> "unresolved symbol name"; -message(enosys) -> "function not implemented"; -message(enotblk) -> "block device required"; -message(enotconn) -> "socket is not connected"; -message(enotdir) -> "not a directory"; -message(enotempty) -> "directory not empty"; -message(enotnam) -> "not a name file"; -message(enotsock) -> "socket operation on non-socket"; -message(enotsup) -> "operation not supported"; -message(enotty) -> "inappropriate device for ioctl"; -message(enotuniq) -> "name not unique on network"; -message(enxio) -> "no such device or address"; -message(eopnotsupp) -> "operation not supported on socket"; -message(eperm) -> "not owner"; -message(epfnosupport) -> "protocol family not supported"; -message(epipe) -> "broken pipe"; -message(eproclim) -> "too many processes"; -message(eprocunavail) -> "bad procedure for program"; -message(eprogmismatch) -> "program version wrong"; -message(eprogunavail) -> "RPC program not available"; -message(eproto) -> "protocol error"; -message(eprotonosupport) -> "protocol not suppored"; -message(eprototype) -> "protocol wrong type for socket"; -message(erange) -> "math result unrepresentable"; -message(erefused) -> "EREFUSED"; -message(eremchg) -> "remote address changed"; -message(eremdev) -> "remote device"; -message(eremote) -> "pathname hit remote file system"; -message(eremoteio) -> "remote i/o error"; -message(eremoterelease) -> "EREMOTERELEASE"; -message(erofs) -> "read-only file system"; -message(erpcmismatch) -> "RPC version is wrong"; -message(erremote) -> "object is remote"; -message(eshutdown) -> "can't send after socket shutdown"; -message(esocktnosupport) -> "socket type not supported"; -message(espipe) -> "invalid seek"; -message(esrch) -> "no such process"; -message(esrmnt) -> "srmount error"; -message(estale) -> "stale remote file handle"; -message(esuccess) -> "Error 0"; -message(etime) -> "timer expired"; -message(etimedout) -> "connection timed out"; -message(etoomanyrefs) -> "too many references: can't splice"; -message(etxtbsy) -> "text file or pseudo-device busy"; -message(euclean) -> "structure needs cleaning"; -message(eunatch) -> "protocol driver not attached"; -message(eusers) -> "too many users"; -message(eversion) -> "version mismatch"; -message(ewouldblock) -> "operation would block"; -message(exdev) -> "cross-domain link"; -message(exfull) -> "message tables full"; -message(nxdomain) -> "non-existing domain"; -message(_) -> "unknown POSIX error". +message(T) -> + binary_to_list(message_1(T)). + +message_1(e2big) -> <<"argument list too long">>; +message_1(eacces) -> <<"permission denied">>; +message_1(eaddrinuse) -> <<"address already in use">>; +message_1(eaddrnotavail) -> <<"can't assign requested address">>; +message_1(eadv) -> <<"advertise error">>; +message_1(eafnosupport) -> <<"address family not supported by protocol family">>; +message_1(eagain) -> <<"resource temporarily unavailable">>; +message_1(ealign) -> <<"EALIGN">>; +message_1(ealready) -> <<"operation already in progress">>; +message_1(ebade) -> <<"bad exchange descriptor">>; +message_1(ebadf) -> <<"bad file number">>; +message_1(ebadfd) -> <<"file descriptor in bad state">>; +message_1(ebadmsg) -> <<"not a data message">>; +message_1(ebadr) -> <<"bad request descriptor">>; +message_1(ebadrpc) -> <<"RPC structure is bad">>; +message_1(ebadrqc) -> <<"bad request code">>; +message_1(ebadslt) -> <<"invalid slot">>; +message_1(ebfont) -> <<"bad font file format">>; +message_1(ebusy) -> <<"file busy">>; +message_1(echild) -> <<"no children">>; +message_1(echrng) -> <<"channel number out of range">>; +message_1(ecomm) -> <<"communication error on send">>; +message_1(econnaborted) -> <<"software caused connection abort">>; +message_1(econnrefused) -> <<"connection refused">>; +message_1(econnreset) -> <<"connection reset by peer">>; +message_1(edeadlk) -> <<"resource deadlock avoided">>; +message_1(edeadlock) -> <<"resource deadlock avoided">>; +message_1(edestaddrreq) -> <<"destination address required">>; +message_1(edirty) -> <<"mounting a dirty fs w/o force">>; +message_1(edom) -> <<"math argument out of range">>; +message_1(edotdot) -> <<"cross mount point">>; +message_1(edquot) -> <<"disk quota exceeded">>; +message_1(eduppkg) -> <<"duplicate package name">>; +message_1(eexist) -> <<"file already exists">>; +message_1(efault) -> <<"bad address in system call argument">>; +message_1(efbig) -> <<"file too large">>; +message_1(ehostdown) -> <<"host is down">>; +message_1(ehostunreach) -> <<"host is unreachable">>; +message_1(eidrm) -> <<"identifier removed">>; +message_1(einit) -> <<"initialization error">>; +message_1(einprogress) -> <<"operation now in progress">>; +message_1(eintr) -> <<"interrupted system call">>; +message_1(einval) -> <<"invalid argument">>; +message_1(eio) -> <<"I/O error">>; +message_1(eisconn) -> <<"socket is already connected">>; +message_1(eisdir) -> <<"illegal operation on a directory">>; +message_1(eisnam) -> <<"is a name file">>; +message_1(elbin) -> <<"ELBIN">>; +message_1(el2hlt) -> <<"level 2 halted">>; +message_1(el2nsync) -> <<"level 2 not synchronized">>; +message_1(el3hlt) -> <<"level 3 halted">>; +message_1(el3rst) -> <<"level 3 reset">>; +message_1(elibacc) -> <<"can not access a needed shared library">>; +message_1(elibbad) -> <<"accessing a corrupted shared library">>; +message_1(elibexec) -> <<"can not exec a shared library directly">>; +message_1(elibmax) -> + <<"attempting to link in more shared libraries than system limit">>; +message_1(elibscn) -> <<".lib section in a.out corrupted">>; +message_1(elnrng) -> <<"link number out of range">>; +message_1(eloop) -> <<"too many levels of symbolic links">>; +message_1(emfile) -> <<"too many open files">>; +message_1(emlink) -> <<"too many links">>; +message_1(emsgsize) -> <<"message too long">>; +message_1(emultihop) -> <<"multihop attempted">>; +message_1(enametoolong) -> <<"file name too long">>; +message_1(enavail) -> <<"not available">>; +message_1(enet) -> <<"ENET">>; +message_1(enetdown) -> <<"network is down">>; +message_1(enetreset) -> <<"network dropped connection on reset">>; +message_1(enetunreach) -> <<"network is unreachable">>; +message_1(enfile) -> <<"file table overflow">>; +message_1(enoano) -> <<"anode table overflow">>; +message_1(enobufs) -> <<"no buffer space available">>; +message_1(enocsi) -> <<"no CSI structure available">>; +message_1(enodata) -> <<"no data available">>; +message_1(enodev) -> <<"no such device">>; +message_1(enoent) -> <<"no such file or directory">>; +message_1(enoexec) -> <<"exec format error">>; +message_1(enolck) -> <<"no locks available">>; +message_1(enolink) -> <<"link has be severed">>; +message_1(enomem) -> <<"not enough memory">>; +message_1(enomsg) -> <<"no message of desired type">>; +message_1(enonet) -> <<"machine is not on the network">>; +message_1(enopkg) -> <<"package not installed">>; +message_1(enoprotoopt) -> <<"bad proocol option">>; +message_1(enospc) -> <<"no space left on device">>; +message_1(enosr) -> <<"out of stream resources or not a stream device">>; +message_1(enosym) -> <<"unresolved symbol name">>; +message_1(enosys) -> <<"function not implemented">>; +message_1(enotblk) -> <<"block device required">>; +message_1(enotconn) -> <<"socket is not connected">>; +message_1(enotdir) -> <<"not a directory">>; +message_1(enotempty) -> <<"directory not empty">>; +message_1(enotnam) -> <<"not a name file">>; +message_1(enotsock) -> <<"socket operation on non-socket">>; +message_1(enotsup) -> <<"operation not supported">>; +message_1(enotty) -> <<"inappropriate device for ioctl">>; +message_1(enotuniq) -> <<"name not unique on network">>; +message_1(enxio) -> <<"no such device or address">>; +message_1(eopnotsupp) -> <<"operation not supported on socket">>; +message_1(eperm) -> <<"not owner">>; +message_1(epfnosupport) -> <<"protocol family not supported">>; +message_1(epipe) -> <<"broken pipe">>; +message_1(eproclim) -> <<"too many processes">>; +message_1(eprocunavail) -> <<"bad procedure for program">>; +message_1(eprogmismatch) -> <<"program version wrong">>; +message_1(eprogunavail) -> <<"RPC program not available">>; +message_1(eproto) -> <<"protocol error">>; +message_1(eprotonosupport) -> <<"protocol not suppored">>; +message_1(eprototype) -> <<"protocol wrong type for socket">>; +message_1(erange) -> <<"math result unrepresentable">>; +message_1(erefused) -> <<"EREFUSED">>; +message_1(eremchg) -> <<"remote address changed">>; +message_1(eremdev) -> <<"remote device">>; +message_1(eremote) -> <<"pathname hit remote file system">>; +message_1(eremoteio) -> <<"remote i/o error">>; +message_1(eremoterelease) -> <<"EREMOTERELEASE">>; +message_1(erofs) -> <<"read-only file system">>; +message_1(erpcmismatch) -> <<"RPC version is wrong">>; +message_1(erremote) -> <<"object is remote">>; +message_1(eshutdown) -> <<"can't send after socket shutdown">>; +message_1(esocktnosupport) -> <<"socket type not supported">>; +message_1(espipe) -> <<"invalid seek">>; +message_1(esrch) -> <<"no such process">>; +message_1(esrmnt) -> <<"srmount error">>; +message_1(estale) -> <<"stale remote file handle">>; +message_1(esuccess) -> <<"Error 0">>; +message_1(etime) -> <<"timer expired">>; +message_1(etimedout) -> <<"connection timed out">>; +message_1(etoomanyrefs) -> <<"too many references: can't splice">>; +message_1(etxtbsy) -> <<"text file or pseudo-device busy">>; +message_1(euclean) -> <<"structure needs cleaning">>; +message_1(eunatch) -> <<"protocol driver not attached">>; +message_1(eusers) -> <<"too many users">>; +message_1(eversion) -> <<"version mismatch">>; +message_1(ewouldblock) -> <<"operation would block">>; +message_1(exdev) -> <<"cross-domain link">>; +message_1(exfull) -> <<"message tables full">>; +message_1(nxdomain) -> <<"non-existing domain">>; +message_1(_) -> <<"unknown POSIX error">>. diff --git a/lib/stdlib/src/escript.erl b/lib/stdlib/src/escript.erl index 99e454f593..7cb02afb11 100644 --- a/lib/stdlib/src/escript.erl +++ b/lib/stdlib/src/escript.erl @@ -570,9 +570,7 @@ parse_beam(S, File, HeaderSz, CheckOnly) -> forms_or_bin = Bin} end; {error, beam_lib, Reason} when is_tuple(Reason) -> - fatal(element(1, Reason)); - {error, beam_lib, Reason} -> - fatal(Reason) + fatal(element(1, Reason)) end. parse_source(S, File, Fd, StartLine, HeaderSz, CheckOnly) -> diff --git a/lib/stdlib/src/filelib.erl b/lib/stdlib/src/filelib.erl index d5ddf9ed7e..c845b61204 100644 --- a/lib/stdlib/src/filelib.erl +++ b/lib/stdlib/src/filelib.erl @@ -47,14 +47,14 @@ wildcard(Pattern) when is_list(Pattern) -> ?HANDLE_ERROR(do_wildcard(Pattern, file)). -spec wildcard(file:name(), file:name() | atom()) -> [file:filename()]. -wildcard(Pattern, Cwd) when is_list(Pattern), is_list(Cwd) -> +wildcard(Pattern, Cwd) when is_list(Pattern), (is_list(Cwd) or is_binary(Cwd)) -> ?HANDLE_ERROR(do_wildcard(Pattern, Cwd, file)); wildcard(Pattern, Mod) when is_list(Pattern), is_atom(Mod) -> ?HANDLE_ERROR(do_wildcard(Pattern, Mod)). -spec wildcard(file:name(), file:name(), atom()) -> [file:filename()]. wildcard(Pattern, Cwd, Mod) - when is_list(Pattern), is_list(Cwd), is_atom(Mod) -> + when is_list(Pattern), (is_list(Cwd) or is_binary(Cwd)), is_atom(Mod) -> ?HANDLE_ERROR(do_wildcard(Pattern, Cwd, Mod)). -spec is_dir(file:name()) -> boolean(). @@ -118,7 +118,7 @@ do_wildcard_comp({compiled_wildcard,{exists,File}}, Mod) -> do_wildcard_comp({compiled_wildcard,[Base|Rest]}, Mod) -> do_wildcard_1([Base], Rest, Mod). -do_wildcard(Pattern, Cwd, Mod) when is_list(Pattern), is_list(Cwd) -> +do_wildcard(Pattern, Cwd, Mod) when is_list(Pattern), (is_list(Cwd) or is_binary(Cwd)) -> do_wildcard_comp(do_compile_wildcard(Pattern), Cwd, Mod). do_wildcard_comp({compiled_wildcard,{exists,File}}, Cwd, Mod) -> @@ -127,9 +127,18 @@ do_wildcard_comp({compiled_wildcard,{exists,File}}, Cwd, Mod) -> _ -> [] end; do_wildcard_comp({compiled_wildcard,[current|Rest]}, Cwd0, Mod) -> - Cwd = filename:join([Cwd0]), %Slash away redundant slashes. - PrefixLen = length(Cwd)+1, - [lists:nthtail(PrefixLen, N) || N <- do_wildcard_1([Cwd], Rest, Mod)]; + {Cwd,PrefixLen} = case filename:join([Cwd0]) of + Bin when is_binary(Bin) -> {Bin,byte_size(Bin)+1}; + Other -> {Other,length(Other)+1} + end, %Slash away redundant slashes. + [ + if + is_binary(N) -> + <<_:PrefixLen/binary,Res/binary>> = N, + Res; + true -> + lists:nthtail(PrefixLen, N) + end || N <- do_wildcard_1([Cwd], Rest, Mod)]; do_wildcard_comp({compiled_wildcard,[Base|Rest]}, _Cwd, Mod) -> do_wildcard_1([Base], Rest, Mod). @@ -166,36 +175,44 @@ do_is_regular(File, Mod) -> %% If <Recursive> is true all sub-directories to <Dir> are processed do_fold_files(Dir, RegExp, Recursive, Fun, Acc, Mod) -> - {ok, Re1} = re:compile(RegExp), - do_fold_files1(Dir, Re1, Recursive, Fun, Acc, Mod). + {ok, Re1} = re:compile(RegExp,[unicode]), + do_fold_files1(Dir, Re1, RegExp, Recursive, Fun, Acc, Mod). -do_fold_files1(Dir, RegExp, Recursive, Fun, Acc, Mod) -> +do_fold_files1(Dir, RegExp, OrigRE, Recursive, Fun, Acc, Mod) -> case eval_list_dir(Dir, Mod) of - {ok, Files} -> do_fold_files2(Files, Dir, RegExp, Recursive, Fun, Acc, Mod); + {ok, Files} -> do_fold_files2(Files, Dir, RegExp, OrigRE, + Recursive, Fun, Acc, Mod); {error, _} -> Acc end. -do_fold_files2([], _Dir, _RegExp, _Recursive, _Fun, Acc, _Mod) -> +%% OrigRE is not to be compiled as it's for non conforming filenames, +%% i.e. for filenames that does not comply to the current encoding, which should +%% be very rare. We use it only in those cases and do not want to precompile. +do_fold_files2([], _Dir, _RegExp, _OrigRE, _Recursive, _Fun, Acc, _Mod) -> Acc; -do_fold_files2([File|T], Dir, RegExp, Recursive, Fun, Acc0, Mod) -> +do_fold_files2([File|T], Dir, RegExp, OrigRE, Recursive, Fun, Acc0, Mod) -> FullName = filename:join(Dir, File), case do_is_regular(FullName, Mod) of true -> - case re:run(File, RegExp, [{capture,none}]) of + case (catch re:run(File, if is_binary(File) -> OrigRE; + true -> RegExp end, + [{capture,none}])) of match -> Acc = Fun(FullName, Acc0), - do_fold_files2(T, Dir, RegExp, Recursive, Fun, Acc, Mod); + do_fold_files2(T, Dir, RegExp, OrigRE, Recursive, Fun, Acc, Mod); + {'EXIT',_} -> + do_fold_files2(T, Dir, RegExp, OrigRE, Recursive, Fun, Acc0, Mod); nomatch -> - do_fold_files2(T, Dir, RegExp, Recursive, Fun, Acc0, Mod) + do_fold_files2(T, Dir, RegExp, OrigRE, Recursive, Fun, Acc0, Mod) end; false -> case Recursive andalso do_is_dir(FullName, Mod) of true -> - Acc1 = do_fold_files1(FullName, RegExp, Recursive, + Acc1 = do_fold_files1(FullName, RegExp, OrigRE, Recursive, Fun, Acc0, Mod), - do_fold_files2(T, Dir, RegExp, Recursive, Fun, Acc1, Mod); + do_fold_files2(T, Dir, RegExp, OrigRE, Recursive, Fun, Acc1, Mod); false -> - do_fold_files2(T, Dir, RegExp, Recursive, Fun, Acc0, Mod) + do_fold_files2(T, Dir, RegExp, OrigRE, Recursive, Fun, Acc0, Mod) end end. @@ -268,6 +285,13 @@ do_wildcard_3(Base, [Pattern|Rest], Result, Mod) -> do_wildcard_3(Base, [], Result, _Mod) -> [Base|Result]. +wildcard_4(Pattern, [File|Rest], Base, Result) when is_binary(File) -> + case wildcard_5(Pattern, binary_to_list(File)) of + true -> + wildcard_4(Pattern, Rest, Base, [join(Base, File)|Result]); + false -> + wildcard_4(Pattern, Rest, Base, Result) + end; wildcard_4(Pattern, [File|Rest], Base, Result) -> case wildcard_5(Pattern, File) of true -> diff --git a/lib/stdlib/src/filename.erl b/lib/stdlib/src/filename.erl index 01c06e4596..24abf1e977 100644 --- a/lib/stdlib/src/filename.erl +++ b/lib/stdlib/src/filename.erl @@ -41,6 +41,9 @@ -include_lib("kernel/include/file.hrl"). +-define(IS_DRIVELETTER(Letter),(((Letter >= $A) andalso (Letter =< $Z)) orelse + ((Letter >= $a) andalso (Letter =< $z)))). + %% Converts a relative filename to an absolute filename %% or the filename itself if it already is an absolute filename %% Note that no attempt is made to create the most beatiful @@ -57,12 +60,18 @@ %% (for Unix) : absname("/") -> "/" %% (for WIN32): absname("/") -> "D:/" --spec absname(file:name()) -> string(). + +-spec absname(file:name()) -> file:filename(). absname(Name) -> {ok, Cwd} = file:get_cwd(), absname(Name, Cwd). --spec absname(file:name(), string()) -> string(). +-spec absname(file:name(), file:filename()) -> file:filename(). +absname(Name, AbsBase) when is_binary(Name), is_list(AbsBase) -> + absname(Name,filename_string_to_binary(AbsBase)); +absname(Name, AbsBase) when is_list(Name), is_binary(AbsBase) -> + absname(filename_string_to_binary(Name),AbsBase); + absname(Name, AbsBase) -> case pathtype(Name) of relative -> @@ -77,6 +86,20 @@ absname(Name, AbsBase) -> %% Handles volumerelative names (on Windows only). +absname_vr([<<"/">>|Rest1], [Volume|_], _AbsBase) -> + %% Absolute path on current drive. + join([Volume|Rest1]); +absname_vr([<<X, $:>>|Rest1], [<<X,_/binary>>|_], AbsBase) -> + %% Relative to current directory on current drive. + absname(join(Rest1), AbsBase); +absname_vr([<<X, $:>>|Name], _, _AbsBase) -> + %% Relative to current directory on another drive. + Dcwd = + case file:get_cwd([X, $:]) of + {ok, Dir} -> filename_string_to_binary(Dir); + {error, _} -> <<X, $:, $/>> + end, + absname(join(Name), Dcwd); absname_vr(["/"|Rest1], [Volume|_], _AbsBase) -> %% Absolute path on current drive. join([Volume|Rest1]); @@ -92,41 +115,13 @@ absname_vr([[X, $:]|Name], _, _AbsBase) -> end, absname(join(Name), Dcwd). -%% Joins a relative filename to an absolute base. For VxWorks the -%% resulting name is fixed to minimize the length by collapsing -%% ".." directories. -%% For other systems this is just a join/2, but assumes that +%% Joins a relative filename to an absolute base. +%% This is just a join/2, but assumes that %% AbsBase must be absolute and Name must be relative. --spec absname_join(string(), file:name()) -> string(). +-spec absname_join(file:filename(), file:name()) -> file:filename(). absname_join(AbsBase, Name) -> - case major_os_type() of - vxworks -> - absname_pretty(AbsBase, split(Name), lists:reverse(split(AbsBase))); - _Else -> - join(AbsBase, flatten(Name)) - end. - -%% Handles absolute filenames for VxWorks - these are 'pretty-printed', -%% since a C function call chdir("/erlang/lib/../bin") really sets -%% cwd to '/erlang/lib/../bin' which also works, but the long term -%% effect is potentially not so good ... -%% -%% absname_pretty("../bin", "/erlang/lib") -> "/erlang/bin" -%% absname_pretty("../../../..", "/erlang") -> "/erlang" - -absname_pretty(Abspath, Relpath, []) -> - %% AbsBase _must_ begin with a vxworks device name - {device, _Rest, Dev} = vxworks_first(Abspath), - absname_pretty(Abspath, Relpath, [lists:reverse(Dev)]); -absname_pretty(_Abspath, [], AbsBase) -> - join(lists:reverse(AbsBase)); -absname_pretty(Abspath, [[$.]|Rest], AbsBase) -> - absname_pretty(Abspath, Rest, AbsBase); -absname_pretty(Abspath, [[$.,$.]|Rest], [_|AbsRest]) -> - absname_pretty(Abspath, Rest, AbsRest); -absname_pretty(Abspath, [First|Rest], AbsBase) -> - absname_pretty(Abspath, Rest, [First|AbsBase]). + join(AbsBase, flatten(Name)). %% Returns the part of the filename after the last directory separator, %% or the filename itself if it has no separators. @@ -136,18 +131,40 @@ absname_pretty(Abspath, [First|Rest], AbsBase) -> %% basename("/usr/foo/") -> "foo" (trailing slashes ignored) %% basename("/") -> [] --spec basename(file:name()) -> string(). +-spec basename(file:name()) -> file:filename(). +basename(Name) when is_binary(Name) -> + case os:type() of + {win32,_} -> + win_basenameb(Name); + _ -> + basenameb(Name,[<<"/">>]) + end; + basename(Name0) -> Name = flatten(Name0), {DirSep2, DrvSep} = separators(), basename1(skip_prefix(Name, DrvSep), [], DirSep2). +win_basenameb(<<Letter,$:,Rest/binary>>) when ?IS_DRIVELETTER(Letter) -> + basenameb(Rest,[<<"/">>,<<"\\">>]); +win_basenameb(O) -> + basenameb(O,[<<"/">>,<<"\\">>]). +basenameb(Bin,Sep) -> + Parts = [ X || X <- binary:split(Bin,Sep,[global]), + X =/= <<>> ], + if + Parts =:= [] -> + <<>>; + true -> + lists:last(Parts) + end. + + + basename1([$/|[]], Tail, DirSep2) -> basename1([], Tail, DirSep2); basename1([$/|Rest], _Tail, DirSep2) -> basename1(Rest, [], DirSep2); -basename1([[_|_]=List|Rest], Tail, DirSep2) -> - basename1(List++Rest, Tail, DirSep2); basename1([DirSep2|Rest], Tail, DirSep2) when is_integer(DirSep2) -> basename1([$/|Rest], Tail, DirSep2); basename1([Char|Rest], Tail, DirSep2) when is_integer(Char) -> @@ -155,26 +172,11 @@ basename1([Char|Rest], Tail, DirSep2) when is_integer(Char) -> basename1([], Tail, _DirSep2) -> lists:reverse(Tail). -skip_prefix(Name, false) -> % No prefix for unix, but for VxWorks. - case major_os_type() of - vxworks -> - case vxworks_first(Name) of - {device, Rest, _Device} -> - Rest; - {not_device, _Rest, _First} -> - Name - end; - _Else -> - Name - end; -skip_prefix(Name, DrvSep) -> - skip_prefix1(Name, DrvSep). - -skip_prefix1([L, DrvSep|Name], DrvSep) when is_integer(L) -> +skip_prefix(Name, false) -> Name; -skip_prefix1([L], _) when is_integer(L) -> - [L]; -skip_prefix1(Name, _) -> +skip_prefix([L, DrvSep|Name], DrvSep) when ?IS_DRIVELETTER(L) -> + Name; +skip_prefix(Name, _) -> Name. %% Returns the last component of the filename, with the given @@ -190,7 +192,29 @@ skip_prefix1(Name, _) -> %% rootname(basename("xxx.jam")) -> "xxx" %% rootname(basename("xxx.erl")) -> "xxx" --spec basename(file:name(), file:name()) -> string(). +-spec basename(file:name(), file:name()) -> file:filename(). +basename(Name, Ext) when is_binary(Name), is_list(Ext) -> + basename(Name,filename_string_to_binary(Ext)); +basename(Name, Ext) when is_list(Name), is_binary(Ext) -> + basename(filename_string_to_binary(Name),Ext); +basename(Name, Ext) when is_binary(Name), is_binary(Ext) -> + BName = basename(Name), + LAll = byte_size(Name), + LN = byte_size(BName), + LE = byte_size(Ext), + case LN - LE of + Neg when Neg < 0 -> + BName; + Pos -> + StartLen = LAll - Pos - LE, + case Name of + <<_:StartLen/binary,Part:Pos/binary,Ext/binary>> -> + Part; + _Other -> + BName + end + end; + basename(Name0, Ext0) -> Name = flatten(Name0), Ext = flatten(Ext0), @@ -204,7 +228,7 @@ basename([$/|[]], Ext, Tail, DrvSep2) -> basename([], Ext, Tail, DrvSep2); basename([$/|Rest], Ext, _Tail, DrvSep2) -> basename(Rest, Ext, [], DrvSep2); -basename([$\\|Rest], Ext, Tail, DirSep2) when is_integer(DirSep2) -> +basename([DirSep2|Rest], Ext, Tail, DirSep2) when is_integer(DirSep2) -> basename([$/|Rest], Ext, Tail, DirSep2); basename([Char|Rest], Ext, Tail, DrvSep2) when is_integer(Char) -> basename(Rest, Ext, [Char|Tail], DrvSep2); @@ -216,24 +240,44 @@ basename([], _Ext, Tail, _DrvSep2) -> %% Example: dirname("/usr/src/kalle.erl") -> "/usr/src", %% dirname("kalle.erl") -> "." --spec dirname(file:name()) -> string(). +-spec dirname(file:name()) -> file:filename(). +dirname(Name) when is_binary(Name) -> + {Dsep,Drivesep} = separators(), + SList = case Dsep of + Sep when is_integer(Sep) -> + [ <<Sep>> ]; + _ -> + [] + end, + {XPart0,Dirs} = case Drivesep of + X when is_integer(X) -> + case Name of + <<DL,X,Rest/binary>> when ?IS_DRIVELETTER(DL) -> + {<<DL,X>>,Rest}; + _ -> + {<<>>,Name} + end; + _ -> + {<<>>,Name} + end, + Parts0 = binary:split(Dirs,[<<"/">>|SList],[global]), + %% Fairly short lists of parts, OK to reverse twice... + Parts = case Parts0 of + [] -> []; + _ -> lists:reverse(fstrip(tl(lists:reverse(Parts0)))) + end, + XPart = case {Parts,XPart0} of + {[],<<>>} -> + <<".">>; + _ -> + XPart0 + end, + dirjoin(Parts,XPart,<<"/">>); + dirname(Name0) -> Name = flatten(Name0), - case os:type() of - vxworks -> - {Devicep, Restname, FirstComp} = vxworks_first(Name), - case Devicep of - device -> - dirname(Restname, FirstComp, [], separators()); - _ -> - dirname(Name, [], [], separators()) - end; - _ -> - dirname(Name, [], [], separators()) - end. + dirname(Name, [], [], separators()). -dirname([[_|_]=List|Rest], Dir, File, Seps) -> - dirname(List++Rest, Dir, File, Seps); dirname([$/|Rest], Dir, File, Seps) -> dirname(Rest, File++Dir, [$/], Seps); dirname([DirSep|Rest], Dir, File, {DirSep,_}=Seps) when is_integer(DirSep) -> @@ -258,6 +302,26 @@ dirname([], [DrvSep,Dl], File, {_,DrvSep}) -> end; dirname([], Dir, _, _) -> lists:reverse(Dir). + +%% Compatibility with lists variant, remove trailing slashes +fstrip([<<>>,X|Y]) -> + fstrip([X|Y]); +fstrip(A) -> + A. + + +dirjoin([<<>>|T],Acc,Sep) -> + dirjoin1(T,<<Acc/binary,"/">>,Sep); +dirjoin(A,B,C) -> + dirjoin1(A,B,C). + +dirjoin1([],Acc,_) -> + Acc; +dirjoin1([One],Acc,_) -> + <<Acc/binary,One/binary>>; +dirjoin1([H|T],Acc,Sep) -> + dirjoin(T,<<Acc/binary,H/binary,Sep/binary>>,Sep). + %% Given a filename string, returns the file extension, %% including the period. Returns an empty list if there @@ -268,7 +332,29 @@ dirname([], Dir, _, _) -> %% %% On Windows: fn:dirname("\\usr\\src/kalle.erl") -> "/usr/src" --spec extension(file:name()) -> string(). +-spec extension(file:name()) -> file:filename(). +extension(Name) when is_binary(Name) -> + {Dsep,_} = separators(), + SList = case Dsep of + Sep when is_integer(Sep) -> + [ <<Sep>> ]; + _ -> + [] + end, + case binary:matches(Name,[<<".">>]) of + [] -> + <<>>; + List -> + {Pos,_} = lists:last(List), + <<_:Pos/binary,Part/binary>> = Name, + case binary:match(Part,[<<"/">>|SList]) of + nomatch -> + Part; + _ -> + <<>> + end + end; + extension(Name0) -> Name = flatten(Name0), extension(Name, [], major_os_type()). @@ -281,8 +367,6 @@ extension([$/|Rest], _Result, OsType) -> extension(Rest, [], OsType); extension([$\\|Rest], _Result, win32) -> extension(Rest, [], win32); -extension([$\\|Rest], _Result, vxworks) -> - extension(Rest, [], vxworks); extension([Char|Rest], Result, OsType) when is_integer(Char) -> extension(Rest, [Char|Result], OsType); extension([], Result, _OsType) -> @@ -290,23 +374,36 @@ extension([], Result, _OsType) -> %% Joins a list of filenames with directory separators. --spec join([string()]) -> string(). +-spec join([file:filename()]) -> file:filename(). join([Name1, Name2|Rest]) -> join([join(Name1, Name2)|Rest]); join([Name]) when is_list(Name) -> join1(Name, [], [], major_os_type()); +join([Name]) when is_binary(Name) -> + join1b(Name, <<>>, [], major_os_type()); join([Name]) when is_atom(Name) -> join([atom_to_list(Name)]). %% Joins two filenames with directory separators. --spec join(string(), string()) -> string(). +-spec join(file:filename(), file:filename()) -> file:filename(). join(Name1, Name2) when is_list(Name1), is_list(Name2) -> OsType = major_os_type(), case pathtype(Name2) of relative -> join1(Name1, Name2, [], OsType); _Other -> join1(Name2, [], [], OsType) end; +join(Name1, Name2) when is_binary(Name1), is_list(Name2) -> + join(Name1,filename_string_to_binary(Name2)); +join(Name1, Name2) when is_list(Name1), is_binary(Name2) -> + join(filename_string_to_binary(Name1),Name2); +join(Name1, Name2) when is_binary(Name1), is_binary(Name2) -> + OsType = major_os_type(), + case pathtype(Name2) of + relative -> join1b(Name1, Name2, [], OsType); + _Other -> join1b(Name2, <<>>, [], OsType) + end; + join(Name1, Name2) when is_atom(Name1) -> join(atom_to_list(Name1), Name2); join(Name1, Name2) when is_atom(Name2) -> @@ -321,8 +418,6 @@ when is_integer(UcLetter), UcLetter >= $A, UcLetter =< $Z -> join1(Rest, RelativeName, [$:, UcLetter+$a-$A], win32); join1([$\\|Rest], RelativeName, Result, win32) -> join1([$/|Rest], RelativeName, Result, win32); -join1([$\\|Rest], RelativeName, Result, vxworks) -> - join1([$/|Rest], RelativeName, Result, vxworks); join1([$/|Rest], RelativeName, [$., $/|Result], OsType) -> join1(Rest, RelativeName, [$/|Result], OsType); join1([$/|Rest], RelativeName, [$/|Result], OsType) -> @@ -344,6 +439,26 @@ join1([Char|Rest], RelativeName, Result, OsType) when is_integer(Char) -> join1([Atom|Rest], RelativeName, Result, OsType) when is_atom(Atom) -> join1(atom_to_list(Atom)++Rest, RelativeName, Result, OsType). +join1b(<<UcLetter, $:, Rest/binary>>, RelativeName, [], win32) +when is_integer(UcLetter), UcLetter >= $A, UcLetter =< $Z -> + join1b(Rest, RelativeName, [$:, UcLetter+$a-$A], win32); +join1b(<<$\\,Rest/binary>>, RelativeName, Result, win32) -> + join1b(<<$/,Rest/binary>>, RelativeName, Result, win32); +join1b(<<$/,Rest/binary>>, RelativeName, [$., $/|Result], OsType) -> + join1b(Rest, RelativeName, [$/|Result], OsType); +join1b(<<$/,Rest/binary>>, RelativeName, [$/|Result], OsType) -> + join1b(Rest, RelativeName, [$/|Result], OsType); +join1b(<<>>, <<>>, Result, OsType) -> + list_to_binary(maybe_remove_dirsep(Result, OsType)); +join1b(<<>>, RelativeName, [$:|Rest], win32) -> + join1b(RelativeName, <<>>, [$:|Rest], win32); +join1b(<<>>, RelativeName, [$/|Result], OsType) -> + join1b(RelativeName, <<>>, [$/|Result], OsType); +join1b(<<>>, RelativeName, Result, OsType) -> + join1b(RelativeName, <<>>, [$/|Result], OsType); +join1b(<<Char,Rest/binary>>, RelativeName, Result, OsType) when is_integer(Char) -> + join1b(Rest, RelativeName, [Char|Result], OsType). + maybe_remove_dirsep([$/, $:, Letter], win32) -> [Letter, $:, $/]; maybe_remove_dirsep([$/], _) -> @@ -357,7 +472,13 @@ maybe_remove_dirsep(Name, _) -> %% a given base directory, which is is assumed to be normalised %% by a previous call to join/{1,2}. --spec append(string(), file:name()) -> string(). +-spec append(file:filename(), file:name()) -> file:filename(). +append(Dir, Name) when is_binary(Dir), is_binary(Name) -> + <<Dir/binary,$/:8,Name/binary>>; +append(Dir, Name) when is_binary(Dir) -> + append(Dir,filename_string_to_binary(Name)); +append(Dir, Name) when is_binary(Name) -> + append(filename_string_to_binary(Dir),Name); append(Dir, Name) -> Dir ++ [$/|Name]. @@ -376,19 +497,14 @@ append(Dir, Name) -> -spec pathtype(file:name()) -> 'absolute' | 'relative' | 'volumerelative'. pathtype(Atom) when is_atom(Atom) -> pathtype(atom_to_list(Atom)); -pathtype(Name) when is_list(Name) -> +pathtype(Name) when is_list(Name) or is_binary(Name) -> case os:type() of {unix, _} -> unix_pathtype(Name); - {win32, _} -> win32_pathtype(Name); - vxworks -> case vxworks_first(Name) of - {device, _Rest, _Dev} -> - absolute; - _ -> - relative - end; - {ose,_} -> unix_pathtype(Name) + {win32, _} -> win32_pathtype(Name) end. +unix_pathtype(<<$/,_/binary>>) -> + absolute; unix_pathtype([$/|_]) -> absolute; unix_pathtype([List|Rest]) when is_list(List) -> @@ -404,6 +520,15 @@ win32_pathtype([Atom|Rest]) when is_atom(Atom) -> win32_pathtype(atom_to_list(Atom)++Rest); win32_pathtype([Char, List|Rest]) when is_list(List) -> win32_pathtype([Char|List++Rest]); +win32_pathtype(<<$/, $/, _/binary>>) -> absolute; +win32_pathtype(<<$\\, $/, _/binary>>) -> absolute; +win32_pathtype(<<$/, $\\, _/binary>>) -> absolute; +win32_pathtype(<<$\\, $\\, _/binary>>) -> absolute; +win32_pathtype(<<$/, _/binary>>) -> volumerelative; +win32_pathtype(<<$\\, _/binary>>) -> volumerelative; +win32_pathtype(<<_Letter, $:, $/, _/binary>>) -> absolute; +win32_pathtype(<<_Letter, $:, $\\, _/binary>>) -> absolute; +win32_pathtype(<<_Letter, $:, _/binary>>) -> volumerelative; win32_pathtype([$/, $/|_]) -> absolute; win32_pathtype([$\\, $/|_]) -> absolute; win32_pathtype([$/, $\\|_]) -> absolute; @@ -422,7 +547,9 @@ win32_pathtype(_) -> relative. %% Examples: rootname("/jam.src/kalle") -> "/jam.src/kalle" %% rootname("/jam.src/foo.erl") -> "/jam.src/foo" --spec rootname(file:name()) -> string(). +-spec rootname(file:name()) -> file:filename(). +rootname(Name) when is_binary(Name) -> + list_to_binary(rootname(binary_to_list(Name))); % No need to handle unicode, . is < 128 rootname(Name0) -> Name = flatten(Name0), rootname(Name, [], [], major_os_type()). @@ -431,8 +558,6 @@ rootname([$/|Rest], Root, Ext, OsType) -> rootname(Rest, [$/]++Ext++Root, [], OsType); rootname([$\\|Rest], Root, Ext, win32) -> rootname(Rest, [$/]++Ext++Root, [], win32); -rootname([$\\|Rest], Root, Ext, vxworks) -> - rootname(Rest, [$/]++Ext++Root, [], vxworks); rootname([$.|Rest], Root, [], OsType) -> rootname(Rest, Root, ".", OsType); rootname([$.|Rest], Root, Ext, OsType) -> @@ -451,7 +576,13 @@ rootname([], Root, _Ext, _OsType) -> %% Examples: rootname("/jam.src/kalle.jam", ".erl") -> "/jam.src/kalle.jam" %% rootname("/jam.src/foo.erl", ".erl") -> "/jam.src/foo" --spec rootname(file:name(), file:name()) -> string(). +-spec rootname(file:name(), file:name()) -> file:filename(). +rootname(Name, Ext) when is_binary(Name), is_binary(Ext) -> + list_to_binary(rootname(binary_to_list(Name),binary_to_list(Ext))); +rootname(Name, Ext) when is_binary(Name) -> + rootname(Name,filename_string_to_binary(Ext)); +rootname(Name, Ext) when is_binary(Ext) -> + rootname(filename_string_to_binary(Name),Ext); rootname(Name0, Ext0) -> Name = flatten(Name0), Ext = flatten(Ext0), @@ -471,27 +602,55 @@ rootname2([Char|Rest], Ext, Result) when is_integer(Char) -> %% split("foo/bar") -> ["foo", "bar"] %% split("a:\\msdev\\include") -> ["a:/", "msdev", "include"] --spec split(file:name()) -> [string()]. +-spec split(file:name()) -> [file:filename()]. +split(Name) when is_binary(Name) -> + case os:type() of + {win32, _} -> win32_splitb(Name); + _ -> unix_splitb(Name) + end; + split(Name0) -> Name = flatten(Name0), case os:type() of - {unix, _} -> unix_split(Name); {win32, _} -> win32_split(Name); - vxworks -> vxworks_split(Name); - {ose,_} -> unix_split(Name) + _ -> unix_split(Name) end. -%% If a VxWorks filename starts with '[/\].*[^/\]' '[/\].*:' or '.*:' -%% that part of the filename is considered a device. -%% The rest of the name is interpreted exactly as for win32. -%% XXX - dirty solution to make filename:split([]) return the same thing on -%% VxWorks as on unix and win32. -vxworks_split([]) -> - []; -vxworks_split(L) -> - {_Devicep, Rest, FirstComp} = vxworks_first(L), - split(Rest, [], [lists:reverse(FirstComp)], win32). +unix_splitb(Name) -> + L = binary:split(Name,[<<"/">>],[global]), + LL = case L of + [<<>>|Rest] -> + [<<"/">>|Rest]; + _ -> + L + end, + [ X || X <- LL, X =/= <<>>]. + + +fix_driveletter(Letter0) -> + if + Letter0 >= $A, Letter0 =< $Z -> + Letter0+$a-$A; + true -> + Letter0 + end. +win32_splitb(<<Letter0,$:, Slash, Rest/binary>>) when (((Slash =:= $\\) orelse (Slash =:= $/)) andalso + ?IS_DRIVELETTER(Letter0)) -> + Letter = fix_driveletter(Letter0), + L = binary:split(Rest,[<<"/">>,<<"\\">>],[global]), + [<<Letter,$:,$/>> | [ X || X <- L, X =/= <<>> ]]; +win32_splitb(<<Letter0,$:,Rest/binary>>) when ?IS_DRIVELETTER(Letter0) -> + Letter = fix_driveletter(Letter0), + L = binary:split(Rest,[<<"/">>,<<"\\">>],[global]), + [<<Letter,$:>> | [ X || X <- L, X =/= <<>> ]]; +win32_splitb(<<Slash,Rest/binary>>) when ((Slash =:= $\\) orelse (Slash =:= $/)) -> + L = binary:split(Rest,[<<"/">>,<<"\\">>],[global]), + [<<$/>> | [ X || X <- L, X =/= <<>> ]]; +win32_splitb(Name) -> + L = binary:split(Name,[<<"/">>,<<"\\">>],[global]), + [ X || X <- L, X =/= <<>> ]. + unix_split(Name) -> split(Name, [], unix). @@ -502,8 +661,6 @@ win32_split([X, $\\|Rest]) when is_integer(X) -> win32_split([X, $/|Rest]); win32_split([X, Y, $\\|Rest]) when is_integer(X), is_integer(Y) -> win32_split([X, Y, $/|Rest]); -win32_split([$/, $/|Rest]) -> - split(Rest, [], [[$/, $/]]); win32_split([UcLetter, $:|Rest]) when UcLetter >= $A, UcLetter =< $Z -> win32_split([UcLetter+$a-$A, $:|Rest]); win32_split([Letter, $:, $/|Rest]) -> @@ -528,8 +685,6 @@ split([$/|Rest], Comp, Components, OsType) -> split(Rest, [], [lists:reverse(Comp)|Components], OsType); split([Char|Rest], Comp, Components, OsType) when is_integer(Char) -> split(Rest, [Char|Comp], Components, OsType); -split([List|Rest], Comp, Components, OsType) when is_list(List) -> - split(List++Rest, Comp, Components, OsType); split([], [], Components, _OsType) -> lists:reverse(Components); split([], Comp, Components, OsType) -> @@ -540,7 +695,7 @@ split([], Comp, Components, OsType) -> %% will be converted to backslashes. On all platforms, the %% name will be normalized as done by join/1. --spec nativename(string()) -> string(). +-spec nativename(file:filename()) -> file:filename(). nativename(Name0) -> Name = join([Name0]), %Normalize. case os:type() of @@ -557,13 +712,12 @@ win32_nativename([]) -> separators() -> case os:type() of - {unix, _} -> {false, false}; {win32, _} -> {$\\, $:}; - vxworks -> {$\\, false}; - {ose,_} -> {false, false} + _ -> {false, false} end. + %% find_src(Module) -- %% find_src(Module, Rules) -- %% @@ -733,45 +887,12 @@ major_os_type() -> OsT -> OsT end. -%% Need to take care of the first pathname component separately -%% due to VxWorks less than good device naming rules. -%% (i.e. this is VxWorks specific ...) -%% The following four all starts with device names -%% elrond:/foo -> elrond: -%% elrond:\\foo.bar -> elrond: -%% /DISK1:foo -> /DISK1: -%% /usr/include -> /usr -%% This one doesn't: -%% foo/bar - -vxworks_first([]) -> - {not_device, [], []}; -vxworks_first([$/|T]) -> - vxworks_first2(device, T, [$/]); -vxworks_first([$\\|T]) -> - vxworks_first2(device, T, [$/]); -vxworks_first([H|T]) when is_list(H) -> - vxworks_first(H++T); -vxworks_first([H|T]) -> - vxworks_first2(not_device, T, [H]). - -vxworks_first2(Devicep, [], FirstComp) -> - {Devicep, [], FirstComp}; -vxworks_first2(Devicep, [$/|T], FirstComp) -> - {Devicep, [$/|T], FirstComp}; -vxworks_first2(Devicep, [$\\|T], FirstComp) -> - {Devicep, [$/|T], FirstComp}; -vxworks_first2(_Devicep, [$:|T], FirstComp)-> - {device, T, [$:|FirstComp]}; -vxworks_first2(Devicep, [H|T], FirstComp) when is_list(H) -> - vxworks_first2(Devicep, H++T, FirstComp); -vxworks_first2(Devicep, [H|T], FirstComp) -> - vxworks_first2(Devicep, T, [H|FirstComp]). - %% flatten(List) %% Flatten a list, also accepting atoms. --spec flatten(file:name()) -> string(). +-spec flatten(file:name()) -> file:filename(). +flatten(Bin) when is_binary(Bin) -> + Bin; flatten(List) -> do_flatten(List, []). @@ -785,3 +906,12 @@ do_flatten([], Tail) -> Tail; do_flatten(Atom, Tail) when is_atom(Atom) -> atom_to_list(Atom) ++ flatten(Tail). + +filename_string_to_binary(List) -> + case unicode:characters_to_binary(flatten(List),unicode,file:native_name_encoding()) of + {error,_,_} -> + erlang:error(badarg); + Bin when is_binary(Bin) -> + Bin + end. + diff --git a/lib/stdlib/src/io.erl b/lib/stdlib/src/io.erl index 1d0f9374bc..3efa68ca09 100644 --- a/lib/stdlib/src/io.erl +++ b/lib/stdlib/src/io.erl @@ -39,6 +39,8 @@ -type device() :: atom() | pid(). -type prompt() :: atom() | string(). +-type error_description() :: term(). % Whatever the io-server sends. +-type request_error() :: {'error',error_description()}. %% XXX: Some uses of line() in this file may need to read erl_scan:location() -type line() :: pos_integer(). @@ -53,26 +55,12 @@ to_tuple(T) when is_tuple(T) -> T; to_tuple(T) -> {T}. -%% Problem: the variables Other, Name and Args may collide with surrounding -%% ones. -%% Give extra args to macro, being the variables to use. --define(O_REQUEST(Io, Request), - case request(Io, Request) of - {error, Reason} -> - [Name | Args] = tuple_to_list(to_tuple(Request)), - erlang:error(conv_reason(Name, Reason), [Name, Io | Args]); - Other -> - Other - end). - o_request(Io, Request, Func) -> case request(Io, Request) of {error, Reason} -> [_Name | Args] = tuple_to_list(to_tuple(Request)), - {'EXIT',{undef,[_Current|Mfas]}} = (catch erlang:error(undef)), - MFA = {io, Func, [Io | Args]}, - exit({conv_reason(Func, Reason),[MFA|Mfas]}); -% erlang:error(conv_reason(Name, Reason), [Name, Io | Args]); + {'EXIT',{get_stacktrace,[_Current|Mfas]}} = (catch erlang:error(get_stacktrace)), + erlang:raise(error, conv_reason(Func, Reason), [{io, Func, [Io | Args]}|Mfas]); Other -> Other end. @@ -299,32 +287,32 @@ format(Io, Format, Args) -> %% Scanning Erlang code. --spec scan_erl_exprs(prompt()) -> erl_scan:tokens_result(). +-spec scan_erl_exprs(prompt()) -> erl_scan:tokens_result() | request_error(). scan_erl_exprs(Prompt) -> scan_erl_exprs(default_input(), Prompt, 1). --spec scan_erl_exprs(device(), prompt()) -> erl_scan:tokens_result(). +-spec scan_erl_exprs(device(), prompt()) -> erl_scan:tokens_result() | request_error(). scan_erl_exprs(Io, Prompt) -> scan_erl_exprs(Io, Prompt, 1). --spec scan_erl_exprs(device(), prompt(), line()) -> erl_scan:tokens_result(). +-spec scan_erl_exprs(device(), prompt(), line()) -> erl_scan:tokens_result() | request_error(). scan_erl_exprs(Io, Prompt, Pos0) -> request(Io, {get_until,unicode,Prompt,erl_scan,tokens,[Pos0]}). --spec scan_erl_form(prompt()) -> erl_scan:tokens_result(). +-spec scan_erl_form(prompt()) -> erl_scan:tokens_result() | request_error(). scan_erl_form(Prompt) -> scan_erl_form(default_input(), Prompt, 1). --spec scan_erl_form(device(), prompt()) -> erl_scan:tokens_result(). +-spec scan_erl_form(device(), prompt()) -> erl_scan:tokens_result() | request_error(). scan_erl_form(Io, Prompt) -> scan_erl_form(Io, Prompt, 1). --spec scan_erl_form(device(), prompt(), line()) -> erl_scan:tokens_result(). +-spec scan_erl_form(device(), prompt(), line()) -> erl_scan:tokens_result() | request_error(). scan_erl_form(Io, Prompt, Pos0) -> request(Io, {get_until,unicode,Prompt,erl_scan,tokens,[Pos0]}). @@ -335,7 +323,8 @@ scan_erl_form(Io, Prompt, Pos0) -> -type parse_ret() :: {'ok', erl_parse_expr_list(), line()} | {'eof', line()} - | {'error', erl_scan:error_info(), line()}. + | {'error', erl_scan:error_info(), line()} + | request_error(). -spec parse_erl_exprs(prompt()) -> parse_ret(). @@ -364,7 +353,8 @@ parse_erl_exprs(Io, Prompt, Pos0) -> -type parse_form_ret() :: {'ok', erl_parse_absform(), line()} | {'eof', line()} - | {'error', erl_scan:error_info(), line()}. + | {'error', erl_scan:error_info(), line()} + | request_error(). -spec parse_erl_form(prompt()) -> parse_form_ret(). diff --git a/lib/stdlib/src/re.erl b/lib/stdlib/src/re.erl index 296a6b3d23..9642de17b4 100644 --- a/lib/stdlib/src/re.erl +++ b/lib/stdlib/src/re.erl @@ -208,29 +208,25 @@ replace(Subject,RE,Replacement,Options) -> process_repl_params(Options,iodata,false), FlatSubject = to_binary(Subject, Unicode), FlatReplacement = to_binary(Replacement, Unicode), - case do_replace(FlatSubject,Subject,RE,FlatReplacement,NewOpt) of - {error,_Err} -> - throw(badre); - IoList -> - case Convert of - iodata -> - IoList; - binary -> - case Unicode of - false -> - iolist_to_binary(IoList); - true -> - unicode:characters_to_binary(IoList,unicode) - end; - list -> - case Unicode of - false -> - binary_to_list(iolist_to_binary(IoList)); - true -> - unicode:characters_to_list(IoList,unicode) - end - end - end + IoList = do_replace(FlatSubject,Subject,RE,FlatReplacement,NewOpt), + case Convert of + iodata -> + IoList; + binary -> + case Unicode of + false -> + iolist_to_binary(IoList); + true -> + unicode:characters_to_binary(IoList,unicode) + end; + list -> + case Unicode of + false -> + binary_to_list(iolist_to_binary(IoList)); + true -> + unicode:characters_to_list(IoList,unicode) + end + end catch throw:badopt -> erlang:error(badarg,[Subject,RE,Replacement,Options]); diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl index 7102fb9f6e..3c5800effa 100644 --- a/lib/stdlib/src/supervisor.erl +++ b/lib/stdlib/src/supervisor.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -40,7 +40,7 @@ %%-------------------------------------------------------------------------- -type child_id() :: pid() | 'undefined'. --type mfargs() :: {module(), atom(), [term()]}. +-type mfargs() :: {module(), atom(), [term()] | undefined}. -type modules() :: [module()] | 'dynamic'. -type restart() :: 'permanent' | 'transient' | 'temporary'. -type shutdown() :: 'brutal_kill' | timeout(). @@ -69,7 +69,7 @@ -record(state, {name, strategy :: strategy(), children = [] :: [child()], - dynamics = ?DICT:new() :: ?DICT(), + dynamics :: ?DICT() | list(), intensity :: non_neg_integer(), period :: pos_integer(), restarts = [], @@ -283,16 +283,15 @@ do_start_child_i(M, F, A) -> -spec handle_call(call(), term(), state()) -> {'reply', term(), state()}. handle_call({start_child, EArgs}, _From, State) when ?is_simple(State) -> - #child{mfargs = {M, F, A}} = hd(State#state.children), + Child = hd(State#state.children), + #child{mfargs = {M, F, A}} = Child, Args = A ++ EArgs, case do_start_child_i(M, F, Args) of {ok, Pid} -> - NState = State#state{dynamics = - ?DICT:store(Pid, Args, State#state.dynamics)}, + NState = save_dynamic_child(Child#child.restart_type, Pid, Args, State), {reply, {ok, Pid}, NState}; {ok, Pid, Extra} -> - NState = State#state{dynamics = - ?DICT:store(Pid, Args, State#state.dynamics)}, + NState = save_dynamic_child(Child#child.restart_type, Pid, Args, State), {reply, {ok, Pid, Extra}, NState}; What -> {reply, What, State} @@ -351,10 +350,20 @@ handle_call({terminate_child, Name}, _From, State) -> {reply, {error, not_found}, State} end; -handle_call(which_children, _From, State) when ?is_simple(State) -> - [#child{child_type = CT, modules = Mods}] = State#state.children, +handle_call(which_children, _From, #state{children = [#child{restart_type = temporary, + child_type = CT, + modules = Mods}]} = + State) when ?is_simple(State) -> + Reply = lists:map(fun(Pid) -> {undefined, Pid, CT, Mods} end, dynamics_db(temporary, + State#state.dynamics)), + {reply, Reply, State}; + +handle_call(which_children, _From, #state{children = [#child{restart_type = RType, + child_type = CT, + modules = Mods}]} = + State) when ?is_simple(State) -> Reply = lists:map(fun({Pid, _}) -> {undefined, Pid, CT, Mods} end, - ?DICT:to_list(State#state.dynamics)), + ?DICT:to_list(dynamics_db(RType, State#state.dynamics))), {reply, Reply, State}; handle_call(which_children, _From, State) -> @@ -366,13 +375,31 @@ handle_call(which_children, _From, State) -> State#state.children), {reply, Resp, State}; -handle_call(count_children, _From, State) when ?is_simple(State) -> - [#child{child_type = CT}] = State#state.children, + +handle_call(count_children, _From, #state{children = [#child{restart_type = temporary, + child_type = CT}]} = State) + when ?is_simple(State) -> + {Active, Count} = + lists:foldl(fun(Pid, {Alive, Tot}) -> + if is_pid(Pid) -> {Alive+1, Tot +1}; + true -> {Alive, Tot + 1} end + end, {0, 0}, dynamics_db(temporary, State#state.dynamics)), + Reply = case CT of + supervisor -> [{specs, 1}, {active, Active}, + {supervisors, Count}, {workers, 0}]; + worker -> [{specs, 1}, {active, Active}, + {supervisors, 0}, {workers, Count}] + end, + {reply, Reply, State}; + +handle_call(count_children, _From, #state{children = [#child{restart_type = RType, + child_type = CT}]} = State) + when ?is_simple(State) -> {Active, Count} = ?DICT:fold(fun(Pid, _Val, {Alive, Tot}) -> if is_pid(Pid) -> {Alive+1, Tot +1}; true -> {Alive, Tot + 1} end - end, {0, 0}, State#state.dynamics), + end, {0, 0}, dynamics_db(RType, State#state.dynamics)), Reply = case CT of supervisor -> [{specs, 1}, {active, Active}, {supervisors, Count}, {workers, 0}]; @@ -535,15 +562,11 @@ handle_start_child(Child, State) -> false -> case do_start_child(State#state.name, Child) of {ok, Pid} -> - Children = State#state.children, {{ok, Pid}, - State#state{children = - [Child#child{pid = Pid}|Children]}}; + save_child(Child#child{pid = Pid}, State)}; {ok, Pid, Extra} -> - Children = State#state.children, {{ok, Pid, Extra}, - State#state{children = - [Child#child{pid = Pid}|Children]}}; + save_child(Child#child{pid = Pid}, State)}; {error, What} -> {{error, {What, Child}}, State} end; @@ -558,22 +581,21 @@ handle_start_child(Child, State) -> %%% Returns: {ok, state()} | {shutdown, state()} %%% --------------------------------------------------- -restart_child(Pid, Reason, State) when ?is_simple(State) -> - case ?DICT:find(Pid, State#state.dynamics) of +restart_child(Pid, Reason, #state{children = [Child]} = State) when ?is_simple(State) -> + RestartType = Child#child.restart_type, + case dynamic_child_args(Pid, dynamics_db(RestartType, State#state.dynamics)) of {ok, Args} -> - [Child] = State#state.children, - RestartType = Child#child.restart_type, {M, F, _} = Child#child.mfargs, NChild = Child#child{pid = Pid, mfargs = {M, F, Args}}, do_restart(RestartType, Reason, NChild, State); error -> - {ok, State} + {ok, State} end; + restart_child(Pid, Reason, State) -> Children = State#state.children, case lists:keyfind(Pid, #child.pid, Children) of - #child{} = Child -> - RestartType = Child#child.restart_type, + #child{restart_type = RestartType} = Child -> do_restart(RestartType, Reason, Child, State); false -> {ok, State} @@ -608,7 +630,8 @@ restart(Child, State) -> restart(simple_one_for_one, Child, State) -> #child{mfargs = {M, F, A}} = Child, - Dynamics = ?DICT:erase(Child#child.pid, State#state.dynamics), + Dynamics = ?DICT:erase(Child#child.pid, dynamics_db(Child#child.restart_type, + State#state.dynamics)), case do_start_child_i(M, F, A) of {ok, Pid} -> NState = State#state{dynamics = ?DICT:store(Pid, A, Dynamics)}, @@ -755,8 +778,40 @@ monitor_child(Pid) -> %%----------------------------------------------------------------- %% Child/State manipulating functions. %%----------------------------------------------------------------- -state_del_child(#child{pid = Pid}, State) when ?is_simple(State) -> - NDynamics = ?DICT:erase(Pid, State#state.dynamics), + +%% Note we do not want to save the parameter list for temporary processes as +%% they will not be restarted, and hence we do not need this information. +%% Especially for dynamic children to simple_one_for_one supervisors +%% it could become very costly as it is not uncommon to spawn +%% very many such processes. +save_child(#child{restart_type = temporary, + mfargs = {M, F, _}} = Child, #state{children = Children} = State) -> + State#state{children = [Child#child{mfargs = {M, F, undefined}} |Children]}; +save_child(Child, #state{children = Children} = State) -> + State#state{children = [Child |Children]}. + +save_dynamic_child(temporary, Pid, _, #state{dynamics = Dynamics} = State) -> + State#state{dynamics = [Pid | dynamics_db(temporary, Dynamics)]}; +save_dynamic_child(RestartType, Pid, Args, #state{dynamics = Dynamics} = State) -> + State#state{dynamics = ?DICT:store(Pid, Args, dynamics_db(RestartType, Dynamics))}. + +dynamics_db(temporary, undefined) -> + []; +dynamics_db(_, undefined) -> + ?DICT:new(); +dynamics_db(_,Dynamics) -> + Dynamics. + +dynamic_child_args(_, Dynamics) when is_list(Dynamics)-> + {ok, undefined}; +dynamic_child_args(Pid, Dynamics) -> + ?DICT:find(Pid, Dynamics). + +state_del_child(#child{pid = Pid, restart_type = temporary}, State) when ?is_simple(State) -> + NDynamics = lists:delete(Pid, dynamics_db(temporary, State#state.dynamics)), + State#state{dynamics = NDynamics}; +state_del_child(#child{pid = Pid, restart_type = RType}, State) when ?is_simple(State) -> + NDynamics = ?DICT:erase(Pid, dynamics_db(RType, State#state.dynamics)), State#state{dynamics = NDynamics}; state_del_child(Child, State) -> NChildren = del_child(Child#child.name, State#state.children), diff --git a/lib/stdlib/test/Makefile b/lib/stdlib/test/Makefile index 3bbd9ce318..3dd0a91870 100644 --- a/lib/stdlib/test/Makefile +++ b/lib/stdlib/test/Makefile @@ -133,7 +133,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) stdlib.spec stdlib.spec.vxworks $(EMAKEFILE) \ + $(INSTALL_DATA) stdlib.spec $(EMAKEFILE) \ $(ERL_FILES) $(COVERFILE) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/stdlib/test/array_SUITE.erl b/lib/stdlib/test/array_SUITE.erl index e7cfc65be1..a8b252f081 100644 --- a/lib/stdlib/test/array_SUITE.erl +++ b/lib/stdlib/test/array_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -19,7 +19,7 @@ -module(array_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Default timetrap timeout (set in init_per_testcase). %% This should be set relatively high (10-15 times the expected @@ -27,8 +27,9 @@ -define(default_timeout, ?t:seconds(60)). %% Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([ new_test/1, @@ -64,33 +65,37 @@ %% %% all/1 %% -all(doc) -> - []; -all(suite) -> - [new_test, - fix_test, - relax_test, - resize_test, - set_get_test, - to_list_test, - sparse_to_list_test, - from_list_test, - to_orddict_test, - sparse_to_orddict_test, - from_orddict_test, - map_test, - sparse_map_test, - foldl_test, - sparse_foldl_test, - foldr_test, - sparse_foldr_test - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [new_test, fix_test, relax_test, resize_test, + set_get_test, to_list_test, sparse_to_list_test, + from_list_test, to_orddict_test, sparse_to_orddict_test, + from_orddict_test, map_test, sparse_map_test, + foldl_test, sparse_foldl_test, foldr_test, + sparse_foldr_test]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/stdlib/test/base64_SUITE.erl b/lib/stdlib/test/base64_SUITE.erl index 44742063b3..c64a961ffa 100644 --- a/lib/stdlib/test/base64_SUITE.erl +++ b/lib/stdlib/test/base64_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -18,18 +18,19 @@ %% -module(base64_SUITE). --author('[email protected]'). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). %% Test server specific exports --export([all/1, init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). %% Test cases must be exported. -export([base64_encode/1, base64_decode/1, base64_otp_5635/1, base64_otp_6279/1, big/1, illegal/1, mime_decode/1, - roundtrip/1]). + mime_decode_to_string/1, roundtrip/1]). init_per_testcase(_, Config) -> Dog = test_server:timetrap(?t:minutes(2)), @@ -44,14 +45,29 @@ end_per_testcase(_, Config) -> %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -all(doc) -> - ["Test library functions for base64 encode and decode " - "(taken from inets/test/http_format_SUITE)"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [base64_encode, base64_decode, base64_otp_5635, - base64_otp_6279, big, illegal, mime_decode, + base64_otp_6279, big, illegal, mime_decode, mime_decode_to_string, roundtrip]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%------------------------------------------------------------------------- base64_encode(doc) -> @@ -59,7 +75,7 @@ base64_encode(doc) -> base64_encode(suite) -> []; base64_encode(Config) when is_list(Config) -> - %% Two pads + %% Two pads <<"QWxhZGRpbjpvcGVuIHNlc2FtZQ==">> = base64:encode("Aladdin:open sesame"), %% One pad @@ -77,8 +93,8 @@ base64_decode(doc) -> base64_decode(suite) -> []; base64_decode(Config) when is_list(Config) -> - %% Two pads - <<"Aladdin:open sesame">> = + %% Two pads + <<"Aladdin:open sesame">> = base64:decode("QWxhZGRpbjpvcGVuIHNlc2FtZQ=="), %% One pad <<"Hello World">> = base64:decode(<<"SGVsbG8gV29ybGQ=">>), @@ -138,20 +154,85 @@ illegal(Config) when is_list(Config) -> {'EXIT',{function_clause, _}} = (catch base64:decode("()")), ok. %%------------------------------------------------------------------------- +%% mime_decode and mime_decode_to_string have different implementations +%% so test both with the same input separately. Both functions have +%% the same implementation for binary/string arguments. mime_decode(doc) -> ["Test base64:mime_decode/1."]; mime_decode(suite) -> []; mime_decode(Config) when is_list(Config) -> - %% Two pads - <<"Aladdin:open sesame">> = + %% Test correct padding + <<"one">> = base64:mime_decode(<<"b25l">>), + <<"on">> = base64:mime_decode(<<"b24=">>), + <<"o">> = base64:mime_decode(<<"bw==">>), + %% Test 1 extra padding + <<"one">> = base64:mime_decode(<<"b25l= =">>), + <<"on">> = base64:mime_decode(<<"b24== =">>), + <<"o">> = base64:mime_decode(<<"bw=== =">>), + %% Test 2 extra padding + <<"one">> = base64:mime_decode(<<"b25l===">>), + <<"on">> = base64:mime_decode(<<"b24====">>), + <<"o">> = base64:mime_decode(<<"bw=====">>), + %% Test misc embedded padding + <<"one">> = base64:mime_decode(<<"b2=5l===">>), + <<"on">> = base64:mime_decode(<<"b=24====">>), + <<"o">> = base64:mime_decode(<<"b=w=====">>), + %% Test misc white space and illegals with embedded padding + <<"one">> = base64:mime_decode(<<" b~2=\r\n5()l===">>), + <<"on">> = base64:mime_decode(<<"\tb =2\"�4=�= ==">>), + <<"o">> = base64:mime_decode(<<"\nb=w=====">>), + %% Two pads + <<"Aladdin:open sesame">> = base64:mime_decode("QWxhZGRpbjpvc()GVuIHNlc2FtZQ=="), - %% One pad, followed by ignored text - <<"Hello World">> = base64:mime_decode(<<"SGVsb)(G8gV29ybGQ=apa">>), + %% One pad to ignore, followed by more text + <<"Hello World!!">> = base64:mime_decode(<<"SGVsb)(G8gV29ybGQ=h IQ= =">>), + %% No pad + <<"Aladdin:open sesam">> = + base64:mime_decode("QWxhZGRpbjpvcG�\")(VuIHNlc2Ft"), + %% Encoded base 64 strings may be divided by non base 64 chars. + %% In this cases whitespaces. + <<"0123456789!@#0^&*();:<>,. []{}">> = + base64:mime_decode( + <<"MDEy MzQ1Njc4 \tOSFAIzBeJ \nio)(oKTs6 PD4sLi \r\nBbXXt9">>), + ok. + +%%------------------------------------------------------------------------- + +%% Repeat of mime_decode() tests +mime_decode_to_string(doc) -> + ["Test base64:mime_decode_to_string/1."]; +mime_decode_to_string(suite) -> + []; +mime_decode_to_string(Config) when is_list(Config) -> + %% Test correct padding + "one" = base64:mime_decode_to_string(<<"b25l">>), + "on" = base64:mime_decode_to_string(<<"b24=">>), + "o" = base64:mime_decode_to_string(<<"bw==">>), + %% Test 1 extra padding + "one" = base64:mime_decode_to_string(<<"b25l= =">>), + "on" = base64:mime_decode_to_string(<<"b24== =">>), + "o" = base64:mime_decode_to_string(<<"bw=== =">>), + %% Test 2 extra padding + "one" = base64:mime_decode_to_string(<<"b25l===">>), + "on" = base64:mime_decode_to_string(<<"b24====">>), + "o" = base64:mime_decode_to_string(<<"bw=====">>), + %% Test misc embedded padding + "one" = base64:mime_decode_to_string(<<"b2=5l===">>), + "on" = base64:mime_decode_to_string(<<"b=24====">>), + "o" = base64:mime_decode_to_string(<<"b=w=====">>), + %% Test misc white space and illegals with embedded padding + "one" = base64:mime_decode_to_string(<<" b~2=\r\n5()l===">>), + "on" = base64:mime_decode_to_string(<<"\tb =2\"�4=�= ==">>), + "o" = base64:mime_decode_to_string(<<"\nb=w=====">>), + %% Two pads + "Aladdin:open sesame" = + base64:mime_decode_to_string("QWxhZGRpbjpvc()GVuIHNlc2FtZQ=="), + %% One pad to ignore, followed by more text + "Hello World!!" = base64:mime_decode_to_string(<<"SGVsb)(G8gV29ybGQ=h IQ= =">>), %% No pad "Aladdin:open sesam" = base64:mime_decode_to_string("QWxhZGRpbjpvcG�\")(VuIHNlc2Ft"), - %% Encoded base 64 strings may be divided by non base 64 chars. %% In this cases whitespaces. "0123456789!@#0^&*();:<>,. []{}" = @@ -159,6 +240,7 @@ mime_decode(Config) when is_list(Config) -> <<"MDEy MzQ1Njc4 \tOSFAIzBeJ \nio)(oKTs6 PD4sLi \r\nBbXXt9">>), ok. +%%------------------------------------------------------------------------- roundtrip(Config) when is_list(Config) -> Sizes = lists:seq(1, 255) ++ lists:seq(2400-5, 2440), diff --git a/lib/stdlib/test/beam_lib_SUITE.erl b/lib/stdlib/test/beam_lib_SUITE.erl index bc867a3770..994abebc1a 100644 --- a/lib/stdlib/test/beam_lib_SUITE.erl +++ b/lib/stdlib/test/beam_lib_SUITE.erl @@ -1,6 +1,19 @@ %% %% %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(beam_lib_SUITE). @@ -14,25 +27,45 @@ -define(t,test_server). -define(privdir, "beam_lib_SUITE_priv"). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -define(privdir, ?config(priv_dir, Conf)). -endif. --export([all/1, normal/1, error/1, cmp/1, cmp_literals/1, strip/1, otp_6711/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + normal/1, error/1, cmp/1, cmp_literals/1, strip/1, otp_6711/1, building/1, md5/1, encrypted_abstr/1, encrypted_abstr_file/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [error, normal, cmp, cmp_literals, strip, otp_6711, + building, md5, encrypted_abstr, encrypted_abstr_file]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [error, normal, cmp, cmp_literals, strip, otp_6711, building, md5, - encrypted_abstr, encrypted_abstr_file]. init_per_testcase(_Case, Config) -> Dog=?t:timetrap(?t:minutes(2)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/stdlib/test/binary_module_SUITE.erl b/lib/stdlib/test/binary_module_SUITE.erl index 16ed9a2c26..f6bf874741 100644 --- a/lib/stdlib/test/binary_module_SUITE.erl +++ b/lib/stdlib/test/binary_module_SUITE.erl @@ -1,6 +1,26 @@ +%% +%% %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(binary_module_SUITE). --export([all/1, interesting/1,random_ref_comp/1,random_ref_sr_comp/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + interesting/1,random_ref_comp/1,random_ref_sr_comp/1, random_ref_fla_comp/1,parts/1, bin_to_list/1, list_to_bin/1, copy/1, referenced/1,guard/1,encode_decode/1,badargs/1,longest_common_trap/1]). @@ -16,8 +36,8 @@ -else. --include("test_server.hrl"). --export([init_per_testcase/2, fin_per_testcase/2]). +-include_lib("test_server/include/test_server.hrl"). +-export([init_per_testcase/2, end_per_testcase/2]). % Default timetrap timeout (set in init_per_testcase). % Some of these testcases are really heavy... -define(default_timeout, ?t:minutes(20)). @@ -38,15 +58,35 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> ?line Dog = ?config(watchdog, Config), ?line test_server:timetrap_cancel(Dog), ok. -endif. -all(suite) -> [interesting,random_ref_fla_comp,random_ref_sr_comp, - random_ref_comp,parts,bin_to_list, list_to_bin, copy, - referenced,guard,encode_decode,badargs,longest_common_trap]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [interesting, random_ref_fla_comp, random_ref_sr_comp, + random_ref_comp, parts, bin_to_list, list_to_bin, copy, + referenced, guard, encode_decode, badargs, + longest_common_trap]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -define(MASK_ERROR(EXPR),mask_error((catch (EXPR)))). @@ -186,7 +226,7 @@ badargs(Config) when is_list(Config) -> binary:match(<<1,2,3>>, {ac,ets:match_spec_compile([{'_',[],['$_']}])}, [{scope,{0,1}}])), - ?line nomatch = + ?line [] = ?MASK_ERROR(binary:matches(<<1,2,3>>,<<1>>,[{scope,{0,0}}])), ?line badarg = ?MASK_ERROR(binary:matches(<<1,2,3>>,{bm,<<>>},[{scope,{0,1}}])), diff --git a/lib/stdlib/test/c_SUITE.erl b/lib/stdlib/test/c_SUITE.erl index 2edbc7ab4c..e4c794ca84 100644 --- a/lib/stdlib/test/c_SUITE.erl +++ b/lib/stdlib/test/c_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -17,18 +17,36 @@ %% %CopyrightEnd% %% -module(c_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([c_1/1, c_2/1, c_3/1, c_4/1, nc_1/1, nc_2/1, nc_3/1, nc_4/1, memory/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -import(c, [c/2, nc/2]). -all(doc) -> ["Test cases for the 'c' module."]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [c_1, c_2, c_3, c_4, nc_1, nc_2, nc_3, nc_4, memory]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%% Write output to a directory other than current directory: c_1(doc) -> diff --git a/lib/stdlib/test/calendar_SUITE.erl b/lib/stdlib/test/calendar_SUITE.erl index 10fb72c1b1..81b0299118 100644 --- a/lib/stdlib/test/calendar_SUITE.erl +++ b/lib/stdlib/test/calendar_SUITE.erl @@ -18,9 +18,10 @@ %% -module(calendar_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, gregorian_days/1, gregorian_seconds/1, day_of_the_week/1, @@ -32,15 +33,28 @@ -define(START_YEAR, 1947). -define(END_YEAR, 2012). -all(suite) -> [gregorian_days, - gregorian_seconds, - day_of_the_week, - day_of_the_week_calibrate, - leap_years, - last_day_of_the_month, - local_time_to_universal_time_dst]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [gregorian_days, gregorian_seconds, day_of_the_week, + day_of_the_week_calibrate, leap_years, + last_day_of_the_month, local_time_to_universal_time_dst]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(doc) -> "This is the test suite for calendar.erl". gregorian_days(doc) -> "Tests that date_to_gregorian_days and gregorian_days_to_date " diff --git a/lib/stdlib/test/dets_SUITE.erl b/lib/stdlib/test/dets_SUITE.erl index 8b18ef5664..a37822ea9d 100644 --- a/lib/stdlib/test/dets_SUITE.erl +++ b/lib/stdlib/test/dets_SUITE.erl @@ -28,13 +28,15 @@ -define(privdir(_), "./dets_SUITE_priv"). -define(datadir(_), "./dets_SUITE_data"). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -define(privdir(Conf), ?config(priv_dir, Conf)). -define(datadir(Conf), ?config(data_dir, Conf)). -endif. --export([all/1, not_run/1, newly_started/1, basic_v8/1, basic_v9/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + not_run/1, newly_started/1, basic_v8/1, basic_v9/1, open_v8/1, open_v9/1, sets_v8/1, sets_v9/1, bags_v8/1, bags_v9/1, duplicate_bags_v8/1, duplicate_bags_v9/1, access_v8/1, access_v9/1, dirty_mark/1, dirty_mark2/1, @@ -57,7 +59,7 @@ -export([histogram/1, sum_histogram/1, ave_histogram/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). %% Internal export. -export([client/2]). @@ -83,36 +85,51 @@ init_per_testcase(_Case, Config) -> Dog=?t:timetrap(?t:minutes(15)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> Dog=?config(watchdog, _Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case os:type() of - vxworks -> - [not_run]; + vxworks -> [not_run]; _ -> - {req,[stdlib], - [basic_v8, basic_v9, open_v8, open_v9, sets_v8, sets_v9, - bags_v8, bags_v9, duplicate_bags_v8, duplicate_bags_v9, - newly_started, open_file_v8, open_file_v9, - init_table_v8, init_table_v9, repair_v8, repair_v9, - access_v8, access_v9, oldbugs_v8, oldbugs_v9, - unsafe_assumptions, truncated_segment_array_v8, - truncated_segment_array_v9, dirty_mark, dirty_mark2, - bag_next_v8, bag_next_v9, hash_v8b_v8c, phash, fold_v8, - fold_v9, fixtable_v8, fixtable_v9, match_v8, match_v9, - select_v8, select_v9, update_counter, badarg, - cache_sets_v8, cache_sets_v9, cache_bags_v8, - cache_bags_v9, cache_duplicate_bags_v8, - cache_duplicate_bags_v9, otp_4208, otp_4989, many_clients, - otp_4906, otp_5402, simultaneous_open, insert_new, - repair_continuation, otp_5487, otp_6206, otp_6359, otp_4738, - otp_7146, otp_8070, otp_8856, otp_8898, otp_8899, otp_8903, - otp_8923]} + [basic_v8, basic_v9, open_v8, open_v9, sets_v8, sets_v9, + bags_v8, bags_v9, duplicate_bags_v8, duplicate_bags_v9, + newly_started, open_file_v8, open_file_v9, + init_table_v8, init_table_v9, repair_v8, repair_v9, + access_v8, access_v9, oldbugs_v8, oldbugs_v9, + unsafe_assumptions, truncated_segment_array_v8, + truncated_segment_array_v9, dirty_mark, dirty_mark2, + bag_next_v8, bag_next_v9, hash_v8b_v8c, phash, fold_v8, + fold_v9, fixtable_v8, fixtable_v9, match_v8, match_v9, + select_v8, select_v9, update_counter, badarg, + cache_sets_v8, cache_sets_v9, cache_bags_v8, + cache_bags_v9, cache_duplicate_bags_v8, + cache_duplicate_bags_v9, otp_4208, otp_4989, + many_clients, otp_4906, otp_5402, simultaneous_open, + insert_new, repair_continuation, otp_5487, otp_6206, + otp_6359, otp_4738, otp_7146, otp_8070, otp_8856, otp_8898, + otp_8899, otp_8903, otp_8923] end. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + not_run(suite) -> []; not_run(Conf) when is_list(Conf) -> {comment, "Not runnable VxWorks/NFS"}. diff --git a/lib/stdlib/test/dict_SUITE.erl b/lib/stdlib/test/dict_SUITE.erl index 6a90870bda..396a8d4763 100644 --- a/lib/stdlib/test/dict_SUITE.erl +++ b/lib/stdlib/test/dict_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -22,21 +22,41 @@ -module(dict_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, create/1,store/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -import(lists, [foldl/3,reverse/1]). -all(suite) -> - [create,store]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [create, store]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?t:minutes(5)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/stdlib/test/dict_test_lib.erl b/lib/stdlib/test/dict_test_lib.erl index fd15baa5ff..92a75dad89 100644 --- a/lib/stdlib/test/dict_test_lib.erl +++ b/lib/stdlib/test/dict_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 diff --git a/lib/stdlib/test/digraph_SUITE.erl b/lib/stdlib/test/digraph_SUITE.erl index 6ef5b1ddef..4e7c468097 100644 --- a/lib/stdlib/test/digraph_SUITE.erl +++ b/lib/stdlib/test/digraph_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -23,19 +23,41 @@ -ifdef(STANDALONE). -define(line, put(line, ?LINE), ). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -endif. --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([opts/1, degree/1, path/1, cycle/1, misc/1, vertices/1, - edges/1, data/1, tickets/1, otp_3522/1, otp_3630/1, otp_8066/1]). +-export([opts/1, degree/1, path/1, cycle/1, vertices/1, + edges/1, data/1, otp_3522/1, otp_3630/1, otp_8066/1]). -export([spawn_graph/2]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> {req, [stdlib], [opts, degree, path, cycle, misc, tickets]}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [opts, degree, path, cycle, {group, misc}, + {group, tickets}]. + +groups() -> + [{misc, [], [vertices, edges, data]}, + {tickets, [], [otp_3522, otp_3630, otp_8066]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -147,7 +169,6 @@ cycle(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -misc(suite) -> [vertices, edges, data]. vertices(doc) -> []; vertices(suite) -> []; @@ -210,7 +231,6 @@ data(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -tickets(suite) -> [otp_3522, otp_3630, otp_8066]. otp_3522(doc) -> []; otp_3522(suite) -> []; diff --git a/lib/stdlib/test/digraph_utils_SUITE.erl b/lib/stdlib/test/digraph_utils_SUITE.erl index d6d477b388..28daf0f0fb 100644 --- a/lib/stdlib/test/digraph_utils_SUITE.erl +++ b/lib/stdlib/test/digraph_utils_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -22,10 +22,11 @@ -ifdef(debug). -define(line, put(line, ?LINE), ). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -endif. --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([simple/1, loop/1, isolated/1, topsort/1, subgraph/1, condensation/1, tree/1]). @@ -33,8 +34,27 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> {req, [stdlib], [simple, loop, isolated, topsort, - subgraph, condensation, tree]}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [simple, loop, isolated, topsort, subgraph, + condensation, tree]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/stdlib/test/dummy_h.erl b/lib/stdlib/test/dummy_h.erl index 01eb790a75..7546fe78a0 100644 --- a/lib/stdlib/test/dummy_h.erl +++ b/lib/stdlib/test/dummy_h.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/stdlib/test/edlin_expand_SUITE.erl b/lib/stdlib/test/edlin_expand_SUITE.erl index 613bfd000e..514d22c4d2 100644 --- a/lib/stdlib/test/edlin_expand_SUITE.erl +++ b/lib/stdlib/test/edlin_expand_SUITE.erl @@ -17,13 +17,14 @@ %% %CopyrightEnd% %% -module(edlin_expand_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([normal/1, quoted_fun/1, quoted_module/1, quoted_both/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -31,16 +32,36 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(doc) -> - ["Test cases for edlin_expand."]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [normal, quoted_fun, quoted_module, quoted_both]. +groups() -> + []. + +init_per_suite(Config) -> + true = code:delete(expand_test), + true = code:delete(expand_test1), + true = code:delete('ExpandTestCaps'), + true = code:delete('ExpandTestCaps1'), + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + normal(doc) -> [""]; normal(suite) -> diff --git a/lib/stdlib/test/epp_SUITE.erl b/lib/stdlib/test/epp_SUITE.erl index e9fb932632..195eeb5e89 100644 --- a/lib/stdlib/test/epp_SUITE.erl +++ b/lib/stdlib/test/epp_SUITE.erl @@ -17,11 +17,12 @@ %% %CopyrightEnd% -module(epp_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([rec_1/1, predef_mac/1, - upcase_mac/1, upcase_mac_1/1, upcase_mac_2/1, - variable/1, variable_1/1, otp_4870/1, otp_4871/1, otp_5362/1, + upcase_mac_1/1, upcase_mac_2/1, + variable_1/1, otp_4870/1, otp_4871/1, otp_5362/1, pmod/1, not_circular/1, skip_header/1, otp_6277/1, otp_7702/1, otp_8130/1, overload_mac/1, otp_8388/1, otp_8470/1, otp_8503/1, otp_8562/1, otp_8665/1, otp_8911/1]). @@ -44,8 +45,8 @@ config(priv_dir, _) -> config(data_dir, _) -> filename:absname("./epp_SUITE_data"). -else. --include("test_server.hrl"). --export([init_per_testcase/2, fin_per_testcase/2]). +-include_lib("test_server/include/test_server.hrl"). +-export([init_per_testcase/2, end_per_testcase/2]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -53,18 +54,36 @@ config(data_dir, _) -> init_per_testcase(_, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_, Config) -> +end_per_testcase(_, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -endif. -all(doc) -> - ["Test cases for epp."]; -all(suite) -> - [rec_1, upcase_mac, predef_mac, variable, otp_4870, otp_4871, otp_5362, - pmod, not_circular, skip_header, otp_6277, otp_7702, otp_8130, - overload_mac, otp_8388, otp_8470, otp_8503, otp_8562, otp_8665, otp_8911]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [rec_1, {group, upcase_mac}, predef_mac, + {group, variable}, otp_4870, otp_4871, otp_5362, pmod, + not_circular, skip_header, otp_6277, otp_7702, otp_8130, + overload_mac, otp_8388, otp_8470, otp_8503, otp_8562, + otp_8665, otp_8911]. + +groups() -> + [{upcase_mac, [], [upcase_mac_1, upcase_mac_2]}, + {variable, [], [variable_1]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. rec_1(doc) -> ["Recursive macros hang or crash epp (OTP-1398)."]; @@ -127,10 +146,6 @@ check_errors([{error, Info} | Rest]) -> check_errors([_ | Rest]) -> check_errors(Rest). -upcase_mac(doc) -> - ["Check that uppercase macro names are implicitly quoted (OTP-2608)"]; -upcase_mac(suite) -> - [upcase_mac_1, upcase_mac_2]. upcase_mac_1(doc) -> []; @@ -176,10 +191,6 @@ predef_mac(Config) when is_list(Config) -> end, ok. -variable(doc) -> - ["Check variable as first file component of the include directives."]; -variable(suite) -> - [variable_1]. variable_1(doc) -> []; diff --git a/lib/stdlib/test/erl_eval_SUITE.erl b/lib/stdlib/test/erl_eval_SUITE.erl index c60a558fa1..6277b2c52e 100644 --- a/lib/stdlib/test/erl_eval_SUITE.erl +++ b/lib/stdlib/test/erl_eval_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -17,7 +17,8 @@ %% %CopyrightEnd% -module(erl_eval_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([guard_1/1, guard_2/1, match_pattern/1, @@ -38,7 +39,8 @@ otp_8133/1, funs/1, try_catch/1, - eval_expr_5/1]). + eval_expr_5/1, + zero_width/1]). %% %% Define to run outside of test server @@ -57,26 +59,42 @@ config(priv_dir,_) -> ".". -else. --include("test_server.hrl"). --export([init_per_testcase/2, fin_per_testcase/2]). +-include_lib("test_server/include/test_server.hrl"). +-export([init_per_testcase/2, end_per_testcase/2]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -endif. -all(doc) -> - ["Test cases for the 'erl_eval' module."]; -all(suite) -> - [guard_1, guard_2, match_pattern, string_plusplus, pattern_expr, - match_bin, guard_3, guard_4, - lc, simple_cases, unary_plus, apply_atom, otp_5269, otp_6539, otp_6543, - otp_6787, otp_6977, otp_7550, otp_8133, funs, try_catch, eval_expr_5]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [guard_1, guard_2, match_pattern, string_plusplus, + pattern_expr, match_bin, guard_3, guard_4, lc, + simple_cases, unary_plus, apply_atom, otp_5269, + otp_6539, otp_6543, otp_6787, otp_6977, otp_7550, + otp_8133, funs, try_catch, eval_expr_5, zero_width]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. guard_1(doc) -> ["(OTP-2405)"]; @@ -1326,6 +1344,14 @@ eval_expr_5(Config) when is_list(Config) -> ok end. +zero_width(Config) when is_list(Config) -> + ?line check(fun() -> + {'EXIT',{badarg,_}} = (catch <<not_a_number:0>>), + ok + end, "begin {'EXIT',{badarg,_}} = (catch <<not_a_number:0>>), " + "ok end.", ok), + ok. + %% Check the string in different contexts: as is; in fun; from compiled code. check(F, String, Result) -> check1(F, String, Result), diff --git a/lib/stdlib/test/erl_eval_helper.erl b/lib/stdlib/test/erl_eval_helper.erl index 7fdbabcb17..6863b40108 100644 --- a/lib/stdlib/test/erl_eval_helper.erl +++ b/lib/stdlib/test/erl_eval_helper.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 diff --git a/lib/stdlib/test/erl_expand_records_SUITE.erl b/lib/stdlib/test/erl_expand_records_SUITE.erl index 1d621c65df..44c986640f 100644 --- a/lib/stdlib/test/erl_expand_records_SUITE.erl +++ b/lib/stdlib/test/erl_expand_records_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% 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 @@ -27,15 +27,17 @@ -define(privdir, "erl_expand_records_SUITE_priv"). -define(t, test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(privdir, ?config(priv_dir, Config)). -endif. --export([all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). -export([abstract_module/1, attributes/1, expr/1, guard/1, init/1, pattern/1, strict/1, update/1, - tickets/1, otp_5915/1, otp_7931/1, otp_5990/1, + otp_5915/1, otp_7931/1, otp_5990/1, otp_7078/1, otp_7101/1]). % Default timetrap timeout (set in init_per_testcase). @@ -45,14 +47,33 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> Dog = ?config(watchdog, _Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [abstract_module, attributes, expr, guard, init, pattern, - strict, update, tickets]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [abstract_module, attributes, expr, guard, init, + pattern, strict, update, {group, tickets}]. + +groups() -> + [{tickets, [], + [otp_5915, otp_7931, otp_5990, otp_7078, otp_7101]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + abstract_module(doc) -> "Compile an abstract module."; @@ -399,8 +420,6 @@ update(Config) when is_list(Config) -> ?line run(Config, Ts), ok. -tickets(suite) -> - [otp_5915, otp_7931, otp_5990, otp_7078, otp_7101]. otp_5915(doc) -> "Strict record tests in guards."; diff --git a/lib/stdlib/test/erl_internal_SUITE.erl b/lib/stdlib/test/erl_internal_SUITE.erl index 8f675c94ec..678e22c252 100644 --- a/lib/stdlib/test/erl_internal_SUITE.erl +++ b/lib/stdlib/test/erl_internal_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -18,15 +18,35 @@ %% -module(erl_internal_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([behav/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [behav]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> [behav]. -define(default_timeout, ?t:minutes(2)). @@ -34,7 +54,7 @@ init_per_testcase(_Case, Config) -> ?line Dog = test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl index d0c0d68b4a..f980d52e4e 100644 --- a/lib/stdlib/test/erl_lint_SUITE.erl +++ b/lib/stdlib/test/erl_lint_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -27,34 +27,37 @@ -define(privdir, "erl_lint_SUITE_priv"). -define(t, test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(datadir, ?config(data_dir, Conf)). -define(privdir, ?config(priv_dir, Conf)). -endif. --export([all/1, init_per_testcase/2, fin_per_testcase/2]). - --export([unused_vars_warn/1, - unused_vars_warn_basic/1, - unused_vars_warn_lc/1, - unused_vars_warn_rec/1, - unused_vars_warn_fun/1, - unused_vars_OTP_4858/1, - export_vars_warn/1, - shadow_vars/1, - unused_import/1, - unused_function/1, - unsafe_vars/1,unsafe_vars2/1, - unsafe_vars_try/1, - guard/1, otp_4886/1, otp_4988/1, otp_5091/1, otp_5276/1, otp_5338/1, - otp_5362/1, otp_5371/1, otp_7227/1, otp_5494/1, otp_5644/1, otp_5878/1, - otp_5917/1, otp_6585/1, otp_6885/1, export_all/1, - bif_clash/1, - behaviour_basic/1, behaviour_multiple/1, - otp_7550/1, - otp_8051/1, - format_warn/1, - on_load/1, on_load_successful/1, on_load_failing/1 +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). + +-export([ + unused_vars_warn_basic/1, + unused_vars_warn_lc/1, + unused_vars_warn_rec/1, + unused_vars_warn_fun/1, + unused_vars_OTP_4858/1, + export_vars_warn/1, + shadow_vars/1, + unused_import/1, + unused_function/1, + unsafe_vars/1,unsafe_vars2/1, + unsafe_vars_try/1, + guard/1, otp_4886/1, otp_4988/1, otp_5091/1, otp_5276/1, otp_5338/1, + otp_5362/1, otp_5371/1, otp_7227/1, otp_5494/1, otp_5644/1, otp_5878/1, + otp_5917/1, otp_6585/1, otp_6885/1, export_all/1, + bif_clash/1, + behaviour_basic/1, behaviour_multiple/1, + otp_7550/1, + otp_8051/1, + format_warn/1, + on_load_successful/1, on_load_failing/1, + too_many_arguments/1 ]). % Default timetrap timeout (set in init_per_testcase). @@ -64,24 +67,44 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> Dog = ?config(watchdog, _Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [unused_vars_warn, export_vars_warn, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, unused_vars_warn}, export_vars_warn, shadow_vars, unused_import, unused_function, - unsafe_vars, unsafe_vars2, unsafe_vars_try, - guard, otp_4886, otp_4988, otp_5091, otp_5276, otp_5338, - otp_5362, otp_5371, otp_7227, otp_5494, otp_5644, otp_5878, otp_5917, otp_6585, - otp_6885, export_all, bif_clash, - behaviour_basic, behaviour_multiple, otp_7550, otp_8051, format_warn, - on_load]. + unsafe_vars, unsafe_vars2, unsafe_vars_try, guard, + otp_4886, otp_4988, otp_5091, otp_5276, otp_5338, + otp_5362, otp_5371, otp_7227, otp_5494, otp_5644, + otp_5878, otp_5917, otp_6585, otp_6885, export_all, + bif_clash, behaviour_basic, behaviour_multiple, + otp_7550, otp_8051, format_warn, {group, on_load}, + too_many_arguments]. + +groups() -> + [{unused_vars_warn, [], + [unused_vars_warn_basic, unused_vars_warn_lc, + unused_vars_warn_rec, unused_vars_warn_fun, + unused_vars_OTP_4858]}, + {on_load, [], [on_load_successful, on_load_failing]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -unused_vars_warn(suite) -> - [unused_vars_warn_basic, unused_vars_warn_lc, unused_vars_warn_rec, - unused_vars_warn_fun, unused_vars_OTP_4858]. unused_vars_warn_basic(doc) -> "Warnings for unused variables in some simple cases."; @@ -2831,8 +2854,6 @@ format_level(Level, Count, Config) -> %% Test the -on_load(Name/0) directive. -on_load(suite) -> - [on_load_successful, on_load_failing]. on_load_successful(Config) when is_list(Config) -> Ts = [{on_load_1, @@ -2913,6 +2934,21 @@ on_load_failing(Config) when is_list(Config) -> ?line [] = run(Config, Ts), ok. +too_many_arguments(doc) -> + "Test that too many arguments is not accepted."; +too_many_arguments(suite) -> []; +too_many_arguments(Config) when is_list(Config) -> + Ts = [{too_many_1, + <<"f(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_) -> ok.">>, + [], + {errors, + [{1,erl_lint,{too_many_arguments,256}}],[]}} + ], + + ?line [] = run(Config, Ts), + ok. + + run(Config, Tests) -> F = fun({N,P,Ws,E}, BadL) -> case catch run_test(Config, P, Ws) of diff --git a/lib/stdlib/test/erl_pp_SUITE.erl b/lib/stdlib/test/erl_pp_SUITE.erl index c57541fba9..e0f233fb2a 100644 --- a/lib/stdlib/test/erl_pp_SUITE.erl +++ b/lib/stdlib/test/erl_pp_SUITE.erl @@ -30,23 +30,25 @@ -define(privdir, "erl_pp_SUITE_priv"). -define(t, test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(datadir, ?config(data_dir, Config)). -define(privdir, ?config(priv_dir, Config)). -endif. --export([all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). --export([expr/1, func/1, call/1, recs/1, try_catch/1, if_then/1, - receive_after/1, bits/1, head_tail/1, package/1, - cond1/1, block/1, case1/1, ops/1, messages/1, - old_mnemosyne_syntax/1, - attributes/1, import_export/1, misc_attrs/1, - hook/1, - neg_indent/1, - tickets/1, - otp_6321/1, otp_6911/1, otp_6914/1, otp_8150/1, otp_8238/1, - otp_8473/1, otp_8522/1, otp_8567/1, otp_8664/1]). +-export([ func/1, call/1, recs/1, try_catch/1, if_then/1, + receive_after/1, bits/1, head_tail/1, package/1, + cond1/1, block/1, case1/1, ops/1, messages/1, + old_mnemosyne_syntax/1, + import_export/1, misc_attrs/1, + hook/1, + neg_indent/1, + + otp_6321/1, otp_6911/1, otp_6914/1, otp_8150/1, otp_8238/1, + otp_8473/1, otp_8522/1, otp_8567/1, otp_8664/1]). %% Internal export. -export([ehook/6]). @@ -58,17 +60,40 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> Dog = ?config(watchdog, _Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [expr, attributes, hook, neg_indent, tickets]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, expr}, {group, attributes}, hook, neg_indent, + {group, tickets}]. + +groups() -> + [{expr, [], + [func, call, recs, try_catch, if_then, receive_after, + bits, head_tail, package, cond1, block, case1, ops, + messages, old_mnemosyne_syntax]}, + {attributes, [], [misc_attrs, import_export]}, + {tickets, [], + [otp_6321, otp_6911, otp_6914, otp_8150, otp_8238, + otp_8473, otp_8522, otp_8567, otp_8664]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -expr(suite) -> - [func, call, recs, try_catch, if_then, receive_after, bits, head_tail, - package, cond1, block, case1, ops, messages, old_mnemosyne_syntax]. func(suite) -> []; @@ -564,8 +589,6 @@ old_mnemosyne_syntax(Config) when is_list(Config) -> ok. -attributes(suite) -> - [misc_attrs, import_export]. import_export(suite) -> []; @@ -763,9 +786,6 @@ neg_indent(Config) when is_list(Config) -> ok. -tickets(suite) -> - [otp_6321, otp_6911, otp_6914, otp_8150, otp_8238, otp_8473, otp_8522, - otp_8567, otp_8664]. otp_6321(doc) -> "OTP_6321. Bug fix of exprs()."; diff --git a/lib/stdlib/test/erl_scan_SUITE.erl b/lib/stdlib/test/erl_scan_SUITE.erl index 32eb97bc92..75e908e97c 100644 --- a/lib/stdlib/test/erl_scan_SUITE.erl +++ b/lib/stdlib/test/erl_scan_SUITE.erl @@ -17,9 +17,10 @@ %% %CopyrightEnd% -module(erl_scan_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([error/1, error_1/1, error_2/1, iso88591/1, otp_7810/1]). +-export([ error_1/1, error_2/1, iso88591/1, otp_7810/1]). -import(lists, [nth/2,flatten/1]). -import(io_lib, [print/1]). @@ -39,14 +40,14 @@ %% config(data_dir, _) -> %% ".". -else. --include("test_server.hrl"). --export([init_per_testcase/2, fin_per_testcase/2]). +-include_lib("test_server/include/test_server.hrl"). +-export([init_per_testcase/2, end_per_testcase/2]). init_per_testcase(_Case, Config) when is_list(Config) -> ?line Dog=test_server:timetrap(test_server:seconds(1200)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -55,15 +56,27 @@ fin_per_testcase(_Case, Config) -> % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). -all(doc) -> - ["Test cases for the 'erl_scan' module."]; -all(suite) -> - [error,iso88591,otp_7810]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, error}, iso88591, otp_7810]. + +groups() -> + [{error, [], [error_1, error_2]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -error(doc) -> - ["Error cases"]; -error(suite) -> - [error_1, error_2]. error_1(doc) -> ["(OTP-2347)"]; diff --git a/lib/stdlib/test/error_logger_forwarder.erl b/lib/stdlib/test/error_logger_forwarder.erl index 7d99d07860..5703ac769a 100644 --- a/lib/stdlib/test/error_logger_forwarder.erl +++ b/lib/stdlib/test/error_logger_forwarder.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 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 diff --git a/lib/stdlib/test/escript_SUITE.erl b/lib/stdlib/test/escript_SUITE.erl index 162ca6006f..447d6fb629 100644 --- a/lib/stdlib/test/escript_SUITE.erl +++ b/lib/stdlib/test/escript_SUITE.erl @@ -18,9 +18,10 @@ -module(escript_SUITE). -export([ - all/1, + all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, basic/1, errors/1, strange_name/1, @@ -35,29 +36,36 @@ verify_sections/3 ]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). -all(suite) -> - [ - basic, - errors, - strange_name, - emulator_flags, - module_script, - beam_script, - archive_script, - epp, - create_and_extract, - foldl, - overflow - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic, errors, strange_name, emulator_flags, + module_script, beam_script, archive_script, epp, + create_and_extract, foldl, overflow]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?t:minutes(1)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl index b621b17441..9d348b5f1a 100644 --- a/lib/stdlib/test/ets_SUITE.erl +++ b/lib/stdlib/test/ets_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -18,24 +18,25 @@ %% -module(ets_SUITE). --export([all/1]). --export([new/1,default/1,setbag/1,badnew/1,verybadnew/1,named/1,keypos2/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([default/1,setbag/1,badnew/1,verybadnew/1,named/1,keypos2/1, privacy/1,privacy_owner/2]). --export([insert/1,empty/1,badinsert/1]). --export([lookup/1,time_lookup/1,badlookup/1,lookup_order/1]). --export([delete/1,delete_elem/1,delete_tab/1,delete_large_tab/1, +-export([empty/1,badinsert/1]). +-export([time_lookup/1,badlookup/1,lookup_order/1]). +-export([delete_elem/1,delete_tab/1,delete_large_tab/1, delete_large_named_table/1, evil_delete/1,baddelete/1,match_delete/1,table_leak/1]). -export([match_delete3/1]). -export([firstnext/1,firstnext_concurrent/1]). -export([slot/1]). --export([match/1, match1/1, match2/1, match_object/1, match_object2/1]). --export([misc/1, dups/1, misc1/1, safe_fixtable/1, info/1, tab2list/1]). --export([files/1, tab2file/1, tab2file2/1, tabfile_ext1/1, +-export([ match1/1, match2/1, match_object/1, match_object2/1]). +-export([ dups/1, misc1/1, safe_fixtable/1, info/1, tab2list/1]). +-export([ tab2file/1, tab2file2/1, tabfile_ext1/1, tabfile_ext2/1, tabfile_ext3/1, tabfile_ext4/1]). --export([heavy/1, heavy_lookup/1, heavy_lookup_element/1, heavy_concurrent/1]). --export([lookup_element/1, lookup_element_mult/1]). --export([fold/1]). +-export([ heavy_lookup/1, heavy_lookup_element/1, heavy_concurrent/1]). +-export([ lookup_element_mult/1]). +-export([]). -export([foldl_ordered/1, foldr_ordered/1, foldl/1, foldr/1, fold_empty/1]). -export([t_delete_object/1, t_init_table/1, t_whitebox/1, t_delete_all_objects/1, t_insert_list/1, t_test_ms/1, @@ -59,7 +60,7 @@ -export([otp_7665/1]). -export([meta_wb/1]). -export([grow_shrink/1, grow_pseudo_deleted/1, shrink_pseudo_deleted/1]). --export([meta_smp/1, +-export([ meta_lookup_unnamed_read/1, meta_lookup_unnamed_write/1, meta_lookup_named_read/1, meta_lookup_named_write/1, meta_newdel_unnamed/1, meta_newdel_named/1]). @@ -72,7 +73,7 @@ -export([write_concurrency/1, heir/1, give_away/1, setopts/1]). -export([bad_table/1, types/1]). --export([init_per_testcase/2, fin_per_testcase/2, end_per_suite/1]). +-export([init_per_testcase/2, end_per_testcase/2]). %% Convenience for manual testing -export([random_test/0]). @@ -92,12 +93,15 @@ misc1_do/1, safe_fixtable_do/1, info_do/1, dups_do/1, heavy_lookup_do/1, heavy_lookup_element_do/1, member_do/1, otp_5340_do/1, otp_7665_do/1, meta_wb_do/1, do_heavy_concurrent/1, tab2file2_do/2, exit_large_table_owner_do/2, - types_do/1, sleeper/0, rpc_externals/0, memory_do/1 + types_do/1, sleeper/0, rpc_externals/0, memory_do/1, + ms_tracee_dummy/1, ms_tracee_dummy/2, ms_tracee_dummy/3, ms_tracee_dummy/4 ]). -export([t_select_reverse/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +-define(m(A,B), ?line assert_eq(A,B)). init_per_testcase(Case, Config) -> Seed = {S1,S2,S3} = random:seed0(), %now(), @@ -108,44 +112,80 @@ init_per_testcase(Case, Config) -> Dog=test_server:timetrap(test_server:minutes(20)), [{watchdog, Dog}, {test_case, Case} | Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), wait_for_test_procs(true), test_server:timetrap_cancel(Dog). - + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, new}, {group, insert}, {group, lookup}, + {group, delete}, firstnext, firstnext_concurrent, slot, + {group, match}, t_match_spec_run, + {group, lookup_element}, {group, misc}, {group, files}, + {group, heavy}, ordered, ordered_match, + interface_equality, fixtable_next, fixtable_insert, + rename, rename_unnamed, evil_rename, update_element, + update_counter, evil_update_counter, partly_bound, + match_heavy, {group, fold}, member, t_delete_object, + t_init_table, t_whitebox, t_delete_all_objects, + t_insert_list, t_test_ms, t_select_delete, t_ets_dets, + memory, t_select_reverse, t_bucket_disappears, + select_fail, t_insert_new, t_repair_continuation, + otp_5340, otp_6338, otp_6842_select_1000, otp_7665, + otp_8732, meta_wb, grow_shrink, grow_pseudo_deleted, + shrink_pseudo_deleted, {group, meta_smp}, smp_insert, + smp_fixed_delete, smp_unfix_fix, smp_select_delete, + otp_8166, exit_large_table_owner, + exit_many_large_table_owner, exit_many_tables_owner, + exit_many_many_tables_owner, write_concurrency, heir, + give_away, setopts, bad_table, types]. + +groups() -> + [{new, [], + [default, setbag, badnew, verybadnew, named, keypos2, + privacy]}, + {insert, [], [empty, badinsert]}, + {lookup, [], [time_lookup, badlookup, lookup_order]}, + {lookup_element, [], [lookup_element_mult]}, + {delete, [], + [delete_elem, delete_tab, delete_large_tab, + delete_large_named_table, evil_delete, table_leak, + baddelete, match_delete, match_delete3]}, + {match, [], + [match1, match2, match_object, match_object2]}, + {misc, [], + [misc1, safe_fixtable, info, dups, tab2list]}, + {files, [], + [tab2file, tab2file2, tabfile_ext1, + tabfile_ext2, tabfile_ext3, tabfile_ext4]}, + {heavy, [], + [heavy_lookup, heavy_lookup_element, heavy_concurrent]}, + {fold, [], + [foldl_ordered, foldr_ordered, foldl, foldr, + fold_empty]}, + {meta_smp, [], + [meta_lookup_unnamed_read, meta_lookup_unnamed_write, + meta_lookup_named_read, meta_lookup_named_write, + meta_newdel_unnamed, meta_newdel_named]}]. + +init_per_suite(Config) -> + Config. end_per_suite(_Config) -> stop_spawn_logger(), catch erts_debug:set_internal_state(available_internal_state, false). -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [ - new,insert,lookup,delete,firstnext,firstnext_concurrent,slot,match, - t_match_spec_run, - lookup_element, misc,files, heavy, - ordered, ordered_match, interface_equality, - fixtable_next, fixtable_insert, rename, rename_unnamed, evil_rename, - update_element, update_counter, evil_update_counter, partly_bound, - match_heavy, fold, member, - t_delete_object, t_init_table, t_whitebox, - t_delete_all_objects, t_insert_list, t_test_ms, - t_select_delete, t_ets_dets, memory, t_select_reverse, - t_bucket_disappears, - select_fail,t_insert_new, t_repair_continuation, otp_5340, otp_6338, - otp_6842_select_1000, otp_7665, otp_8732, - meta_wb, - grow_shrink, grow_pseudo_deleted, shrink_pseudo_deleted, - meta_smp, - smp_insert, smp_fixed_delete, smp_unfix_fix, smp_select_delete, otp_8166, - exit_large_table_owner, - exit_many_large_table_owner, - exit_many_tables_owner, - exit_many_many_tables_owner, - write_concurrency, heir, give_away, setopts, - bad_table, types - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -176,29 +216,180 @@ t_match_spec_run(suite) -> t_match_spec_run(doc) -> ["Check ets:match_spec_run/2."]; t_match_spec_run(Config) when is_list(Config) -> + init_externals(), ?line EtsMem = etsmem(), - ?line [2,3] = ets:match_spec_run([{1},{2},{3}], - ets:match_spec_compile( - [{{'$1'},[{'>','$1',1}],['$1']}])), + + t_match_spec_run_test([{1},{2},{3}], + [{{'$1'},[{'>','$1',1}],['$1']}], + [2,3]), + ?line Huge = [{X} || X <- lists:seq(1,2500)], ?line L = lists:seq(2476,2500), - ?line L = ets:match_spec_run(Huge, - ets:match_spec_compile( - [{{'$1'},[{'>','$1',2475}],['$1']}])), + t_match_spec_run_test(Huge, [{{'$1'},[{'>','$1',2475}],['$1']}], L), + ?line L2 = [{X*16#FFFFFFF} || X <- L], - ?line L2 = ets:match_spec_run(Huge, - ets:match_spec_compile( - [{{'$1'}, - [{'>','$1',2475}], - [{{{'*','$1',16#FFFFFFF}}}]}])), - ?line [500,1000,1500,2000,2500] = - ets:match_spec_run(Huge, - ets:match_spec_compile( - [{{'$1'}, - [{'=:=',{'rem','$1',500},0}], - ['$1']}])), + t_match_spec_run_test(Huge, + [{{'$1'}, [{'>','$1',2475}], [{{{'*','$1',16#FFFFFFF}}}]}], + L2), + + t_match_spec_run_test(Huge, [{{'$1'}, [{'=:=',{'rem','$1',500},0}], ['$1']}], + [500,1000,1500,2000,2500]), + + %% More matching fun with several match clauses and guards, + %% applied to a variety of terms. + Fun = fun(Term) -> + CTerm = {const, Term}, + + N_List = [{Term, "0", "v-element"}, + {"=hidden_node", "0", Term}, + {"0", Term, Term}, + {"something", Term, "something else"}, + {"guard and res", Term, 872346}, + {Term, {'and',Term,'again'}, 3.14}, + {Term, {'and',Term,'again'}, "m&g"}, + {Term, {'and',Term,'again'}, "m&g&r"}, + {[{second,Term}, 'and', "tail"], Term, ['and',"tail"]}], + + N_MS = [{{'$1','$2','$3'}, + [{'=:=','$1',CTerm}, {'=:=','$2',{const,"0"}}], + [{{"Guard only for $1",'$3'}}]}, + + {{'$3','$1','$4'}, + [{'=:=','$3',"=hidden_node"}, {'=:=','$1',{const,"0"}}], + [{{"Result only for $4",'$4'}}]}, + + {{'$2','$1','$1'}, + [{'=:=','$2',{const,"0"}}], + [{{"Match only for $1",'$2'}}]}, + + {{'$2',Term,['$3'|'_']}, + [{is_list,'$2'},{'=:=','$3',$s}], + [{{"Matching term",'$2'}}]}, + + {{'$1','$2',872346}, + [{'=:=','$2',CTerm}, {is_list,'$1'}], + [{{"Guard and result",'$2'}}]}, + + {{'$1', {'and','$1','again'}, '$2'}, + [{is_float,'$2'}], + [{{"Match and result",'$1'}}]}, + + {{'$1', {'and','$1','again'}, '$2'}, + [{'=:=','$1',CTerm}, {'=:=', '$2', "m&g"}], + [{{"Match and guard",'$2'}}]}, + + {{'$1', {'and','$1','again'}, "m&g&r"}, + [{'=:=','$1',CTerm}], + [{{"Match, guard and result",'$1'}}]}, + + {{'$1', '$2', '$3'}, + [{'=:=','$1',[{{second,'$2'}} | '$3']}], + [{{"Building guard"}}]} + ], + + N_Result = [{"Guard only for $1", "v-element"}, + {"Result only for $4", Term}, + {"Match only for $1", "0"}, + {"Matching term","something"}, + {"Guard and result",Term}, + {"Match and result",Term}, + {"Match and guard","m&g"}, + {"Match, guard and result",Term}, + {"Building guard"}], + + F = fun(N_MS_Perm) -> + t_match_spec_run_test(N_List, N_MS_Perm, N_Result) + end, + repeat_for_permutations(F, N_MS) + end, + + test_terms(Fun, skip_refc_check), + ?line verify_etsmem(EtsMem). +t_match_spec_run_test(List, MS, Result) -> + + %%io:format("ms = ~p\n",[MS]), + + ?m(Result, ets:match_spec_run(List, ets:match_spec_compile(MS))), + + %% Check that ets:select agree + Tab = ets:new(xxx, [bag]), + ets:insert(Tab, List), + SRes = lists:sort(Result), + ?m(SRes, lists:sort(ets:select(Tab, MS))), + ets:delete(Tab), + + %% Check that tracing agree + Self = self(), + {Tracee, MonRef} = spawn_monitor(fun() -> ms_tracee(Self, List) end), + receive {Tracee, ready} -> ok end, + + MST = lists:map(fun(Clause) -> ms_clause_ets_to_trace(Clause) end, MS), + + %%io:format("MS = ~p\nMST= ~p\n",[MS,MST]), + + erlang:trace_pattern({?MODULE,ms_tracee_dummy,'_'}, MST , [local]), + erlang:trace(Tracee, true, [call]), + Tracee ! start, + TRes = ms_tracer_collect(Tracee, MonRef, []), + %erlang:trace(Tracee, false, [call]), + %Tracee ! stop, + case TRes of + SRes -> ok; + _ -> + io:format("TRACE MATCH FAILED\n"), + io:format("Input = ~p\nMST = ~p\nExpected = ~p\nGot = ~p\n", [List, MST, SRes, TRes]), + ?t:fail("TRACE MATCH FAILED") + end, + ok. + + + +ms_tracer_collect(Tracee, Ref, Acc) -> + receive + {trace, Tracee, call, _Args, [Msg]} -> + %io:format("trace Args=~p Msg=~p\n", [_Args, Msg]), + ms_tracer_collect(Tracee, Ref, [Msg | Acc]); + + {'DOWN', Ref, process, Tracee, _} -> + %io:format("monitor DOWN for ~p\n", [Tracee]), + TDRef = erlang:trace_delivered(Tracee), + ms_tracer_collect(Tracee, TDRef, Acc); + + {trace_delivered, Tracee, Ref} -> + %%io:format("trace delivered for ~p\n", [Tracee]), + lists:sort(Acc); + + Other -> + io:format("Unexpected message = ~p\n", [Other]), + ?t:fail("Unexpected tracer msg") + end. + + +ms_tracee(Parent, CallArgList) -> + %io:format("ms_tracee ~p started with ArgList = ~p\n", [self(), CallArgList]), + Parent ! {self(), ready}, + receive start -> ok end, + lists:foreach(fun(Args) -> + erlang:apply(?MODULE, ms_tracee_dummy, tuple_to_list(Args)) + end, CallArgList). + %%receive stop -> ok end. + + + +ms_tracee_dummy(_) -> ok. +ms_tracee_dummy(_,_) -> ok. +ms_tracee_dummy(_,_,_) -> ok. +ms_tracee_dummy(_,_,_,_) -> ok. + +ms_clause_ets_to_trace({Head, Guard, Body}) -> + {tuple_to_list(Head), Guard, [{message, Body}]}. + +assert_eq(A,A) -> ok; +assert_eq(A,B) -> + io:format("FAILED MATCH:\n~p\n =/=\n~p\n",[A,B]), + ?t:fail("assert_eq failed"). t_repair_continuation(suite) -> @@ -332,7 +523,6 @@ t_repair_continuation_do(Opts) -> ?line true = ets:is_compiled_ms(ets:match_spec_compile(MS)), ?line verify_etsmem(EtsMem). -new(suite) -> [default,setbag,badnew,verybadnew,named,keypos2,privacy]. default(doc) -> ["Check correct default vaules of a new ets table"]; @@ -1391,8 +1581,7 @@ update_element_opts(Tuple,KeyPos,UpdPos,Opts) -> ok. update_element(T,Tuple,KeyPos,UpdPos) -> - KeyList = [Key || Key <- [17,"seventeen",<<"seventeen">>,{17},list_to_binary(lists:seq(1,100)), - make_ref(), self()]], + KeyList = [17,"seventeen",<<"seventeen">>,{17},list_to_binary(lists:seq(1,100)),make_ref(), self()], lists:foreach(fun(Key) -> TupleWithKey = setelement(KeyPos,Tuple,Key), update_element_do(T,TupleWithKey,Key,UpdPos) @@ -1406,6 +1595,8 @@ update_element_do(Tab,Tuple,Key,UpdPos) -> % This will try all combinations of {fromValue,toValue} % % IMPORTANT: size(Values) must be a prime number for this to work!!! + + %io:format("update_element_do for key=~p\n",[Key]), Big32 = 16#12345678, Big64 = 16#123456789abcdef0, Values = { 623, -27, 0, Big32, -Big32, Big64, -Big64, Big32*Big32, @@ -1426,7 +1617,7 @@ update_element_do(Tab,Tuple,Key,UpdPos) -> (ToIx, [], Pos, _Rand, _MeF) -> {Pos, element(ToIx+1,Values)} % single {pos,value} arg end, - + UpdateF = fun(ToIx,Rand) -> PosValArg = PosValArgF(ToIx,[],UpdPos,Rand,PosValArgF), %%io:format("update_element(~p)~n",[PosValArg]), @@ -1553,6 +1744,7 @@ update_counter_for(T) -> (Obj, Times, Arg3, Myself) -> ?line {NewObj, Ret} = uc_mimic(Obj,Arg3), ArgHash = erlang:phash2({T,a,Arg3}), + %%io:format("update_counter(~p, ~p, ~p) expecting ~p\n",[T,a,Arg3,Ret]), ?line Ret = ets:update_counter(T,a,Arg3), ?line ArgHash = erlang:phash2({T,a,Arg3}), %%io:format("NewObj=~p~n ",[NewObj]), @@ -2720,8 +2912,6 @@ rotate_tuple(Tuple, N) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -insert(doc) -> ["Test proper and improper inserts into a table."]; -insert(suite) -> [empty,badinsert]. empty(doc) -> ["Check lookup in an empty table and lookup of a non-existing key"]; @@ -2761,8 +2951,6 @@ badinsert_do(Opts) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -lookup(doc) -> ["Some tests for lookups (timing, bad lookups, etc.)."]; -lookup(suite) -> [time_lookup,badlookup,lookup_order]. time_lookup(doc) -> ["Lookup timing."]; time_lookup(suite) -> []; @@ -2889,8 +3077,6 @@ fill_tab(Tab,Val) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -lookup_element(doc) -> ["Some tests for lookup_element."]; -lookup_element(suite) -> [lookup_element_mult]. lookup_element_mult(doc) -> ["Multiple return elements (OTP-2386)"]; lookup_element_mult(suite) -> []; @@ -2932,11 +3118,6 @@ lem_crash_3(T) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -delete(doc) -> - ["Check delete functionality (proper/improper deletes)"]; -delete(suite) -> - [delete_elem,delete_tab,delete_large_tab,delete_large_named_table,evil_delete, - table_leak,baddelete,match_delete,match_delete3]. delete_elem(doc) -> ["Check delete of an element inserted in a `filled' table."]; @@ -3416,7 +3597,7 @@ firstnext_concurrent(Config) when is_list(Config) -> [dynamic_go() || _ <- lists:seq(1, 2)], receive after 5000 -> ok - end. + end. ets_init(Tab, N) -> ets_new(Tab, [named_table,public,ordered_set]), @@ -3471,7 +3652,6 @@ slot_loop(Tab,SlotNo,EltsSoFar) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -match(suite) -> [match1, match2, match_object, match_object2]. match1(suite) -> []; match1(Config) when is_list(Config) -> @@ -3606,7 +3786,6 @@ match_object2_do(Opts) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -misc(suite) -> [misc1, safe_fixtable, info, dups, tab2list]. tab2list(doc) -> ["Tests tab2list (OTP-3319)"]; tab2list(suite) -> []; @@ -3739,9 +3918,6 @@ dups_do(Opts) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -files(suite) -> [tab2file, tab2file2, tabfile_ext1, tabfile_ext2, - tabfile_ext3, tabfile_ext4]. - tab2file(doc) -> ["Check the ets:tab2file function on an empty " "ets table."]; tab2file(suite) -> []; @@ -3991,7 +4167,6 @@ make_sub_binary(List, Num) when is_list(List) -> {_,B} = split_binary(Bin, N+1), B. -heavy(suite) -> [heavy_lookup, heavy_lookup_element, heavy_concurrent]. %% Lookup stuff like crazy... heavy_lookup(doc) -> ["Performs multiple lookups for every key ", @@ -4054,7 +4229,7 @@ do_lookup_element(Tab, N, M) -> end. -heavy_concurrent(_Config) -> +heavy_concurrent(Config) when is_list(Config) -> repeat_for_opts(do_heavy_concurrent). do_heavy_concurrent(Opts) -> @@ -4092,9 +4267,6 @@ do_heavy_concurrent_proc(Tab, N, Offs) -> _ = ets:lookup(Tab, N), do_heavy_concurrent_proc(Tab, N-1, Offs). -fold(suite) -> [foldl_ordered, foldr_ordered, - foldl, foldr, - fold_empty]. fold_empty(doc) -> []; @@ -4856,13 +5028,6 @@ shrink_pseudo_deleted_do(Type) -> process_flag(scheduler,0). -meta_smp(suite) -> - [meta_lookup_unnamed_read, - meta_lookup_unnamed_write, - meta_lookup_named_read, - meta_lookup_named_write, - meta_newdel_unnamed, - meta_newdel_named]. meta_lookup_unnamed_read(suite) -> []; meta_lookup_unnamed_read(Config) when is_list(Config) -> @@ -5250,7 +5415,7 @@ types_do(Opts) -> ets:delete_all_objects(T), ?line 0 = ets:info(T,size) end, - test_terms(Fun), + test_terms(Fun, strict), ets:delete(T), ?line verify_etsmem(EtsMem). @@ -5325,7 +5490,25 @@ my_tab_to_list(_Ts,'$end_of_table', Acc) -> lists:reverse(Acc); my_tab_to_list(Ts,Key, Acc) -> my_tab_to_list(Ts,ets:next(Ts,Key),[ets:lookup(Ts, Key)| Acc]). +wait_for_all_schedulers_online_to_execute() -> + PMs = lists:map(fun (Sched) -> + spawn_opt(fun () -> ok end, + [monitor, {scheduler, Sched}]) + end, + lists:seq(1,erlang:system_info(schedulers_online))), + lists:foreach(fun ({P, M}) -> + receive + {'DOWN', M, process, P, _} -> ok + end + end, + PMs), + ok. + etsmem() -> + %% Wait until it is guaranteed that all already scheduled + %% deallocations of DbTable structures have completed. + wait_for_all_schedulers_online_to_execute(), + AllTabs = lists:map(fun(T) -> {T,ets:info(T,name),ets:info(T,size), ets:info(T,memory),ets:info(T,type)} end, ets:all()), @@ -5476,6 +5659,20 @@ repeat_while(Fun, Arg0) -> {false,Ret} -> Ret end. +%% Some (but not all) permutations of List +repeat_for_permutations(Fun, List) -> + repeat_for_permutations(Fun, List, length(List)-1). +repeat_for_permutations(Fun, List, 0) -> + Fun(List); +repeat_for_permutations(Fun, List, N) -> + {A,B} = lists:split(N, List), + L1 = B++A, + L2 = lists:reverse(L1), + L3 = B++lists:reverse(A), + L4 = lists:reverse(B)++A, + Fun(L1), Fun(L2), Fun(L3), Fun(L4), + repeat_for_permutations(Fun, List, N-1). + receive_any() -> receive M -> io:format("Process ~p got msg ~p\n", [self(),M]), @@ -5533,7 +5730,7 @@ only_if_smp(Schedulers, Func) -> %% Copy-paste from emulator/test/binary_SUITE.erl -define(heap_binary_size, 64). -test_terms(Test_Func) -> +test_terms(Test_Func, Mode) -> garbage_collect(), ?line Pib0 = process_info(self(),binary), @@ -5610,7 +5807,10 @@ test_terms(Test_Func) -> Pib = process_info(self(),binary), ?line Test_Func(Bin3), garbage_collect(), - ?line Pib = process_info(self(),binary), + case Mode of + strict -> ?line Pib = process_info(self(),binary); + skip_refc_check -> ok + end, ?line Test_Func(make_unaligned_sub_binary(Bin0)), ?line Test_Func(make_unaligned_sub_binary(Bin1)), @@ -5654,9 +5854,13 @@ test_terms(Test_Func) -> ?line Test_Func(lists:duplicate(32, FF)), garbage_collect(), - ?line Pib0 = process_info(self(),binary), + case Mode of + strict -> ?line Pib0 = process_info(self(),binary); + skip_refc_check -> ok + end, ok. + id(I) -> I. very_big_num() -> @@ -5688,15 +5892,32 @@ make_ext_ref() -> Ref. init_externals() -> - ?line Pa = filename:dirname(code:which(?MODULE)), - ?line {ok, Node} = test_server:start_node(plopp, slave, [{args, " -pa " ++ Pa}]), - ?line Res = case rpc:call(Node, ?MODULE, rpc_externals, []) of - {badrpc, {'EXIT', E}} -> - test_server:fail({rpcresult, E}); - R -> R - end, - ?line test_server:stop_node(Node), - put(externals, Res). + case get(externals) of + undefined -> + SysDistSz = ets:info(sys_dist,size), + ?line Pa = filename:dirname(code:which(?MODULE)), + ?line {ok, Node} = test_server:start_node(plopp, slave, [{args, " -pa " ++ Pa}]), + ?line Res = case rpc:call(Node, ?MODULE, rpc_externals, []) of + {badrpc, {'EXIT', E}} -> + test_server:fail({rpcresult, E}); + R -> R + end, + ?line test_server:stop_node(Node), + + %% Wait for table 'sys_dist' to stabilize + repeat_while(fun() -> + case ets:info(sys_dist,size) of + SysDistSz -> false; + Sz -> + io:format("Waiting for sys_dist to revert size from ~p to size ~p\n", + [Sz, SysDistSz]), + receive after 1000 -> true end + end + end), + put(externals, Res); + + {_,_,_} -> ok + end. rpc_externals() -> {self(), make_port(), make_ref()}. diff --git a/lib/stdlib/test/ets_tough_SUITE.erl b/lib/stdlib/test/ets_tough_SUITE.erl index 4c8d941f13..0386a0272a 100644 --- a/lib/stdlib/test/ets_tough_SUITE.erl +++ b/lib/stdlib/test/ets_tough_SUITE.erl @@ -17,13 +17,33 @@ %% %CopyrightEnd% %% -module(ets_tough_SUITE). --export([all/1,ex1/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,ex1/1]). -export([init/1,terminate/2,handle_call/3,handle_info/2]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -compile([export_all]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [ex1]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> [ex1]. -define(DEBUG(X),debug_disabled). @@ -34,7 +54,7 @@ init_per_testcase(_Func, Config) -> Dog=test_server:timetrap(test_server:seconds(300)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ets:delete(?GLOBAL_PARAMS). diff --git a/lib/stdlib/test/file_sorter_SUITE.erl b/lib/stdlib/test/file_sorter_SUITE.erl index c00ed91fe7..9ca2460a05 100644 --- a/lib/stdlib/test/file_sorter_SUITE.erl +++ b/lib/stdlib/test/file_sorter_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -27,12 +27,13 @@ -define(t,test_server). -define(privdir(_), "./file_sorter_SUITE_priv"). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -define(privdir(Conf), ?config(priv_dir, Conf)). -endif. --export([all/1, basic/1, badarg/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, basic/1, badarg/1, term_sort/1, term_keysort/1, binary_term_sort/1, binary_term_keysort/1, binary_sort/1, @@ -44,30 +45,42 @@ binary_check/1, inout/1, misc/1, many/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). init_per_testcase(_Case, Config) -> Dog=?t:timetrap(?t:minutes(2)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - {req,[stdlib,kernel], - [basic, badarg, - term_sort, term_keysort, - binary_term_sort, binary_term_keysort, - binary_sort, - term_merge, term_keymerge, - binary_term_merge, binary_term_keymerge, - binary_merge, - term_check, binary_term_keycheck, - binary_term_check, binary_term_keycheck, - binary_check, - inout, misc, many]}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic, badarg, term_sort, term_keysort, + binary_term_sort, binary_term_keysort, binary_sort, + term_merge, term_keymerge, binary_term_merge, + binary_term_keymerge, binary_merge, term_check, + binary_term_keycheck, binary_term_check, + binary_term_keycheck, binary_check, inout, misc, many]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + basic(doc) -> ["Basic test case."]; diff --git a/lib/stdlib/test/filelib_SUITE.erl b/lib/stdlib/test/filelib_SUITE.erl index d54741051f..628e741870 100644 --- a/lib/stdlib/test/filelib_SUITE.erl +++ b/lib/stdlib/test/filelib_SUITE.erl @@ -19,27 +19,47 @@ -module(filelib_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, wildcard_one/1,wildcard_two/1,wildcard_errors/1, fold_files/1,otp_5960/1,ensure_dir_eexist/1]). -import(lists, [foreach/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?t:minutes(5)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [wildcard_one,wildcard_two,wildcard_errors,fold_files,otp_5960, - ensure_dir_eexist]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [wildcard_one, wildcard_two, wildcard_errors, + fold_files, otp_5960, ensure_dir_eexist]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + wildcard_one(Config) when is_list(Config) -> ?line {ok,OldCwd} = file:get_cwd(), @@ -53,8 +73,11 @@ wildcard_one(Config) when is_list(Config) -> wildcard_two(Config) when is_list(Config) -> ?line Dir = filename:join(?config(priv_dir, Config), "wildcard_two"), + ?line DirB = unicode:characters_to_binary(Dir, file:native_name_encoding()), ?line ok = file:make_dir(Dir), - ?line do_wildcard_1(Dir, fun(Wc) -> filelib:wildcard(Wc, Dir) end), + ?line do_wildcard_1(Dir, fun(Wc) -> io:format("~p~n",[{Wc,Dir, X = filelib:wildcard(Wc, Dir)}]),X end), + ?line do_wildcard_1(Dir, fun(Wc) -> io:format("~p~n",[{Wc,DirB, X = filelib:wildcard(Wc, DirB)}]), + [unicode:characters_to_list(Y,file:native_name_encoding()) || Y <- X] end), ?line do_wildcard_1(Dir, fun(Wc) -> filelib:wildcard(Wc, Dir++"/") end), case os:type() of {win32,_} -> @@ -253,5 +276,7 @@ ensure_dir_eexist(Config) when is_list(Config) -> %% There already is a file with the name of the directory %% we want to create. ?line NeedFile = filename:join(Name, "file"), + ?line NeedFileB = filename:join(Name, <<"file">>), ?line {error, eexist} = filelib:ensure_dir(NeedFile), + ?line {error, eexist} = filelib:ensure_dir(NeedFileB), ok. diff --git a/lib/stdlib/test/filename_SUITE.erl b/lib/stdlib/test/filename_SUITE.erl index ab6521f37b..a72af3448b 100644 --- a/lib/stdlib/test/filename_SUITE.erl +++ b/lib/stdlib/test/filename_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -17,17 +17,44 @@ %% %CopyrightEnd% %% -module(filename_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([absname/1, absname_2/1, basename_1/1, basename_2/1, dirname/1, extension/1, join/1, t_nativename/1]). -export([pathtype/1,rootname/1,split/1,find_src/1]). --include("test_server.hrl"). +-export([absname_bin/1, absname_bin_2/1, + basename_bin_1/1, basename_bin_2/1, + dirname_bin/1, extension_bin/1, join_bin/1]). +-export([pathtype_bin/1,rootname_bin/1,split_bin/1]). -all(suite) -> +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [absname, absname_2, basename_1, basename_2, dirname, extension, - join, pathtype, rootname, split, t_nativename, find_src]. + join, pathtype, rootname, split, t_nativename, find_src, + absname_bin, absname_bin_2, basename_bin_1, basename_bin_2, dirname_bin, + extension_bin, + join_bin, pathtype_bin, rootname_bin, split_bin]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -457,3 +484,307 @@ find_src(Config) when is_list(Config) -> %% Try to find the source for a preloaded module. ?line {error,{preloaded,init}} = filename:find_src(init), ok. + +%% +%% +%% With binaries +%% +%% + +absname_bin(Config) when is_list(Config) -> + case os:type() of + {win32, _} -> + ?line [Drive|_] = ?config(priv_dir, Config), + ?line Temp = filename:join([Drive|":/"], "temp"), + ?line case file:make_dir(Temp) of + ok -> ok; + {error,eexist} -> ok + end, + ?line {ok,Cwd} = file:get_cwd(), + ?line ok = file:set_cwd(Temp), + ?line <<Drive:8,":/temp/foo">> = filename:absname(<<"foo">>), + ?line <<Drive:8,":/temp/../ebin">> = filename:absname(<<"../ebin">>), + ?line <<Drive:8,":/erlang">> = filename:absname(<<"/erlang">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<"/erlang/src">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<"\\erlang\\src">>), + ?line <<Drive:8,":/temp/erlang">> = filename:absname(<<Drive:8,":erlang">>), + ?line <<Drive:8,":/temp/erlang/src">> = + filename:absname(<<Drive:8,":erlang/src">>), + ?line <<Drive:8,":/temp/erlang/src">> = + filename:absname(<<Drive:8,":erlang\\src\\">>), + ?line <<"a:/erlang">> = filename:absname(<<"a:erlang">>), + + ?line file:set_cwd(<<Drive:8,":/">>), + ?line <<Drive:8,":/foo">> = filename:absname(<<"foo">>), + ?line <<Drive:8,":/../ebin">> = filename:absname(<<"../ebin">>), + ?line <<Drive:8,":/erlang">> = filename:absname(<<"/erlang">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<"/erlang/src">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<"\\erlang\\\\src">>), + ?line <<Drive:8,":/erlang">> = filename:absname(<<Drive:8,":erlang">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<Drive:8,":erlang/src">>), + ?line <<"a:/erlang">> = filename:absname(<<"a:erlang">>), + + ?line file:set_cwd(Cwd), + ok; + {unix, _} -> + ?line ok = file:set_cwd(<<"/usr">>), + ?line <<"/usr/foo">> = filename:absname(<<"foo">>), + ?line <<"/usr/../ebin">> = filename:absname(<<"../ebin">>), + + ?line file:set_cwd(<<"/">>), + ?line <<"/foo">> = filename:absname(<<"foo">>), + ?line <<"/../ebin">> = filename:absname(<<"../ebin">>), + ?line <<"/erlang">> = filename:absname(<<"/erlang">>), + ?line <<"/erlang/src">> = filename:absname(<<"/erlang/src">>), + ?line <<"/erlang/src">> = filename:absname(<<"/erlang///src">>), + ok + end. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +absname_bin_2(Config) when is_list(Config) -> + case os:type() of + {win32, _} -> + ?line [Drive|_] = ?config(priv_dir, Config), + ?line <<Drive:8,":/temp/foo">> = filename:absname(<<"foo">>, <<Drive:8,":/temp">>), + ?line <<Drive:8,":/temp/../ebin">> = filename:absname(<<"../ebin">>, + <<Drive:8,":/temp">>), + ?line <<Drive:8,":/erlang">> = filename:absname(<<"/erlang">>, <<Drive:8,":/temp">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<"/erlang/src">>, + <<Drive:8,":/temp">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<"\\erlang\\src">>, + <<Drive:8,":/temp">>), + ?line <<Drive:8,":/temp/erlang">> = filename:absname(<<Drive:8,":erlang">>, + <<Drive:8,":/temp">>), + ?line <<Drive:8,":/temp/erlang/src">> = filename:absname(<<Drive:8,":erlang/src">>, + <<Drive:8,":/temp">>), + ?line <<Drive:8,":/temp/erlang/src">> = + filename:absname(<<Drive:8,":erlang\\src\\">>, <<Drive:8,":/temp">>), + ?line <<"a:/erlang">> = filename:absname(<<"a:erlang">>, <<Drive:8,":/temp">>), + + ?line file:set_cwd(<<Drive:8,":/">>), + ?line <<Drive:8,":/foo">> = filename:absname(foo, <<Drive:8,":/">>), + ?line <<Drive:8,":/foo">> = filename:absname(<<"foo">>, <<Drive:8,":/">>), + ?line <<Drive:8,":/../ebin">> = filename:absname(<<"../ebin">>, <<Drive:8,":/">>), + ?line <<Drive:8,":/erlang">> = filename:absname(<<"/erlang">>, <<Drive:8,":/">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<"/erlang/src">>, + <<Drive:8,":/">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<"\\erlang\\\\src">>, + <<Drive:8,":/">>), + ?line <<Drive:8,":/erlang">> = filename:absname(<<Drive:8,":erlang">>, + <<Drive:8,":/">>), + ?line <<Drive:8,":/erlang/src">> = filename:absname(<<Drive:8,":erlang/src">>, + <<Drive:8,":/">>), + ?line <<"a:/erlang">> = filename:absname(<<"a:erlang">>, <<Drive:8,":/">>), + + ok; + {unix, _} -> + ?line <<"/usr/foo">> = filename:absname(<<"foo">>, <<"/usr">>), + ?line <<"/usr/../ebin">> = filename:absname(<<"../ebin">>, <<"/usr">>), + + ?line <<"/foo">> = filename:absname(<<"foo">>, <<"/">>), + ?line <<"/../ebin">> = filename:absname(<<"../ebin">>, <<"/">>), + ?line <<"/erlang">> = filename:absname(<<"/erlang">>, <<"/">>), + ?line <<"/erlang/src">> = filename:absname(<<"/erlang/src">>, <<"/">>), + ?line <<"/erlang/src">> = filename:absname(<<"/erlang///src">>, <<"/">>), + ok + end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +basename_bin_1(Config) when is_list(Config) -> + ?line Dog = test_server:timetrap(test_server:seconds(10)), + ?line <<".">> = filename:basename(<<".">>), + ?line <<"foo">> = filename:basename(<<"foo">>), + ?line <<"foo">> = filename:basename(<<"/usr/foo">>), + ?line <<"foo.erl">> = filename:basename(<<"A:usr/foo.erl">>), + ?line case os:type() of + {win32, _} -> + ?line <<"foo">> = filename:basename(<<"A:\\usr\\foo">>), + ?line <<"foo">> = filename:basename(<<"A:foo">>); + {unix, _} -> + ?line <<"strange\\but\\true">> = + filename:basename(<<"strange\\but\\true">>) + end, + ?line test_server:timetrap_cancel(Dog), + ok. + +basename_bin_2(Config) when is_list(Config) -> + ?line Dog = test_server:timetrap(test_server:seconds(10)), + ?line <<".">> = filename:basename(<<".">>, <<".erl">>), + ?line <<"foo">> = filename:basename(<<"foo.erl">>, <<".erl">>), + ?line <<"foo.erl">> = filename:basename(<<"/usr/foo.erl">>, <<".hrl">>), + ?line <<"foo.erl">> = filename:basename(<<"/usr.hrl/foo.erl">>, <<".hrl">>), + ?line <<"foo">> = filename:basename(<<"/usr.hrl/foo">>, <<".hrl">>), + ?line <<"foo">> = filename:basename(<<"usr/foo/">>, <<".erl">>), + ?line <<"foo.erl">> = filename:basename(<<"usr/foo.erl/">>, <<".erl">>), + ?line case os:type() of + {win32, _} -> + ?line <<"foo">> = filename:basename(<<"A:foo">>, <<".erl">>), + ?line <<"foo.erl">> = filename:basename(<<"a:\\usr\\foo.erl">>, + <<".hrl">>), + ?line <<"foo.erl">> = filename:basename(<<"c:\\usr.hrl\\foo.erl">>, + <<".hrl">>), + ?line <<"foo">> = filename:basename(<<"A:\\usr\\foo">>, <<".hrl">>); + {unix, _} -> + ?line <<"strange\\but\\true">> = + filename:basename(<<"strange\\but\\true.erl">>, <<".erl">>), + ?line <<"strange\\but\\true">> = + filename:basename(<<"strange\\but\\true">>, <<".erl">>) + end, + ?line test_server:timetrap_cancel(Dog), + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +dirname_bin(Config) when is_list(Config) -> + case os:type() of + {win32,_} -> + ?line <<"A:/usr">> = filename:dirname(<<"A:/usr/foo.erl">>), + ?line <<"A:usr">> = filename:dirname(<<"A:usr/foo.erl">>), + ?line <<"/usr">> = filename:dirname(<<"\\usr\\foo.erl">>), + ?line <<"/">> = filename:dirname(<<"\\usr">>), + ?line <<"A:">> = filename:dirname(<<"A:">>); + vxworks -> + ?line <<"net:/usr">> = filename:dirname(<<"net:/usr/foo.erl">>), + ?line <<"/disk0:/usr">> = filename:dirname(<<"/disk0:/usr/foo.erl">>), + ?line <<"/usr">> = filename:dirname(<<"\\usr\\foo.erl">>), + ?line <<"/usr">> = filename:dirname(<<"\\usr">>), + ?line <<"net:">> = filename:dirname(<<"net:">>); + _ -> true + end, + ?line <<"usr">> = filename:dirname(<<"usr///foo.erl">>), + ?line <<".">> = filename:dirname(<<"foo.erl">>), + ?line <<".">> = filename:dirname(<<".">>), + case os:type() of + vxworks -> + ?line <<"/">> = filename:dirname(<<"/">>), + ?line <<"/usr">> = filename:dirname(<<"/usr">>); + _ -> + ?line <<"/">> = filename:dirname(<<"/">>), + ?line <<"/">> = filename:dirname(<<"/usr">>) + end, + ok. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +extension_bin(Config) when is_list(Config) -> + ?line <<".erl">> = filename:extension(<<"A:/usr/foo.erl">>), + ?line <<".erl">> = filename:extension(<<"A:/usr/foo.nisse.erl">>), + ?line <<".erl">> = filename:extension(<<"A:/usr.bar/foo.nisse.erl">>), + ?line <<"">> = filename:extension(<<"A:/usr.bar/foo">>), + ?line <<"">> = filename:extension(<<"A:/usr/foo">>), + ?line case os:type() of + {win32, _} -> + ?line <<"">> = filename:extension(<<"A:\\usr\\foo">>), + ?line <<".erl">> = + filename:extension(<<"A:/usr.bar/foo.nisse.erl">>), + ?line <<"">> = filename:extension(<<"A:/usr.bar/foo">>), + ok; + vxworks -> + ?line <<"">> = filename:extension(<<"/disk0:\\usr\\foo">>), + ?line <<".erl">> = + filename:extension(<<"net:/usr.bar/foo.nisse.erl">>), + ?line <<"">> = filename:extension(<<"net:/usr.bar/foo">>), + ok; + _ -> ok + end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +join_bin(Config) when is_list(Config) -> + ?line <<"/">> = filename:join([<<"/">>]), + ?line <<"/">> = filename:join([<<"//">>]), + ?line <<"usr/foo.erl">> = filename:join(<<"usr">>,<<"foo.erl">>), + ?line <<"/src/foo.erl">> = filename:join(usr, <<"/src/foo.erl">>), + ?line <<"/src/foo.erl">> = filename:join([<<"/src/">>,'foo.erl']), + ?line <<"/src/foo.erl">> = filename:join(<<"usr">>, ["/sr", 'c/foo.erl']), + ?line <<"/src/foo.erl">> = filename:join(<<"usr">>, <<"/src/foo.erl">>), + + %% Make sure that redundant slashes work too. + ?line <<"a/b/c/d/e/f/g">> = filename:join([<<"a//b/c/////d//e/f/g">>]), + ?line <<"a/b/c/d/e/f/g">> = filename:join([<<"a//b/c/">>, <<"d//e/f/g">>]), + ?line <<"a/b/c/d/e/f/g">> = filename:join([<<"a//b/c">>, <<"d//e/f/g">>]), + ?line <<"/d/e/f/g">> = filename:join([<<"a//b/c">>, <<"/d//e/f/g">>]), + ?line <<"/d/e/f/g">> = filename:join([<<"a//b/c">>, <<"//d//e/f/g">>]), + + ?line <<"foo/bar">> = filename:join([$f,$o,$o,$/,[]], <<"bar">>), + + ?line case os:type() of + {win32, _} -> + ?line <<"d:/">> = filename:join([<<"D:/">>]), + ?line <<"d:/">> = filename:join([<<"D:\\">>]), + ?line <<"d:/abc">> = filename:join([<<"D:/">>, <<"abc">>]), + ?line <<"d:abc">> = filename:join([<<"D:">>, <<"abc">>]), + ?line <<"a/b/c/d/e/f/g">> = + filename:join([<<"a//b\\c//\\/\\d/\\e/f\\g">>]), + ?line <<"a:usr/foo.erl">> = + filename:join([<<"A:">>,<<"usr">>,<<"foo.erl">>]), + ?line <<"/usr/foo.erl">> = + filename:join([<<"A:">>,<<"/usr">>,<<"foo.erl">>]), + ?line <<"c:usr">> = filename:join(<<"A:">>,<<"C:usr">>), + ?line <<"a:usr">> = filename:join(<<"A:">>,<<"usr">>), + ?line <<"c:/usr">> = filename:join(<<"A:">>, <<"C:/usr">>), + ?line <<"c:/usr/foo.erl">> = + filename:join([<<"A:">>,<<"C:/usr">>,<<"foo.erl">>]), + ?line <<"c:usr/foo.erl">> = + filename:join([<<"A:">>,<<"C:usr">>,<<"foo.erl">>]), + ?line <<"d:/foo">> = filename:join([$D, $:, $/, []], <<"foo">>), + ok; + {unix, _} -> + ok + end. + +pathtype_bin(Config) when is_list(Config) -> + ?line relative = filename:pathtype(<<"..">>), + ?line relative = filename:pathtype(<<"foo">>), + ?line relative = filename:pathtype(<<"foo/bar">>), + ?line relative = filename:pathtype('foo/bar'), + case os:type() of + {win32, _} -> + ?line volumerelative = filename:pathtype(<<"/usr/local/bin">>), + ?line volumerelative = filename:pathtype(<<"A:usr/local/bin">>), + ok; + {unix, _} -> + ?line absolute = filename:pathtype(<<"/">>), + ?line absolute = filename:pathtype(<<"/usr/local/bin">>), + ok + end. + +rootname_bin(Config) when is_list(Config) -> + ?line <<"/jam.src/kalle">> = filename:rootname(<<"/jam.src/kalle">>), + ?line <<"/jam.src/foo">> = filename:rootname(<<"/jam.src/foo.erl">>), + ?line <<"/jam.src/foo">> = filename:rootname(<<"/jam.src/foo.erl">>, <<".erl">>), + ?line <<"/jam.src/foo.jam">> = filename:rootname(<<"/jam.src/foo.jam">>, <<".erl">>), + ?line <<"/jam.src/foo.jam">> = filename:rootname(["/jam.sr",'c/foo.j',"am"],<<".erl">>), + ?line <<"/jam.src/foo.jam">> = filename:rootname(["/jam.sr",'c/foo.j'|am],<<".erl">>), + ok. + +split_bin(Config) when is_list(Config) -> + case os:type() of + vxworks -> + ?line [<<"/usr">>,<<"local">>,<<"bin">>] = filename:split(<<"/usr/local/bin">>); + _ -> + ?line [<<"/">>,<<"usr">>,<<"local">>,<<"bin">>] = filename:split(<<"/usr/local/bin">>) + end, + ?line [<<"foo">>,<<"bar">>]= filename:split(<<"foo/bar">>), + ?line [<<"foo">>, <<"bar">>, <<"hello">>]= filename:split(<<"foo////bar//hello">>), + case os:type() of + {win32,_} -> + ?line [<<"a:/">>,<<"msdev">>,<<"include">>] = + filename:split(<<"a:/msdev/include">>), + ?line [<<"a:/">>,<<"msdev">>,<<"include">>] = + filename:split(<<"A:/msdev/include">>), + ?line [<<"msdev">>,<<"include">>] = + filename:split(<<"msdev\\include">>), + ?line [<<"a:/">>,<<"msdev">>,<<"include">>] = + filename:split(<<"a:\\msdev\\include">>), + ?line [<<"a:">>,<<"msdev">>,<<"include">>] = + filename:split(<<"a:msdev\\include">>), + ok; + _ -> + ok + end. + diff --git a/lib/stdlib/test/fixtable_SUITE.erl b/lib/stdlib/test/fixtable_SUITE.erl index 1940ee147e..c2160d8ba7 100644 --- a/lib/stdlib/test/fixtable_SUITE.erl +++ b/lib/stdlib/test/fixtable_SUITE.erl @@ -21,22 +21,41 @@ %%%---------------------------------------------------------------------- -module(fixtable_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %%% Test cases -export([multiple_fixes/1, multiple_processes/1, other_process_deletes/1, owner_dies/1, other_process_closes/1,insert_same_key/1]). -export([fixbag/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). %%% Internal exports -export([command_loop/0,start_commander/0]). -all(suite) -> {req, [stdlib], - [multiple_fixes, multiple_processes, - other_process_deletes, owner_dies, - other_process_closes,insert_same_key,fixbag]}. +suite() -> [{ct_hooks,[ts_install_cth]}]. --include("test_server.hrl"). +all() -> + [multiple_fixes, multiple_processes, + other_process_deletes, owner_dies, other_process_closes, + insert_same_key, fixbag]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +-include_lib("test_server/include/test_server.hrl"). %%% I wrote this thinking I would use more than one temporary at a time, but %%% I wasn't... Well, maybe in the future... @@ -53,7 +72,7 @@ init_per_testcase(_Func, Config) -> Dog=test_server:timetrap(test_server:seconds(60)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), lists:foreach(fun(X) -> diff --git a/lib/stdlib/test/format_SUITE.erl b/lib/stdlib/test/format_SUITE.erl index 1c9e953003..c1a896abe8 100644 --- a/lib/stdlib/test/format_SUITE.erl +++ b/lib/stdlib/test/format_SUITE.erl @@ -17,13 +17,14 @@ %% %CopyrightEnd% %% -module(format_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([hang_1/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -31,16 +32,32 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(doc) -> - ["Test cases for io:format/[2,3]."]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [hang_1]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + hang_1(doc) -> ["Bad args can hang (OTP-2400)"]; hang_1(suite) -> diff --git a/lib/stdlib/test/gen_event_SUITE.erl b/lib/stdlib/test/gen_event_SUITE.erl index 4f7de451e3..8fa2f4e3a3 100644 --- a/lib/stdlib/test/gen_event_SUITE.erl +++ b/lib/stdlib/test/gen_event_SUITE.erl @@ -18,16 +18,39 @@ %% -module(gen_event_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). --export([start/1, test_all/1, add_handler/1, add_sup_handler/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([start/1, add_handler/1, add_sup_handler/1, delete_handler/1, swap_handler/1, swap_sup_handler/1, notify/1, sync_notify/1, call/1, info/1, hibernate/1, call_format_status/1, error_format_status/1]). -all(suite) -> {req, [stdlib], [start, test_all, hibernate, - call_format_status, error_format_status]}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [start, {group, test_all}, hibernate, + call_format_status, error_format_status]. + +groups() -> + [{test_all, [], + [add_handler, add_sup_handler, delete_handler, + swap_handler, swap_sup_handler, notify, sync_notify, + call, info]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% -------------------------------------- %% Start an event manager. @@ -171,9 +194,6 @@ hibernate(Config) when is_list(Config) -> ok. -test_all(suite) -> [add_handler, add_sup_handler, delete_handler, - swap_handler, swap_sup_handler, notify, - sync_notify, call, info]. add_handler(doc) -> []; add_handler(suite) -> []; diff --git a/lib/stdlib/test/gen_fsm_SUITE.erl b/lib/stdlib/test/gen_fsm_SUITE.erl index dd120f8c05..9d9e1f8dd8 100644 --- a/lib/stdlib/test/gen_fsm_SUITE.erl +++ b/lib/stdlib/test/gen_fsm_SUITE.erl @@ -18,19 +18,20 @@ %% -module(gen_fsm_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test cases --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([start/1, start1/1, start2/1, start3/1, start4/1 , start5/1, start6/1, +-export([ start1/1, start2/1, start3/1, start4/1 , start5/1, start6/1, start7/1, start8/1, start9/1, start10/1, start11/1]). --export([abnormal/1, abnormal1/1, abnormal2/1]). +-export([ abnormal1/1, abnormal2/1]). -export([shutdown/1]). --export([sys/1, sys1/1, call_format_status/1, error_format_status/1]). +-export([ sys1/1, call_format_status/1, error_format_status/1]). -export([hibernate/1,hiber_idle/3,hiber_wakeup/3,hiber_idle/2,hiber_wakeup/2]). @@ -53,13 +54,31 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - [start, abnormal, shutdown, sys, hibernate, enter_loop]. - +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, start}, {group, abnormal}, shutdown, + {group, sys}, hibernate, enter_loop]. + +groups() -> + [{start, [], + [start1, start2, start3, start4, start5, start6, start7, + start8, start9, start10, start11]}, + {abnormal, [], [abnormal1, abnormal2]}, + {sys, [], + [sys1, call_format_status, error_format_status]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. +init_per_group(_GroupName, Config) -> + Config. -start(suite) -> [start1, start2, start3, start4, start5, start6, start7, - start8, start9, start10, start11]. +end_per_group(_GroupName, Config) -> + Config. %% anonymous start1(Config) when is_list(Config) -> @@ -239,7 +258,6 @@ start11(Config) when is_list(Config) -> test_server:messages_get(), ok. -abnormal(suite) -> [abnormal1, abnormal2]. %% Check that time outs in calls work abnormal1(suite) -> []; @@ -305,7 +323,6 @@ shutdown(Config) when is_list(Config) -> ok. -sys(suite) -> [sys1, call_format_status, error_format_status]. sys1(Config) when is_list(Config) -> ?line {ok, Pid} = diff --git a/lib/stdlib/test/gen_server_SUITE.erl b/lib/stdlib/test/gen_server_SUITE.erl index 99388ba2e3..5a248d7c10 100644 --- a/lib/stdlib/test/gen_server_SUITE.erl +++ b/lib/stdlib/test/gen_server_SUITE.erl @@ -18,12 +18,13 @@ %% -module(gen_server_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet.hrl"). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([start/1, crash/1, call/1, cast/1, cast_fast/1, info/1, abcast/1, multicall/1, multicall_down/1, call_remote1/1, call_remote2/1, call_remote3/1, @@ -45,23 +46,55 @@ -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, format_status/2]). -all(suite) -> - [start, crash, call, cast, cast_fast, info, - abcast, multicall, multicall_down, call_remote1, - call_remote2, call_remote3, call_remote_n1, - call_remote_n2, call_remote_n3, spec_init, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [start, crash, call, cast, cast_fast, info, abcast, + multicall, multicall_down, call_remote1, call_remote2, + call_remote3, call_remote_n1, call_remote_n2, + call_remote_n3, spec_init, spec_init_local_registered_parent, - spec_init_global_registered_parent, - otp_5854, hibernate, otp_7669, - call_format_status, error_format_status, + spec_init_global_registered_parent, otp_5854, hibernate, + otp_7669, call_format_status, error_format_status, call_with_huge_message_queue]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + -define(default_timeout, ?t:minutes(1)). +init_per_testcase(Case, Config) when Case == call_remote1; + Case == call_remote2; + Case == call_remote3; + Case == call_remote_n1; + Case == call_remote_n2; + Case == call_remote_n3 -> + {ok,N} = start_node(hubba), + ?line Dog = ?t:timetrap(?default_timeout), + [{node,N},{watchdog, Dog} | Config]; init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> + case proplists:get_value(node, Config) of + undefined -> + ok; + N -> + test_server:stop_node(N) + end, Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -294,8 +327,8 @@ start_node(Name) -> call_remote1(suite) -> []; call_remote1(Config) when is_list(Config) -> - ?line N = hubba, - ?line {ok, Node} = start_node(N), + N = hubba, + ?line Node = proplists:get_value(node,Config), ?line {ok, Pid} = rpc:call(Node, gen_server, start, [{global, N}, ?MODULE, [], []]), ?line ok = (catch gen_server:call({global, N}, started_p, infinity)), @@ -308,7 +341,7 @@ call_remote1(Config) when is_list(Config) -> call_remote2(suite) -> []; call_remote2(Config) when is_list(Config) -> ?line N = hubba, - ?line {ok, Node} = start_node(N), + ?line Node = proplists:get_value(node,Config), ?line {ok, Pid} = rpc:call(Node, gen_server, start, [{global, N}, ?MODULE, [], []]), @@ -321,8 +354,7 @@ call_remote2(Config) when is_list(Config) -> call_remote3(suite) -> []; call_remote3(Config) when is_list(Config) -> - ?line N = hubba, - ?line {ok, Node} = start_node(N), + ?line Node = proplists:get_value(node,Config), ?line {ok, Pid} = rpc:call(Node, gen_server, start, [{local, piller}, ?MODULE, [], []]), @@ -340,7 +372,7 @@ call_remote3(Config) when is_list(Config) -> call_remote_n1(suite) -> []; call_remote_n1(Config) when is_list(Config) -> ?line N = hubba, - ?line {ok, Node} = start_node(N), + ?line Node = proplists:get_value(node,Config), ?line {ok, _Pid} = rpc:call(Node, gen_server, start, [{global, N}, ?MODULE, [], []]), ?line _ = test_server:stop_node(Node), @@ -352,7 +384,7 @@ call_remote_n1(Config) when is_list(Config) -> call_remote_n2(suite) -> []; call_remote_n2(Config) when is_list(Config) -> ?line N = hubba, - ?line {ok, Node} = start_node(N), + ?line Node = proplists:get_value(node,Config), ?line {ok, Pid} = rpc:call(Node, gen_server, start, [{global, N}, ?MODULE, [], []]), @@ -364,8 +396,7 @@ call_remote_n2(Config) when is_list(Config) -> call_remote_n3(suite) -> []; call_remote_n3(Config) when is_list(Config) -> - ?line N = hubba, - ?line {ok, Node} = start_node(N), + ?line Node = proplists:get_value(node,Config), ?line {ok, _Pid} = rpc:call(Node, gen_server, start, [{local, piller}, ?MODULE, [], []]), diff --git a/lib/stdlib/test/id_transform_SUITE.erl b/lib/stdlib/test/id_transform_SUITE.erl index 95ee509833..da52f43728 100644 --- a/lib/stdlib/test/id_transform_SUITE.erl +++ b/lib/stdlib/test/id_transform_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -21,17 +21,37 @@ -include_lib("kernel/include/file.hrl"). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, id_transform/1]). -export([check/2,check2/1,g/0,f/1,t/1,t1/1,t2/1,t3/1,t4/1, t5/1,t6/1,apa/1,new_fun/0]). -% Serves as test... + % Serves as test... -hej(hopp). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [id_transform]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> [id_transform]. id_transform(doc) -> "Test erl_id_trans."; id_transform(Config) when is_list(Config) -> diff --git a/lib/stdlib/test/io_SUITE.erl b/lib/stdlib/test/io_SUITE.erl index 73efeb004a..497fd3c562 100644 --- a/lib/stdlib/test/io_SUITE.erl +++ b/lib/stdlib/test/io_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -18,9 +18,10 @@ %% -module(io_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([error_1/1, float_g/1, otp_5403/1, otp_5813/1, otp_6230/1, otp_6282/1, otp_6354/1, otp_6495/1, otp_6517/1, otp_6502/1, @@ -37,7 +38,7 @@ -define(t, test_server). -define(privdir(_), "./io_SUITE_priv"). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -define(privdir(Conf), ?config(priv_dir, Conf)). -endif. @@ -49,17 +50,35 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> Dog = ?config(watchdog, _Config), test_server:timetrap_cancel(Dog), ok. -all(doc) -> - ["Test cases for io."]; -all(suite) -> - [error_1,float_g,otp_5403,otp_5813,otp_6230,otp_6282,otp_6354,otp_6495, - otp_6517,otp_6502,manpage,otp_6708,otp_7084,otp_7421, - io_lib_collect_line_3_wb,cr_whitespace_in_string,io_fread_newlines]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [error_1, float_g, otp_5403, otp_5813, otp_6230, + otp_6282, otp_6354, otp_6495, otp_6517, otp_6502, + manpage, otp_6708, otp_7084, otp_7421, + io_lib_collect_line_3_wb, cr_whitespace_in_string, + io_fread_newlines]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + error_1(doc) -> ["Error cases for output"]; diff --git a/lib/stdlib/test/io_proto_SUITE.erl b/lib/stdlib/test/io_proto_SUITE.erl index d9672a8c7b..3474f41ee6 100644 --- a/lib/stdlib/test/io_proto_SUITE.erl +++ b/lib/stdlib/test/io_proto_SUITE.erl @@ -19,15 +19,19 @@ -module(io_proto_SUITE). -compile(r12). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). --export([setopts_getopts/1,unicode_options/1,unicode_options_gen/1, binary_options/1, bc_with_r12/1, - bc_with_r12_gl/1, read_modes_gl/1,bc_with_r12_ogl/1, read_modes_ogl/1, broken_unicode/1,eof_on_pipe/1,unicode_prompt/1]). +-export([setopts_getopts/1,unicode_options/1,unicode_options_gen/1, + binary_options/1, bc_with_r12/1, + bc_with_r12_gl/1, read_modes_gl/1,bc_with_r12_ogl/1, + read_modes_ogl/1, broken_unicode/1,eof_on_pipe/1,unicode_prompt/1]). --export([io_server_proxy/1,start_io_server_proxy/0, proxy_getall/1, proxy_setnext/2, proxy_quit/1]). +-export([io_server_proxy/1,start_io_server_proxy/0, proxy_getall/1, + proxy_setnext/2, proxy_quit/1]). %% For spawn -export([toerl_server/3,hold_the_line/3,answering_machine1/3, answering_machine2/3]). @@ -42,7 +46,7 @@ -define(t, test_server). -define(privdir(_), "./io_SUITE_priv"). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(privdir(Conf), ?config(priv_dir, Conf)). -endif. @@ -73,19 +77,36 @@ init_per_testcase(_Case, Config) -> end, os:putenv("TERM","vt100"), [{watchdog, Dog}, {term, Term} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), Term = ?config(term,Config), os:putenv("TERM",Term), test_server:timetrap_cancel(Dog), ok. -all(doc) -> - ["Test cases for the io_protocol."]; -all(suite) -> - [setopts_getopts, unicode_options, unicode_options_gen, binary_options, bc_with_r12, - bc_with_r12_gl,bc_with_r12_ogl, read_modes_gl, read_modes_ogl, - broken_unicode,eof_on_pipe,unicode_prompt]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [setopts_getopts, unicode_options, unicode_options_gen, + binary_options, bc_with_r12, bc_with_r12_gl, + bc_with_r12_ogl, read_modes_gl, read_modes_ogl, + broken_unicode, eof_on_pipe, unicode_prompt]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -record(state, { diff --git a/lib/stdlib/test/lists_SUITE.erl b/lib/stdlib/test/lists_SUITE.erl index 0089e874c8..1fc9de09c3 100644 --- a/lib/stdlib/test/lists_SUITE.erl +++ b/lib/stdlib/test/lists_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -21,7 +21,7 @@ %%%----------------------------------------------------------------- -module(lists_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). @@ -30,36 +30,37 @@ -define(default_timeout, ?t:minutes(4)). % Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). % Test cases must be exported. -export([member/1, reverse/1, keymember/1, keysearch_keyfind/1, keystore/1, keytake/1, - append/1, append_1/1, append_2/1, - seq/1, seq_loop/1, seq_2/1, seq_3/1, seq_2_e/1, seq_3_e/1, - sublist/1, flatten/1, + append_1/1, append_2/1, + seq_loop/1, seq_2/1, seq_3/1, seq_2_e/1, seq_3_e/1, + sublist_2/1, sublist_3/1, sublist_2_e/1, sublist_3_e/1, flatten_1/1, flatten_2/1, flatten_1_e/1, flatten_2_e/1, dropwhile/1, - sort/1, sort_1/1, sort_stable/1, merge/1, rmerge/1, sort_rand/1, - usort/1, usort_1/1, usort_stable/1, umerge/1, rumerge/1,usort_rand/1, + sort_1/1, sort_stable/1, merge/1, rmerge/1, sort_rand/1, + usort_1/1, usort_stable/1, umerge/1, rumerge/1,usort_rand/1, keymerge/1, rkeymerge/1, - keysort/1, keysort_1/1, keysort_i/1, keysort_stable/1, + keysort_1/1, keysort_i/1, keysort_stable/1, keysort_rand/1, keysort_error/1, ukeymerge/1, rukeymerge/1, - ukeysort/1, ukeysort_1/1, ukeysort_i/1, ukeysort_stable/1, + ukeysort_1/1, ukeysort_i/1, ukeysort_stable/1, ukeysort_rand/1, ukeysort_error/1, funmerge/1, rfunmerge/1, - funsort/1, funsort_1/1, funsort_stable/1, funsort_rand/1, + funsort_1/1, funsort_stable/1, funsort_rand/1, funsort_error/1, ufunmerge/1, rufunmerge/1, - ufunsort/1, ufunsort_1/1, ufunsort_stable/1, ufunsort_rand/1, + ufunsort_1/1, ufunsort_stable/1, ufunsort_rand/1, ufunsort_error/1, zip_unzip/1, zip_unzip3/1, zipwith/1, zipwith3/1, filter_partition/1, - tickets/1, otp_5939/1, otp_6023/1, otp_6606/1, otp_7230/1, + otp_5939/1, otp_6023/1, otp_6606/1, otp_7230/1, suffix/1, subtract/1]). %% Sort randomized lists until stopped. @@ -76,21 +77,59 @@ %% %% all/1 %% -all(doc) -> - []; -all(suite) -> - [append, reverse, member, keymember, keysearch_keyfind, keystore, keytake, - dropwhile, - sort, usort, keysort, ukeysort, - funsort, ufunsort, sublist, flatten, seq, - zip_unzip, zip_unzip3, zipwith, zipwith3, - filter_partition, tickets, suffix, subtract]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, append}, reverse, member, keymember, + keysearch_keyfind, keystore, keytake, dropwhile, {group,sort}, + {group, usort}, {group, keysort}, {group, ukeysort}, + {group, funsort}, {group, ufunsort}, {group, sublist}, + {group, flatten}, {group, seq}, zip_unzip, zip_unzip3, + zipwith, zipwith3, filter_partition, {group, tickets}, + suffix, subtract]. + +groups() -> + [{append, [], [append_1, append_2]}, + {usort, [], + [umerge, rumerge, usort_1, usort_rand, usort_stable]}, + {keysort, [], + [keymerge, rkeymerge, keysort_1, keysort_rand, + keysort_i, keysort_stable, keysort_error]}, + {sort,[],[merge, rmerge, sort_1, sort_rand]}, + {ukeysort, [], + [ukeymerge, rukeymerge, ukeysort_1, ukeysort_rand, + ukeysort_i, ukeysort_stable, ukeysort_error]}, + {funsort, [], + [funmerge, rfunmerge, funsort_1, funsort_stable, + funsort_error, funsort_rand]}, + {ufunsort, [], + [ufunmerge, rufunmerge, ufunsort_1, ufunsort_stable, + ufunsort_error, ufunsort_rand]}, + {seq, [], [seq_loop, seq_2, seq_3, seq_2_e, seq_3_e]}, + {sublist, [], + [sublist_2, sublist_3, sublist_2_e, sublist_3_e]}, + {flatten, [], + [flatten_1, flatten_2, flatten_1_e, flatten_2_e]}, + {tickets, [], [otp_5939, otp_6023, otp_6606, otp_7230]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -98,10 +137,6 @@ fin_per_testcase(_Case, Config) -> % % Test cases starts here. % -append(doc) -> - ["Tests lists:append/1 & lists:append/2"]; -append(suite) -> - [append_1, append_2]. append_1(doc) -> []; append_1(suite) -> []; @@ -346,12 +381,6 @@ keytake(Config) when is_list(Config) -> ?line false = lists:keytake(4, 2, L), ok. -sort(doc) -> - ["Tests merge functions and lists:sort/1"]; -sort(suite) -> - %% [merge, rmerge, sort_1, sort_rand, sort_stable]. - [merge, rmerge, sort_1, sort_rand]. - merge(doc) -> ["merge functions"]; merge(suite) -> []; merge(Config) when is_list(Config) -> @@ -536,10 +565,6 @@ expl_pid([{I,F} | T], L) when is_function(F) -> expl_pid([], L) -> L. -usort(doc) -> - ["Tests unique merge functions and lists:usort/1"]; -usort(suite) -> - [umerge, rumerge, usort_1, usort_rand, usort_stable]. usort_1(suite) -> []; usort_1(doc) -> [""]; @@ -750,11 +775,6 @@ ucheck_stability(L) -> U = lists:usort(L), check_stab(L, U, S, "usort/1", "ukeysort/2"). -keysort(doc) -> - ["Tests lists:keysort/2"]; -keysort(suite) -> - [keymerge, rkeymerge, - keysort_1, keysort_rand, keysort_i, keysort_stable, keysort_error]. keymerge(doc) -> ["Key merge two lists."]; keymerge(suite) -> []; @@ -946,11 +966,6 @@ keycompare(I, J, A, B) when element(I, A) == element(I, B), element(J, A) =< element(J, B) -> ok. -ukeysort(doc) -> - ["Tests lists:ukeysort/2"]; -ukeysort(suite) -> - [ukeymerge, rukeymerge, - ukeysort_1, ukeysort_rand, ukeysort_i, ukeysort_stable, ukeysort_error]. ukeymerge(suite) -> []; ukeymerge(doc) -> ["Merge two lists while removing duplicates."]; @@ -1240,11 +1255,6 @@ ukeycompare(I, J, A, B) when A =/= B, ok. -funsort(doc) -> - ["Tests lists:sort/2"]; -funsort(suite) -> - [funmerge, rfunmerge, - funsort_1, funsort_stable, funsort_error, funsort_rand]. funmerge(doc) -> ["Merge two lists using a fun."]; funmerge(suite) -> []; @@ -1377,11 +1387,6 @@ funsort_check(I, Input, Expected) -> ?line Expected = funsort(I, Input), check_sorted(I, Input, Expected). -ufunsort(doc) -> - ["Tests lists:usort/2"]; -ufunsort(suite) -> - [ufunmerge, rufunmerge, - ufunsort_1, ufunsort_stable, ufunsort_error, ufunsort_rand]. ufunmerge(suite) -> []; ufunmerge(doc) -> ["Merge two lists while removing duplicates using a fun."]; @@ -2076,12 +2081,6 @@ rkeymerge2_2(_I, T1, _E1, [], M, H1) -> %%%------------------------------------------------------------ -seq(doc) -> - ["Tests lists:seq/3"]; -seq(suite) -> - [ - seq_loop, - seq_2, seq_3, seq_2_e, seq_3_e]. seq_loop(doc) -> ["Test for infinite loop (OTP-2404)."]; @@ -2229,10 +2228,6 @@ property(From, To, Step) -> %%%------------------------------------------------------------ -sublist(doc) -> - ["Tests lists:sublist/[2,3]"]; -sublist(suite) -> - [sublist_2, sublist_3, sublist_2_e, sublist_3_e]. -define(sublist_error2(X,Y), ?line {'EXIT', _} = (catch lists:sublist(X,Y))). -define(sublist_error3(X,Y,Z), ?line {'EXIT', _} = (catch lists:sublist(X,Y,Z))). @@ -2326,10 +2321,6 @@ sublist_3_e(Config) when is_list(Config) -> %%%------------------------------------------------------------ -flatten(doc) -> - ["Tests lists:flatten/[1,2]"]; -flatten(suite) -> - [flatten_1, flatten_2, flatten_1_e, flatten_2_e]. -define(flatten_error1(X), ?line {'EXIT', _} = (catch lists:flatten(X))). -define(flatten_error2(X,Y), ?line {'EXIT', _} = (catch lists:flatten(X,Y))). @@ -2489,10 +2480,6 @@ filpart(F, All, Exp) -> Other = lists:filter(fun(E) -> not F(E) end, All), {Exp,Other} = lists:partition(F, All). -tickets(doc) -> - ["Ticktes."]; -tickets(suite) -> - [otp_5939, otp_6023, otp_6606, otp_7230]. otp_5939(doc) -> ["OTP-5939. Guard tests added."]; otp_5939(suite) -> []; diff --git a/lib/stdlib/test/log_mf_h_SUITE.erl b/lib/stdlib/test/log_mf_h_SUITE.erl index 640261f665..688be31e64 100644 --- a/lib/stdlib/test/log_mf_h_SUITE.erl +++ b/lib/stdlib/test/log_mf_h_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -18,12 +18,32 @@ %% -module(log_mf_h_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). --export([all/1, test/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, test/1]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [test]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> [test]. %%----------------------------------------------------------------- diff --git a/lib/stdlib/test/ms_transform_SUITE.erl b/lib/stdlib/test/ms_transform_SUITE.erl index 2d90d5b823..f747d09f3c 100644 --- a/lib/stdlib/test/ms_transform_SUITE.erl +++ b/lib/stdlib/test/ms_transform_SUITE.erl @@ -19,9 +19,10 @@ -module(ms_transform_SUITE). -author('[email protected]'). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([basic_ets/1]). -export([basic_dbg/1]). -export([from_shell/1]). @@ -38,21 +39,40 @@ -export([float_1_function/1]). -export([action_function/1]). -export([warnings/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). init_per_testcase(_Func, Config) -> Dog=test_server:timetrap(test_server:seconds(360)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog). -all(suite) -> [from_shell,basic_ets,basic_dbg,records,record_index,multipass, - bitsyntax, record_defaults, andalso_orelse, - float_1_function, action_function, - warnings, - top_match, old_guards, autoimported, semicolon]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [from_shell, basic_ets, basic_dbg, records, + record_index, multipass, bitsyntax, record_defaults, + andalso_orelse, float_1_function, action_function, + warnings, top_match, old_guards, autoimported, + semicolon]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% This may be subject to change -define(WARN_NUMBER_SHADOW,50). diff --git a/lib/stdlib/test/naughty_child.erl b/lib/stdlib/test/naughty_child.erl index b56130929c..b939436bfc 100644 --- a/lib/stdlib/test/naughty_child.erl +++ b/lib/stdlib/test/naughty_child.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% 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 diff --git a/lib/stdlib/test/proc_lib_SUITE.erl b/lib/stdlib/test/proc_lib_SUITE.erl index 2fd7725335..25a385950e 100644 --- a/lib/stdlib/test/proc_lib_SUITE.erl +++ b/lib/stdlib/test/proc_lib_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -23,10 +23,12 @@ %% %%-define(STANDALONE,1). --export([all/1, crash/1, sync_start/1, sync_start_nolink/1, sync_start_link/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + crash/1, sync_start_nolink/1, sync_start_link/1, spawn_opt/1, sp1/0, sp2/0, sp3/1, sp4/2, sp5/1, hibernate/1]). --export([tickets/1, otp_6345/1]). +-export([ otp_6345/1]). -export([hib_loop/1, awaken/1]). @@ -40,12 +42,32 @@ -ifdef(STANDALONE). -define(line, noop, ). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -endif. -all(suite) -> [crash, sync_start, spawn_opt, hibernate, tickets]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [crash, {group, sync_start}, spawn_opt, hibernate, + {group, tickets}]. + +groups() -> + [{tickets, [], [otp_6345]}, + {sync_start, [], [sync_start_nolink, sync_start_link]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -tickets(suite) -> [otp_6345]. %%----------------------------------------------------------------- %% We don't have to test that spwn and spawn_link actually spawns @@ -127,7 +149,6 @@ crash(Config) when is_list(Config) -> ok end. -sync_start(suite) -> [sync_start_nolink, sync_start_link]. sync_start_nolink(Config) when is_list(Config) -> _Pid = spawn_link(?MODULE, sp5, [self()]), diff --git a/lib/stdlib/test/qlc_SUITE.erl b/lib/stdlib/test/qlc_SUITE.erl index e21de8770a..05d8c5f8e3 100644 --- a/lib/stdlib/test/qlc_SUITE.erl +++ b/lib/stdlib/test/qlc_SUITE.erl @@ -43,7 +43,7 @@ -define(testcase, current_testcase). % don't know -define(t, test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(datadir, ?config(data_dir, Config)). -define(privdir, ?config(priv_dir, Config)). -define(testcase, ?config(?TESTCASE, Config)). @@ -51,36 +51,33 @@ -include_lib("stdlib/include/ms_transform.hrl"). --export([all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). --export([parse_transform/1, - badarg/1, nested_qlc/1, unused_var/1, lc/1, fun_clauses/1, - filter_var/1, single/1, exported_var/1, generator_vars/1, - nomatch/1, errors/1, pattern/1, +-export([ + badarg/1, nested_qlc/1, unused_var/1, lc/1, fun_clauses/1, + filter_var/1, single/1, exported_var/1, generator_vars/1, + nomatch/1, errors/1, pattern/1, - evaluation/1, - eval/1, cursor/1, fold/1, eval_unique/1, eval_cache/1, append/1, - evaluator/1, string_to_handle/1, table/1, process_dies/1, - sort/1, keysort/1, filesort/1, cache/1, cache_list/1, filter/1, - info/1, nested_info/1, lookup1/1, lookup2/1, lookup_rec/1, - indices/1, pre_fun/1, skip_filters/1, + eval/1, cursor/1, fold/1, eval_unique/1, eval_cache/1, append/1, + evaluator/1, string_to_handle/1, table/1, process_dies/1, + sort/1, keysort/1, filesort/1, cache/1, cache_list/1, filter/1, + info/1, nested_info/1, lookup1/1, lookup2/1, lookup_rec/1, + indices/1, pre_fun/1, skip_filters/1, - table_impls/1, - ets/1, dets/1, + ets/1, dets/1, - join/1, - join_option/1, join_filter/1, join_lookup/1, join_merge/1, - join_sort/1, join_complex/1, + join_option/1, join_filter/1, join_lookup/1, join_merge/1, + join_sort/1, join_complex/1, - tickets/1, - otp_5644/1, otp_5195/1, otp_6038_bug/1, otp_6359/1, otp_6562/1, - otp_6590/1, otp_6673/1, otp_6964/1, otp_7114/1, otp_7238/1, - otp_7232/1, otp_7552/1, otp_6674/1, otp_7714/1, + otp_5644/1, otp_5195/1, otp_6038_bug/1, otp_6359/1, otp_6562/1, + otp_6590/1, otp_6673/1, otp_6964/1, otp_7114/1, otp_7238/1, + otp_7232/1, otp_7552/1, otp_6674/1, otp_7714/1, - manpage/1, + manpage/1, - compat/1, - backward/1, forward/1]). + backward/1, forward/1]). %% Internal exports. -export([bad_table_throw/1, bad_table_exit/1, default_table/1, bad_table/1, @@ -114,17 +111,50 @@ init_per_testcase(Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{?TESTCASE, Case}, {watchdog, Dog} | Config]. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> Dog = ?config(watchdog, _Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [parse_transform, evaluation, table_impls, join, tickets, manpage, compat]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, parse_transform}, {group, evaluation}, + {group, table_impls}, {group, join}, {group, tickets}, + manpage, {group, compat}]. + +groups() -> + [{parse_transform, [], + [badarg, nested_qlc, unused_var, lc, fun_clauses, + filter_var, single, exported_var, generator_vars, + nomatch, errors, pattern]}, + {evaluation, [], + [eval, cursor, fold, eval_unique, eval_cache, append, + evaluator, string_to_handle, table, process_dies, sort, + keysort, filesort, cache, cache_list, filter, info, + nested_info, lookup1, lookup2, lookup_rec, indices, + pre_fun, skip_filters]}, + {table_impls, [], [ets, dets]}, + {join, [], + [join_option, join_filter, join_lookup, join_merge, + join_sort, join_complex]}, + {tickets, [], + [otp_5644, otp_5195, otp_6038_bug, otp_6359, otp_6562, + otp_6590, otp_6673, otp_6964, otp_7114, otp_7232, + otp_7238, otp_7552, otp_6674, otp_7714]}, + {compat, [], [backward, forward]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. -parse_transform(suite) -> - [badarg, nested_qlc, unused_var, lc, fun_clauses, filter_var, - single, exported_var, generator_vars, nomatch, errors, pattern]. +end_per_group(_GroupName, Config) -> + Config. badarg(doc) -> "Badarg."; @@ -461,11 +491,6 @@ pattern(Config) when is_list(Config) -> -record(k, {t,v}).\n">>, Ts), ok. -evaluation(suite) -> - [eval, cursor, fold, eval_unique, eval_cache, append, evaluator, - string_to_handle, table, process_dies, sort, keysort, filesort, cache, - cache_list, filter, info, nested_info, lookup1, lookup2, lookup_rec, - indices, pre_fun, skip_filters]. eval(doc) -> "eval/2"; @@ -4297,8 +4322,6 @@ skip_filters(Config) when is_list(Config) -> ok. -table_impls(suite) -> - [ets, dets]. ets(doc) -> "ets:table/1,2."; @@ -4445,9 +4468,6 @@ dets(Config) when is_list(Config) -> _ = file:delete(Fname), ok. -join(suite) -> - [join_option, join_filter, join_lookup, join_merge, - join_sort, join_complex]. join_option(doc) -> "The 'join' option (any, lookup, merge, nested_loop). Also cache/unique."; @@ -5729,10 +5749,6 @@ join_complex(Config) when is_list(Config) -> ok. -tickets(suite) -> - [otp_5644, otp_5195, otp_6038_bug, otp_6359, otp_6562, otp_6590, - otp_6673, otp_6964, otp_7114, otp_7232, otp_7238, otp_7552, otp_6674, - otp_7714]. otp_5644(doc) -> "OTP-5644. Handle the new language element M:F/A."; @@ -7378,8 +7394,6 @@ gb_iter(I0, N, EFun) -> end. ">>. -compat(suite) -> - [backward, forward]. backward(doc) -> "OTP-6674. Join info and extra constants."; diff --git a/lib/stdlib/test/queue_SUITE.erl b/lib/stdlib/test/queue_SUITE.erl index 2cd6b52311..4095b62643 100644 --- a/lib/stdlib/test/queue_SUITE.erl +++ b/lib/stdlib/test/queue_SUITE.erl @@ -17,13 +17,14 @@ %% %CopyrightEnd% %% -module(queue_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([do/1, to_list/1, io_test/1, op_test/1, error/1, oops/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -31,16 +32,32 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(doc) -> - ["Test cases for queue."]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [do, to_list, io_test, op_test, error, oops]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + do(doc) -> [""]; do(suite) -> diff --git a/lib/stdlib/test/random_SUITE.erl b/lib/stdlib/test/random_SUITE.erl index 8f1c304705..6164301e38 100644 --- a/lib/stdlib/test/random_SUITE.erl +++ b/lib/stdlib/test/random_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -17,13 +17,14 @@ %% %CopyrightEnd% -module(random_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([interval_1/1, seed0/1, seed/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -31,16 +32,32 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(doc) -> - ["Test cases for random."]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [interval_1, seed0, seed]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + seed0(doc) -> ["Test that seed is set implicitly, and always the same."]; seed0(suite) -> diff --git a/lib/stdlib/test/random_iolist.erl b/lib/stdlib/test/random_iolist.erl index 4bce347d9a..8f21b5a3b3 100644 --- a/lib/stdlib/test/random_iolist.erl +++ b/lib/stdlib/test/random_iolist.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 diff --git a/lib/stdlib/test/random_unicode_list.erl b/lib/stdlib/test/random_unicode_list.erl index 3e83383b08..b8bd719b89 100644 --- a/lib/stdlib/test/random_unicode_list.erl +++ b/lib/stdlib/test/random_unicode_list.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl index 46a84d4e24..b82835854e 100644 --- a/lib/stdlib/test/re_SUITE.erl +++ b/lib/stdlib/test/re_SUITE.erl @@ -18,12 +18,41 @@ %% -module(re_SUITE). --export([all/1, pcre/1,compile_options/1,run_options/1,combined_options/1,replace_autogen/1,global_capture/1,replace_input_types/1,replace_return/1,split_autogen/1,split_options/1,split_specials/1,error_handling/1,pcre_cve_2008_2371/1,pcre_compile_workspace_overflow/1,re_infinite_loop/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, pcre/1,compile_options/1, + run_options/1,combined_options/1,replace_autogen/1, + global_capture/1,replace_input_types/1,replace_return/1, + split_autogen/1,split_options/1,split_specials/1, + error_handling/1,pcre_cve_2008_2371/1, + pcre_compile_workspace_overflow/1,re_infinite_loop/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). -all(suite) -> [pcre,compile_options,run_options,combined_options,replace_autogen,global_capture,replace_input_types,replace_return,split_autogen,split_options,split_specials,error_handling,pcre_cve_2008_2371,pcre_compile_workspace_overflow,re_infinite_loop]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [pcre, compile_options, run_options, combined_options, + replace_autogen, global_capture, replace_input_types, + replace_return, split_autogen, split_options, + split_specials, error_handling, pcre_cve_2008_2371, + pcre_compile_workspace_overflow, re_infinite_loop]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + pcre(doc) -> ["Run all applicable tests from the PCRE testsuites."]; diff --git a/lib/stdlib/test/select_SUITE.erl b/lib/stdlib/test/select_SUITE.erl index 6900f1a8f5..af67b798b0 100644 --- a/lib/stdlib/test/select_SUITE.erl +++ b/lib/stdlib/test/select_SUITE.erl @@ -37,7 +37,7 @@ -export([config/2]). -define(fmt(A,B),io:format(A,B)). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(fmt(A,B),test_server:format(A,B)). -endif. @@ -58,23 +58,41 @@ config(priv_dir,_) -> ".". -else. %% When run in test server. --export([all/1,select_test/1,init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,select_test/1, + init_per_testcase/2, end_per_testcase/2, return_values/1]). init_per_testcase(_Case, Config) when is_list(Config) -> ?line Dog=test_server:timetrap(test_server:seconds(1200)), [{watchdog, Dog}|Config]. - -fin_per_testcase(_Case, Config) -> + +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(doc) -> - ["Test ets:select"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [return_values, select_test]. - + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + select_test(suite) -> []; select_test(doc) -> diff --git a/lib/stdlib/test/sets_SUITE.erl b/lib/stdlib/test/sets_SUITE.erl index c9f1a03598..bce23c7b12 100644 --- a/lib/stdlib/test/sets_SUITE.erl +++ b/lib/stdlib/test/sets_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -22,13 +22,15 @@ -module(sets_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, create/1,add_element/1,del_element/1, subtract/1,intersection/1,union/1,is_subset/1, is_set/1,fold/1,filter/1, take_smallest/1,take_largest/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -import(lists, [foldl/3,reverse/1]). @@ -36,15 +38,33 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?t:minutes(5)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [create,add_element,del_element,subtract, - intersection,union,is_subset,is_set,fold,filter, - take_smallest,take_largest]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [create, add_element, del_element, subtract, + intersection, union, is_subset, is_set, fold, filter, + take_smallest, take_largest]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + create(Config) when is_list(Config) -> test_all(fun create_1/1). diff --git a/lib/stdlib/test/sets_test_lib.erl b/lib/stdlib/test/sets_test_lib.erl index 6b6fb00550..bdfb0d59d2 100644 --- a/lib/stdlib/test/sets_test_lib.erl +++ b/lib/stdlib/test/sets_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 diff --git a/lib/stdlib/test/shell_SUITE.erl b/lib/stdlib/test/shell_SUITE.erl index 588342d46a..4f8c9dffd3 100644 --- a/lib/stdlib/test/shell_SUITE.erl +++ b/lib/stdlib/test/shell_SUITE.erl @@ -17,21 +17,22 @@ %% %CopyrightEnd% %% -module(shell_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([forget/1, records/1, known_bugs/1, otp_5226/1, otp_5327/1, - otp_5435/1, otp_5195/1, otp_5915/1, otp_5916/1, - bits/1, bs_match_misc_SUITE/1, bs_match_int_SUITE/1, - bs_match_tail_SUITE/1, bs_match_bin_SUITE/1, - bs_construct_SUITE/1, - refman/1, refman_bit_syntax/1, - progex/1, progex_bit_syntax/1, progex_records/1, - progex_lc/1, progex_funs/1, - tickets/1, otp_5990/1, otp_6166/1, otp_6554/1, otp_6785/1, - otp_7184/1, otp_7232/1, otp_8393/1]). - --export([restricted/1, start_restricted_from_shell/1, - start_restricted_on_command_line/1,restricted_local/1]). + otp_5435/1, otp_5195/1, otp_5915/1, otp_5916/1, + bs_match_misc_SUITE/1, bs_match_int_SUITE/1, + bs_match_tail_SUITE/1, bs_match_bin_SUITE/1, + bs_construct_SUITE/1, + refman_bit_syntax/1, + progex_bit_syntax/1, progex_records/1, + progex_lc/1, progex_funs/1, + otp_5990/1, otp_6166/1, otp_6554/1, otp_6785/1, + otp_7184/1, otp_7232/1, otp_8393/1]). + +-export([ start_restricted_from_shell/1, + start_restricted_on_command_line/1,restricted_local/1]). %% Internal export. -export([otp_5435_2/0, prompt1/1, prompt2/1, prompt3/1, prompt4/1, @@ -50,8 +51,8 @@ config(priv_dir,_) -> ".". -else. --include("test_server.hrl"). --export([init_per_testcase/2, fin_per_testcase/2]). +-include_lib("test_server/include/test_server.hrl"). +-export([init_per_testcase/2, end_per_testcase/2]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(2)). init_per_testcase(_Case, Config) -> @@ -60,7 +61,7 @@ init_per_testcase(_Case, Config) -> ?line code:add_patha(?config(priv_dir,Config)), [{orig_path,OrigPath}, {watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> ?line Dog = ?config(watchdog, Config), ?line test_server:timetrap_cancel(Dog), ?line OrigPath = ?config(orig_path,Config), @@ -71,18 +72,44 @@ fin_per_testcase(_Case, Config) -> ok. -endif. -all(doc) -> - ["Test cases for the 'shell' module."]; -all(suite) -> - [forget, records, known_bugs, otp_5226, otp_5327, otp_5435, otp_5195, - otp_5915, otp_5916, bits, refman, progex, tickets, restricted]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [forget, records, known_bugs, otp_5226, otp_5327, + otp_5435, otp_5195, otp_5915, otp_5916, {group, bits}, + {group, refman}, {group, progex}, {group, tickets}, + {group, restricted}]. + +groups() -> + [{restricted, [], + [start_restricted_from_shell, + start_restricted_on_command_line, restricted_local]}, + {bits, [], + [bs_match_misc_SUITE, bs_match_tail_SUITE, + bs_match_bin_SUITE, bs_construct_SUITE]}, + {refman, [], [refman_bit_syntax]}, + {progex, [], + [progex_bit_syntax, progex_records, progex_lc, + progex_funs]}, + {tickets, [], + [otp_5990, otp_6166, otp_6554, otp_6785, otp_7184, + otp_7232, otp_8393]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -record(state, {bin, reply, leader}). -restricted(doc) -> - ["Test restricted_shell"]; -restricted(suite) -> - [start_restricted_from_shell,start_restricted_on_command_line,restricted_local]. start_restricted_from_shell(doc) -> ["Test that a restricted shell can be started from the normal shell"]; @@ -797,9 +824,6 @@ otp_5916(Config) when is_list(Config) -> [ok] = scan(C), ok. -bits(suite) -> - [bs_match_misc_SUITE, % bs_match_int_SUITE/, - bs_match_tail_SUITE, bs_match_bin_SUITE, bs_construct_SUITE]. bs_match_misc_SUITE(doc) -> ["OTP-5327. Adopted from parts of emulator/test/bs_match_misc_SUITE.erl."]; @@ -1520,8 +1544,6 @@ evaluate(Str, Vars) -> Result end. -refman(suite) -> - [refman_bit_syntax]. refman_bit_syntax(doc) -> ["Bit syntax examples from the Reference Manual. OTP-5237."]; @@ -1564,8 +1586,6 @@ refman_bit_syntax(Config) when is_list(Config) -> ?line <<2,4,6>> = << << (X*2) >> || <<X>> <= << 1,2,3 >> >>, ok. -progex(suite) -> - [progex_bit_syntax, progex_records, progex_lc, progex_funs]. -define(IP_VERSION, 4). -define(IP_MIN_HDR_LEN, 5). @@ -2256,8 +2276,6 @@ progex_funs(Config) when is_list(Config) -> ?line [ok] = scan(Test2_shell), ok. -tickets(suite) -> - [otp_5990, otp_6166, otp_6554, otp_6785, otp_7184, otp_7232, otp_8393]. otp_5990(doc) -> "OTP-5990. {erlang,is_record}."; diff --git a/lib/stdlib/test/slave_SUITE.erl b/lib/stdlib/test/slave_SUITE.erl index 5c1282fe9b..12325dcca9 100644 --- a/lib/stdlib/test/slave_SUITE.erl +++ b/lib/stdlib/test/slave_SUITE.erl @@ -18,18 +18,37 @@ %% -module(slave_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, t_start/1, t_start_link/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, t_start/1, t_start_link/1, start_link_nodedown/1, errors/1]). %% Internal exports. -export([fun_init/1, test_errors/1]). -export([timeout_test/1, auth_test/1, rsh_test/1, start_a_slave/3]). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [t_start_link, start_link_nodedown, t_start, errors]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + t_start_link(suite) -> []; t_start_link(Config) when is_list(Config) -> ?line Dog = test_server:timetrap(test_server:seconds(20)), diff --git a/lib/stdlib/test/sofs_SUITE.erl b/lib/stdlib/test/sofs_SUITE.erl index d60cfc6895..e1eaf7f8ec 100644 --- a/lib/stdlib/test/sofs_SUITE.erl +++ b/lib/stdlib/test/sofs_SUITE.erl @@ -26,13 +26,14 @@ -define(config(X,Y), foo). -define(t, test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -endif. --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([sofs/1, from_term_1/1, set_1/1, from_sets_1/1, relation_1/1, +-export([ from_term_1/1, set_1/1, from_sets_1/1, relation_1/1, a_function_1/1, family_1/1, projection/1, relation_to_family_1/1, domain_1/1, range_1/1, image/1, inverse_image/1, inverse_1/1, converse_1/1, no_elements_1/1, @@ -47,7 +48,7 @@ multiple_relative_product/1, digraph/1, constant_function/1, misc/1]). --export([sofs_family/1, family_specification/1, +-export([ family_specification/1, family_domain_1/1, family_range_1/1, family_to_relation_1/1, union_of_family_1/1, intersection_of_family_1/1, @@ -81,18 +82,56 @@ union/1, union/2, family_to_digraph/1, family_to_digraph/2, digraph_to_family/1, digraph_to_family/2]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -compile({inline,[{eval,2}]}). -all(suite) -> - [sofs, sofs_family]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, sofs}, {group, sofs_family}]. + +groups() -> + [{sofs, [], + [from_term_1, set_1, from_sets_1, relation_1, + a_function_1, family_1, relation_to_family_1, domain_1, + range_1, image, inverse_image, inverse_1, converse_1, + no_elements_1, substitution, restriction, drestriction, + projection, strict_relation_1, extension, + weak_relation_1, to_sets_1, specification, union_1, + intersection_1, difference, symdiff, + symmetric_partition, is_sofs_set_1, is_set_1, is_equal, + is_subset, is_a_function_1, is_disjoint, join, + canonical, composite_1, relative_product_1, + relative_product_2, product_1, partition_1, partition_3, + multiple_relative_product, digraph, constant_function, + misc]}, + {sofs_family, [], + [family_specification, family_domain_1, family_range_1, + family_to_relation_1, union_of_family_1, + intersection_of_family_1, family_projection, + family_difference, family_intersection_1, + family_intersection_2, family_union_1, family_union_2, + partition_family]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> Dog=?t:timetrap(?t:minutes(2)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -100,18 +139,6 @@ fin_per_testcase(_Case, Config) -> %% [{2,b},{1,a,b}] == lists:sort([{2,b},{1,a,b}]) %% [{1,a,b},{2,b}] == lists:keysort(1,[{2,b},{1,a,b}]) -sofs(suite) -> - [from_term_1, set_1, from_sets_1, relation_1, a_function_1, - family_1, relation_to_family_1, domain_1, range_1, image, - inverse_image, inverse_1, converse_1, no_elements_1, - substitution, restriction, drestriction, projection, - strict_relation_1, extension, weak_relation_1, to_sets_1, - specification, union_1, intersection_1, difference, symdiff, - symmetric_partition, is_sofs_set_1, is_set_1, is_equal, - is_subset, is_a_function_1, is_disjoint, join, canonical, - composite_1, relative_product_1, relative_product_2, product_1, - partition_1, partition_3, multiple_relative_product, digraph, - constant_function, misc]. from_term_1(suite) -> []; from_term_1(doc) -> [""]; @@ -1934,12 +1961,6 @@ relational_restriction(R) -> Fun = fun(S) -> no_elements(S) > 1 end, family_to_relation(family_specification(Fun, relation_to_family(R))). -sofs_family(suite) -> - [family_specification, family_domain_1, family_range_1, - family_to_relation_1, union_of_family_1, intersection_of_family_1, - family_projection, family_difference, - family_intersection_1, family_intersection_2, - family_union_1, family_union_2, partition_family]. family_specification(suite) -> []; family_specification(doc) -> [""]; diff --git a/lib/stdlib/test/stdlib.cover b/lib/stdlib/test/stdlib.cover index b98d949889..61f4f064b9 100644 --- a/lib/stdlib/test/stdlib.cover +++ b/lib/stdlib/test/stdlib.cover @@ -1,10 +1,17 @@ %% -*- erlang -*- -{exclude, - [erl_parse, - ets, - filename, - gen_event, - gen_server, - gen, - lists, - proc_lib]}. +{incl_app,stdlib,details}. + +{excl_mods,stdlib, + [erl_parse, + erl_eval, + ets, + filename, + gen_event, + gen_server, + gen, + lists, + io, + io_lib, + io_lib_format, + io_lib_pretty, + proc_lib]}. diff --git a/lib/stdlib/test/stdlib.spec b/lib/stdlib/test/stdlib.spec index bbfb43bd15..3768e494b2 100644 --- a/lib/stdlib/test/stdlib.spec +++ b/lib/stdlib/test/stdlib.spec @@ -1,4 +1 @@ -{topcase, {dir, "../stdlib_test"}}. -%{skip,{dets_SUITE,open_file_1,"Crashes Windows tests"}}. -%{skip,{dets_SUITE,fold,"Crashes Windows tests"}}. -%{skip,{dets_SUITE,match,"Crashes Windows tests"}}. +{suites,"../stdlib_test",all}. diff --git a/lib/stdlib/test/stdlib_SUITE.erl b/lib/stdlib/test/stdlib_SUITE.erl index d46a2caf90..0cca030b3d 100644 --- a/lib/stdlib/test/stdlib_SUITE.erl +++ b/lib/stdlib/test/stdlib_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -20,7 +20,7 @@ %%% Purpose:Stdlib application test suite. %%%----------------------------------------------------------------- -module(stdlib_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). @@ -28,8 +28,9 @@ -define(application, stdlib). % Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). % Test cases must be exported. -export([app_test/1]). @@ -38,15 +39,31 @@ %% %% all/1 %% -all(doc) -> - []; -all(suite) -> - [?cases]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [app_test]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -58,7 +75,7 @@ app_test(suite) -> []; app_test(doc) -> ["Application consistency test."]; -app_test(Config) when list(Config) -> +app_test(Config) when is_list(Config) -> ?t:app_test(stdlib), ok. diff --git a/lib/stdlib/test/string_SUITE.erl b/lib/stdlib/test/string_SUITE.erl index 452e048dd7..7e52441a67 100644 --- a/lib/stdlib/test/string_SUITE.erl +++ b/lib/stdlib/test/string_SUITE.erl @@ -20,15 +20,16 @@ %%% Purpose: string test suite. %%%----------------------------------------------------------------- -module(string_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). % Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). % Test cases must be exported. -export([len/1,equal/1,concat/1,chr_rchr/1,str_rstr/1]). @@ -40,19 +41,34 @@ %% %% all/1 %% -all(doc) -> - []; -all(suite) -> - [len,equal,concat,chr_rchr,str_rstr, - span_cspan,substr,tokens,chars, - copies,words,strip,sub_word,left_right, - sub_string,centre, join, - to_integer,to_float,to_upper_to_lower]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [len, equal, concat, chr_rchr, str_rstr, span_cspan, + substr, tokens, chars, copies, words, strip, sub_word, + left_right, sub_string, centre, join, to_integer, + to_float, to_upper_to_lower]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/stdlib/test/supervisor_1.erl b/lib/stdlib/test/supervisor_1.erl index 297550b230..3198be0fed 100644 --- a/lib/stdlib/test/supervisor_1.erl +++ b/lib/stdlib/test/supervisor_1.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl index 039ea298c4..8aed93ce12 100644 --- a/lib/stdlib/test/supervisor_SUITE.erl +++ b/lib/stdlib/test/supervisor_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -20,49 +20,104 @@ -module(supervisor_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Testserver specific export --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, + end_per_testcase/2]). %% Indirect spawn export -export([init/1]). %% API tests --export([sup_start/1, sup_start_normal/1, sup_start_ignore_init/1, +-export([ sup_start_normal/1, sup_start_ignore_init/1, sup_start_ignore_child/1, sup_start_error_return/1, - sup_start_fail/1, sup_stop/1, sup_stop_infinity/1, + sup_start_fail/1, sup_stop_infinity/1, sup_stop_timeout/1, sup_stop_brutal_kill/1, child_adm/1, child_adm_simple/1, child_specs/1, extra_return/1]). %% Tests concept permanent, transient and temporary --export([normal_termination/1, permanent_normal/1, transient_normal/1, - temporary_normal/1, abnormal_termination/1, +-export([ permanent_normal/1, transient_normal/1, + temporary_normal/1, permanent_abnormal/1, transient_abnormal/1, temporary_abnormal/1]). %% Restart strategy tests --export([restart_one_for_one/1, one_for_one/1, - one_for_one_escalation/1, restart_one_for_all/1, one_for_all/1, - one_for_all_escalation/1, restart_simple_one_for_one/1, +-export([ one_for_one/1, + one_for_one_escalation/1, one_for_all/1, + one_for_all_escalation/1, simple_one_for_one/1, simple_one_for_one_escalation/1, - restart_rest_for_one/1, rest_for_one/1, rest_for_one_escalation/1, + rest_for_one/1, rest_for_one_escalation/1, simple_one_for_one_extra/1]). %% Misc tests --export([child_unlink/1, tree/1, count_children_memory/1]). +-export([child_unlink/1, tree/1, count_children_memory/1, + do_not_save_start_parameters_for_temporary_children/1]). %------------------------------------------------------------------------- -all(suite) -> - {req,[stdlib], - [sup_start, sup_stop, child_adm, - child_adm_simple, extra_return, child_specs, - restart_one_for_one, restart_one_for_all, - restart_simple_one_for_one, restart_rest_for_one, - normal_termination, abnormal_termination, child_unlink, tree, - count_children_memory]}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, sup_start}, {group, sup_stop}, child_adm, + child_adm_simple, extra_return, child_specs, + {group, restart_one_for_one}, + {group, restart_one_for_all}, + {group, restart_simple_one_for_one}, + {group, restart_rest_for_one}, + {group, normal_termination}, + {group, abnormal_termination}, child_unlink, tree, + count_children_memory, do_not_save_start_parameters_for_temporary_children]. + +groups() -> + [{sup_start, [], + [sup_start_normal, sup_start_ignore_init, + sup_start_ignore_child, sup_start_error_return, + sup_start_fail]}, + {sup_stop, [], + [sup_stop_infinity, sup_stop_timeout, + sup_stop_brutal_kill]}, + {normal_termination, [], + [permanent_normal, transient_normal, temporary_normal]}, + {abnormal_termination, [], + [permanent_abnormal, transient_abnormal, + temporary_abnormal]}, + {restart_one_for_one, [], + [one_for_one, one_for_one_escalation]}, + {restart_one_for_all, [], + [one_for_all, one_for_all_escalation]}, + {restart_simple_one_for_one, [], + [simple_one_for_one, simple_one_for_one_extra, + simple_one_for_one_escalation]}, + {restart_rest_for_one, [], + [rest_for_one, rest_for_one_escalation]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +init_per_testcase(count_children_memory, Config) -> + MemoryState = erlang:system_info(allocator), + case count_children_allocator_test(MemoryState) of + true -> Config; + false -> + {skip, "+Meamin used during test; erlang:memory/1 not available"} + end; +init_per_testcase(_Case, Config) -> + Config. + +end_per_testcase(_Case, _Config) -> + ok. start(InitResult) -> supervisor:start_link({local, sup_test}, ?MODULE, InitResult). @@ -81,19 +136,8 @@ get_child_counts(Supervisor) -> proplists:get_value(supervisors, Counts), proplists:get_value(workers, Counts)]. - %------------------------------------------------------------------------- -% % Test cases starts here. -% -%------------------------------------------------------------------------- - -sup_start(doc) -> - ["Test start of a supervisor."]; -sup_start(suite) -> - [sup_start_normal, sup_start_ignore_init, sup_start_ignore_child, - sup_start_error_return, sup_start_fail]. - %------------------------------------------------------------------------- sup_start_normal(doc) -> ["Tests that the supervisor process starts correctly and that it " @@ -192,12 +236,6 @@ sup_start_fail(Config) when is_list(Config) -> end, ok. %------------------------------------------------------------------------- -sup_stop(doc) -> - ["Tests that the supervisor shoutdowns its children if it is " - "shutdown itself."]; -sup_stop(suite) -> [sup_stop_infinity, sup_stop_timeout, sup_stop_brutal_kill]. - -%------------------------------------------------------------------------- sup_stop_infinity(doc) -> ["See sup_stop/1 when Shutdown = infinity, this walue is only allowed " @@ -549,11 +587,6 @@ child_specs(Config) when is_list(Config) -> ?line ok = supervisor:check_childspecs([C3]), ?line ok = supervisor:check_childspecs([C4]), ok. -%------------------------------------------------------------------------- -normal_termination(doc) -> - ["Testes the supervisors behaviour if a child dies with reason normal"]; -normal_termination(suite) -> - [permanent_normal, transient_normal, temporary_normal]. %------------------------------------------------------------------------- permanent_normal(doc) -> @@ -615,11 +648,6 @@ temporary_normal(Config) when is_list(Config) -> ?line [1,0,0,1] = get_child_counts(sup_test), ok. -%------------------------------------------------------------------------- -abnormal_termination(doc) -> - ["Testes the supervisors behaviour if a child dies with reason abnormal"]; -abnormal_termination(suite) -> - [permanent_abnormal, transient_abnormal, temporary_abnormal]. %------------------------------------------------------------------------- permanent_abnormal(doc) -> @@ -688,12 +716,6 @@ temporary_abnormal(Config) when is_list(Config) -> ok. %------------------------------------------------------------------------- -restart_one_for_one(doc) -> - ["Test that the one_for_one strategy works."]; - -restart_one_for_one(suite) -> [one_for_one, one_for_one_escalation]. - -%------------------------------------------------------------------------- one_for_one(doc) -> ["Test the one_for_one base case."]; one_for_one(suite) -> []; @@ -772,13 +794,6 @@ one_for_one_escalation(Config) when is_list(Config) -> end, ok. %------------------------------------------------------------------------- -restart_one_for_all(doc) -> - ["Test that the one_for_all strategy works."]; - -restart_one_for_all(suite) -> - [one_for_all, one_for_all_escalation]. - -%------------------------------------------------------------------------- one_for_all(doc) -> ["Test the one_for_all base case."]; one_for_all(suite) -> []; @@ -866,14 +881,6 @@ one_for_all_escalation(Config) when is_list(Config) -> ok. %------------------------------------------------------------------------- -restart_simple_one_for_one(doc) -> - ["Test that the simple_one_for_one strategy works."]; - -restart_simple_one_for_one(suite) -> - [simple_one_for_one, simple_one_for_one_extra, - simple_one_for_one_escalation]. - -%------------------------------------------------------------------------- simple_one_for_one(doc) -> ["Test the simple_one_for_one base case."]; simple_one_for_one(suite) -> []; @@ -990,11 +997,6 @@ simple_one_for_one_escalation(Config) when is_list(Config) -> end, ok. %------------------------------------------------------------------------- -restart_rest_for_one(doc) -> - ["Test that the rest_for_one strategy works."]; -restart_rest_for_one(suite) -> [rest_for_one, rest_for_one_escalation]. - -%------------------------------------------------------------------------- rest_for_one(doc) -> ["Test the rest_for_one base case."]; rest_for_one(suite) -> []; @@ -1267,26 +1269,10 @@ tree(Config) when is_list(Config) -> ok. %------------------------------------------------------------------------- -count_children_allocator_test(MemoryState) -> - Allocators = [temp_alloc, eheap_alloc, binary_alloc, ets_alloc, - driver_alloc, sl_alloc, ll_alloc, fix_alloc, std_alloc, - sys_alloc], - MemoryStateList = element(4, MemoryState), - AllocTypes = [lists:keyfind(Alloc, 1, MemoryStateList) - || Alloc <- Allocators], - AllocStates = [lists:keyfind(e, 1, AllocValue) - || {_Type, AllocValue} <- AllocTypes], - lists:all(fun(State) -> State == {e, true} end, AllocStates). - count_children_memory(doc) -> - ["Test that which_children eats memory, but count_children does not."]; + ["Test that count_children does not eat memory."]; count_children_memory(suite) -> - MemoryState = erlang:system_info(allocator), - case count_children_allocator_test(MemoryState) of - true -> []; - false -> - {skip, "+Meamin used during test; erlang:memory/1 not available"} - end; + []; count_children_memory(Config) when is_list(Config) -> process_flag(trap_exit, true), Child = {child, {supervisor_1, start_child, []}, temporary, 1000, @@ -1299,7 +1285,7 @@ count_children_memory(Config) when is_list(Config) -> Children = supervisor:which_children(sup_test), _Size2 = erlang:memory(processes_used), ChildCount = get_child_counts(sup_test), - Size3 = erlang:memory(processes_used), + _Size3 = erlang:memory(processes_used), [supervisor:start_child(sup_test, []) || _Ignore2 <- lists:seq(1,1000)], @@ -1323,8 +1309,8 @@ count_children_memory(Config) when is_list(Config) -> ?line ChildCount3 = ChildCount2, %% count_children consumes memory using an accumulator function, - %% but the space can be reclaimed incrementally, whereas - %% which_children generates a return list. + %% but the space can be reclaimed incrementally, + %% which_children may generate garbage that will reclaimed later. case (Size5 =< Size4) of true -> ok; false -> @@ -1336,19 +1322,98 @@ count_children_memory(Config) when is_list(Config) -> ?line test_server:fail({count_children, used_more_memory}) end, - case Size4 > Size3 of - true -> ok; - false -> - ?line test_server:fail({which_children, used_no_memory}) - end, - case Size6 > Size5 of - true -> ok; - false -> - ?line test_server:fail({which_children, used_no_memory}) - end, - [exit(Pid, kill) || {undefined, Pid, worker, _Modules} <- Children3], test_server:sleep(100), ?line [1,0,0,0] = get_child_counts(sup_test), - ok. +count_children_allocator_test(MemoryState) -> + Allocators = [temp_alloc, eheap_alloc, binary_alloc, ets_alloc, + driver_alloc, sl_alloc, ll_alloc, fix_alloc, std_alloc, + sys_alloc], + MemoryStateList = element(4, MemoryState), + AllocTypes = [lists:keyfind(Alloc, 1, MemoryStateList) + || Alloc <- Allocators], + AllocStates = [lists:keyfind(e, 1, AllocValue) + || {_Type, AllocValue} <- AllocTypes], + lists:all(fun(State) -> State == {e, true} end, AllocStates). +%------------------------------------------------------------------------- +do_not_save_start_parameters_for_temporary_children(doc) -> + ["Temporary children shall not be restarted so they should not" + "save start parameters, as it potentially can" + "take up a huge amount of memory for no purpose."]; +do_not_save_start_parameters_for_temporary_children(suite) -> + []; +do_not_save_start_parameters_for_temporary_children(Config) when is_list(Config) -> + process_flag(trap_exit, true), + dont_save_start_parameters_for_temporary_children(one_for_all), + dont_save_start_parameters_for_temporary_children(one_for_one), + dont_save_start_parameters_for_temporary_children(rest_for_one), + dont_save_start_parameters_for_temporary_children(simple_one_for_one). + +dont_save_start_parameters_for_temporary_children(simple_one_for_one = Type) -> + Permanent = {child, {supervisor_1, start_child, []}, + permanent, 1000, worker, []}, + Transient = {child, {supervisor_1, start_child, []}, + transient, 1000, worker, []}, + Temporary = {child, {supervisor_1, start_child, []}, + temporary, 1000, worker, []}, + {ok, Sup1} = supervisor:start_link(?MODULE, {ok, {{Type, 2, 3600}, [Permanent]}}), + {ok, Sup2} = supervisor:start_link(?MODULE, {ok, {{Type, 2, 3600}, [Transient]}}), + {ok, Sup3} = supervisor:start_link(?MODULE, {ok, {{Type, 2, 3600}, [Temporary]}}), + + LargeList = lists:duplicate(10, "Potentially large"), + + start_children(Sup1, [LargeList], 100), + start_children(Sup2, [LargeList], 100), + start_children(Sup3, [LargeList], 100), + + [{memory,Mem1}] = process_info(Sup1, [memory]), + [{memory,Mem2}] = process_info(Sup2, [memory]), + [{memory,Mem3}] = process_info(Sup3, [memory]), + + true = (Mem3 < Mem1) and (Mem3 < Mem2), + + exit(Sup1, shutdown), + exit(Sup2, shutdown), + exit(Sup3, shutdown); + +dont_save_start_parameters_for_temporary_children(Type) -> + {ok, Sup1} = supervisor:start_link(?MODULE, {ok, {{Type, 2, 3600}, []}}), + {ok, Sup2} = supervisor:start_link(?MODULE, {ok, {{Type, 2, 3600}, []}}), + {ok, Sup3} = supervisor:start_link(?MODULE, {ok, {{Type, 2, 3600}, []}}), + + LargeList = lists:duplicate(10, "Potentially large"), + + Permanent = {child1, {supervisor_1, start_child, [LargeList]}, + permanent, 1000, worker, []}, + Transient = {child2, {supervisor_1, start_child, [LargeList]}, + transient, 1000, worker, []}, + Temporary = {child3, {supervisor_1, start_child, [LargeList]}, + temporary, 1000, worker, []}, + + start_children(Sup1, Permanent, 100), + start_children(Sup2, Transient, 100), + start_children(Sup3, Temporary, 100), + + [{memory,Mem1}] = process_info(Sup1, [memory]), + [{memory,Mem2}] = process_info(Sup2, [memory]), + [{memory,Mem3}] = process_info(Sup3, [memory]), + + true = (Mem3 < Mem1) and (Mem3 < Mem2), + + exit(Sup1, shutdown), + exit(Sup2, shutdown), + exit(Sup3, shutdown). + +start_children(_,_, 0) -> + ok; +start_children(Sup, Args, N) -> + Spec = child_spec(Args, N), + {ok, _, _} = supervisor:start_child(Sup, Spec), + start_children(Sup, Args, N-1). + +child_spec([_|_] = SimpleOneForOneArgs, _) -> + SimpleOneForOneArgs; +child_spec({Name, MFA, RestartType, Shutdown, Type, Modules}, N) -> + NewName = list_to_atom((atom_to_list(Name) ++ integer_to_list(N))), + {NewName, MFA, RestartType, Shutdown, Type, Modules}. diff --git a/lib/stdlib/test/supervisor_bridge_SUITE.erl b/lib/stdlib/test/supervisor_bridge_SUITE.erl index b23bac2d44..407968747c 100644 --- a/lib/stdlib/test/supervisor_bridge_SUITE.erl +++ b/lib/stdlib/test/supervisor_bridge_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -17,16 +17,37 @@ %% %CopyrightEnd% %% -module(supervisor_bridge_SUITE). --export([all/1,starting/1,mini_terminate/1,mini_die/1,badstart/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,starting/1, + mini_terminate/1,mini_die/1,badstart/1]). -export([client/1,init/1,internal_loop_init/1,terminate/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(bridge_name,supervisor_bridge_SUITE_server). -define(work_bridge_name,work_supervisor_bridge_SUITE_server). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> [starting,mini_terminate,mini_die,badstart]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [starting, mini_terminate, mini_die, badstart]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/stdlib/test/sys_SUITE.erl b/lib/stdlib/test/sys_SUITE.erl index e44fd56403..dcb2380910 100644 --- a/lib/stdlib/test/sys_SUITE.erl +++ b/lib/stdlib/test/sys_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -17,9 +17,11 @@ %% %CopyrightEnd% %% -module(sys_SUITE). --export([all/1,log/1,log_to_file/1,stats/1,trace/1,suspend/1,install/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,log/1,log_to_file/1, + stats/1,trace/1,suspend/1,install/1]). -export([handle_call/3,terminate/2,init/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(server,sys_SUITE_server). @@ -29,7 +31,26 @@ %% system messages at all. -all(suite) -> [log,log_to_file,stats,trace,suspend,install]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [log, log_to_file, stats, trace, suspend, install]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/stdlib/test/tar_SUITE.erl b/lib/stdlib/test/tar_SUITE.erl index 7646f4c249..84c3915749 100644 --- a/lib/stdlib/test/tar_SUITE.erl +++ b/lib/stdlib/test/tar_SUITE.erl @@ -18,21 +18,39 @@ %% -module(tar_SUITE). --export([all/1, borderline/1, atomic/1, long_names/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, borderline/1, atomic/1, long_names/1, create_long_names/1, bad_tar/1, errors/1, extract_from_binary/1, extract_from_binary_compressed/1, extract_from_open_file/1, symlinks/1, open_add_close/1, cooked_compressed/1, memory/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). -all(suite) -> [borderline, atomic, long_names, create_long_names, - bad_tar, errors, - extract_from_binary, extract_from_binary_compressed, - extract_from_open_file, - symlinks, open_add_close, cooked_compressed, - memory]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [borderline, atomic, long_names, create_long_names, + bad_tar, errors, extract_from_binary, + extract_from_binary_compressed, extract_from_open_file, + symlinks, open_add_close, cooked_compressed, memory]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + borderline(doc) -> ["Test creating, listing and extracting one file from an archive", diff --git a/lib/stdlib/test/timer_SUITE.erl b/lib/stdlib/test/timer_SUITE.erl index 5f38c91c64..cc05e3d832 100644 --- a/lib/stdlib/test/timer_SUITE.erl +++ b/lib/stdlib/test/timer_SUITE.erl @@ -18,12 +18,12 @@ %% -module(timer_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). -export([do_big_test/1]). -export([big_test/1, collect/3, i_t/3, a_t/2]). -export([do_nrev/1, internal_watchdog/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test suite for timer module. This is a really nasty test it runs a %% lot of timeouts and then checks in the end if any of them was @@ -51,7 +51,26 @@ %% amount of load. The test suite should also include tests that test the %% interface of the timer module. -all(suite) -> [do_big_test]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [do_big_test]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% ------------------------------------------------------- %% diff --git a/lib/stdlib/test/timer_simple_SUITE.erl b/lib/stdlib/test/timer_simple_SUITE.erl index 6aa2b7b945..afe6699920 100644 --- a/lib/stdlib/test/timer_simple_SUITE.erl +++ b/lib/stdlib/test/timer_simple_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% 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 @@ -21,7 +21,8 @@ -module(timer_simple_SUITE). %% external --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, apply_after/1, send_after1/1, @@ -49,31 +50,35 @@ timer/4, timer/5]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(MAXREF, (1 bsl 18)). -define(REFMARG, 30). -all(doc) -> "Test of the timer module."; -all(suite) -> - [apply_after, - send_after1, - send_after2, - send_after3, - exit_after1, - exit_after2, - kill_after1, - kill_after2, - apply_interval, - send_interval1, - send_interval2, - send_interval3, - send_interval4, - cancel1, - cancel2, - tc, - unique_refs, - timer_perf]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [apply_after, send_after1, send_after2, send_after3, + exit_after1, exit_after2, kill_after1, kill_after2, + apply_interval, send_interval1, send_interval2, + send_interval3, send_interval4, cancel1, cancel2, tc, + unique_refs, timer_perf]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_, Config) when is_list(Config) -> timer:start(), diff --git a/lib/stdlib/test/unicode_SUITE.erl b/lib/stdlib/test/unicode_SUITE.erl index 141ac64606..3cca1ab894 100644 --- a/lib/stdlib/test/unicode_SUITE.erl +++ b/lib/stdlib/test/unicode_SUITE.erl @@ -18,11 +18,12 @@ %% -module(unicode_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, utf8_illegal_sequences_bif/1, utf16_illegal_sequences_bif/1, random_lists/1, @@ -34,12 +35,32 @@ init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog=?t:timetrap(?t:minutes(20)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog). -all(suite) -> - [utf8_illegal_sequences_bif,utf16_illegal_sequences_bif,random_lists,roundtrips,latin1,exceptions]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [utf8_illegal_sequences_bif, + utf16_illegal_sequences_bif, random_lists, roundtrips, + latin1, exceptions]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + exceptions(Config) when is_list(Config) -> diff --git a/lib/stdlib/test/win32reg_SUITE.erl b/lib/stdlib/test/win32reg_SUITE.erl index c8cc82f61e..f54cd2dcca 100644 --- a/lib/stdlib/test/win32reg_SUITE.erl +++ b/lib/stdlib/test/win32reg_SUITE.erl @@ -18,22 +18,34 @@ %% -module(win32reg_SUITE). --export([all/1,long/1,evil_write/1]). --export([ostype/1,fini/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,long/1,evil_write/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -all(suite) -> - [{conf,ostype,[long,evil_write],fini}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -ostype(Config) when is_list(Config) -> +all() -> + [long, evil_write]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) when is_list(Config) -> case os:type() of {win32, _} -> Config; _ -> {skip,"Doesn't run on UNIX."} end. -fini(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> Config. long(doc) -> "Test long keys and entries (OTP-3446)."; diff --git a/lib/stdlib/test/y2k_SUITE.erl b/lib/stdlib/test/y2k_SUITE.erl index a574d5e36e..0ea51355e2 100644 --- a/lib/stdlib/test/y2k_SUITE.erl +++ b/lib/stdlib/test/y2k_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -21,30 +21,38 @@ -module(y2k_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, date_1999_01_01/1, date_1999_02_28/1, date_1999_09_09/1, date_2000_01_01/1, date_2000_02_29/1, date_2001_01_01/1, date_2001_02_29/1, date_2004_02_29/1 ]). -all(doc) -> - "This is the test suite for year 2000. Eight dates according " - "to Ericsson Corporate Millennium Test Specification " - "(LME/DT-98:1097 are tested."; - -all(suite) -> - [date_1999_01_01, - date_1999_02_28, - date_1999_09_09, - date_2000_01_01, - date_2000_02_29, - date_2001_01_01, - date_2001_02_29, - date_2004_02_29 - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [date_1999_01_01, date_1999_02_28, date_1999_09_09, + date_2000_01_01, date_2000_02_29, date_2001_01_01, + date_2001_02_29, date_2004_02_29]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + date_1999_01_01(doc) -> "#1 : 1999-01-01: test roll-over from 1998-12-31 to 1999-01-01."; diff --git a/lib/stdlib/test/zip_SUITE.erl b/lib/stdlib/test/zip_SUITE.erl index 48b14396c1..895019ab96 100644 --- a/lib/stdlib/test/zip_SUITE.erl +++ b/lib/stdlib/test/zip_SUITE.erl @@ -18,7 +18,8 @@ %% -module(zip_SUITE). --export([all/1, borderline/1, atomic/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, borderline/1, atomic/1, bad_zip/1, unzip_from_binary/1, unzip_to_binary/1, zip_to_binary/1, unzip_options/1, zip_options/1, list_dir_options/1, aliases/1, @@ -26,18 +27,34 @@ compress_control/1, foldl/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("test_server_line.hrl"). -include_lib("kernel/include/file.hrl"). -include_lib("stdlib/include/zip.hrl"). -all(suite) -> [borderline, atomic, bad_zip, - unzip_from_binary, unzip_to_binary, - zip_to_binary, - unzip_options, zip_options, list_dir_options, aliases, - openzip_api, zip_api, unzip_jar, - compress_control, - foldl]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [borderline, atomic, bad_zip, unzip_from_binary, + unzip_to_binary, zip_to_binary, unzip_options, + zip_options, list_dir_options, aliases, openzip_api, + zip_api, unzip_jar, compress_control, foldl]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + borderline(doc) -> ["Test creating, listing and extracting one file from an archive " diff --git a/lib/stdlib/vsn.mk b/lib/stdlib/vsn.mk index db7954af04..ac02e1f359 100644 --- a/lib/stdlib/vsn.mk +++ b/lib/stdlib/vsn.mk @@ -1 +1 @@ -STDLIB_VSN = 1.17.2 +STDLIB_VSN = 1.17.3 diff --git a/lib/syntax_tools/doc/src/notes.xml b/lib/syntax_tools/doc/src/notes.xml index fca93a27d9..3f5eb7231e 100644 --- a/lib/syntax_tools/doc/src/notes.xml +++ b/lib/syntax_tools/doc/src/notes.xml @@ -31,6 +31,20 @@ <p>This document describes the changes made to the Syntax_Tools application.</p> +<section><title>Syntax_Tools 1.6.7</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>Miscellaneous updates</p> + <p> + Own Id: OTP-8976</p> + </item> + </list> + </section> + +</section> + <section><title>Syntax_Tools 1.6.6</title> <section><title>Improvements and New Features</title> diff --git a/lib/syntax_tools/test/Makefile b/lib/syntax_tools/test/Makefile index 621c76f5a5..e793dec566 100644 --- a/lib/syntax_tools/test/Makefile +++ b/lib/syntax_tools/test/Makefile @@ -59,7 +59,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) - $(INSTALL_DATA) syntax_tools.dynspec $(RELSYSDIR) + $(INSTALL_DATA) syntax_tools.spec syntax_tools.cover $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) release_docs_spec: diff --git a/lib/syntax_tools/test/syntax_tools.cover b/lib/syntax_tools/test/syntax_tools.cover new file mode 100644 index 0000000000..fd30f66cc4 --- /dev/null +++ b/lib/syntax_tools/test/syntax_tools.cover @@ -0,0 +1,2 @@ +{incl_app,syntax_tools,details}. + diff --git a/lib/syntax_tools/test/syntax_tools.dynspec b/lib/syntax_tools/test/syntax_tools.dynspec deleted file mode 100644 index 981cb8175e..0000000000 --- a/lib/syntax_tools/test/syntax_tools.dynspec +++ /dev/null @@ -1,5 +0,0 @@ -%% -*- erlang -*- -%% You can test this file using this command. -%% file:script("syntax_tools.dynspec", [{'Os',"Unix"}]). - -[]. diff --git a/lib/syntax_tools/test/syntax_tools.spec b/lib/syntax_tools/test/syntax_tools.spec new file mode 100644 index 0000000000..e7ddbf7586 --- /dev/null +++ b/lib/syntax_tools/test/syntax_tools.spec @@ -0,0 +1,2 @@ +%% -*- erlang -*- +{suites,"../syntax_tools_test",all}. diff --git a/lib/syntax_tools/test/syntax_tools_SUITE.erl b/lib/syntax_tools/test/syntax_tools_SUITE.erl index 16f794683b..fd381f0b25 100644 --- a/lib/syntax_tools/test/syntax_tools_SUITE.erl +++ b/lib/syntax_tools/test/syntax_tools_SUITE.erl @@ -17,17 +17,36 @@ %% -module(syntax_tools_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). %% Test cases -export([smoke_test/1]). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [smoke_test]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %% Read and parse all source in the OTP release. smoke_test(Config) when is_list(Config) -> ?line Dog = ?t:timetrap(?t:minutes(12)), diff --git a/lib/syntax_tools/vsn.mk b/lib/syntax_tools/vsn.mk index 6051fb8e39..2e23f6aef9 100644 --- a/lib/syntax_tools/vsn.mk +++ b/lib/syntax_tools/vsn.mk @@ -1 +1 @@ -SYNTAX_TOOLS_VSN = 1.6.6 +SYNTAX_TOOLS_VSN = 1.6.7 diff --git a/lib/test_server/doc/src/notes.xml b/lib/test_server/doc/src/notes.xml index e0c4c28e44..ab329c399b 100644 --- a/lib/test_server/doc/src/notes.xml +++ b/lib/test_server/doc/src/notes.xml @@ -32,6 +32,20 @@ <file>notes.xml</file> </header> +<section><title>Test_Server 3.4.2</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>Miscellaneous updates</p> + <p> + Own Id: OTP-8976</p> + </item> + </list> + </section> + +</section> + <section><title>Test_Server 3.4.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/test_server/src/Makefile b/lib/test_server/src/Makefile index 3dca55178d..0858d24fce 100644 --- a/lib/test_server/src/Makefile +++ b/lib/test_server/src/Makefile @@ -57,7 +57,8 @@ TS_MODULES= \ ts_erl_config \ ts_autoconf_win32 \ ts_autoconf_vxworks \ - ts_install + ts_install \ + ts_install_cth TARGET_MODULES= $(MODULES:%=$(EBIN)/%) TS_TARGET_MODULES= $(TS_MODULES:%=$(EBIN)/%) @@ -71,7 +72,7 @@ C_FILES = AUTOCONF_FILES = configure.in conf_vars.in COVER_FILES = cross.cover PROGRAMS = configure config.sub config.guess install-sh -CONFIG = ts.config ts.unix.config ts.win32.config ts.vxworks.config +CONFIG = ts.config ts.unix.config ts.win32.config TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) \ $(APP_TARGET) $(APPUP_TARGET) @@ -136,7 +137,7 @@ release_tests_spec: opt $(INSTALL_DIR) $(RELEASE_PATH)/test_server $(INSTALL_DATA) $(ERL_FILES) $(TS_ERL_FILES) \ $(HRL_FILES) $(INTERNAL_HRL_FILES) $(TS_HRL_FILES) \ - $(TARGET_FILES) $(TS_TARGET_FILES) \ + $(TS_TARGET_FILES) \ $(AUTOCONF_FILES) $(C_FILES) $(COVER_FILES) $(CONFIG) \ $(RELEASE_PATH)/test_server $(INSTALL_SCRIPT) $(PROGRAMS) $(RELEASE_PATH)/test_server diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl index ee121e5bb6..e0bf50bc43 100644 --- a/lib/test_server/src/test_server.erl +++ b/lib/test_server/src/test_server.erl @@ -856,7 +856,7 @@ run_test_case_msgloop(Ref, Pid, CaptureStdout, Terminate, Comment, CurrConf) -> %% a framework function failed CB = os:getenv("TEST_SERVER_FRAMEWORK"), Loc = case CB of - false -> + FW when FW =:= false; FW =:= "undefined" -> {test_server,Func}; _ -> {list_to_atom(CB),Func} @@ -935,8 +935,7 @@ spawn_fw_call(Mod,{init_per_testcase,Func},Pid,{timetrap_timeout,TVal}=Why, Skip = {skip,{failed,{Mod,init_per_testcase,Why}}}, %% if init_per_testcase fails, the test case %% should be skipped - case catch test_server_sup:framework_call( - end_tc,[?pl2a(Mod),Func,{Pid,Skip,[[]]}]) of + case catch do_end_tc_call(Mod,Func,{Pid,Skip,[[]]},Why) of {'EXIT',FwEndTCErr} -> exit({fw_notify_done,end_tc,FwEndTCErr}); _ -> @@ -955,11 +954,9 @@ spawn_fw_call(Mod,{end_per_testcase,Func},Pid,{timetrap_timeout,TVal}=Why, Conf = [{tc_status,ok}], %% if end_per_testcase fails, the test case should be %% reported successful with a warning printed as comment - case catch test_server_sup:framework_call(end_tc, - [?pl2a(Mod),Func, - {Pid, - {failed,{Mod,end_per_testcase,Why}}, - [Conf]}]) of + case catch do_end_tc_call(Mod,Func,{Pid, + {failed,{Mod,end_per_testcase,Why}}, + [Conf]}, Why) of {'EXIT',FwEndTCErr} -> exit({fw_notify_done,end_tc,FwEndTCErr}); _ -> @@ -1001,9 +998,7 @@ spawn_fw_call(Mod,Func,Pid,Error,Loc,SendTo,Comment) -> ok end, Conf = [{tc_status,{failed,timetrap_timeout}}], - case catch test_server_sup:framework_call(end_tc, - [?pl2a(Mod),Func, - {Pid,Error,[Conf]}]) of + case catch do_end_tc_call(Mod,Func,{Pid,Error,[Conf]},Error) of {'EXIT',FwEndTCErr} -> exit({fw_notify_done,end_tc,FwEndTCErr}); _ -> @@ -1069,27 +1064,27 @@ run_test_case_eval(Mod, Func, Args0, Name, Ref, RunInit, {{Time,Value},Loc,Opts} = case test_server_sup:framework_call(init_tc,[?pl2a(Mod),Func,Args0], - {ok,Args0}) of + {ok, Args0}) of {ok,Args} -> run_test_case_eval1(Mod, Func, Args, Name, RunInit, TCCallback); Error = {error,_Reason} -> - test_server_sup:framework_call(end_tc,[?pl2a(Mod),Func,{Error,Args0}]), - {{0,{skip,{failed,Error}}},{Mod,Func},[]}; + NewResult = do_end_tc_call(Mod,Func,{Error,Args0}, + {skip,{failed,Error}}), + {{0,NewResult},{Mod,Func},[]}; {fail,Reason} -> [Conf] = Args0, Conf1 = [{tc_status,{failed,Reason}} | Conf], fw_error_notify(Mod, Func, Conf, Reason), - test_server_sup:framework_call(end_tc,[?pl2a(Mod),Func, - {{error,Reason},[Conf1]}]), - {{0,{failed,Reason}},{Mod,Func},[]}; + NewResult = do_end_tc_call(Mod,Func, {{error,Reason},[Conf1]}, + {fail, Reason}), + {{0,NewResult},{Mod,Func},[]}; Skip = {skip,_Reason} -> - test_server_sup:framework_call(end_tc,[?pl2a(Mod),Func,{Skip,Args0}]), - {{0,Skip},{Mod,Func},[]}; + NewResult = do_end_tc_call(Mod,Func,{Skip,Args0},Skip), + {{0,NewResult},{Mod,Func},[]}; {auto_skip,Reason} -> - test_server_sup:framework_call(end_tc,[?pl2a(Mod), - Func, - {{skip,Reason},Args0}]), - {{0,{skip,{fw_auto_skip,Reason}}},{Mod,Func},[]} + NewResult = do_end_tc_call(Mod, Func, {{skip,Reason},Args0}, + {skip, {fw_auto_skip,Reason}}), + {{0,NewResult},{Mod,Func},[]} end, exit({Ref,Time,Value,Loc,Opts}). @@ -1103,14 +1098,14 @@ run_test_case_eval1(Mod, Func, Args, Name, RunInit, TCCallback) -> Skip = {skip,Reason} -> Line = get_loc(), Conf = [{tc_status,{skipped,Reason}}], - test_server_sup:framework_call(end_tc,[?pl2a(Mod),Func,{Skip,[Conf]}]), - {{0,{skip,Reason}},Line,[]}; + NewRes = do_end_tc_call(Mod,Func,{Skip,[Conf]}, Skip), + {{0,NewRes},Line,[]}; {skip_and_save,Reason,SaveCfg} -> Line = get_loc(), Conf = [{tc_status,{skipped,Reason}},{save_config,SaveCfg}], - test_server_sup:framework_call(end_tc,[?pl2a(Mod),Func, - {{skip,Reason},[Conf]}]), - {{0,{skip,Reason}},Line,[]}; + NewRes = do_end_tc_call(Mod, Func, {{skip, Reason}, [Conf]}, + {skip, Reason}), + {{0,NewRes},Line,[]}; {ok,NewConf} -> put(test_server_init_or_end_conf,undefined), %% call user callback function if defined @@ -1155,13 +1150,12 @@ run_test_case_eval1(Mod, Func, Args, Name, RunInit, TCCallback) -> {FWReturn,TSReturn,EndConf1} end, put(test_server_init_or_end_conf,undefined), - case test_server_sup:framework_call(end_tc, [?pl2a(Mod), Func, - {FWReturn1,[EndConf2]}]) of - {fail,Reason} -> - fw_error_notify(Mod, Func, EndConf2, Reason), - {{T,{failed,Reason}},{Mod,Func},[]}; - _ -> - {{T,TSReturn1},Loc,[]} + case do_end_tc_call(Mod, Func, {FWReturn1,[EndConf2]}, TSReturn1) of + {failed,Reason} = NewReturn -> + fw_error_notify(Mod,Func,EndConf2, Reason), + {{T,NewReturn},{Mod,Func},[]}; + NewReturn -> + {{T,NewReturn},Loc,[]} end end; skip_init -> @@ -1179,10 +1173,36 @@ run_test_case_eval1(Mod, Func, Args, Name, RunInit, TCCallback) -> {{T,Return},Loc} = {ts_tc(Mod, Func, Args2),get_loc()}, %% call user callback function if defined Return1 = user_callback(TCCallback, Mod, Func, 'end', Return), - {Return2,Opts} = process_return_val([Return1], Mod,Func,Args1, Loc, Return1), + {Return2,Opts} = process_return_val([Return1], Mod, Func, + Args1, Loc, Return1), {{T,Return2},Loc,Opts} end. +do_end_tc_call(M,F,Res,Return) -> + Ref = make_ref(), + case test_server_sup:framework_call( + end_tc, [?pl2a(M),F,Res], Ref) of + {fail,FWReason} -> + {failed,FWReason}; + Ref -> + case test_server_sup:framework_call( + end_tc, [?pl2a(M),F,Res, Return], ok) of + {fail,FWReason} -> + {failed,FWReason}; + ok -> + case Return of + {fail,Reason} -> + {failed,Reason}; + Return -> + Return + end; + NewReturn -> + NewReturn + end; + _ -> + Return + end. + %% the return value is a list and we have to check if it contains %% the result of an end conf case or if it's a Config list process_return_val([Return], M,F,A, Loc, Final) when is_list(Return) -> @@ -1197,13 +1217,13 @@ process_return_val([Return], M,F,A, Loc, Final) when is_list(Return) -> end, Return) of true -> % must be return value from end conf case process_return_val1(Return, M,F,A, Loc, Final, []); - false -> % must be Config value from init conf case - case test_server_sup:framework_call(end_tc, [?pl2a(M),F,{ok,A}]) of - {fail,FWReason} -> + false -> % must be Config value from init conf case + case do_end_tc_call(M,F,{ok,A}, Return) of + {failed, FWReason} = Failed -> fw_error_notify(M,F,A, FWReason), - {{failed,FWReason},[]}; - _ -> - {Return,[]} + {Failed, []}; + NewReturn -> + {NewReturn, []} end end; %% the return value is not a list, so it's the return value from an @@ -1211,16 +1231,16 @@ process_return_val([Return], M,F,A, Loc, Final) when is_list(Return) -> process_return_val(Return, M,F,A, Loc, Final) -> process_return_val1(Return, M,F,A, Loc, Final, []). -process_return_val1([Failed={E,TCError}|_], M,F,A=[Args], Loc, _, SaveOpts) when E=='EXIT'; - E==failed -> +process_return_val1([Failed={E,TCError}|_], M,F,A=[Args], Loc, _, SaveOpts) + when E=='EXIT'; + E==failed -> fw_error_notify(M,F,A, TCError, mod_loc(Loc)), - case test_server_sup:framework_call(end_tc, - [?pl2a(M),F,{{error,TCError}, - [[{tc_status,{failed,TCError}}|Args]]}]) of - {fail,FWReason} -> + case do_end_tc_call(M,F,{{error,TCError}, + [[{tc_status,{failed,TCError}}|Args]]}, Failed) of + {failed,FWReason} -> {{failed,FWReason},SaveOpts}; - _ -> - {Failed,SaveOpts} + NewReturn -> + {NewReturn,SaveOpts} end; process_return_val1([SaveCfg={save_config,_}|Opts], M,F,[Args], Loc, Final, SaveOpts) -> process_return_val1(Opts, M,F,[[SaveCfg|Args]], Loc, Final, SaveOpts); @@ -1234,11 +1254,11 @@ process_return_val1([RetVal={Tag,_}|Opts], M,F,A, Loc, _, SaveOpts) when Tag==sk process_return_val1([_|Opts], M,F,A, Loc, Final, SaveOpts) -> process_return_val1(Opts, M,F,A, Loc, Final, SaveOpts); process_return_val1([], M,F,A, _Loc, Final, SaveOpts) -> - case test_server_sup:framework_call(end_tc, [?pl2a(M),F,{Final,A}]) of - {fail,FWReason} -> + case do_end_tc_call(M,F,{Final,A}, Final) of + {failed,FWReason} -> {{failed,FWReason},SaveOpts}; - _ -> - {Final,lists:reverse(SaveOpts)} + NewReturn -> + {NewReturn,lists:reverse(SaveOpts)} end. user_callback(undefined, _, _, _, Args) -> @@ -1263,7 +1283,7 @@ init_per_testcase(Mod, Func, Args) -> false -> code:load_file(Mod); _ -> ok end, - %% init_per_testcase defined, returns new configuration +%% init_per_testcase defined, returns new configuration case erlang:function_exported(Mod,init_per_testcase,2) of true -> case catch my_apply(Mod, init_per_testcase, [Func|Args]) of @@ -1306,8 +1326,8 @@ init_per_testcase(Mod, Func, Args) -> {skip,{failed,{Mod,init_per_testcase,Other}}} end; false -> - %% Optional init_per_testcase not defined - %% keep quiet. +%% Optional init_per_testcase not defined +%% keep quiet. [Config] = Args, {ok, Config} end. diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index 1dc5646184..7cd58642d0 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -168,6 +168,7 @@ cross_cover_analyse/1, cross_cover_analyse/2, trc/1, stop_trace/0]). -export([testcase_callback/1]). -export([set_random_seed/1]). +-export([kill_slavenodes/0]). %%% TEST_SERVER INTERFACE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -export([output/2, print/2, print/3, print_timestamp/2]). @@ -525,6 +526,9 @@ testcase_callback(ModFunc) -> set_random_seed(Seed) -> controller_call({set_random_seed,Seed}). +kill_slavenodes() -> + controller_call(kill_slavenodes). + get_hosts() -> get(test_server_hosts). @@ -533,6 +537,8 @@ get_target_os_type() -> undefined -> %% This is probably called on the target node os:type(); + Pid when Pid =:= self() -> + os:type(); _pid -> %% This is called on the controller, e.g. from a %% specification clause of a test case @@ -637,7 +643,7 @@ contact_main_target(local) -> %% When used by a general framework, global registration of %% test_server should not be required. case os:getenv("TEST_SERVER_FRAMEWORK") of - false -> + FW when FW =:= false; FW =:= "undefined" -> %% Local target! The global test_server process implemented by %% test_server.erl will not be started, so we simulate it by %% globally registering this process instead. @@ -1704,7 +1710,7 @@ do_test_cases(TopCases, SkipCases, [erlang:system_info(version), code:root_dir()]), case os:getenv("TEST_SERVER_FRAMEWORK") of - false -> + FW when FW =:= false; FW =:= "undefined" -> print(html, "<p>Target:<br>\n"), print_who(TI#target_info.host, TI#target_info.username), print(html, "<br>Used Erlang ~s in <tt>~s</tt>.\n", @@ -3552,7 +3558,7 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit, Where, {_,{'EXIT',Reason}} -> progress(failed, Num, Mod, Func, Loc, Reason, Time, Comment, Style); - {_, {failed, Reason}} -> + {_, {Fail, Reason}} when Fail =:= fail; Fail =:= failed -> progress(failed, Num, Mod, Func, Loc, Reason, Time, Comment, Style); {_, {Skip, Reason}} when Skip==skip; Skip==skipped -> @@ -4057,7 +4063,7 @@ get_font_style1(default) -> format_exception(Reason={_Error,Stack}) when is_list(Stack) -> case os:getenv("TEST_SERVER_FRAMEWORK") of - false -> + FW when FW =:= false; FW =:= "undefined" -> case application:get_env(test_server, format_exception) of {ok,false} -> {"~p",Reason}; @@ -4630,7 +4636,7 @@ collect_case([Case | Cases], St, Acc) -> collect_case_invoke(Mod, Case, MFA, St) -> case os:getenv("TEST_SERVER_FRAMEWORK") of - false -> + FW when FW =:= false; FW =:= "undefined" -> case catch apply(Mod, Case, [suite]) of {'EXIT',_} -> {ok,[MFA],St}; diff --git a/lib/test_server/src/test_server_node.erl b/lib/test_server/src/test_server_node.erl index 49025b1a3d..056d18da96 100644 --- a/lib/test_server/src/test_server_node.erl +++ b/lib/test_server/src/test_server_node.erl @@ -84,7 +84,7 @@ start_remote_main_target(Parameters) -> MasterNode,MasterCookie), Cmd = case os:getenv("TEST_SERVER_FRAMEWORK") of - false -> Cmd0; + FW when FW =:= false; FW =:= "undefined" -> Cmd0; FW -> Cmd0 ++ " -env TEST_SERVER_FRAMEWORK " ++ FW end, diff --git a/lib/test_server/src/test_server_sup.erl b/lib/test_server/src/test_server_sup.erl index 625724fbb5..4a7804a482 100644 --- a/lib/test_server/src/test_server_sup.erl +++ b/lib/test_server/src/test_server_sup.erl @@ -494,7 +494,8 @@ framework_call(Func,Args) -> framework_call(Func,Args,DefaultReturn) -> CB = os:getenv("TEST_SERVER_FRAMEWORK"), framework_call(CB,Func,Args,DefaultReturn). -framework_call(false,_Func,_Args,DefaultReturn) -> +framework_call(FW,_Func,_Args,DefaultReturn) + when FW =:= false; FW =:= "undefined" -> DefaultReturn; framework_call(Callback,Func,Args,DefaultReturn) -> Mod = list_to_atom(Callback), diff --git a/lib/test_server/src/ts.config b/lib/test_server/src/ts.config index 30ef25a0b8..f021f5958b 100644 --- a/lib/test_server/src/ts.config +++ b/lib/test_server/src/ts.config @@ -1,45 +1,46 @@ %% -*- erlang -*- -{ipv6_hosts,[otptest06,otptest08,sauron,iluvatar]}. -%%% Change these to suite the environment. -%%% test_hosts are looked up using "ypmatch xx yy zz hosts" -{test_hosts, - [bingo, hurin, turin, gandalf, super, - merry, nenya, sam, elrond, isildur]}. +%%% Change these to suite the environment. See the inet_SUITE for info about +%%% what they are used for. +%%% test_hosts are looked up using "ypmatch xx yy zz hosts.byname" +%{test_hosts,[my_ip4_host]}. %% IPv4 host only - no ipv6 entry must exist! -{test_host_ipv4_only, - {"isildur", %Short hostname - "isildur.du.uab.ericsson.se", %Long hostname - "134.138.177.24", %IP string - {134,138,177,24}, %IP tuple - ["isildur"], %Any aliases - "::ffff:134.138.177.24", %IPv6 string (compatibilty addr) - {0,0,0,0,0,65535,34442,45336} %IPv6 tuple - }}. - -{test_host_ipv6_only, - {"otptest06", %Short hostname - "otptest06.du.uab.ericsson.se", %Long hostname - "fec0::a00:20ff:feb2:b4a9", %IPv6 string - {65216,0,0,0,2560,8447,65202,46249}, %IPv6 tuple - ["otptest06-ip6"] %Aliases. - }}. - - - -{test_dummy_host, {"dummy", - "dummy.du.uab.ericsson.se", - "192.138.177.1", - {192,138,177,1}, - ["dummy"], - "::ffff:192.138.177.1", - {0,0,0,0,0,65535,49290,45313} - }}. - -{test_dummy_ipv6_host, {"dummy6", - "dummy6.du.uab.ericsson.se", - "fec0::a00:20ff:feb2:6666", - {65216,0,0,0,2560,8447,65202,26214}, - ["dummy6-ip6"] - }}. +%{test_host_ipv4_only, +% {"my_ip4_host", %Short hostname +% "my_ip4_host.mydomain.com", %Long hostname +% "10.10.0.1", %IP string +% {10,10,0,1}, %IP tuple +% ["my_ip4_host"], %Any aliases +% "::ffff:10.10.0.1", %IPv6 string (compatibilty addr) +% {0,0,0,0,0,65535,2570,1} %IPv6 tuple +% }}. + +%{test_dummy_host, {"dummy", +% "dummy.mydomain.com", +% "192.168.0.1", +% {192,168,0,1}, +% ["dummy"], +% "::ffff:192.168.0.1", +% {0,0,0,0,0,65535,49320,1} +% }}. + + +%%% test_hosts are looked up using "ypmatch xx yy zz ipnodes.byname" +%{ipv6_hosts,[my_ip6_host]}. + + +%{test_host_ipv6_only, +% {"my_ip6_host", %Short hostname +% "my_ip6_host.mydomain.com", %Long hostname +% "::2eff:f2b0:1ea0", %IPv6 string +% {0,0,0,0,0,12031,62128,7840}, %IPv6 tuple +% ["my_ip6_host"] %Aliases. +% }}. + +%{test_dummy_ipv6_host, {"dummy6", +% "dummy6.mydomain.com", +% "127::1", +% {295,0,0,0,0,0,0,1}, +% ["dummy6-ip6"] +% }}. diff --git a/lib/test_server/src/ts.erl b/lib/test_server/src/ts.erl index fcd955345f..3d55f41b8c 100644 --- a/lib/test_server/src/ts.erl +++ b/lib/test_server/src/ts.erl @@ -150,6 +150,14 @@ help(installed) -> " TraceSpec is the name of a file containing\n", " trace specifications or a list of trace\n", " specification elements.\n", + " {config, Path} - Specify which directory ts should get it's \n" + " config files from. The files should follow\n" + " the convention lib/test_server/src/ts*.config.\n" + " These config files can also be specified by\n" + " setting the TEST_CONFIG_PATH environment\n" + " variable to the directory where the config\n" + " files are. The default location is\n" + " tests/test_server/.\n" "\n", "Supported trace information elements\n", " {tp | tpl, Mod, [] | match_spec()}\n", @@ -249,7 +257,7 @@ run_some([Spec|Specs], Opts) -> run(Testspec) when is_atom(Testspec) -> Options=check_test_get_opts(Testspec, []), File = atom_to_list(Testspec), - run_test(File, ["SPEC current.spec NAME ",File], Options); + run_test(File, [{spec,[File++".spec"]}], Options); %% This can be used from command line, e.g. %% erl -s ts run all_tests <config> @@ -293,11 +301,11 @@ run(List, Opts) when is_list(List), is_list(Opts) -> run(Testspec, Config) when is_atom(Testspec), is_list(Config) -> Options=check_test_get_opts(Testspec, Config), File=atom_to_list(Testspec), - run_test(File, ["SPEC current.spec NAME ", File], Options); + run_test(File, [{spec,[File++".spec"]}], Options); %% Runs one module in a spec (interactive) run(Testspec, Mod) when is_atom(Testspec), is_atom(Mod) -> run_test({atom_to_list(Testspec), Mod}, - ["SPEC current.spec NAME ", atom_to_list(Mod)], + [{suite,Mod}], [interactive]). %% run/3 @@ -305,20 +313,23 @@ run(Testspec, Mod) when is_atom(Testspec), is_atom(Mod) -> run(Testspec,Mod,Config) when is_atom(Testspec), is_atom(Mod), is_list(Config) -> Options=check_test_get_opts(Testspec, Config), run_test({atom_to_list(Testspec), Mod}, - ["SPEC current.spec NAME ", atom_to_list(Mod)], + [{suite,Mod}], Options); %% Runs one testcase in a module. run(Testspec, Mod, Case) when is_atom(Testspec), is_atom(Mod), is_atom(Case) -> Options=check_test_get_opts(Testspec, []), - Args = ["CASE ",atom_to_list(Mod)," ",atom_to_list(Case)], + Args = [{suite,atom_to_list(Mod)},{testcase,atom_to_list(Case)}], run_test(atom_to_list(Testspec), Args, Options). %% run/4 %% Run one testcase in a module with Options. -run(Testspec, Mod, Case, Config) when is_atom(Testspec), is_atom(Mod), is_atom(Case), is_list(Config) -> +run(Testspec, Mod, Case, Config) when is_atom(Testspec), + is_atom(Mod), + is_atom(Case), + is_list(Config) -> Options=check_test_get_opts(Testspec, Config), - Args = ["CASE ",atom_to_list(Mod), " ",atom_to_list(Case)], + Args = [{suite,atom_to_list(Mod)}, {testcase,atom_to_list(Case)}], run_test(atom_to_list(Testspec), Args, Options). %% Check testspec to be valid and get possible Options @@ -327,10 +338,11 @@ check_test_get_opts(Testspec, Config) -> validate_test(Testspec), Mode = configmember(batch, {batch, interactive}, Config), Vars = configvars(Config), - Trace = configtrace(Config), + Trace = get_config(trace,Config), + ConfigPath = get_config(config,Config), KeepTopcase = configmember(keep_topcase, {keep_topcase,[]}, Config), Cover = configcover(Testspec,Config), - lists:flatten([Vars,Mode,Trace,KeepTopcase,Cover]). + lists:flatten([Vars,Mode,Trace,KeepTopcase,Cover,ConfigPath]). to_erlang_term(Atom) -> String = atom_to_list(Atom), @@ -398,8 +410,8 @@ special_vars(Config) -> SpecVars1 end. -configtrace(Config) -> - case lists:keysearch(trace,1,Config) of +get_config(Key,Config) -> + case lists:keysearch(Key,1,Config) of {value,Value} -> Value; false -> [] end. diff --git a/lib/test_server/src/ts.unix.config b/lib/test_server/src/ts.unix.config index b4325f065f..5a2580f464 100644 --- a/lib/test_server/src/ts.unix.config +++ b/lib/test_server/src/ts.unix.config @@ -1,4 +1,4 @@ %% -*- erlang -*- %% Always run a (VNC) X server on host -{xserver, "frumgar.du.uab.ericsson.se:66"}. +%% {xserver, "xserver.example.com:66"}. diff --git a/lib/test_server/src/ts.vxworks.config b/lib/test_server/src/ts.vxworks.config deleted file mode 100644 index b0b66e07ad..0000000000 --- a/lib/test_server/src/ts.vxworks.config +++ /dev/null @@ -1,19 +0,0 @@ -%% -*- erlang -*- - -%%% There is no equivalent command to ypmatch on Win32... :-( -{hardcoded_hosts, - [{"134.138.177.74","strider"}, - {"134.138.177.72", "elrond"}, - {"134.138.177.67", "sam"}, - {"134.138.176.215", "nenya"}, - {"134.138.176.192", "merry"}, - {"134.138.177.35", "lw4"}, - {"134.138.177.35", "lw5"}, - {"134.138.176.16", "super"}, - {"134.138.177.16", "gandalf"}, - {"134.138.177.92", "turin"}, - {"134.138.177.86", "mallor"}]}. - -{hardcoded_ipv6_hosts, - [{"fe80::a00:20ff:feb2:b4a9","otptest06"}, - {"fe80::a00:20ff:feb2:a621","otptest08"}]}. diff --git a/lib/test_server/src/ts.win32.config b/lib/test_server/src/ts.win32.config index 2802c4a75a..cae587bea8 100644 --- a/lib/test_server/src/ts.win32.config +++ b/lib/test_server/src/ts.win32.config @@ -1,15 +1,8 @@ %% -*- erlang -*- %%% There is no equivalent command to ypmatch on Win32... :-( -{hardcoded_hosts, - [{"134.138.177.24","isildur"}, - {"134.138.177.72", "elrond"}, - {"134.138.176.215", "nenya"}, - {"134.138.176.192", "merry"}, - {"134.138.176.16", "super"}, - {"134.138.177.16", "gandalf"}, - {"134.138.177.92", "turin"}]}. +%{hardcoded_hosts, +% [{"127.0.0.1","localhost"}]}. -{hardcoded_ipv6_hosts, - [{"fe80::a00:20ff:feb2:b4a9","otptest06"}, - {"fe80::a00:20ff:feb2:a621","otptest08"}]}. +%{hardcoded_ipv6_hosts, +% [{"::1","localhost"}]}. diff --git a/lib/test_server/src/ts_install_cth.erl b/lib/test_server/src/ts_install_cth.erl new file mode 100644 index 0000000000..3e28ebd529 --- /dev/null +++ b/lib/test_server/src/ts_install_cth.erl @@ -0,0 +1,293 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 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% +%% + +%%% @doc TS Installed SCB +%%% +%%% This module does what the make parts of the ts:run/x command did, +%%% but not the Makefile.first parts! So they have to be done by ts or +%%% manually!! + +-module(ts_install_cth). + +%% Suite Callbacks +-export([id/1]). +-export([init/2]). + +-export([pre_init_per_suite/3]). +-export([post_init_per_suite/4]). +-export([pre_end_per_suite/3]). +-export([post_end_per_suite/4]). + +-export([pre_init_per_group/3]). +-export([post_init_per_group/4]). +-export([pre_end_per_group/3]). +-export([post_end_per_group/4]). + +-export([pre_init_per_testcase/3]). +-export([post_end_per_testcase/4]). + +-export([on_tc_fail/3]). +-export([on_tc_skip/3]). + +-export([terminate/1]). + +-include_lib("kernel/include/file.hrl"). + +-type proplist() :: list({atom(),term()}). +-type config() :: proplist(). +-type reason() :: term(). +-type skip_or_fail() :: {skip, reason()} | + {auto_skip, reason()} | + {fail, reason()}. + +-record(state, { ts_conf_dir, target_system, install_opts, nodenames, nodes }). + +%% @doc The id of this SCB +-spec id(Opts :: term()) -> + Id :: term(). +id(_Opts) -> + ?MODULE. + +%% @doc Always called before any other callback function. +-spec init(Id :: term(), Opts :: proplist()) -> + State :: #state{}. +init(_Id, Opts) -> +% ct:log("CurrWD: ~p",[file:get_cwd()]), + Nodenames = proplists:get_value(nodenames, Opts, 0), + Nodes = proplists:get_value(nodes, Opts, 0), + TSConfDir = proplists:get_value(ts_conf_dir, Opts), + TargetSystem = proplists:get_value(target_system, Opts, install_local), + InstallOpts = proplists:get_value(install_opts, Opts, []), + #state{ nodenames = Nodenames, + nodes = Nodes, + ts_conf_dir = TSConfDir, + target_system = TargetSystem, + install_opts = InstallOpts }. + +%% @doc Called before init_per_suite is called. +-spec pre_init_per_suite(Suite :: atom(), + Config :: config(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +pre_init_per_suite(Suite,Config,#state{ ts_conf_dir = undefined} = State) -> + DataDir = proplists:get_value(data_dir, Config), + ParentDir = filename:join( + lists:reverse( + tl(lists:reverse(filename:split(DataDir))))), + TSConfDir = filename:join([ParentDir, "..","test_server"]), + pre_init_per_suite(Suite, Config, State#state{ ts_conf_dir = TSConfDir }); +pre_init_per_suite(_Suite,Config,State) -> +% ct:log("pre_init_per_suite(~p,~p,~p)",[_Suite,Config,State]), + DataDir = proplists:get_value(data_dir, Config), + try +% install(State#state.ts_conf_dir, +% State#state.target_system, +% State#state.install_opts), + + {ok,Variables} = + file:consult(filename:join(State#state.ts_conf_dir,"variables")), + + %% Make the stuff in all_SUITE_data if it exists + AllDir = filename:join(DataDir,"../all_SUITE_data"), + case filelib:is_dir(AllDir) of + true -> + make_non_erlang(AllDir,Variables); + false -> + ok + end, + + make_non_erlang(DataDir, Variables), + + {add_node_name(Config, State), State} + catch Error:Reason -> + Stack = erlang:get_stacktrace(), + ct:pal("~p failed! ~p:{~p,~p}",[?MODULE,Error,Reason,Stack]), + {fail,{?MODULE,{Error,Reason, Stack}}} + end. + +%% @doc Called after init_per_suite. +-spec post_init_per_suite(Suite :: atom(), + Config :: config(), + Return :: config() | skip_or_fail(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +post_init_per_suite(_Suite,_Config,Return,State) -> + test_server_ctrl:kill_slavenodes(), + {Return, State}. + +%% @doc Called before end_per_suite. +-spec pre_end_per_suite(Suite :: atom(), + Config :: config() | skip_or_fail(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +pre_end_per_suite(_Suite,Config,State) -> + {Config, State}. + +%% @doc Called after end_per_suite. +-spec post_end_per_suite(Suite :: atom(), + Config :: config(), + Return :: term(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +post_end_per_suite(_Suite,_Config,Return,State) -> + {Return, State}. + +%% @doc Called before each init_per_group. +-spec pre_init_per_group(Group :: atom(), + Config :: config(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +pre_init_per_group(_Group,Config,State) -> + {add_node_name(Config, State), State}. + +%% @doc Called after each init_per_group. +-spec post_init_per_group(Group :: atom(), + Config :: config(), + Return :: config() | skip_or_fail(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +post_init_per_group(_Group,_Config,Return,State) -> + {Return, State}. + +%% @doc Called after each end_per_group. +-spec pre_end_per_group(Group :: atom(), + Config :: config() | skip_or_fail(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +pre_end_per_group(_Group,Config,State) -> + {Config, State}. + +%% @doc Called after each end_per_group. +-spec post_end_per_group(Group :: atom(), + Config :: config(), + Return :: term(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +post_end_per_group(_Group,_Config,Return,State) -> + {Return, State}. + +%% @doc Called before each test case. +-spec pre_init_per_testcase(TC :: atom(), + Config :: config(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +pre_init_per_testcase(_TC,Config,State) -> + {add_node_name(Config, State), State}. + +%% @doc Called after each test case. +-spec post_end_per_testcase(TC :: atom(), + Config :: config(), + Return :: term(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +post_end_per_testcase(_TC,_Config,Return,State) -> + {Return, State}. + +%% @doc Called after a test case failed. +-spec on_tc_fail(TC :: init_per_suite | end_per_suite | + init_per_group | end_per_group | atom(), + Reason :: term(), State :: #state{}) -> + NewState :: #state{}. +on_tc_fail(_TC, _Reason, State) -> + State. + +%% @doc Called when a test case is skipped. +-spec on_tc_skip(TC :: end_per_suite | init_per_group | end_per_group | atom(), + {tc_auto_skip, {failed, {Mod :: atom(), Function :: atom(), + Reason :: term()}}} | + {tc_user_skip, {skipped, Reason :: term()}}, + State :: #state{}) -> + NewState :: #state{}. +on_tc_skip(_TC, _Reason, State) -> + State. + +%% @doc Called when the scope of the SCB is done. +-spec terminate(State :: #state{}) -> + term(). +terminate(_State) -> +% ct:log("Terminate called"), + ok. + +%%% ============================================================================ +%%% Local functions +%%% ============================================================================ +%% Configure and run all the Makefiles in the data dirs of the suite +%% in question +make_non_erlang(DataDir, Variables) -> + {ok,CurrWD} = file:get_cwd(), + try + file:set_cwd(DataDir), + MakeCommand = proplists:get_value(make_command,Variables), + + FirstMakefile = filename:join(DataDir,"Makefile.first"), + case filelib:is_regular(FirstMakefile) of + true -> + ct:log("Making ~p",[FirstMakefile]), + ok = ts_make:make( + MakeCommand, DataDir, filename:basename(FirstMakefile)); + false -> + ok + end, + + MakefileSrc = filename:join(DataDir,"Makefile.src"), + MakefileDest = filename:join(DataDir,"Makefile"), + case filelib:is_regular(MakefileSrc) of + true -> + ok = ts_lib:subst_file(MakefileSrc,MakefileDest,Variables), + ct:log("Making ~p",[MakefileDest]), + ok = ts_make:make([{makefile,"Makefile"},{data_dir,DataDir} + | Variables]); + false -> + ok + end + after + file:set_cwd(CurrWD), + timer:sleep(100) + end. + +%% Add a nodename to config if it does not exist +add_node_name(Config, State) -> + case proplists:get_value(nodenames, Config) of + undefined -> + lists:keystore( + nodenames, 1, Config, + {nodenames,generate_nodenames(State#state.nodenames)}); + _Else -> + Config + end. + + +%% Copied from test_server_ctrl.erl +generate_nodenames(Num) -> + {ok,Name} = inet:gethostname(), + generate_nodenames2(Num, [Name], []). + +generate_nodenames2(0, _Hosts, Acc) -> + Acc; +generate_nodenames2(N, Hosts, Acc) -> + Host=lists:nth((N rem (length(Hosts)))+1, Hosts), + Name=list_to_atom(temp_nodename("nod", []) ++ "@" ++ Host), + generate_nodenames2(N-1, Hosts, [Name|Acc]). + +temp_nodename([], Acc) -> + lists:flatten(Acc); +temp_nodename([Chr|Base], Acc) -> + {A,B,C} = erlang:now(), + New = [Chr | integer_to_list(Chr bxor A bxor B+A bxor C+B)], + temp_nodename(Base, [New|Acc]). diff --git a/lib/test_server/src/ts_run.erl b/lib/test_server/src/ts_run.erl index 888ac98973..60e01600e1 100644 --- a/lib/test_server/src/ts_run.erl +++ b/lib/test_server/src/ts_run.erl @@ -63,32 +63,13 @@ run(File, Args0, Options, Vars0) -> _ -> {false, fun run_interactive/3} end, - HandleTopcase = case member(keep_topcase, Options) of - true -> [fun copy_topcase/3]; - false -> [fun remove_original_topcase/3, - fun init_topcase/3] - end, - MakefileHooks = [fun make_make/3, - fun add_make_testcase/3], - MakeLoop = fun(V, Sp, St) -> make_loop(MakefileHooks, V, Sp, St) end, Hooks = [fun init_state/3, - fun read_spec_file/3] ++ - HandleTopcase ++ - [fun run_preinits/3, - fun find_makefiles/3, - MakeLoop, - fun make_test_suite/3, - fun add_topcase_to_spec/3, - fun write_spec_file/3, + fun run_preinits/3, fun make_command/3, Runner], - Args = make_test_server_args(Args0,Options,Vars), + Args = make_common_test_args(Args0,Options,Vars), St = #state{file=File,test_server_args=Args,batch=Batch}, R = execute(Hooks, Vars, [], St), - case Batch of - true -> ts_reports:make_index(); - false -> ok % ts_reports:make_index() is run on the test_server node - end, case R of {ok,_,_,_} -> ok; Error -> Error @@ -430,6 +411,15 @@ write_spec_file(Vars, Spec, _State) -> MoreConfig = io_lib:format("~p.\n", [{config,Conf}]), file:write_file("current.spec", [DiskLess,Hosts,MoreConfig,SpecFile]). +get_config_files() -> + TSConfig = "ts.config", + [TSConfig | case os:type() of + {unix,_} -> ["ts.unix.config"]; + {win32,_} -> ["ts.win32.config"]; + vxworks -> ["ts.vxworks.config"]; + _ -> [] + end]. + consult_config() -> {ok,Conf} = file:consult("ts.config"), case os:type() of @@ -457,6 +447,7 @@ backslashify([]) -> []. make_command(Vars, Spec, State) -> + {ok,Cwd} = file:get_cwd(), TestDir = State#state.test_dir, TestPath = filename:nativename(TestDir), Erl = case os:getenv("TS_RUN_VALGRIND") of @@ -487,7 +478,7 @@ make_command(Vars, Spec, State) -> {value,{erl_start_args,Args}} -> Args; false -> "" end, - CrashFile = State#state.file ++ "_erl_crash.dump", + CrashFile = filename:join(Cwd,State#state.file ++ "_erl_crash.dump"), case filelib:is_file(CrashFile) of true -> io:format("ts_run: Deleting dump: ~s\n",[CrashFile]), @@ -495,7 +486,8 @@ make_command(Vars, Spec, State) -> false -> ok end, - Cmd = [Erl, Naming, "test_server -pa ", $", TestPath, $", + %% NOTE: Do not use ' in these commands as it wont work on windows + Cmd = [Erl, Naming, "test_server" " -rsh ", ts_lib:var(rsh_name, Vars), " -env PATH \"", backslashify(lists:flatten([TestPath, path_separator(), @@ -505,15 +497,20 @@ make_command(Vars, Spec, State) -> %% uncomment the line below to disable exception formatting %% " -test_server_format_exception false", " -boot start_sasl -sasl errlog_type error", - " -s test_server_ctrl run_test ", State#state.test_server_args, + " -pz ",Cwd, + " -eval \"file:set_cwd(\\\"",TestDir,"\\\")\" " + " -eval \"ct:run_test(", + backslashify(lists:flatten(State#state.test_server_args)),")\"" " ", ExtraArgs], {ok, Vars, Spec, State#state{command=lists:flatten(Cmd)}}. + run_batch(Vars, _Spec, State) -> process_flag(trap_exit, true), Command = State#state.command ++ " -noinput -s erlang halt", ts_lib:progress(Vars, 1, "Command: ~s~n", [Command]), + io:format(user, "Command: ~s~n",[Command]), Port = open_port({spawn, Command}, [stream, in, eof]), tricky_print_data(Port). @@ -554,7 +551,7 @@ is_testnode_dead([{"test_server",_}|_]) -> false; is_testnode_dead([_|T]) -> is_testnode_dead(T). run_interactive(Vars, _Spec, State) -> - Command = State#state.command ++ " -s ts_reports make_index", + Command = State#state.command, ts_lib:progress(Vars, 1, "Command: ~s~n", [Command]), case ts_lib:var(os, Vars) of "Windows 95" -> @@ -604,6 +601,52 @@ path_separator() -> end. +make_common_test_args(Args0, Options, _Vars) -> + Trace = + case lists:keysearch(trace,1,Options) of + {value,{trace,TI}} when is_tuple(TI); is_tuple(hd(TI)) -> + ok = file:write_file(?tracefile,io_lib:format("~p.~n",[TI])), + [{ct_trace,?tracefile}]; + {value,{trace,TIFile}} when is_atom(TIFile) -> + [{ct_trace,atom_to_list(TIFile)}]; + {value,{trace,TIFile}} -> + [{ct_trace,TIFile}]; + false -> + [] + end, + Cover = + case lists:keysearch(cover,1,Options) of + {value,{cover, App, none, _Analyse}} -> + io:format("No cover file found for ~p~n",[App]), + []; + {value,{cover,_App,File,_Analyse}} -> + [{cover,to_list(File)}]; + false -> + [] + end, + + Logdir = case lists:keysearch(logdir, 1, Options) of + {value,{logdir, _}} -> + []; + false -> + [{logdir,"../test_server"}] + end, + + ConfigPath = case {os:getenv("TEST_CONFIG_PATH"), + lists:keysearch(config, 1, Options)} of + {false,{value, {config, Path}}} -> + Path; + {false,false} -> + "../test_server"; + {Path,_} -> + Path + end, + ConfigFiles = [{config,[filename:join(ConfigPath,File) + || File <- get_config_files()]}], + + io_lib:format("~100000p",[Args0++Trace++Cover++Logdir++ + ConfigFiles++Options]). + make_test_server_args(Args0,Options,Vars) -> Parameters = case ts_lib:var(os, Vars) of diff --git a/lib/test_server/test/Makefile b/lib/test_server/test/Makefile index fcb1282d16..9fe5aee3bb 100644 --- a/lib/test_server/test/Makefile +++ b/lib/test_server/test/Makefile @@ -88,7 +88,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) $(COVERFILE) $(RELSYSDIR) - $(INSTALL_DATA) test_server.spec $(RELSYSDIR) + $(INSTALL_DATA) test_server.spec test_server.cover $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/test_server/test/test_server.cover b/lib/test_server/test/test_server.cover index c2366db166..5c59bab494 100644 --- a/lib/test_server/test/test_server.cover +++ b/lib/test_server/test/test_server.cover @@ -1,20 +1,22 @@ -{exclude,[test_server, - test_server_ctrl, - ts_selftest]}. +{incl_app,test_server,details}. -%% Using include list here because the test_server might not find +{excl_mods, test_server, [test_server, + test_server_ctrl, + ts_selftest]}. + +%% Using incl_mods list here because the test_server might not find %% lib_dir for test_server - and so it will not find which modules to %% compile. -{include,[erl2html2, - test_server_node, - test_server_sup, - ts, - ts_autoconf_vxworks, - ts_autoconf_win32, - ts_erl_config, - ts_install, - ts_lib, - ts_make, - ts_run, - vxworks_client]}. +{incl_mods, test_server, [erl2html2, + test_server_node, + test_server_sup, + ts, + ts_autoconf_vxworks, + ts_autoconf_win32, + ts_erl_config, + ts_install, + ts_lib, + ts_make, + ts_run, + vxworks_client]}. diff --git a/lib/test_server/vsn.mk b/lib/test_server/vsn.mk index 4c3df28814..4e293b76a7 100644 --- a/lib/test_server/vsn.mk +++ b/lib/test_server/vsn.mk @@ -1,2 +1,2 @@ -TEST_SERVER_VSN = 3.4.1 +TEST_SERVER_VSN = 3.4.2 diff --git a/lib/tools/doc/src/notes.xml b/lib/tools/doc/src/notes.xml index 4a71993da9..5f9cecd6e4 100644 --- a/lib/tools/doc/src/notes.xml +++ b/lib/tools/doc/src/notes.xml @@ -30,6 +30,26 @@ </header> <p>This document describes the changes made to the Tools application.</p> +<section><title>Tools 2.6.6.2</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p>eprof: API sort mismatch has now been fixed. </p> + <p> + Own Id: OTP-8853</p> + </item> + <item> + <p> + eprof: fix division by zero in statistics</p> + <p> + Own Id: OTP-8963</p> + </item> + </list> + </section> + +</section> + <section><title>Tools 2.6.6.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/tools/test/Makefile b/lib/tools/test/Makefile index 3a59be758a..826a8f3ee8 100644 --- a/lib/tools/test/Makefile +++ b/lib/tools/test/Makefile @@ -39,7 +39,8 @@ INSTALL_PROGS= $(TARGET_FILES) EMAKEFILE=Emakefile -SPEC_FILES= tools.spec tools.spec.win +SPEC_FILES= tools.spec +COVER_FILE = tools.cover # ---------------------------------------------------- # Release directory specification @@ -84,7 +85,8 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) $(SPEC_FILES) $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) $(SPEC_FILES) $(COVER_FILE) $(EMAKEFILE) \ + $(ERL_FILES) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl index b9ccd62d0b..d9daff7a1f 100644 --- a/lib/tools/test/cover_SUITE.erl +++ b/lib/tools/test/cover_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% 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 @@ -18,13 +18,14 @@ %% -module(cover_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([start/1, compile/1, analyse/1, misc/1, stop/1, distribution/1, export_import/1, otp_5031/1, eif/1, otp_5305/1, otp_5418/1, otp_6115/1, otp_7095/1, otp_8188/1, otp_8270/1, otp_8273/1, otp_8340/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%---------------------------------------------------------------------- %% The following directory structure is assumed: @@ -37,18 +38,37 @@ %% y %%---------------------------------------------------------------------- -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case whereis(cover_server) of undefined -> [start, compile, analyse, misc, stop, distribution, - export_import, - otp_5031, eif, otp_5305, otp_5418, otp_6115, otp_7095, - otp_8188, otp_8270, otp_8273, otp_8340]; + export_import, otp_5031, eif, otp_5305, otp_5418, + otp_6115, otp_7095, otp_8188, otp_8270, otp_8273, + otp_8340]; _pid -> - {skip,"It looks like the test server is running cover. " - "Can't run cover test."} + {skip, + "It looks like the test server is running " + "cover. Can't run cover test."} end. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + start(suite) -> []; start(Config) when is_list(Config) -> ?line ok = file:set_cwd(?config(data_dir, Config)), diff --git a/lib/tools/test/cprof_SUITE.erl b/lib/tools/test/cprof_SUITE.erl index e697cc1571..b6f786d33f 100644 --- a/lib/tools/test/cprof_SUITE.erl +++ b/lib/tools/test/cprof_SUITE.erl @@ -41,7 +41,7 @@ -define(config(A,B),config(A,B)). -export([config/2]). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -endif. -ifdef(debug). @@ -63,14 +63,17 @@ config(data_dir, _) -> "cprof_SUITE_data". -else. %% When run in test server. --export([all/1, init_per_testcase/2, fin_per_testcase/2, not_run/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + not_run/1]). -export([basic/1, on_load/1, modules/1]). init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(test_server:seconds(30)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> erlang:trace_pattern({'_','_','_'}, false, [local,meta,call_count]), erlang:trace_pattern(on_load, false, [local,meta,call_count]), erlang:trace(all, false, [all]), @@ -78,16 +81,30 @@ fin_per_testcase(_Case, Config) -> test_server:timetrap_cancel(Dog), ok. -all(doc) -> - ["Test the cprof profiling tool."]; -all(suite) -> - case test_server:is_native(?MODULE) of +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + case test_server:is_native(cprof_SUITE) of true -> [not_run]; false -> [basic, on_load, modules] -%, on_and_off, info, -% pause_and_restart, combo] end. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + not_run(Config) when is_list(Config) -> {skipped,"Native code"}. diff --git a/lib/tools/test/emem_SUITE.erl b/lib/tools/test/emem_SUITE.erl index 430fa86c6c..8b38e7d3a8 100644 --- a/lib/tools/test/emem_SUITE.erl +++ b/lib/tools/test/emem_SUITE.erl @@ -24,7 +24,8 @@ receive_and_save_trace/2, send_trace/2]). --export([all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). -export([live_node/1, 'sparc_sunos5.8_32b_emt2.0'/1, @@ -41,7 +42,7 @@ -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(DEFAULT_TIMEOUT, ?t:minutes(5)). @@ -65,23 +66,32 @@ %% %% -all(doc) -> []; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case is_debug_compiled() of - true -> {skipped, "Not run when debug compiled"}; + true -> {skip, "Not run when debug compiled"}; false -> test_cases() end. - -test_cases() -> - [live_node, - 'sparc_sunos5.8_32b_emt2.0', + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +test_cases() -> + [live_node, 'sparc_sunos5.8_32b_emt2.0', 'pc_win2000_32b_emt2.0', 'pc.smp_linux2.2.19pre17_32b_emt2.0', 'powerpc_darwin7.7.0_32b_emt2.0', 'alpha_osf1v5.1_64b_emt2.0', 'sparc_sunos5.8_64b_emt2.0', - 'sparc_sunos5.8_32b_emt1.0', - 'pc_win2000_32b_emt1.0', + 'sparc_sunos5.8_32b_emt1.0', 'pc_win2000_32b_emt1.0', 'powerpc_darwin7.7.0_32b_emt1.0', 'alpha_osf1v5.1_64b_emt1.0', 'sparc_sunos5.8_64b_emt1.0']. @@ -100,7 +110,7 @@ init_per_testcase(Case, Config) when is_list(Config) -> [{watchdog, Dog}, {testcase, Case} | Config]) end. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> ignore_cores:restore(Config), Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), @@ -700,8 +710,8 @@ start_node(Name, Args) -> % stop_node(Node) -> % ?t:stop_node(Node). -is_debug_compiled() -> - is_debug_compiled(erlang:system_info(system_version)). +is_debug_compiled() -> +is_debug_compiled(erlang:system_info(system_version)). is_debug_compiled([$d,$e,$b,$u,$g | _]) -> true; diff --git a/lib/tools/test/eprof_SUITE.erl b/lib/tools/test/eprof_SUITE.erl index 67607c6cf2..16246d5e0b 100644 --- a/lib/tools/test/eprof_SUITE.erl +++ b/lib/tools/test/eprof_SUITE.erl @@ -18,11 +18,31 @@ %% -module(eprof_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1,tiny/1,eed/1,basic/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,tiny/1,eed/1,basic/1]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic, tiny, eed]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> [basic,tiny,eed]. basic(suite) -> []; basic(Config) when is_list(Config) -> diff --git a/lib/tools/test/fprof_SUITE.erl b/lib/tools/test/fprof_SUITE.erl index 1cd9ac7824..78de77526c 100644 --- a/lib/tools/test/fprof_SUITE.erl +++ b/lib/tools/test/fprof_SUITE.erl @@ -18,10 +18,11 @@ %% -module(fprof_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server framework exports --export([all/1, not_run/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, not_run/1]). %% Test suites -export([stack_seq/1, tail_seq/1, create_file_slow/1, spawn_simple/1, @@ -54,18 +55,33 @@ -all(doc) -> - ["Test the 'fprof' profiling tool."]; -all(suite) -> - case test_server:is_native(?MODULE) of - true -> - [not_run]; +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + case test_server:is_native(fprof_SUITE) of + true -> [not_run]; false -> [stack_seq, tail_seq, create_file_slow, spawn_simple, imm_tail_seq, imm_create_file_slow, imm_compile, cpu_create_file_slow] end. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + not_run(Config) when is_list(Config) -> {skipped, "Native code"}. diff --git a/lib/tools/test/ignore_cores.erl b/lib/tools/test/ignore_cores.erl index 8902a469ef..8b1ac0fe6c 120000..100644 --- a/lib/tools/test/ignore_cores.erl +++ b/lib/tools/test/ignore_cores.erl @@ -1 +1,158 @@ -../../../erts/test/ignore_cores.erl
\ No newline at end of file +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-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% +%% + +%%%------------------------------------------------------------------- +%%% File : ignore_cores.erl +%%% Author : Rickard Green <[email protected]> +%%% Description : +%%% +%%% Created : 11 Feb 2008 by Rickard Green <[email protected]> +%%%------------------------------------------------------------------- + +-module(ignore_cores). + +-include_lib("test_server/include/test_server.hrl"). + +-export([init/1, fini/1, setup/3, setup/4, restore/1, dir/1]). + +-record(ignore_cores, {org_cwd, + org_path, + org_pwd_env, + ign_dir = false, + cores_dir = false}). + +%% +%% Takes a testcase config +%% + +init(Config) -> + {ok, OrgCWD} = file:get_cwd(), + [{ignore_cores, + #ignore_cores{org_cwd = OrgCWD, + org_path = code:get_path(), + org_pwd_env = os:getenv("PWD")}} + | lists:keydelete(ignore_cores, 1, Config)]. + +fini(Config) -> + #ignore_cores{org_cwd = OrgCWD, + org_path = OrgPath, + org_pwd_env = OrgPWD} = ?config(ignore_cores, Config), + ok = file:set_cwd(OrgCWD), + true = code:set_path(OrgPath), + case OrgPWD of + false -> ok; + _ -> true = os:putenv("PWD", OrgPWD) + end, + lists:keydelete(ignore_cores, 1, Config). + +setup(Suite, Testcase, Config) -> + setup(Suite, Testcase, Config, false). + +setup(Suite, Testcase, Config, SetCwd) when is_atom(Suite), + is_atom(Testcase), + is_list(Config) -> + #ignore_cores{org_cwd = OrgCWD, + org_path = OrgPath, + org_pwd_env = OrgPWD} = ?config(ignore_cores, Config), + Path = lists:map(fun (".") -> OrgCWD; (Dir) -> Dir end, OrgPath), + true = code:set_path(Path), + PrivDir = ?config(priv_dir, Config), + IgnDir = filename:join([PrivDir, + atom_to_list(Suite) + ++ "_" + ++ atom_to_list(Testcase) + ++ "_wd"]), + ok = file:make_dir(IgnDir), + case SetCwd of + false -> + ok; + _ -> + ok = file:set_cwd(IgnDir), + OrgPWD = case os:getenv("PWD") of + false -> false; + PWD -> + os:putenv("PWD", IgnDir), + PWD + end + end, + ok = file:write_file(filename:join([IgnDir, "ignore_core_files"]), <<>>), + %% cores are dumped in /cores on MacOS X + CoresDir = case {?t:os_type(), filelib:is_dir("/cores")} of + {{unix,darwin}, true} -> + filelib:fold_files("/cores", + "^core.*$", + false, + fun (C,Cs) -> [C|Cs] end, + []); + _ -> + false + end, + lists:keyreplace(ignore_cores, + 1, + Config, + {ignore_cores, + #ignore_cores{org_cwd = OrgCWD, + org_path = OrgPath, + org_pwd_env = OrgPWD, + ign_dir = IgnDir, + cores_dir = CoresDir}}). + +restore(Config) -> + #ignore_cores{org_cwd = OrgCWD, + org_path = OrgPath, + org_pwd_env = OrgPWD, + ign_dir = IgnDir, + cores_dir = CoresDir} = ?config(ignore_cores, Config), + try + case CoresDir of + false -> + ok; + _ -> + %% Move cores dumped by these testcases in /cores + %% to cwd. + lists:foreach(fun (C) -> + case lists:member(C, CoresDir) of + true -> ok; + _ -> + Dst = filename:join( + [IgnDir, + filename:basename(C)]), + {ok, _} = file:copy(C, Dst), + file:delete(C) + end + end, + filelib:fold_files("/cores", + "^core.*$", + false, + fun (C,Cs) -> [C|Cs] end, + [])) + end + after + catch file:set_cwd(OrgCWD), + catch code:set_path(OrgPath), + case OrgPWD of + false -> ok; + _ -> catch os:putenv("PWD", OrgPWD) + end + end. + + +dir(Config) -> + #ignore_cores{ign_dir = Dir} = ?config(ignore_cores, Config), + Dir. diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl index da5930e015..6800a94f94 100644 --- a/lib/tools/test/instrument_SUITE.erl +++ b/lib/tools/test/instrument_SUITE.erl @@ -18,22 +18,43 @@ %% -module(instrument_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2]). -export(['+Mim true'/1, '+Mis true'/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). init_per_testcase(_Case, Config) -> ?line Dog=?t:timetrap(10000), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. -all(suite) -> ['+Mim true', '+Mis true']. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + ['+Mim true', '+Mis true']. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + '+Mim true'(doc) -> ["Check that memory data can be read and processed"]; '+Mim true'(suite) -> []; diff --git a/lib/tools/test/lcnt_SUITE.erl b/lib/tools/test/lcnt_SUITE.erl index e6866f721d..21383fa544 100644 --- a/lib/tools/test/lcnt_SUITE.erl +++ b/lib/tools/test/lcnt_SUITE.erl @@ -18,10 +18,10 @@ %% -module(lcnt_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Test server specific exports --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -51,10 +51,21 @@ end_per_testcase(_Case, Config) -> ?t:timetrap_cancel(Dog), ok. -all(suite) -> - % Test cases +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [load_v1, conflicts, locations, swap_keys]. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%---------------------------------------------------------------------- %% Tests %%---------------------------------------------------------------------- diff --git a/lib/tools/test/make_SUITE.erl b/lib/tools/test/make_SUITE.erl index 72dccdb465..524ed04af4 100644 --- a/lib/tools/test/make_SUITE.erl +++ b/lib/tools/test/make_SUITE.erl @@ -18,12 +18,13 @@ %% -module(make_SUITE). --export([all/1, make_all/1, make_files/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, make_all/1, make_files/1]). -export([otp_6057_init/1, otp_6057_a/1, otp_6057_b/1, otp_6057_c/1, otp_6057_end/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). @@ -35,9 +36,27 @@ %% that the file :"test5.erl" shall be compiled with the 'S' option, %% i.e. produce "test5.S" instead of "test5.<objext>" -all(suite) -> [make_all, make_files, - {conf, otp_6057_init, - [otp_6057_a,otp_6057_b,otp_6057_c], otp_6057_end}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [make_all, make_files, {group, otp_6057}]. + +groups() -> + [{otp_6057,[],[otp_6057_a, otp_6057_b, + otp_6057_c]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + otp_6057_init(Config). + +end_per_group(_GroupName, Config) -> + otp_6057_end(Config). + test_files() -> ["test1", "test2", "test3", "test4"]. @@ -146,7 +165,7 @@ otp_6057_init(Config) when is_list(Config) -> otp_6057_a(suite) -> []; otp_6057_a(doc) -> - ["Test that make:all/0 looks for object file in correct place"]; + ["Test that make:all/0, suite/0 looks for object file in correct place"]; otp_6057_a(Config) when is_list(Config) -> ?line PrivDir = ?config(priv_dir, Config), diff --git a/lib/tools/test/tools.cover b/lib/tools/test/tools.cover new file mode 100644 index 0000000000..1053be4f0f --- /dev/null +++ b/lib/tools/test/tools.cover @@ -0,0 +1,2 @@ +{incl_app,tools,details}. + diff --git a/lib/tools/test/tools.spec b/lib/tools/test/tools.spec index 93d5930472..1b07cf1cb6 100644 --- a/lib/tools/test/tools.spec +++ b/lib/tools/test/tools.spec @@ -1 +1 @@ -{topcase, {dir, "../tools_test"}}. +{suites,"../tools_test",all}. diff --git a/lib/tools/test/tools_SUITE.erl b/lib/tools/test/tools_SUITE.erl index 6b952f10ab..69dfab8fe7 100644 --- a/lib/tools/test/tools_SUITE.erl +++ b/lib/tools/test/tools_SUITE.erl @@ -18,28 +18,45 @@ %% -module(tools_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %% Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). -define(application, tools). %% Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). %% Test cases must be exported. -export([app_test/1]). -all(doc) -> - []; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [app_test]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/tools/test/xref_SUITE.erl b/lib/tools/test/xref_SUITE.erl index f9d062ef85..1fad070b67 100644 --- a/lib/tools/test/xref_SUITE.erl +++ b/lib/tools/test/xref_SUITE.erl @@ -29,28 +29,29 @@ -define(privdir, "xref_SUITE_priv"). -define(copydir, "xref_SUITE_priv/datacopy"). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -define(datadir, ?config(data_dir, Conf)). -define(privdir, ?config(priv_dir, Conf)). -define(copydir, ?config(copy_dir, Conf)). -endif. --export([all/1, init/1, fini/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, init/1, fini/1]). --export([xref/1, +-export([ addrem/1, convert/1, intergraph/1, lines/1, loops/1, no_data/1, modules/1]). --export([files/1, +-export([ add/1, default/1, info/1, lib/1, read/1, read2/1, remove/1, replace/1, update/1, deprecated/1, trycatch/1, abstract_modules/1, fun_mfa/1, qlc/1]). --export([analyses/1, +-export([ analyze/1, basic/1, md/1, q/1, variables/1, unused_locals/1]). --export([misc/1, +-export([ format_error/1, otp_7423/1, otp_7831/1]). -import(lists, [append/2, flatten/1, keysearch/3, member/2, sort/1, usort/1]). @@ -59,7 +60,7 @@ range/1, relation_to_family/1, set/1, to_external/1, union/2]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). %% Checks some info counters of a server and some relations that should hold. -export([check_count/1, check_state/1]). @@ -68,8 +69,36 @@ -include_lib("tools/src/xref.hrl"). -all(suite) -> - {conf, init, [xref, files, analyses, misc], fini}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, xref}, {group, files}, {group, analyses}, + {group, misc}]. + +groups() -> + [{xref, [], + [addrem, convert, intergraph, lines, loops, no_data, + modules]}, + {files, [], + [add, default, info, lib, read, read2, remove, replace, + update, deprecated, trycatch, abstract_modules, fun_mfa, + qlc]}, + {analyses, [], + [analyze, basic, md, q, variables, unused_locals]}, + {misc, [], [format_error, otp_7423, otp_7831]}]. + +init_per_suite(Config) -> + init(Config). + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init(Conf) when is_list(Conf) -> DataDir = ?datadir, @@ -91,13 +120,11 @@ init_per_testcase(_Case, Config) -> Dog=?t:timetrap(?t:minutes(2)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> Dog=?config(watchdog, _Config), test_server:timetrap_cancel(Dog), ok. -xref(suite) -> - [addrem, convert, intergraph, lines, loops, no_data, modules]. %% Seems a bit short... addrem(suite) -> []; @@ -680,9 +707,6 @@ modules(Conf) when is_list(Conf) -> ?line ok = xref_base:delete(S), ok. -files(suite) -> - [add, default, info, lib, read, read2, remove, replace, update, - deprecated, trycatch, abstract_modules, fun_mfa, qlc]. add(suite) -> []; add(doc) -> ["Add modules, applications, releases, directories"]; @@ -1788,8 +1812,6 @@ qlc(Conf) when is_list(Conf) -> ok. -analyses(suite) -> - [analyze, basic, md, q, variables, unused_locals]. analyze(suite) -> []; analyze(doc) -> ["Simple analyses"]; @@ -2312,8 +2334,6 @@ unused_locals(Conf) when is_list(Conf) -> ?line ok = file:delete(Beam2), ok. -misc(suite) -> - [format_error, otp_7423, otp_7831]. format_error(suite) -> []; format_error(doc) -> ["Format error messages"]; diff --git a/lib/tools/vsn.mk b/lib/tools/vsn.mk index 77b5254eaa..0c89b18065 100644 --- a/lib/tools/vsn.mk +++ b/lib/tools/vsn.mk @@ -1 +1 @@ -TOOLS_VSN = 2.6.6.1 +TOOLS_VSN = 2.6.6.2 diff --git a/lib/wx/doc/src/notes.xml b/lib/wx/doc/src/notes.xml index 8414028106..1493501ea4 100644 --- a/lib/wx/doc/src/notes.xml +++ b/lib/wx/doc/src/notes.xml @@ -31,6 +31,25 @@ <p>This document describes the changes made to the wxErlang application.</p> +<section><title>Wx 0.98.8</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>Add wxSystemSettings which was missing in the previous + release, despite previous comments.</p> <p>Fix an + external loop when stopping erlang nicely.</p> + <p>Separate OpenGL to it's own dynamic loaded library, so + other graphic libraries can reuse the gl module and it + will not waste memory if not used.</p> + <p> + Own Id: OTP-8951</p> + </item> + </list> + </section> + +</section> + <section><title>Wx 0.98.7</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/wx/test/Makefile b/lib/wx/test/Makefile index dfec4bb695..90272372b2 100644 --- a/lib/wx/test/Makefile +++ b/lib/wx/test/Makefile @@ -62,7 +62,7 @@ release_spec: release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) wx.spec wx_test_lib.hrl $(ErlSrc) $(ErlTargets) $(RELSYSDIR) + $(INSTALL_DATA) wx.spec wx.cover wx_test_lib.hrl $(ErlSrc) $(ErlTargets) $(RELSYSDIR) $(INSTALL_SCRIPT) wxt $(RELSYSDIR) release_docs_spec: diff --git a/lib/wx/test/wx.cover b/lib/wx/test/wx.cover new file mode 100644 index 0000000000..47e162ba7d --- /dev/null +++ b/lib/wx/test/wx.cover @@ -0,0 +1,2 @@ +{incl_app,wx,details}. + diff --git a/lib/wx/test/wx.spec b/lib/wx/test/wx.spec index a9201e5737..21e4a8c064 100644 --- a/lib/wx/test/wx.spec +++ b/lib/wx/test/wx.spec @@ -1,2 +1 @@ -{topcase, {dir, "../wx_test"}}. - +{suites,"../wx_test",all}. diff --git a/lib/wx/test/wx_app_SUITE.erl b/lib/wx/test/wx_app_SUITE.erl index 8fff324913..9c1e5868f4 100644 --- a/lib/wx/test/wx_app_SUITE.erl +++ b/lib/wx/test/wx_app_SUITE.erl @@ -45,22 +45,28 @@ init_per_testcase(Case, Config0) -> end_per_testcase(Func,Config) -> wx_test_lib:end_per_testcase(Func, Config). -fin_per_testcase(Case, Config) -> - wx_test_lib:end_per_testcase(Case, Config). - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all() -> - all(suite). - -all(suite) -> - [ - fields, - modules, - exportall, - app_depend, - undef_funcs - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [fields, modules, exportall, app_depend, undef_funcs]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/wx/test/wx_basic_SUITE.erl b/lib/wx/test/wx_basic_SUITE.erl index 599aa371ba..bdf54a1b35 100644 --- a/lib/wx/test/wx_basic_SUITE.erl +++ b/lib/wx/test/wx_basic_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -23,8 +23,9 @@ %%% Created : 3 Nov 2008 by Dan Gudmundsson <[email protected]> %%%------------------------------------------------------------------- -module(wx_basic_SUITE). --export([all/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -compile(export_all). @@ -41,20 +42,23 @@ init_per_testcase(Func,Config) -> wx_test_lib:init_per_testcase(Func,Config). end_per_testcase(Func,Config) -> wx_test_lib:end_per_testcase(Func,Config). -fin_per_testcase(Func,Config) -> %% For test_server - wx_test_lib:end_per_testcase(Func,Config). %% SUITE specification -all() -> - all(suite). -all(suite) -> - [ - create_window, - several_apps, - wx_api, - wx_misc, - data_types - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [create_window, several_apps, wx_api, wx_misc, + data_types]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% The test cases diff --git a/lib/wx/test/wx_class_SUITE.erl b/lib/wx/test/wx_class_SUITE.erl index 7b8d510d40..9c9dcd3576 100644 --- a/lib/wx/test/wx_class_SUITE.erl +++ b/lib/wx/test/wx_class_SUITE.erl @@ -24,8 +24,9 @@ %%%------------------------------------------------------------------- -module(wx_class_SUITE). --export([all/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -compile(export_all). @@ -42,25 +43,23 @@ init_per_testcase(Func,Config) -> wx_test_lib:init_per_testcase(Func,Config). end_per_testcase(Func,Config) -> wx_test_lib:end_per_testcase(Func,Config). -fin_per_testcase(Func,Config) -> %% For test_server - wx_test_lib:end_per_testcase(Func,Config). %% SUITE specification -all() -> - all(suite). -all(suite) -> - [ - calendarCtrl, - treeCtrl, - notebook, - staticBoxSizer, - clipboard, - helpFrame, - htmlWindow, - listCtrlSort, - radioBox, - systemSettings - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [calendarCtrl, treeCtrl, notebook, staticBoxSizer, + clipboard, helpFrame, htmlWindow, listCtrlSort, + radioBox, systemSettings]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. %% The test cases diff --git a/lib/wx/test/wx_event_SUITE.erl b/lib/wx/test/wx_event_SUITE.erl index dea10d892e..3258f55e50 100644 --- a/lib/wx/test/wx_event_SUITE.erl +++ b/lib/wx/test/wx_event_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -22,8 +22,9 @@ %%% Created : 3 Nov 2008 by Dan Gudmundsson <[email protected]> %%%------------------------------------------------------------------- -module(wx_event_SUITE). --export([all/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -compile(export_all). @@ -40,22 +41,23 @@ init_per_testcase(Func,Config) -> wx_test_lib:init_per_testcase(Func,Config). end_per_testcase(Func,Config) -> wx_test_lib:end_per_testcase(Func,Config). -fin_per_testcase(Func,Config) -> %% For test_server - wx_test_lib:end_per_testcase(Func,Config). %% SUITE specification -all() -> - all(suite). -all(suite) -> - [ - connect, - disconnect, - connect_msg_20, - connect_cb_20, - mouse_on_grid, - spin_event, - connect_in_callback - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [connect, disconnect, connect_msg_20, connect_cb_20, + mouse_on_grid, spin_event, connect_in_callback]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% The test cases diff --git a/lib/wx/test/wx_opengl_SUITE.erl b/lib/wx/test/wx_opengl_SUITE.erl index 778d089bce..93efa4c68f 100644 --- a/lib/wx/test/wx_opengl_SUITE.erl +++ b/lib/wx/test/wx_opengl_SUITE.erl @@ -22,8 +22,9 @@ %%% Created : 3 Nov 2008 by Dan Gudmundsson <[email protected]> %%%------------------------------------------------------------------- -module(wx_opengl_SUITE). --export([all/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -compile(export_all). @@ -48,18 +49,23 @@ init_per_testcase(Func,Config) -> wx_test_lib:init_per_testcase(Func,Config). end_per_testcase(Func,Config) -> wx_test_lib:end_per_testcase(Func,Config). -fin_per_testcase(Func,Config) -> %% For test_server - wx_test_lib:end_per_testcase(Func,Config). %% SUITE specification -all() -> - all(suite). -all(suite) -> - [ - canvas, - glu_tesselation - ]. - +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [canvas, glu_tesselation]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %% The test cases -define(VS, {{ 0.5, 0.5, -0.5}, %1 diff --git a/lib/wx/test/wx_test_lib.erl b/lib/wx/test/wx_test_lib.erl index 9368aa4bdc..8509d6be6f 100644 --- a/lib/wx/test/wx_test_lib.erl +++ b/lib/wx/test/wx_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -35,7 +35,7 @@ init_per_suite(Config) -> exit("Can not test on MacOSX"); {unix, _} -> io:format("DISPLAY ~s~n", [os:getenv("DISPLAY")]), - case proplists:get_value(xserver, Config, none) of + case ct:get_config(xserver, none) of none -> ignore; Server -> os:putenv("DISPLAY", Server) @@ -200,7 +200,7 @@ eval_test_case(Mod, Fun, Config) -> test_case_evaluator(Mod, Fun, [Config]) -> NewConfig = Mod:init_per_testcase(Fun, Config), R = apply(Mod, Fun, [NewConfig]), - Mod:fin_per_testcase(Fun, NewConfig), + Mod:end_per_testcase(Fun, NewConfig), exit({test_case_ok, R}). wait_for_evaluator(Pid, Mod, Fun, Config) -> @@ -216,12 +216,12 @@ wait_for_evaluator(Pid, Mod, Fun, Config) -> {'EXIT', Pid, {skipped, Reason}} -> log("<WARNING> Test case ~w skipped, because ~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {skip, {Mod, Fun}, Reason}; {'EXIT', Pid, Reason} -> log("<ERROR> Eval process ~w exited, because ~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {crash, {Mod, Fun}, Reason} end. diff --git a/lib/wx/test/wx_xtra_SUITE.erl b/lib/wx/test/wx_xtra_SUITE.erl index d5888bbf94..0d876c4e52 100644 --- a/lib/wx/test/wx_xtra_SUITE.erl +++ b/lib/wx/test/wx_xtra_SUITE.erl @@ -23,8 +23,9 @@ %%% Created : 3 Nov 2008 by Dan Gudmundsson <[email protected]> %%%------------------------------------------------------------------- -module(wx_xtra_SUITE). --export([all/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2]). -compile(export_all). @@ -41,19 +42,23 @@ init_per_testcase(Func,Config) -> wx_test_lib:init_per_testcase(Func,Config). end_per_testcase(Func,Config) -> wx_test_lib:end_per_testcase(Func,Config). -fin_per_testcase(Func,Config) -> %% For test_server - wx_test_lib:end_per_testcase(Func,Config). %% SUITE specification -all() -> - all(suite). -all(suite) -> - [ - destroy_app, - multiple_add_in_sizer, - app_dies, - menu_item_debug - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [destroy_app, multiple_add_in_sizer, app_dies, + menu_item_debug]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% The test cases diff --git a/lib/wx/vsn.mk b/lib/wx/vsn.mk index c0cc302317..dea0678063 100644 --- a/lib/wx/vsn.mk +++ b/lib/wx/vsn.mk @@ -1 +1 @@ -WX_VSN = 0.98.7 +WX_VSN = 0.98.8 diff --git a/lib/xmerl/doc/src/notes.xml b/lib/xmerl/doc/src/notes.xml index d67a622481..aa66cbec77 100644 --- a/lib/xmerl/doc/src/notes.xml +++ b/lib/xmerl/doc/src/notes.xml @@ -31,6 +31,40 @@ <p>This document describes the changes made to the Xmerl application.</p> +<section><title>Xmerl 1.2.7</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> An empty element declared as simpleContent was not + properly validated. </p> + <p> + Own Id: OTP-8599</p> + </item> + <item> + <p> Fix format_man_pages so it handles all man sections + and remove warnings/errors in various man pages. </p> + <p> + Own Id: OTP-8600</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> Fix entity checking so there are no fatal errors for + undefined entities when option skip_external_dtd is used. + </p> + <p> + Own Id: OTP-8947</p> + </item> + </list> + </section> + +</section> + <section><title>Xmerl 1.2.6</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/xmerl/src/xmerl_lib.erl b/lib/xmerl/src/xmerl_lib.erl index 7b76a76a33..1b3a7e57f0 100644 --- a/lib/xmerl/src/xmerl_lib.erl +++ b/lib/xmerl/src/xmerl_lib.erl @@ -148,9 +148,10 @@ expand_element(Element) -> expand_element(Element, Pos, Parents) -> expand_element(Element, Pos, Parents, false). -expand_element(E = #xmlElement{}, Pos, Parents, Norm) -> - Content = expand_content(E#xmlElement.content, 1, Parents, Norm), - Attrs = expand_attributes(E#xmlElement.attributes, 1, []), +expand_element(E = #xmlElement{name = N}, Pos, Parents, Norm) -> + NewParents = [{N,Pos}|Parents], + Content = expand_content(E#xmlElement.content, 1, NewParents, Norm), + Attrs = expand_attributes(E#xmlElement.attributes, 1, NewParents), E#xmlElement{pos = Pos, parents = Parents, attributes = Attrs, diff --git a/lib/xmerl/vsn.mk b/lib/xmerl/vsn.mk index d85a57f447..a4d7efaee3 100644 --- a/lib/xmerl/vsn.mk +++ b/lib/xmerl/vsn.mk @@ -1 +1 @@ -XMERL_VSN = 1.2.6 +XMERL_VSN = 1.2.7 |