diff options
47 files changed, 3021 insertions, 1094 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index b1cf1fe404..9578cd35c4 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -740,11 +740,16 @@ dnl Try to find POSIX threads dnl The usual pthread lib... AC_CHECK_LIB(pthread, pthread_create, THR_LIBS="-lpthread") -dnl FreeBSD has pthreads in special c library, c_r... +dnl Very old versions of FreeBSD have pthreads in special c library, c_r... if test "x$THR_LIBS" = "x"; then AC_CHECK_LIB(c_r, pthread_create, THR_LIBS="-lc_r") fi +dnl QNX has pthreads in standard C library + if test "x$THR_LIBS" = "x"; then + AC_CHECK_FUNC(pthread_create, THR_LIBS="none_needed") + fi + dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" = "x"; then AC_MSG_CHECKING([if the '-pthread' switch can be used]) @@ -765,6 +770,9 @@ dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" != "x"; then THR_DEFS="$THR_DEFS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS" THR_LIB_NAME=pthread + if test "x$THR_LIBS" = "xnone_needed"; then + THR_LIBS= + fi case $host_os in solaris*) THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS" ;; diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 index b1cf1fe404..9578cd35c4 100644 --- a/erts/aclocal.m4 +++ b/erts/aclocal.m4 @@ -740,11 +740,16 @@ dnl Try to find POSIX threads dnl The usual pthread lib... AC_CHECK_LIB(pthread, pthread_create, THR_LIBS="-lpthread") -dnl FreeBSD has pthreads in special c library, c_r... +dnl Very old versions of FreeBSD have pthreads in special c library, c_r... if test "x$THR_LIBS" = "x"; then AC_CHECK_LIB(c_r, pthread_create, THR_LIBS="-lc_r") fi +dnl QNX has pthreads in standard C library + if test "x$THR_LIBS" = "x"; then + AC_CHECK_FUNC(pthread_create, THR_LIBS="none_needed") + fi + dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" = "x"; then AC_MSG_CHECKING([if the '-pthread' switch can be used]) @@ -765,6 +770,9 @@ dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" != "x"; then THR_DEFS="$THR_DEFS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS" THR_LIB_NAME=pthread + if test "x$THR_LIBS" = "xnone_needed"; then + THR_LIBS= + fi case $host_os in solaris*) THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS" ;; diff --git a/lib/common_test/src/Makefile b/lib/common_test/src/Makefile index f7dce195d7..dd2923ece9 100644 --- a/lib/common_test/src/Makefile +++ b/lib/common_test/src/Makefile @@ -73,7 +73,8 @@ MODULES= \ cth_surefire \ ct_netconfc \ ct_conn_log_h \ - cth_conn_log + cth_conn_log \ + ct_groups TARGET_MODULES= $(MODULES:%=$(EBIN)/%) BEAM_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) diff --git a/lib/common_test/src/ct_config.erl b/lib/common_test/src/ct_config.erl index 06a8e12f55..b1d709bc75 100644 --- a/lib/common_test/src/ct_config.erl +++ b/lib/common_test/src/ct_config.erl @@ -171,7 +171,7 @@ process_default_configs(Opts) -> lists:flatmap(fun({config,[_|_] = FileOrFiles}) -> case {io_lib:printable_list(FileOrFiles), io_lib:printable_list(hd(FileOrFiles))} of - {true,true} -> + {false,true} -> FileOrFiles; {true,false} -> [FileOrFiles]; diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl index 4d47731239..403eab66cb 100644 --- a/lib/common_test/src/ct_framework.erl +++ b/lib/common_test/src/ct_framework.erl @@ -32,8 +32,6 @@ -export([error_in_suite/1, init_per_suite/1, end_per_suite/1, init_per_group/2, end_per_group/2]). --export([make_all_conf/3, make_conf/5]). - -include("ct_event.hrl"). -include("ct_util.hrl"). @@ -876,13 +874,13 @@ get_suite(Mod, all) -> {'EXIT',_} -> get_all(Mod, []); GroupDefs when is_list(GroupDefs) -> - case catch find_groups(Mod, all, all, GroupDefs) of + case catch ct_groups:find_groups(Mod, all, all, GroupDefs) of {error,_} = Error -> %% this makes test_server call error_in_suite as first %% (and only) test case so we can report Error properly [{?MODULE,error_in_suite,[[Error]]}]; ConfTests -> - get_all(Mod, ConfTests) + get_all(Mod, ConfTests) end; _ -> E = "Bad return value from "++atom_to_list(Mod)++":groups/0", @@ -901,7 +899,7 @@ get_suite(Mod, Group={conf,Props,_Init,TCs,_End}) -> {'EXIT',_} -> [Group]; GroupDefs when is_list(GroupDefs) -> - case catch find_groups(Mod, Name, TCs, GroupDefs) of + case catch ct_groups:find_groups(Mod, Name, TCs, GroupDefs) of {error,_} = Error -> %% this makes test_server call error_in_suite as first %% (and only) test case so we can report Error properly @@ -916,12 +914,13 @@ get_suite(Mod, Group={conf,Props,_Init,TCs,_End}) -> %% init/end functions for top groups will be executed case catch ?val(name, element(2, hd(ConfTests))) of Name -> % top group - delete_subs(ConfTests, ConfTests); + ct_groups:delete_subs(ConfTests, ConfTests); _ -> [] end; false -> - ConfTests1 = delete_subs(ConfTests, ConfTests), + ConfTests1 = ct_groups:delete_subs(ConfTests, + ConfTests), case ?val(override, Props) of undefined -> ConfTests1; @@ -930,9 +929,9 @@ get_suite(Mod, Group={conf,Props,_Init,TCs,_End}) -> ORSpec -> ORSpec1 = if is_tuple(ORSpec) -> [ORSpec]; true -> ORSpec end, - search_and_override(ConfTests1, - ORSpec1, Mod) - end + ct_groups:search_and_override(ConfTests1, + ORSpec1, Mod) + end end end; _ -> @@ -976,234 +975,6 @@ get_all_cases1(_, []) -> %%%----------------------------------------------------------------- -find_groups(Mod, Name, TCs, GroupDefs) -> - Found = find(Mod, Name, TCs, GroupDefs, [], GroupDefs, false), - trim(Found). - -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)) | - find(Mod, all, all, Gs, [], Defs, true)]; - -find(Mod, Name, TCs, [{Name,Props,Tests} | _Gs], Known, Defs, false) - when is_atom(Name), is_list(Props), is_list(Tests) -> - cyclic_test(Mod, Name, Known), - case TCs of - all -> - [make_conf(Mod, Name, Props, - find(Mod, Name, TCs, Tests, [Name | Known], Defs, true))]; - _ -> - Tests1 = [TC || TC <- TCs, - lists:member(TC, Tests) == true], - [make_conf(Mod, Name, Props, Tests1)] - end; - -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)) | - find(Mod, Name, TCs, Gs, [], Defs, false)]; - -find(Mod, Name, _TCs, [{Name,_Props,_Tests} | _Gs], _Known, _Defs, true) - when is_atom(Name) -> - E = "Duplicate groups named "++atom_to_list(Name)++" in "++ - atom_to_list(Mod)++":groups/0", - throw({error,list_to_atom(E)}); - -find(Mod, Name, all, [{Name1,Props,Tests} | Gs], Known, Defs, true) - when is_atom(Name1), is_list(Props), is_list(Tests) -> - cyclic_test(Mod, Name1, Known), - [make_conf(Mod, Name1, Props, - 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, [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) -> - 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) -> - Where = if length(Known) == 0 -> - atom_to_list(Mod)++":groups/0"; - true -> - "group "++atom_to_list(lists:last(Known))++ - " in "++atom_to_list(Mod)++":groups/0" - end, - Term = io_lib:format("~p", [BadTerm]), - E = "Bad term "++lists:flatten(Term)++" in "++Where, - throw({error,list_to_atom(E)}); - -find(_Mod, _Name, _TCs, [], _Known, _Defs, false) -> - ['$NOMATCH']; - -find(_Mod, _Name, _TCs, [], _Known, _Defs, _Found) -> - []. - -delete_subs([{conf, _,_,_,_} = Conf | Confs], All) -> - All1 = delete_conf(Conf, All), - case is_sub(Conf, All1) of - true -> - delete_subs(Confs, All1); - false -> - delete_subs(Confs, All) - end; -delete_subs([_Else | Confs], All) -> - delete_subs(Confs, All); -delete_subs([], All) -> - All. - -delete_conf({conf,Props,_,_,_}, Confs) -> - Name = ?val(name, Props), - [Conf || Conf = {conf,Props0,_,_,_} <- Confs, - Name =/= ?val(name, Props0)]. - -is_sub({conf,Props,_,_,_}=Conf, [{conf,_,_,Tests,_} | Confs]) -> - Name = ?val(name, Props), - case lists:any(fun({conf,Props0,_,_,_}) -> - case ?val(name, Props0) of - N when N == Name -> - true; - _ -> - false - end; - (_) -> - false - end, Tests) of - true -> - true; - false -> - is_sub(Conf, Tests) or is_sub(Conf, Confs) - end; - -is_sub(Conf, [_TC | Tests]) -> - is_sub(Conf, Tests); - -is_sub(_Conf, []) -> - false. - -trim(['$NOMATCH' | Tests]) -> - trim(Tests); - -trim([{conf,Props,Init,Tests,End} | Confs]) -> - case trim(Tests) of - [] -> - trim(Confs); - Trimmed -> - [{conf,Props,Init,Trimmed,End} | trim(Confs)] - end; - -trim([TC | Tests]) -> - [TC | trim(Tests)]; - -trim([]) -> - []. - -cyclic_test(Mod, Name, Names) -> - case lists:member(Name, Names) of - true -> - E = "Cyclic reference to group "++atom_to_list(Name)++ - " in "++atom_to_list(Mod)++":groups/0", - throw({error,list_to_atom(E)}); - false -> - ok - end. - -expand(Mod, Name, Defs) -> - case lists:keysearch(Name, 1, Defs) of - {value,Def} -> - Def; - false -> - E = "Invalid group "++atom_to_list(Name)++ - " in "++atom_to_list(Mod)++":groups/0", - throw({error,list_to_atom(E)}) - end. - -make_all_conf(Dir, Mod, _Props) -> - case code:is_loaded(Mod) of - false -> - code:load_abs(filename:join(Dir,atom_to_list(Mod))); - _ -> - ok - end, - make_all_conf(Mod). - -make_all_conf(Mod) -> - case catch apply(Mod, groups, []) of - {'EXIT',_} -> - {error,{invalid_group_definition,Mod}}; - GroupDefs when is_list(GroupDefs) -> - case catch find_groups(Mod, all, all, GroupDefs) of - {error,_} = Error -> - %% this makes test_server call error_in_suite as first - %% (and only) test case so we can report Error properly - [{?MODULE,error_in_suite,[[Error]]}]; - [] -> - {error,{invalid_group_spec,Mod}}; - ConfTests -> - [{conf,Props,Init,all,End} || - {conf,Props,Init,_,End} - <- delete_subs(ConfTests, ConfTests)] - end - end. - -make_conf(Dir, Mod, Name, Props, TestSpec) -> - case code:is_loaded(Mod) of - false -> - code:load_abs(filename:join(Dir,atom_to_list(Mod))); - _ -> - ok - end, - make_conf(Mod, Name, Props, TestSpec). - -make_conf(Mod, Name, Props, TestSpec) -> - case code:is_loaded(Mod) of - false -> - code:load_file(Mod); - _ -> - ok - end, - {InitConf,EndConf,ExtraProps} = - case erlang:function_exported(Mod,init_per_group,2) of - true -> - {{Mod,init_per_group},{Mod,end_per_group},[]}; - false -> - ct_logs:log("TEST INFO", "init_per_group/2 and " - "end_per_group/2 missing for group " - "~p in ~p, using default.", - [Name,Mod]), - {{?MODULE,init_per_group}, - {?MODULE,end_per_group}, - [{suite,Mod}]} - end, - {conf,[{name,Name}|Props++ExtraProps],InitConf,TestSpec,EndConf}. - -%%%----------------------------------------------------------------- - get_all(Mod, ConfTests) -> case catch apply(Mod, all, []) of {'EXIT',_} -> @@ -1218,133 +989,24 @@ get_all(Mod, ConfTests) -> [{?MODULE,error_in_suite,[[{error,What}]]}]; SeqsAndTCs -> %% expand group references in all() using ConfTests - case catch expand_groups(SeqsAndTCs, ConfTests, Mod) of + case catch ct_groups:expand_groups(SeqsAndTCs, + ConfTests, + Mod) of {error,_} = Error -> [{?MODULE,error_in_suite,[[Error]]}]; Tests -> - delete_subs(Tests, Tests) + ct_groups:delete_subs(Tests, Tests) end end; Skip = {skip,_Reason} -> Skip; _ -> Reason = - list_to_atom("Bad return value from "++atom_to_list(Mod)++":all/0"), + list_to_atom("Bad return value from "++ + atom_to_list(Mod)++":all/0"), [{?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) -> - expand_groups({group,Name,default,[]}, ConfTests, Mod); -expand_groups({group,Name,default}, ConfTests, Mod) -> - expand_groups({group,Name,default,[]}, ConfTests, Mod); -expand_groups({group,Name,ORProps}, ConfTests, Mod) when is_list(ORProps) -> - expand_groups({group,Name,ORProps,[]}, ConfTests, Mod); -expand_groups({group,Name,ORProps,SubORSpec}, ConfTests, Mod) -> - FindConf = - fun(Conf = {conf,Props,Init,Ts,End}) -> - case ?val(name, Props) of - Name when ORProps == default -> - [Conf]; - Name -> - [{conf,[{name,Name}|ORProps],Init,Ts,End}]; - _ -> - [] - end - end, - case lists:flatmap(FindConf, ConfTests) of - [] -> - throw({error,invalid_ref_msg(Name, Mod)}); - Matching when SubORSpec == [] -> - Matching; - Matching -> - override_props(Matching, SubORSpec, Name,Mod) - end; -expand_groups(SeqOrTC, _ConfTests, _Mod) -> - SeqOrTC. - -%% search deep for the matching conf test and modify it and any -%% sub tests according to the override specification -search_and_override([Conf = {conf,Props,Init,Tests,End}], ORSpec, Mod) -> - Name = ?val(name, Props), - case lists:keysearch(Name, 1, ORSpec) of - {value,{Name,default}} -> - [Conf]; - {value,{Name,ORProps}} -> - [{conf,[{name,Name}|ORProps],Init,Tests,End}]; - {value,{Name,default,[]}} -> - [Conf]; - {value,{Name,default,SubORSpec}} -> - override_props([Conf], SubORSpec, Name,Mod); - {value,{Name,ORProps,SubORSpec}} -> - override_props([{conf,[{name,Name}|ORProps], - Init,Tests,End}], SubORSpec, Name,Mod); - _ -> - [{conf,Props,Init,search_and_override(Tests,ORSpec,Mod),End}] - end. - -%% Modify the Tests element according to the override specification -override_props([{conf,Props,Init,Tests,End} | Confs], SubORSpec, Name,Mod) -> - {Subs,SubORSpec1} = override_sub_props(Tests, [], SubORSpec, Mod), - [{conf,Props,Init,Subs,End} | override_props(Confs, SubORSpec1, Name,Mod)]; -override_props([], [], _,_) -> - []; -override_props([], SubORSpec, Name,Mod) -> - Es = [invalid_ref_msg(Name, element(1,Spec), Mod) || Spec <- SubORSpec], - throw({error,Es}). - -override_sub_props([], New, ORSpec, _) -> - {?rev(New),ORSpec}; -override_sub_props([T = {conf,Props,Init,Tests,End} | Ts], - New, ORSpec, Mod) -> - Name = ?val(name, Props), - case lists:keysearch(Name, 1, ORSpec) of - {value,Spec} -> % group found in spec - Props1 = - case element(2, Spec) of - default -> Props; - ORProps -> [{name,Name} | ORProps] - end, - case catch element(3, Spec) of - Undef when Undef == [] ; 'EXIT' == element(1, Undef) -> - override_sub_props(Ts, [{conf,Props1,Init,Tests,End} | New], - lists:keydelete(Name, 1, ORSpec), Mod); - SubORSpec when is_list(SubORSpec) -> - case override_sub_props(Tests, [], SubORSpec, Mod) of - {Subs,[]} -> - override_sub_props(Ts, [{conf,Props1,Init, - Subs,End} | New], - lists:keydelete(Name, 1, ORSpec), - Mod); - {_,NonEmptySpec} -> - Es = [invalid_ref_msg(Name, element(1, GrRef), - Mod) || GrRef <- NonEmptySpec], - throw({error,Es}) - end; - BadGrSpec -> - throw({error,{invalid_form,BadGrSpec}}) - end; - _ -> % not a group in spec - override_sub_props(Ts, [T | New], ORSpec, Mod) - end; -override_sub_props([TC | Ts], New, ORSpec, Mod) -> - override_sub_props(Ts, [TC | New], ORSpec, Mod). - -invalid_ref_msg(Name, Mod) -> - E = "Invalid reference to group "++ - atom_to_list(Name)++" in "++ - atom_to_list(Mod)++":all/0", - list_to_atom(E). - -invalid_ref_msg(Name0, Name1, Mod) -> - E = "Invalid reference to group "++ - atom_to_list(Name1)++" from "++atom_to_list(Name0)++ - " in "++atom_to_list(Mod)++":all/0", - list_to_atom(E). - %%!============================================================ %%! The support for sequences by means of using sequences/0 %%! will be removed in OTP R15. The code below is only kept diff --git a/lib/common_test/src/ct_groups.erl b/lib/common_test/src/ct_groups.erl new file mode 100644 index 0000000000..24ca3826a8 --- /dev/null +++ b/lib/common_test/src/ct_groups.erl @@ -0,0 +1,599 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2004-2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% 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 callback module. +%%% +%%% <p>This module contains CT internal help functions for searching +%%% through groups specification trees and producing resulting +%%% tests.</p> + +-module(ct_groups). + +-export([find_groups/4]). +-export([make_all_conf/3, make_all_conf/4, make_conf/5]). +-export([delete_subs/2]). +-export([expand_groups/3, search_and_override/3]). + +-define(val(Key, List), proplists:get_value(Key, List)). +-define(val(Key, List, Def), proplists:get_value(Key, List, Def)). +-define(rev(L), lists:reverse(L)). + +find_groups(Mod, GrNames, TCs, GroupDefs) when is_atom(GrNames) ; + (length(GrNames) == 1) -> + find_groups1(Mod, GrNames, TCs, GroupDefs); + +find_groups(Mod, Groups, TCs, GroupDefs) when Groups /= [] -> + lists:append([find_groups1(Mod, [GrNames], TCs, GroupDefs) || + GrNames <- Groups]); + +find_groups(_Mod, [], _TCs, _GroupDefs) -> + []. + +%% GrNames == atom(): Single group name, perform full search +%% GrNames == list(): List of groups, find all matching paths +%% GrNames == [list()]: Search path terminated by last group in GrNames +find_groups1(Mod, GrNames, TCs, GroupDefs) -> + {GrNames1,FindAll} = + case GrNames of + Name when is_atom(Name), Name /= all -> + {[Name],true}; + [Path] when is_list(Path) -> + {Path,false}; + Path -> + {Path,true} + end, + TCs1 = if (is_atom(TCs) and (TCs /= all)) or is_tuple(TCs) -> + [TCs]; + true -> + TCs + end, + Found = find(Mod, GrNames1, TCs1, GroupDefs, [], + GroupDefs, FindAll), + [Conf || Conf <- Found, Conf /= 'NOMATCH']. + +%% Locate all groups +find(Mod, all, all, [{Name,Props,Tests} | Gs], Known, Defs, _) + when is_atom(Name), is_list(Props), is_list(Tests) -> + cyclic_test(Mod, Name, Known), + trim(make_conf(Mod, Name, Props, + find(Mod, all, all, Tests, [Name | Known], + Defs, true))) ++ + find(Mod, all, all, Gs, Known, Defs, true); + +%% Locate particular TCs in all groups +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), + Tests1 = rm_unwanted_tcs(Tests, TCs, []), + trim(make_conf(Mod, Name, Props, + find(Mod, all, TCs, Tests1, [Name | Known], + Defs, true))) ++ + find(Mod, all, TCs, Gs, Known, Defs, true); + +%% Found next group is in search path +find(Mod, [Name|GrNames]=SPath, TCs, [{Name,Props,Tests} | Gs], Known, + Defs, FindAll) when is_atom(Name), is_list(Props), is_list(Tests) -> + cyclic_test(Mod, Name, Known), + Tests1 = rm_unwanted_tcs(Tests, TCs, GrNames), + trim(make_conf(Mod, Name, Props, + find(Mod, GrNames, TCs, Tests1, [Name|Known], + Defs, FindAll))) ++ + find(Mod, SPath, TCs, Gs, Known, Defs, FindAll); + +%% Group path terminated, stop the search +find(Mod, [], TCs, Tests, _Known, _Defs, false) -> + Cases = lists:flatmap(fun(TC) when is_atom(TC), TCs == all -> + [{Mod,TC}]; + ({group,_}) -> + []; + ({_,_}=TC) when TCs == all -> + [TC]; + (TC) -> + if is_atom(TC) -> + Tuple = {Mod,TC}, + case lists:member(Tuple, TCs) of + true -> + [Tuple]; + false -> + case lists:member(TC, TCs) of + true -> [{Mod,TC}]; + false -> [] + end + end; + true -> + [] + end + end, Tests), + if Cases == [] -> ['NOMATCH']; + true -> Cases + end; + +%% No more groups +find(_Mod, [_|_], _TCs, [], _Known, _Defs, _) -> + ['NOMATCH']; + +%% Found group not next in search path +find(Mod, GrNames, TCs, [{Name,Props,Tests} | Gs], Known, + Defs, FindAll) when is_atom(Name), is_list(Props), is_list(Tests) -> + cyclic_test(Mod, Name, Known), + Tests1 = rm_unwanted_tcs(Tests, TCs, GrNames), + trim(make_conf(Mod, Name, Props, + find(Mod, GrNames, TCs, Tests1, [Name|Known], + Defs, FindAll))) ++ + find(Mod, GrNames, TCs, Gs, Known, Defs, FindAll); + +%% A nested group defined on top level found +find(Mod, GrNames, TCs, [{group,Name1} | Gs], Known, Defs, FindAll) + when is_atom(Name1) -> + find(Mod, GrNames, TCs, [expand(Mod, Name1, Defs) | Gs], Known, + Defs, FindAll); + +%% Undocumented remote group feature, use with caution +find(Mod, GrNames, TCs, [{group, ExtMod, ExtGrp} | Gs], Known, + Defs, FindAll) when is_atom(ExtMod), is_atom(ExtGrp) -> + ExternalDefs = ExtMod:groups(), + ExternalTCs = find(ExtMod, ExtGrp, TCs, [{group, ExtGrp}], + [], ExternalDefs, FindAll), + ExternalTCs ++ find(Mod, GrNames, TCs, Gs, Known, Defs, FindAll); + +%% Group definition without properties, add an empty property list +find(Mod, GrNames, TCs, [{Name1,Tests} | Gs], Known, Defs, FindAll) + when is_atom(Name1), is_list(Tests) -> + find(Mod, GrNames, TCs, [{Name1,[],Tests} | Gs], Known, Defs, FindAll); + +%% Save, and keep searching +find(Mod, GrNames, TCs, [{ExternalTC, Case} = TC | Gs], Known, + Defs, FindAll) when is_atom(ExternalTC), + is_atom(Case) -> + [TC | find(Mod, GrNames, TCs, Gs, Known, Defs, FindAll)]; + +%% Save test case +find(Mod, GrNames, all, [TC | Gs], Known, + Defs, FindAll) when is_atom(TC) -> + [{Mod,TC} | find(Mod, GrNames, all, Gs, Known, Defs, FindAll)]; + +%% Save test case +find(Mod, GrNames, all, [{M,TC} | Gs], Known, + Defs, FindAll) when is_atom(M), M /= group, is_atom(TC) -> + [{M,TC} | find(Mod, GrNames, all, Gs, Known, Defs, FindAll)]; + +%% Check if test case should be saved +find(Mod, GrNames, TCs, [TC | Gs], Known, + Defs, FindAll) when is_atom(TC) orelse + ((size(TC) == 2) and (hd(TC) /= group)) -> + Case = + if is_atom(TC) -> + Tuple = {Mod,TC}, + case lists:member(Tuple, TCs) of + true -> + Tuple; + false -> + case lists:member(TC, TCs) of + true -> {Mod,TC}; + false -> [] + end + end; + true -> + case lists:member(TC, TCs) of + true -> {Mod,TC}; + false -> [] + end + end, + if Case == [] -> + find(Mod, GrNames, TCs, Gs, Known, Defs, FindAll); + true -> + [Case | find(Mod, GrNames, TCs, Gs, Known, Defs, FindAll)] + end; + +%% Unexpeted term in group list +find(Mod, _GrNames, _TCs, [BadTerm | _Gs], Known, _Defs, _FindAll) -> + Where = if length(Known) == 0 -> + atom_to_list(Mod)++":groups/0"; + true -> + "group "++atom_to_list(lists:last(Known))++ + " in "++atom_to_list(Mod)++":groups/0" + end, + Term = io_lib:format("~p", [BadTerm]), + E = "Bad term "++lists:flatten(Term)++" in "++Where, + throw({error,list_to_atom(E)}); + +%% No more groups +find(_Mod, _GrNames, _TCs, [], _Known, _Defs, _) -> + []. + +%%%----------------------------------------------------------------- + +%% We have to always search bottom up to only remove a branch +%% if there's 'NOMATCH' in the leaf (otherwise, the branch should +%% be kept) + +trim({conf,Props,Init,Tests,End}) -> + try trim(Tests) of + [] -> []; + Tests1 -> [{conf,Props,Init,Tests1,End}] + catch + throw:_ -> [] + end; + +trim(Tests) when is_list(Tests) -> + %% we need to compare the result of trimming each test on this + %% level, and only let a 'NOMATCH' fail the level if no + %% successful sub group can be found + Tests1 = + lists:flatmap(fun(Test) -> + IsConf = case Test of + {conf,_,_,_,_} -> + true; + _ -> + false + end, + try trim_test(Test) of + [] -> []; + Test1 when IsConf -> [{conf,Test1}]; + Test1 -> [Test1] + catch + throw:_ -> ['NOMATCH'] + end + end, Tests), + case lists:keymember(conf, 1, Tests1) of + true -> % at least one successful group + lists:flatmap(fun({conf,Test}) -> [Test]; + ('NOMATCH') -> []; % ignore any 'NOMATCH' + (Test) -> [Test] + end, Tests1); + false -> + case lists:member('NOMATCH', Tests1) of + true -> + throw('NOMATCH'); + false -> + Tests1 + end + end. + +trim_test({conf,Props,Init,Tests,End}) -> + case trim(Tests) of + [] -> + []; + Tests1 -> + {conf,Props,Init,Tests1,End} + end; + +trim_test('NOMATCH') -> + throw('NOMATCH'); + +trim_test(Test) -> + Test. + +%% GrNames is [] if the terminating group has been found. From +%% that point, all specified test should be included (as well as +%% sub groups for deeper search). +rm_unwanted_tcs(Tests, all, []) -> + Tests; + +rm_unwanted_tcs(Tests, TCs, []) -> + sort_tests(lists:flatmap(fun(Test) when is_tuple(Test), + (size(Test) > 2) -> + [Test]; + (Test={group,_}) -> + [Test]; + (Test={_M,TC}) -> + case lists:member(TC, TCs) of + true -> [Test]; + false -> [] + end; + (Test) when is_atom(Test) -> + case lists:keysearch(Test, 2, TCs) of + {value,_} -> + [Test]; + _ -> + case lists:member(Test, TCs) of + true -> [Test]; + false -> [] + end + end; + (Test) -> [Test] + end, Tests), TCs); + +rm_unwanted_tcs(Tests, _TCs, _) -> + [Test || Test <- Tests, not is_atom(Test)]. + +%% make sure the order of tests is according to the order in TCs +sort_tests(Tests, TCs) when is_list(TCs)-> + lists:sort(fun(T1, T2) -> + case {is_tc(T1),is_tc(T2)} of + {true,true} -> + (position(T1, TCs) =< + position(T2, TCs)); + {false,true} -> + (position(T2, TCs) == (length(TCs)+1)); + _ -> true + + end + end, Tests); +sort_tests(Tests, _) -> + Tests. + +is_tc(T) when is_atom(T) -> true; +is_tc({group,_}) -> false; +is_tc({_M,T}) when is_atom(T) -> true; +is_tc(_) -> false. + +position(T, TCs) -> + position(T, TCs, 1). + +position(T, [T|_TCs], Pos) -> + Pos; +position(T, [{_,T}|_TCs], Pos) -> + Pos; +position({M,T}, [T|_TCs], Pos) when M /= group -> + Pos; +position(T, [_|TCs], Pos) -> + position(T, TCs, Pos+1); +position(_, [], Pos) -> + Pos. + +%%%----------------------------------------------------------------- + +delete_subs([{conf, _,_,_,_} = Conf | Confs], All) -> + All1 = delete_conf(Conf, All), + case is_sub(Conf, All1) of + true -> + delete_subs(Confs, All1); + false -> + delete_subs(Confs, All) + end; +delete_subs([_Else | Confs], All) -> + delete_subs(Confs, All); +delete_subs([], All) -> + All. + +delete_conf({conf,Props,_,_,_}, Confs) -> + Name = ?val(name, Props), + [Conf || Conf = {conf,Props0,_,_,_} <- Confs, + Name =/= ?val(name, Props0)]. + +is_sub({conf,Props,_,_,_}=Conf, [{conf,_,_,Tests,_} | Confs]) -> + Name = ?val(name, Props), + case lists:any(fun({conf,Props0,_,_,_}) -> + case ?val(name, Props0) of + N when N == Name -> + true; + _ -> + false + end; + (_) -> + false + end, Tests) of + true -> + true; + false -> + is_sub(Conf, Tests) orelse is_sub(Conf, Confs) + end; + +is_sub(Conf, [_TC | Tests]) -> + is_sub(Conf, Tests); + +is_sub(_Conf, []) -> + false. + + +cyclic_test(Mod, Name, Names) -> + case lists:member(Name, Names) of + true -> + E = "Cyclic reference to group "++atom_to_list(Name)++ + " in "++atom_to_list(Mod)++":groups/0", + throw({error,list_to_atom(E)}); + false -> + ok + end. + +expand(Mod, Name, Defs) -> + case lists:keysearch(Name, 1, Defs) of + {value,Def} -> + Def; + false -> + E = "Invalid group "++atom_to_list(Name)++ + " in "++atom_to_list(Mod)++":groups/0", + throw({error,list_to_atom(E)}) + end. + +make_all_conf(Dir, Mod, Props, TestSpec) -> + case code:is_loaded(Mod) of + false -> + code:load_abs(filename:join(Dir,atom_to_list(Mod))); + _ -> + ok + end, + make_all_conf(Mod, Props, TestSpec). + +make_all_conf(Mod, Props, TestSpec) -> + case catch apply(Mod, groups, []) of + {'EXIT',_} -> + exit({invalid_group_definition,Mod}); + GroupDefs when is_list(GroupDefs) -> + case catch find_groups(Mod, all, TestSpec, GroupDefs) of + {error,_} = Error -> + %% this makes test_server call error_in_suite as first + %% (and only) test case so we can report Error properly + [{ct_framework,error_in_suite,[[Error]]}]; + [] -> + exit({invalid_group_spec,Mod}); + _ConfTests -> + make_conf(Mod, all, Props, TestSpec) + end + end. + +make_conf(Dir, Mod, Name, Props, TestSpec) -> + case code:is_loaded(Mod) of + false -> + code:load_abs(filename:join(Dir,atom_to_list(Mod))); + _ -> + ok + end, + make_conf(Mod, Name, Props, TestSpec). + +make_conf(Mod, Name, Props, TestSpec) -> + case code:is_loaded(Mod) of + false -> + code:load_file(Mod); + _ -> + ok + end, + {InitConf,EndConf,ExtraProps} = + case erlang:function_exported(Mod,init_per_group,2) of + true -> + {{Mod,init_per_group},{Mod,end_per_group},[]}; + false -> + ct_logs:log("TEST INFO", "init_per_group/2 and " + "end_per_group/2 missing for group " + "~p in ~p, using default.", + [Name,Mod]), + {{ct_framework,init_per_group}, + {ct_framework,end_per_group}, + [{suite,Mod}]} + end, + {conf,[{name,Name}|Props++ExtraProps],InitConf,TestSpec,EndConf}. + +%%%----------------------------------------------------------------- + +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) -> + expand_groups({group,Name,default,[]}, ConfTests, Mod); +expand_groups({group,Name,default}, ConfTests, Mod) -> + expand_groups({group,Name,default,[]}, ConfTests, Mod); +expand_groups({group,Name,ORProps}, ConfTests, Mod) when is_list(ORProps) -> + expand_groups({group,Name,ORProps,[]}, ConfTests, Mod); +expand_groups({group,Name,ORProps,SubORSpec}, ConfTests, Mod) -> + FindConf = + fun(Conf = {conf,Props,Init,Ts,End}) -> + case ?val(name, Props) of + Name when ORProps == default -> + [Conf]; + Name -> + Props1 = case ?val(suite, Props) of + undefined -> + ORProps; + SuiteName -> + [{suite,SuiteName}|ORProps] + end, + [{conf,[{name,Name}|Props1],Init,Ts,End}]; + _ -> + [] + end + end, + case lists:flatmap(FindConf, ConfTests) of + [] -> + throw({error,invalid_ref_msg(Name, Mod)}); + Matching when SubORSpec == [] -> + Matching; + Matching -> + override_props(Matching, SubORSpec, Name,Mod) + end; +expand_groups(SeqOrTC, _ConfTests, _Mod) -> + SeqOrTC. + +%% search deep for the matching conf test and modify it and any +%% sub tests according to the override specification +search_and_override([Conf = {conf,Props,Init,Tests,End}], ORSpec, Mod) -> + InsProps = fun(GrName, undefined, Ps) -> + [{name,GrName} | Ps]; + (GrName, Suite, Ps) -> + [{name,GrName}, {suite,Suite} | Ps] + end, + Name = ?val(name, Props), + Suite = ?val(suite, Props), + case lists:keysearch(Name, 1, ORSpec) of + {value,{Name,default}} -> + [Conf]; + {value,{Name,ORProps}} -> + [{conf,InsProps(Name,Suite,ORProps),Init,Tests,End}]; + {value,{Name,default,[]}} -> + [Conf]; + {value,{Name,default,SubORSpec}} -> + override_props([Conf], SubORSpec, Name,Mod); + {value,{Name,ORProps,SubORSpec}} -> + override_props([{conf,InsProps(Name,Suite,ORProps), + Init,Tests,End}], SubORSpec, Name,Mod); + _ -> + [{conf,Props,Init,search_and_override(Tests,ORSpec,Mod),End}] + end. + +%% Modify the Tests element according to the override specification +override_props([{conf,Props,Init,Tests,End} | Confs], SubORSpec, Name,Mod) -> + {Subs,SubORSpec1} = override_sub_props(Tests, [], SubORSpec, Mod), + [{conf,Props,Init,Subs,End} | override_props(Confs, SubORSpec1, Name,Mod)]; +override_props([], [], _,_) -> + []; +override_props([], SubORSpec, Name,Mod) -> + Es = [invalid_ref_msg(Name, element(1,Spec), Mod) || Spec <- SubORSpec], + throw({error,Es}). + +override_sub_props([], New, ORSpec, _) -> + {?rev(New),ORSpec}; +override_sub_props([T = {conf,Props,Init,Tests,End} | Ts], + New, ORSpec, Mod) -> + Name = ?val(name, Props), + Suite = ?val(suite, Props), + case lists:keysearch(Name, 1, ORSpec) of + {value,Spec} -> % group found in spec + Props1 = + case element(2, Spec) of + default -> Props; + ORProps when Suite == undefined -> [{name,Name} | ORProps]; + ORProps -> [{name,Name}, {suite,Suite} | ORProps] + end, + case catch element(3, Spec) of + Undef when Undef == [] ; 'EXIT' == element(1, Undef) -> + override_sub_props(Ts, [{conf,Props1,Init,Tests,End} | New], + lists:keydelete(Name, 1, ORSpec), Mod); + SubORSpec when is_list(SubORSpec) -> + case override_sub_props(Tests, [], SubORSpec, Mod) of + {Subs,[]} -> + override_sub_props(Ts, [{conf,Props1,Init, + Subs,End} | New], + lists:keydelete(Name, 1, ORSpec), + Mod); + {_,NonEmptySpec} -> + Es = [invalid_ref_msg(Name, element(1, GrRef), + Mod) || GrRef <- NonEmptySpec], + throw({error,Es}) + end; + BadGrSpec -> + throw({error,{invalid_form,BadGrSpec}}) + end; + _ -> % not a group in spec + override_sub_props(Ts, [T | New], ORSpec, Mod) + end; +override_sub_props([TC | Ts], New, ORSpec, Mod) -> + override_sub_props(Ts, [TC | New], ORSpec, Mod). + +invalid_ref_msg(Name, Mod) -> + E = "Invalid reference to group "++ + atom_to_list(Name)++" in "++ + atom_to_list(Mod)++":all/0", + list_to_atom(E). + +invalid_ref_msg(Name0, Name1, Mod) -> + E = "Invalid reference to group "++ + atom_to_list(Name1)++" from "++atom_to_list(Name0)++ + " in "++atom_to_list(Mod)++":all/0", + list_to_atom(E). diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index 3383244bf4..96b2934382 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -1272,7 +1272,8 @@ run_dir(Opts = #opts{logdir = LogDir, reformat_result(catch do_run(tests(Dir2, Mod), [], Opts1, StartOpts)); _ -> - reformat_result(catch do_run(tests(Dir2, Mod, GsAndCs), + reformat_result(catch do_run(tests(Dir2, Mod, + GsAndCs), [], Opts1, StartOpts)) end; @@ -1281,7 +1282,8 @@ run_dir(Opts = #opts{logdir = LogDir, [_,_|_] when GsAndCs /= [] -> exit({error,multiple_suites_and_cases}); [{Dir2,Mod}] when GsAndCs /= [] -> - reformat_result(catch do_run(tests(Dir2, Mod, GsAndCs), + reformat_result(catch do_run(tests(Dir2, Mod, + GsAndCs), [], Opts1, StartOpts)); DirMods -> reformat_result(catch do_run(tests(DirMods), @@ -1536,17 +1538,36 @@ groups_and_cases(Gs, Cs) when ((Gs == undefined) or (Gs == [])) and ((Cs == undefined) or (Cs == [])) -> []; groups_and_cases(Gs, Cs) when Gs == undefined ; Gs == [] -> - [ensure_atom(C) || C <- listify(Cs)]; -groups_and_cases(Gs, Cs) when Cs == undefined ; Cs == [] -> - [{ensure_atom(G),all} || G <- listify(Gs)]; -groups_and_cases(G, Cs) when is_atom(G) -> - [{G,[ensure_atom(C) || C <- listify(Cs)]}]; -groups_and_cases([G], Cs) -> - [{ensure_atom(G),[ensure_atom(C) || C <- listify(Cs)]}]; -groups_and_cases([_,_|_] , Cs) when Cs =/= [] -> - {error,multiple_groups_and_cases}; -groups_and_cases(_Gs, _Cs) -> - {error,incorrect_group_or_case_option}. + if (Cs == all) or (Cs == [all]) or (Cs == ["all"]) -> all; + true -> [ensure_atom(C) || C <- listify(Cs)] + end; +groups_and_cases(GOrGs, Cs) when (is_atom(GOrGs) orelse + (is_list(GOrGs) andalso + (is_atom(hd(GOrGs)) orelse + (is_list(hd(GOrGs)) andalso + is_atom(hd(hd(GOrGs))))))) -> + if (Cs == undefined) or (Cs == []) or + (Cs == all) or (Cs == [all]) or (Cs == ["all"]) -> + [{GOrGs,all}]; + true -> + [{GOrGs,[ensure_atom(C) || C <- listify(Cs)]}] + end; +groups_and_cases(Gs, Cs) when is_integer(hd(hd(Gs))) -> + %% if list of strings, this comes from 'ct_run -group G1 G2 ...' and + %% we need to parse the strings + Gs1 = + if (Gs == [all]) or (Gs == ["all"]) -> + all; + true -> + lists:map(fun(G) -> + {ok,Ts,_} = erl_scan:string(G++"."), + {ok,Term} = erl_parse:parse_term(Ts), + Term + end, Gs) + end, + groups_and_cases(Gs1, Cs); +groups_and_cases(Gs, Cs) -> + {error,{incorrect_group_or_case_option,Gs,Cs}}. tests(TestDir, Suites, []) when is_list(TestDir), is_integer(hd(TestDir)) -> [{?testdir(TestDir,Suites),ensure_atom(Suites),all}]; @@ -1687,11 +1708,15 @@ compile_and_run(Tests, Skip, Opts, Args) -> SavedErrors = save_make_errors(SuiteMakeErrors), ct_repeat:log_loop_info(Args), - {Tests1,Skip1} = final_tests(Tests,Skip,SavedErrors), - - ReleaseSh = proplists:get_value(release_shell, Args), - ct_util:set_testdata({release_shell,ReleaseSh}), - possibly_spawn(ReleaseSh == true, Tests1, Skip1, Opts); + try final_tests(Tests,Skip,SavedErrors) of + {Tests1,Skip1} -> + ReleaseSh = proplists:get_value(release_shell, Args), + ct_util:set_testdata({release_shell,ReleaseSh}), + possibly_spawn(ReleaseSh == true, Tests1, Skip1, Opts) + catch + _:BadFormat -> + {error,BadFormat} + end; false -> io:nl(), ct_util:stop(clean), @@ -1961,22 +1986,21 @@ final_tests1([{TestDir,Suite,GrsOrCs}|Tests], Final, Skip, Bad) when %% for now, only flat group defs are allowed as %% start options and test spec terms fun({all,all}) -> - ct_framework:make_all_conf(TestDir, - Suite, []); + [ct_groups:make_conf(TestDir, Suite, all, [], all)]; ({skipped,Group,TCs}) -> - [ct_framework:make_conf(TestDir, Suite, - Group, [skipped], TCs)]; - ({GrSpec = {Group,_},TCs}) -> + [ct_groups:make_conf(TestDir, Suite, + Group, [skipped], TCs)]; + ({GrSpec = {GroupName,_},TCs}) -> Props = [{override,GrSpec}], - [ct_framework:make_conf(TestDir, Suite, - Group, Props, TCs)]; - ({GrSpec = {Group,_,_},TCs}) -> + [ct_groups:make_conf(TestDir, Suite, + GroupName, Props, TCs)]; + ({GrSpec = {GroupName,_,_},TCs}) -> Props = [{override,GrSpec}], - [ct_framework:make_conf(TestDir, Suite, - Group, Props, TCs)]; - ({Group,TCs}) -> - [ct_framework:make_conf(TestDir, Suite, - Group, [], TCs)]; + [ct_groups:make_conf(TestDir, Suite, + GroupName, Props, TCs)]; + ({GroupOrGroups,TCs}) -> + [ct_groups:make_conf(TestDir, Suite, + GroupOrGroups, [], TCs)]; (TC) -> [TC] end, GrsOrCs), @@ -1988,12 +2012,12 @@ final_tests1([], Final, Skip, _Bad) -> {lists:reverse(Final),Skip}. final_skip([{TestDir,Suite,{all,all},Reason}|Skips], Final) -> - SkipConf = ct_framework:make_conf(TestDir, Suite, all, [], all), + SkipConf = ct_groups:make_conf(TestDir, Suite, all, [], all), Skip = {TestDir,Suite,SkipConf,Reason}, final_skip(Skips, [Skip|Final]); final_skip([{TestDir,Suite,{Group,TCs},Reason}|Skips], Final) -> - Conf = ct_framework:make_conf(TestDir, Suite, Group, [], TCs), + Conf = ct_groups:make_conf(TestDir, Suite, Group, [], TCs), Skip = {TestDir,Suite,Conf,Reason}, final_skip(Skips, [Skip|Final]); @@ -2256,9 +2280,11 @@ add_jobs([{TestDir,all,_}|Tests], Skip, Opts, CleanUp) -> wait_for_idle(), add_jobs(Tests, Skip, Opts, CleanUp) end; -add_jobs([{TestDir,[Suite],all}|Tests], Skip, Opts, CleanUp) when is_atom(Suite) -> +add_jobs([{TestDir,[Suite],all}|Tests], Skip, + Opts, CleanUp) when is_atom(Suite) -> add_jobs([{TestDir,Suite,all}|Tests], Skip, Opts, CleanUp); -add_jobs([{TestDir,Suites,all}|Tests], Skip, Opts, CleanUp) when is_list(Suites) -> +add_jobs([{TestDir,Suites,all}|Tests], Skip, + Opts, CleanUp) when is_list(Suites) -> Name = get_name(TestDir) ++ ".suites", case catch test_server_ctrl:add_module_with_skip(Name, Suites, skiplist(TestDir,Skip)) of @@ -2273,7 +2299,8 @@ add_jobs([{TestDir,Suite,all}|Tests], Skip, Opts, CleanUp) -> ok -> Name = get_name(TestDir) ++ "." ++ atom_to_list(Suite), case catch test_server_ctrl:add_module_with_skip(Name, [Suite], - skiplist(TestDir,Skip)) of + skiplist(TestDir, + Skip)) of {'EXIT',_} -> CleanUp; _ -> @@ -2296,15 +2323,24 @@ add_jobs([{TestDir,Suite,Confs}|Tests], Skip, Opts, CleanUp) when GrTestName = case Confs of [Conf] -> - "." ++ atom_to_list(Group(Conf)) ++ TCTestName(TestCases(Conf)); + case Group(Conf) of + GrName when is_atom(GrName) -> + "." ++ atom_to_list(GrName) ++ + TCTestName(TestCases(Conf)); + _ -> + ".groups" ++ TCTestName(TestCases(Conf)) + end; _ -> ".groups" end, TestName = get_name(TestDir) ++ "." ++ atom_to_list(Suite) ++ GrTestName, case maybe_interpret(Suite, init_per_group, Opts) of ok -> - case catch test_server_ctrl:add_conf_with_skip(TestName, Suite, Confs, - skiplist(TestDir,Skip)) of + case catch test_server_ctrl:add_conf_with_skip(TestName, + Suite, + Confs, + skiplist(TestDir, + Skip)) of {'EXIT',_} -> CleanUp; _ -> @@ -2316,18 +2352,21 @@ add_jobs([{TestDir,Suite,Confs}|Tests], Skip, Opts, CleanUp) when end; %% test case -add_jobs([{TestDir,Suite,[Case]}|Tests], Skip, Opts, CleanUp) when is_atom(Case) -> +add_jobs([{TestDir,Suite,[Case]}|Tests], + Skip, Opts, CleanUp) when is_atom(Case) -> add_jobs([{TestDir,Suite,Case}|Tests], Skip, Opts, CleanUp); -add_jobs([{TestDir,Suite,Cases}|Tests], Skip, Opts, CleanUp) when is_list(Cases) -> +add_jobs([{TestDir,Suite,Cases}|Tests], + Skip, Opts, CleanUp) when is_list(Cases) -> Cases1 = lists:map(fun({GroupName,_}) when is_atom(GroupName) -> GroupName; (Case) -> Case end, Cases), case maybe_interpret(Suite, Cases1, Opts) of ok -> - Name = get_name(TestDir) ++ "." ++ atom_to_list(Suite) ++ ".cases", + Name = get_name(TestDir) ++ "." ++ atom_to_list(Suite) ++ ".cases", case catch test_server_ctrl:add_cases_with_skip(Name, Suite, Cases1, - skiplist(TestDir,Skip)) of + skiplist(TestDir, + Skip)) of {'EXIT',_} -> CleanUp; _ -> @@ -2343,7 +2382,8 @@ add_jobs([{TestDir,Suite,Case}|Tests], Skip, Opts, CleanUp) when is_atom(Case) - Name = get_name(TestDir) ++ "." ++ atom_to_list(Suite) ++ "." ++ atom_to_list(Case), case catch test_server_ctrl:add_case_with_skip(Name, Suite, Case, - skiplist(TestDir,Skip)) of + skiplist(TestDir, + Skip)) of {'EXIT',_} -> CleanUp; _ -> @@ -2378,7 +2418,8 @@ skiplist(Dir, [{Dir,all,Cmt}|Skip]) -> %% we need to turn 'all' into list of modules since %% test_server doesn't do skips on Dir level Ss = filelib:wildcard(filename:join(Dir, "*_SUITE.beam")), - [{list_to_atom(filename:basename(S,".beam")),Cmt} || S <- Ss] ++ skiplist(Dir,Skip); + [{list_to_atom(filename:basename(S,".beam")),Cmt} || S <- Ss] ++ + skiplist(Dir,Skip); skiplist(Dir, [{Dir,S,Cmt}|Skip]) -> [{S,Cmt} | skiplist(Dir, Skip)]; skiplist(Dir, [{Dir,S,C,Cmt}|Skip]) -> @@ -2438,8 +2479,10 @@ run_make(Targets, TestDir0, Mod, UserInclude) -> FileTest = fun(F, suites) -> is_suite(F); (F, helpmods) -> not is_suite(F) end, - Files = lists:flatmap(fun({F,out_of_date}) -> - case FileTest(F, Targets) of + Files = + lists:flatmap(fun({F,out_of_date}) -> + case FileTest(F, + Targets) of true -> [F]; false -> [] end; @@ -2783,11 +2826,14 @@ opts2args(EnvStartOpts) -> lists:flatmap(fun({exit_status,ExitStatusOpt}) when is_atom(ExitStatusOpt) -> [{exit_status,[atom_to_list(ExitStatusOpt)]}]; ({halt_with,{HaltM,HaltF}}) -> - [{halt_with,[atom_to_list(HaltM),atom_to_list(HaltF)]}]; + [{halt_with,[atom_to_list(HaltM), + atom_to_list(HaltF)]}]; ({interactive_mode,true}) -> [{shell,[]}]; - ({config,CfgFiles}) -> - [{ct_config,[CfgFiles]}]; + ({config,CfgFile}) when is_integer(hd(CfgFile)) -> + [{ct_config,[CfgFile]}]; + ({config,CfgFiles}) when is_list(hd(CfgFiles)) -> + [{ct_config,CfgFiles}]; ({userconfig,{CBM,CfgStr=[X|_]}}) when is_integer(X) -> [{userconfig,[atom_to_list(CBM),CfgStr]}]; ({userconfig,{CBM,CfgStrs}}) when is_list(CfgStrs) -> @@ -2805,6 +2851,12 @@ opts2args(EnvStartOpts) -> end, UserCfg), [_LastAnd|StrsR] = lists:reverse(lists:flatten(Strs)), [{userconfig,lists:reverse(StrsR)}]; + ({group,G}) when is_atom(G) -> + [{group,[atom_to_list(G)]}]; + ({group,Gs}) when is_list(Gs) -> + LOfGStrs = [lists:flatten(io_lib:format("~w",[G])) || + G <- Gs], + [{group,LOfGStrs}]; ({testcase,Case}) when is_atom(Case) -> [{'case',[atom_to_list(Case)]}]; ({testcase,Cases}) -> diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl index a8b67d0329..5ce095e38e 100644 --- a/lib/common_test/src/ct_testspec.erl +++ b/lib/common_test/src/ct_testspec.erl @@ -1026,20 +1026,24 @@ insert_groups(Node,Dir,Suite,Group,Cases,Tests,MergeTests) insert_groups(Node,Dir,Suite,[Group],Cases,Tests,MergeTests); insert_groups(Node,Dir,Suite,Groups,Cases,Tests,false) when ((Cases == all) or is_list(Cases)) and is_list(Groups) -> - Groups1 = [{Gr,Cases} || Gr <- Groups], + Groups1 = [if is_list(Gr) -> % preserve group path + {[Gr],Cases}; + true -> + {Gr,Cases} end || Gr <- Groups], append({{Node,Dir},[{Suite,Groups1}]},Tests); insert_groups(Node,Dir,Suite,Groups,Cases,Tests,true) when ((Cases == all) or is_list(Cases)) and is_list(Groups) -> + Groups1 = [if is_list(Gr) -> % preserve group path + {[Gr],Cases}; + true -> + {Gr,Cases} end || Gr <- Groups], case lists:keysearch({Node,Dir},1,Tests) of {value,{{Node,Dir},[{all,_}]}} -> Tests; {value,{{Node,Dir},Suites0}} -> - Suites1 = insert_groups1(Suite, - [{Gr,Cases} || Gr <- Groups], - Suites0), + Suites1 = insert_groups1(Suite,Groups1,Suites0), insert_in_order({{Node,Dir},Suites1},Tests); false -> - Groups1 = [{Gr,Cases} || Gr <- Groups], insert_in_order({{Node,Dir},[{Suite,Groups1}]},Tests) end; insert_groups(Node,Dir,Suite,Groups,Case,Tests, MergeTests) @@ -1062,13 +1066,13 @@ insert_groups1(Suite,Groups,Suites0) -> insert_groups2(_Groups,all) -> all; -insert_groups2([Group={GrName,Cases}|Groups],GrAndCases) -> - case lists:keysearch(GrName,1,GrAndCases) of - {value,{GrName,all}} -> +insert_groups2([Group={Gr,Cases}|Groups],GrAndCases) -> + case lists:keysearch(Gr,1,GrAndCases) of + {value,{Gr,all}} -> GrAndCases; - {value,{GrName,Cases0}} -> + {value,{Gr,Cases0}} -> Cases1 = insert_in_order(Cases,Cases0), - insert_groups2(Groups,insert_in_order({GrName,Cases1},GrAndCases)); + insert_groups2(Groups,insert_in_order({Gr,Cases1},GrAndCases)); false -> insert_groups2(Groups,insert_in_order(Group,GrAndCases)) end; diff --git a/lib/common_test/test/Makefile b/lib/common_test/test/Makefile index 686ee43aa3..374fd8a824 100644 --- a/lib/common_test/test/Makefile +++ b/lib/common_test/test/Makefile @@ -51,7 +51,8 @@ MODULES= \ ct_basic_html_SUITE \ ct_auto_compile_SUITE \ ct_verbosity_SUITE \ - ct_shell_SUITE + ct_shell_SUITE \ + ct_groups_search_SUITE ERL_FILES= $(MODULES:%=%.erl) diff --git a/lib/common_test/test/ct_config_SUITE.erl b/lib/common_test/test/ct_config_SUITE.erl index 1e1df908db..d92be9ec6e 100644 --- a/lib/common_test/test/ct_config_SUITE.erl +++ b/lib/common_test/test/ct_config_SUITE.erl @@ -88,8 +88,8 @@ require(Config) when is_list(Config) -> DataDir = ?config(data_dir, Config), run_test(config_static_SUITE, Config, - [{config, filename:join(DataDir, "config/shadow.txt")}, - {config, filename:join(DataDir, "config/config.txt")}], + [{config, [filename:join(DataDir, "config/shadow.txt"), + filename:join(DataDir, "config/config.txt")]}], ["config_static_SUITE"]). install_config(Config) when is_list(Config) -> @@ -174,6 +174,7 @@ run_test(Name, Config, CTConfig, SuiteNames)-> Joiner = fun(Suite) -> filename:join(DataDir, "config/test/"++Suite) end, Suites = lists:map(Joiner, SuiteNames), {Opts,ERPid} = setup_env({suite,Suites}, Config, CTConfig), + ok = ct_test_support:run(Opts, Config), TestEvents = ct_test_support:get_events(ERPid, Config), ct_test_support:log_events(Name, diff --git a/lib/common_test/test/ct_groups_search_SUITE.erl b/lib/common_test/test/ct_groups_search_SUITE.erl new file mode 100644 index 0000000000..6b1c1f4634 --- /dev/null +++ b/lib/common_test/test/ct_groups_search_SUITE.erl @@ -0,0 +1,1245 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%%%------------------------------------------------------------------- +%%% File: +%%% +%%% Description: +%%% +%%% +%%% The suites used for the test are located in the data directory. +%%% +%%% The group(s) and case(s) are specified according to this: +%%% +%%% Tests = ct_groups:find_groups(Mod, GroupPaths, TestCases, GroupDef) +%%% +%%% GroupPaths = GroupPath | [GroupPath] +%%% GroupPath = atom() | [atom()] +%%% +%%% CT will find all paths that include GroupPath. GroupPath can be a +%%% single group, or a list of groups along the path to TestCases. +%%% If GroupPath is the latter, the last group in the list must be +%%% the "terminating" group in the path, or it will be impossible to +%%% execute test cases in higher level groups *only*, as in this case: +%%% groups() -> [{g1,[],[tc1,{g2,[],[tc2]}]}]. +%%% Compare: find_groups(x, g1, all, groups()), and +%%% find_groups(x, [[g1]], all, groups()) +%%% +%%% Some examples: +%%% +%%% GroupPaths = g1, means find all paths with g1 included +%%% GroupPaths = [g1], -''- +%%% GroupPaths = [g1,g2], search twice - once for g1 and once for g2 +%%% GroupPaths = [[g1,g2]], find cases under group g1 and sub group g2 +%%% GroupPaths = [[g1,g2],[g1,g3]], find cases for g1-g2 AND g1-g3 +%%% +%%% TestCases = all | atom() | [atom()] +%%% +%%%------------------------------------------------------------------- + +-module(ct_groups_search_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("common_test/src/ct_util.hrl"). + + +-define(eh, ct_test_support_eh). + +-define(M1, groups_search_dummy_1_SUITE). +-define(M2, groups_search_dummy_2_SUITE). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +init_per_suite(Config) -> + DataDir = proplists:get_value(data_dir, Config), + code:add_patha(DataDir), + M1Erl = filename:join(DataDir, atom_to_list(?M1)++".erl"), + M2Erl = filename:join(DataDir, atom_to_list(?M2)++".erl"), + {ok,?M1} = compile:file(M1Erl, [{outdir,DataDir}]), + {ok,?M2} = compile:file(M2Erl, [{outdir,DataDir}]), + {module,?M1} = code:load_file(?M1), + {module,?M2} = code:load_file(?M2), + + Config1 = ct_test_support:init_per_suite(Config), + Config1. + +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() -> [{ct_hooks,[ts_install_cth]}]. + +groups() -> + [ + {find_groups,[],[all_groups, + testcases_in_all_groups, + all_in_top_group1, + all_in_top_group2, + all_in_sub_group1, + all_in_sub_group2, + testcase_in_top_group1, + testcase_in_top_group2, + testcase_in_sub_group1, + testcase_in_sub_group2, + testcase_in_top_groups1, + testcase_in_top_groups2, + testcase_in_top_groups3, + testcase_in_top_groups4, + testcase_in_top_groups5, + testcase_in_top_groups6, + testcase_in_top_groups7, + testcase_in_sub_groups1, + testcase_in_sub_groups2, + testcase_in_sub_groups3, + testcase_in_sub_groups4, + testcase_in_sub_groups5, + testcase_in_sub_groups6, + testcase_in_sub_groups7, + testcase_in_sub_groups8, + testcase_in_sub_groups9, + testcase_in_sub_groups10, + testcase_in_sub_groups11, + testcase_in_sub_groups12, + testcase_in_sub_groups13, + bad_testcase_in_sub_groups1]}, + + {run_groups,[sequence],[run_groups_with_options, + run_groups_with_testspec]} + ]. + +all() -> + [{group,find_groups,[parallel]}, + {group,run_groups}]. + + + +%%-------------------------------------------------------------------- +%% TEST CASES CHECKING RETURN VALUE ONLY +%%-------------------------------------------------------------------- + +all_groups(_) -> + GPath = all, TCs = all, + + Found = ct_groups:find_groups(?M1, GPath, TCs, groups1()), + + Top1 = ct_groups:find_groups(?M1, top1, TCs, groups1()), + Top2 = ct_groups:find_groups(?M1, top2, TCs, groups1()), + + All = Top1 ++ Top2 ++ [{conf,[{name,sub2}], + {?M1,init_per_group}, + [{?M1,sub2_tc1},{?M1,sub2_tc2}], + {?M1,end_per_group}}], + + All = Found, + + {?M1,GPath,TCs,Top1++Top2}. + +%%%----------------------------------------------------------------- +%%% +testcases_in_all_groups(_) -> + GPath = all, TCs = [tc3,sub_tc2], + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [Top1 = + {conf,[{name,top1}],{?M2,init_per_group}, + [{?M2,tc3}, + {conf,[{name,sub11}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}], + {?M2,end_per_group}}, + {conf,[{name,sub12}], + {?M2,init_per_group}, + [{?M2,tc3},{?M2,sub_tc2}, + {conf,[{name,sub121}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + Top2 = + {conf,[{name,top2}],{?M2,init_per_group}, + [{?M2,tc3}, + {conf,[{name,sub21}], + {?M2,init_per_group}, + [{?M2,tc3},{?M2,sub_tc2}, + {conf,[{name,sub2xx}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{?M2,tc3},{?M2,sub_tc2}, + {conf,[{name,sub221}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}], + {?M2,end_per_group}}, + {conf,[{name,sub2xx}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub21}], + {?M2,init_per_group}, + [{?M2,tc3},{?M2,sub_tc2}, + {conf,[{name,sub2xx}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}],{?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{?M2,tc3},{?M2,sub_tc2}, + {conf,[{name,sub221}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}],{?M2,end_per_group}}, + {conf,[{name,sub2xx}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}],{?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub221}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}],{?M2,end_per_group}}, + + {conf,[{name,sub2xx}], + {?M2,init_per_group},[{?M2,tc3},{?M2,sub_tc2}],{?M2,end_per_group}}] + + = Found, + + {?M2,GPath,TCs,[Top1,Top2]}. + +%%%----------------------------------------------------------------- +%%% +all_in_top_group1(_) -> + GPath= top1, TCs = all, + + Found = ct_groups:find_groups(?M1, GPath, TCs, groups1()), + + [{conf,[{name,top1}], + {?M1,init_per_group}, + [{?M1,top1_tc1},{?M1,top1_tc2}, + {conf,[{name,sub1}], + {?M1,init_per_group}, + [{?M1,sub1_tc1},{?M1,sub1_tc2}], + {?M1,end_per_group}}], + {?M1,end_per_group}}] = Found, + + {?M1,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +all_in_top_group2(_) -> + GPath= top2, TCs = all, + + Found = ct_groups:find_groups(?M1, GPath, TCs, groups1()), + + [{conf,[{name,top2}], + {?M1,init_per_group}, + [{conf,[{name,sub2}], + {?M1,init_per_group}, + [{?M1,sub2_tc1},{?M1,sub2_tc2}], + {?M1,end_per_group}}, + {?M1,top2_tc1},{?M1,top2_tc2}], + {?M1,end_per_group}}] = Found, + + {?M1,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +all_in_sub_group1(_) -> + GPath = sub1, TCs = all, + + Found = ct_groups:find_groups(?M1, GPath, TCs, groups1()), + + [{conf,[{name,top1}], + {?M1,init_per_group}, + [{conf,[{name,sub1}], + {?M1,init_per_group}, + [{?M1,sub1_tc1},{?M1,sub1_tc2}], + {?M1,end_per_group}}], + {?M1,end_per_group}}] = Found, + + {?M1,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +all_in_sub_group2(_) -> + GPath = sub2, TCs = all, + + Found = ct_groups:find_groups(?M1, GPath, TCs, groups1()), + + [Top2 = + {conf,[{name,top2}], + {?M1,init_per_group}, + [{conf,[{name,sub2}], + {?M1,init_per_group}, + [{?M1,sub2_tc1},{?M1,sub2_tc2}], + {?M1,end_per_group}}], + {?M1,end_per_group}}, + + {conf,[{name,sub2}], + {?M1,init_per_group}, + [{?M1,sub2_tc1},{?M1,sub2_tc2}], + {?M1,end_per_group}}] = Found, + + {?M1,GPath,TCs,Top2}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_top_group1(_) -> + GPath = top1, TCs = [top1_tc2], + + Found = ct_groups:find_groups(?M1, GPath, TCs, groups1()), + + [{conf,[{name,top1}], + {?M1,init_per_group}, + [{?M1,top1_tc2}], + {?M1,end_per_group}}] = Found, + + {?M1,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_top_group2(_) -> + GPath = top2, TCs = [top2_tc2], + + Found = ct_groups:find_groups(?M1, GPath, TCs, groups1()), + + [{conf,[{name,top2}], + {?M1,init_per_group}, + [{?M1,top2_tc2}], + {?M1,end_per_group}}] = Found, + + {?M1,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_group1(_) -> + GPath = sub1, TCs = [sub1_tc2], + + Found = ct_groups:find_groups(?M1, GPath, TCs, groups1()), + + [{conf,[{name,top1}], + {?M1,init_per_group}, + [{conf,[{name,sub1}], + {?M1,init_per_group}, + [{?M1,sub1_tc2}], + {?M1,end_per_group}}], + {?M1,end_per_group}}] = Found, + + {?M1,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_group2(_) -> + GPath = sub2, TCs = [sub2_tc2], + + Found = ct_groups:find_groups(?M1, GPath, TCs, groups1()), + + [Top2 = + {conf,[{name,top2}], + {?M1,init_per_group}, + [{conf,[{name,sub2}], + {?M1,init_per_group}, + [{?M1,sub2_tc2}], + {?M1,end_per_group}}], + {?M1,end_per_group}}, + + {conf,[{name,sub2}], + {?M1,init_per_group}, + [{?M1,sub2_tc2}], + {?M1,end_per_group}}] = Found, + + {?M1,GPath,TCs,Top2}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_top_groups1(_) -> + GPath = [top1,top2], TCs = all, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{?M2,top1_tc1},{?M2,top_tc2},{?M2,tc3}, + {conf,[{name,sub11}], + {?M2,init_per_group}, + [{?M2,sub11_tc1},{?M2,sub_tc2},{?M2,tc3}], + {?M2,end_per_group}}, + {conf,[{name,sub12}], + {?M2,init_per_group}, + [{?M2,sub12_tc1},{?M2,sub_tc2},{?M2,tc3}, + {conf,[{name,sub121}], + {?M2,init_per_group}, + [{?M2,sub121_tc1},{?M2,sub_tc2},{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub21}], + {?M2,init_per_group}, + [{?M2,sub21_tc1},{?M2,sub_tc2},{?M2,tc3}, + {conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,sub2xx_tc1},{?M2,sub_tc2},{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + {?M2,top2_tc1},{?M2,top_tc2},{?M2,tc3}, + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub221}], + {?M2,init_per_group}, + [{?M2,sub221_tc1},{?M2,sub_tc2},{?M2,tc3}], + {?M2,end_per_group}}, + {?M2,sub22_tc1},{?M2,sub_tc2},{?M2,tc3}, + {conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,sub2xx_tc1},{?M2,sub_tc2},{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_top_groups2(_) -> + GPath = [top1,top2], TCs = tc3, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{?M2,tc3}, + {conf,[{name,sub11}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}, + {conf,[{name,sub12}], + {?M2,init_per_group}, + [{?M2,tc3}, + {conf,[{name,sub121}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,top2}], + {?M2,init_per_group}, + [{?M2,tc3}, + {conf,[{name,sub21}], + {?M2,init_per_group}, + [{?M2,tc3}, + {conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{?M2,tc3}, + {conf,[{name,sub221}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}, + {conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_top_groups3(_) -> + GPath = [top1,top2], TCs = top1_tc1, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{?M2,top1_tc1}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_top_groups4(_) -> + GPath = [top1,top2], TCs = sub2xx_tc1, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub21}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,sub2xx_tc1}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,sub2xx_tc1}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_top_groups5(_) -> + GPath = [top1,top2], TCs = [sub21_tc1,sub22_tc1], + + Found = ct_groups:find_groups(?M2, [top1,top2], [sub21_tc1,sub22_tc1], + groups2()), + + [{conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub21}], + {?M2,init_per_group}, + [{?M2,sub21_tc1}], + {?M2,end_per_group}}, + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{?M2,sub22_tc1}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_top_groups6(_) -> + GPath = [[top1],[top2]], TCs = tc3, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}, + {conf,[{name,top2}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_top_groups7(_) -> + GPath = [[top1],[top2]], TCs = all, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{?M2,top1_tc1}, + {?M2,top_tc2}, + {?M2,tc3}], + {?M2,end_per_group}}, + {conf,[{name,top2}], + {?M2,init_per_group}, + [{?M2,top2_tc1}, + {?M2,top_tc2}, + {?M2,tc3}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups1(_) -> + GPath = [sub121], TCs = tc3, + + Found = ct_groups:find_groups(?M2, sub121, tc3, groups2()), + Found = ct_groups:find_groups(?M2, [sub121], tc3, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{conf,[{name,sub12}], + {?M2,init_per_group}, + [{conf,[{name,sub121}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups2(_) -> + GPath = sub12, TCs = tc3, + + Found = ct_groups:find_groups(?M2, sub12, tc3, groups2()), + Found = ct_groups:find_groups(?M2, [sub12], tc3, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{conf,[{name,sub12}], + {?M2,init_per_group}, + [{?M2,tc3}, + {conf,[{name,sub121}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + FoundX = ct_groups:find_groups(?M2, [[sub12]], tc3, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{conf,[{name,sub12}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = FoundX, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups3(_) -> + GPath = [sub121,sub221], TCs = all, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [Top1 = + {conf,[{name,top1}], + {?M2,init_per_group}, + [{conf,[{name,sub12}], + {?M2,init_per_group}, + [{conf,[{name,sub121}], + {?M2,init_per_group}, + [{?M2,sub121_tc1}, + {?M2,sub_tc2}, + {?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + Top2 = + {conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub221}], + {?M2,init_per_group}, + [{?M2,sub221_tc1}, + {?M2,sub_tc2}, + {?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub221}], + {?M2,init_per_group}, + [{?M2,sub221_tc1}, + {?M2,sub_tc2}, + {?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub221}], + {?M2,init_per_group}, + [{?M2,sub221_tc1}, + {?M2,sub_tc2}, + {?M2,tc3}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,[Top1,Top2]}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups4(_) -> + GPath = [top1,sub21], TCs = sub_tc2, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [Top1 = + {conf,[{name,top1}], + {?M2,init_per_group}, + [{conf,[{name,sub11}], + {?M2,init_per_group}, + [{?M2,sub_tc2}], + {?M2,end_per_group}}, + {conf,[{name,sub12}], + {?M2,init_per_group}, + [{?M2,sub_tc2}, + {conf,[{name,sub121}], + {?M2,init_per_group}, + [{?M2,sub_tc2}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + Top2 = + {conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub21}], + {?M2,init_per_group}, + [{?M2,sub_tc2}, + {conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,sub_tc2}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub21}], + {?M2,init_per_group}, + [{?M2,sub_tc2}, + {conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,sub_tc2}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,[Top1,Top2]}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups5(_) -> + GPath = [[top1,sub12]], TCs = sub12_tc1, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{conf,[{name,sub12}], + {?M2,init_per_group}, + [{?M2,sub12_tc1}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups6(_) -> + GPath = [[top1,sub12]], TCs = [sub_tc2], + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{conf,[{name,sub12}], + {?M2,init_per_group}, + [{?M2,sub_tc2}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups7(_) -> + GPath = [[top1,sub12]], TCs = [sub12_tc1,sub_tc2], + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{conf,[{name,sub12}], + {?M2,init_per_group}, + [{?M2,sub12_tc1}, + {?M2,sub_tc2}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups8(_) -> + GPath = [[top2,sub22]], TCs = [sub22_tc1,sub_tc2], + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub22}], + {?M2,init_per_group}, + [{?M2,sub22_tc1}, + {?M2,sub_tc2}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups9(_) -> + GPath = [[sub2xx]], TCs = tc3, + + Found = ct_groups:find_groups(?M2, sub2xx, tc3, groups2()), + Found = ct_groups:find_groups(?M2, [[sub2xx]], tc3, groups2()), + + [Top2 = + {conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub21}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub21}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Top2}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups10(_) -> + GPath = [[sub22,sub2xx]], TCs = tc3, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [Top2 = + {conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Top2}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups11(_) -> + GPath = [[top1,sub12,sub121]], TCs = all, + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top1}], + {?M2,init_per_group}, + [{conf,[{name,sub12}], + {?M2,init_per_group}, + [{conf,[{name,sub121}], + {?M2,init_per_group}, + [{?M2,sub121_tc1}, + {?M2,sub_tc2}, + {?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups12(_) -> + GPath = [[top2,sub2xx]], TCs = [sub2xx_tc1,tc3], + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub21}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,sub2xx_tc1}, + {?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}, + {conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,sub2xx_tc1}, + {?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +testcase_in_sub_groups13(_) -> + GPath = [[top2,sub22,sub2xx]], TCs = [top2_tc1,sub2xx_tc1,tc3], + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [{conf,[{name,top2}], + {?M2,init_per_group}, + [{conf,[{name,sub22}], + {?M2,init_per_group}, + [{conf,[{name,sub2xx}], + {?M2,init_per_group}, + [{?M2,sub2xx_tc1}, + {?M2,tc3}], + {?M2,end_per_group}}], + {?M2,end_per_group}}], + {?M2,end_per_group}}] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +bad_testcase_in_sub_groups1(_) -> + GPath = [sub2xx], TCs = [top2_tc1], + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% +bad_testcase_in_sub_groups2(_) -> + GPath = [sub12,sub2xx], TCs = [top1_tc1,top2_tc1], + + Found = ct_groups:find_groups(?M2, GPath, TCs, groups2()), + + [] = Found, + + {?M2,GPath,TCs,Found}. + +%%%----------------------------------------------------------------- +%%% CASES EXECUTING THE TESTS +%%%----------------------------------------------------------------- + +run_groups_with_options(Config) -> + DataDir = ?config(data_dir, Config), + + {M1All,M1Rest,M2All,M2Rest} = get_all_groups_and_cases(Config), + + M1AllGrs = lists:flatmap(fun({Path,_,_}) when is_atom(hd(Path)) -> Path; + ({Path,_,_}) when is_list(hd(Path)) -> Path; + ({Path,_,_}) -> [Path] + end, M1All), + + %% ct:pal("NOW RUNNING M1 TEST: ~p", [M1All]), + + {OptsM11,ERPidM11} = setup([{dir,DataDir},{suite,?M1}, + {group,M1AllGrs},{label,m1_all_cases}], Config), + M1AllGrInfo = {M1AllGrs,lists:flatten([Found || {_,_,Found} <- M1All])}, + ok = execute(m1_all_cases, M1AllGrInfo, OptsM11, ERPidM11, Config), + + lists:foldl( + fun({GrPath,TCs,Found}, N) -> + TestName = list_to_atom("m1_spec_cases_" ++ integer_to_list(N)), + %% ct:pal("NOW RUNNING M1 TEST ~p: ~p + ~p", + %% [TestName,GrPath,TCs]), + {OptsM12,ERPidM12} = setup([{dir,DataDir},{suite,?M1}, + {group,GrPath},{testcase,TCs}, + {label,TestName}], Config), + ok = execute(TestName, {GrPath,TCs,Found}, + OptsM12, ERPidM12, Config), + N+1 + end, 1, M1Rest), + + %% ct:pal("NOW RUNNING M2 TEST: ~p", [M2All]), + + M2AllGrs = lists:flatmap(fun({Path,_,_}) when is_atom(hd(Path)) -> Path; + ({Path,_,_}) when is_list(hd(Path)) -> Path; + ({Path,_,_}) -> [Path] + end, M2All), + + + {OptsM21,ERPidM21} = setup([{dir,DataDir},{suite,?M2}, + {group,M2AllGrs},{testcase,all}, + {label,m2_all_cases}], Config), + M2AllGrInfo = {M2AllGrs,lists:flatten([Found || {_,_,Found} <- M2All])}, + ok = execute(m2_all_cases, M2AllGrInfo, OptsM21, ERPidM21, Config), + + lists:foldl( + fun({GrPath,TCs,Found}, N) -> + TestName = list_to_atom("m2_spec_cases_" ++ integer_to_list(N)), + %% ct:pal("NOW RUNNING M2 TEST ~p: ~p + ~p", [TestName,GrPath,TCs]), + {OptsM22,ERPidM22} = setup([{dir,DataDir},{suite,?M2}, + {group,GrPath},{testcase,TCs}, + {label,TestName}], Config), + ok = execute(TestName, {GrPath,TCs,Found}, + OptsM22, ERPidM22, Config), + N+1 + end, 1, M2Rest), + ok. + + +%%%----------------------------------------------------------------- +%%% +run_groups_with_testspec(Config) -> + Name = run_groups_with_testspec, + DataDir = ?config(data_dir, Config), + PrivDir = ?config(priv_dir, Config), + + {M1All,M1Rest,M2All,M2Rest} = get_all_groups_and_cases(Config), + + M1AllGrs = lists:flatmap(fun({Path,_,_}) when is_atom(hd(Path)) -> Path; + ({Path,_,_}) when is_list(hd(Path)) -> Path; + ({Path,_,_}) -> [Path] + end, M1All), + M1AllTerm = {groups,DataDir,?M1,M1AllGrs}, + + M1RestTerms = lists:map( + fun({GrPath,TCs,_}) -> + {groups,DataDir,?M1,GrPath,{cases,TCs}} + end, M1Rest), + + M2AllGrs = lists:flatmap(fun({Path,_,_}) when is_atom(hd(Path)) -> Path; + ({Path,_,_}) when is_list(hd(Path)) -> Path; + ({Path,_,_}) -> [Path] + end, M2All), + M2AllTerm = {groups,DataDir,?M2,M2AllGrs,{cases,all}}, + + M2RestTerms = lists:map( + fun({GrPath,TCs,_}) -> + {groups,DataDir,?M2,GrPath,{cases,TCs}} + end, M2Rest), + + GroupTerms = lists:flatten([M1AllTerm, + M1RestTerms, + M2AllTerm, + M2RestTerms]), + + TestSpec = [{merge_tests,false}, + {label,Name}] ++ GroupTerms, + + ct:pal("Here's the test spec:~n~p", [TestSpec]), + + TestSpecName = ct_test_support:write_testspec(TestSpec, PrivDir, + "groups_search_spec"), + + {Opts,ERPid} = setup([{spec,TestSpecName}], Config), + GroupInfo = + [{M1AllTerm,lists:flatten([Found || {_,_,Found} <- M1All])} | + M1Rest] ++ + [{M2AllTerm,lists:flatten([Found || {_,_,Found} <- M2All])} | + M2Rest], + ok = execute(Name, GroupInfo, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% HELP FUNCTIONS +%%%----------------------------------------------------------------- + +groups1() -> + [{top1,[],[top1_tc1,top1_tc2,{sub1,[],[sub1_tc1,sub1_tc2]}]}, + {top2,[],[{group,sub2},top2_tc1,top2_tc2]}, + {sub2,[],[sub2_tc1,sub2_tc2]}]. + +groups2() -> + [{top1,[],[top1_tc1,top_tc2,tc3, + {sub11,[],[sub11_tc1,sub_tc2,tc3]}, + {sub12,[],[sub12_tc1,sub_tc2,tc3, + {sub121,[],[sub121_tc1,sub_tc2,tc3]}]}]}, + {top2,[],[{group,sub21},top2_tc1,top_tc2,tc3,{group,sub22}]}, + {sub21,[],[sub21_tc1,sub_tc2,tc3,{group,sub2xx}]}, + {sub22,[],[{group,sub221},sub22_tc1,sub_tc2,tc3,{group,sub2xx}]}, + {sub221,[],[sub221_tc1,sub_tc2,tc3]}, + {sub2xx,[],[sub2xx_tc1,sub_tc2,tc3]}]. + +get_all_groups_and_cases(Config) -> + {value,{_,_,FindGrTCs}} = lists:keysearch(find_groups, 1, groups()), + + MGTFs = [apply(?MODULE, TC, [Config]) || TC <- FindGrTCs], + + ct:pal("Extracted data from ~p test cases", [length(MGTFs)]), + + lists:foldr(fun({M,Gs,TCs,F}, + {M11,M12,M21,M22}) -> + case {M,Gs,TCs} of + {?M1,all,_} -> {M11,[{Gs,TCs,F}|M12],M21,M22}; + {?M1,_,all} -> {[{Gs,all,F}|M11],M12,M21,M22}; + {?M1,_,_} -> {M11,[{Gs,TCs,F}|M12],M21,M22}; + {?M2,all,_} -> {M11,M12,M21,[{Gs,TCs,F}|M22]}; + {?M2,_,all} -> {M11,M12,[{Gs,all,F}|M21],M22}; + {?M2,_,_} -> {M11,M12,M21,[{Gs,TCs,F}|M22]} + end + end, {[],[],[],[]}, MGTFs). + +%%%----------------------------------------------------------------- + +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}. + +execute(Name, TestParams, Opts, ERPid, Config) -> + ok = ct_test_support:run(Opts, Config), + Events = ct_test_support:get_events(ERPid, Config), + Events1 = reformat(Events, ?eh), + ct_test_support:log_events(Name, + Events1, + ?config(priv_dir, Config), + Opts), + verify_events(Name, TestParams, Events1). + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +verify_events(Name, Params, Events) -> + %% 2 tests (ct:run_test + script_start) is default + verify_events(Name, Params, Events, 2). + +verify_events(_, _, _, 0) -> + ok; +verify_events(Name, Params, Events, N) -> + test_events(Name, Params, Events), + verify_events(Name, Params, Events, N-1). + +%%%----------------------------------------------------------------- +%%% check run_groups_with_options + +test_events(TestName, {GrPath,Found}, Events) -> + test_events(TestName, {GrPath,all,Found}, Events); + +test_events(TestName, {GrPath,TCs,Found}, Events) + when TestName /= run_groups_with_testspec -> + try check_events(Events, flatten_tests(Found)) of + ok -> ok + catch + throw:Reason -> + ct:pal("Test failed for ~p with group path ~p and cases ~p" + "~nReason: ~p", [TestName,GrPath,TCs,Reason]), + throw(failed) + end; + +%%%----------------------------------------------------------------- +%%% check run_groups_with_testspec + +test_events(run_groups_with_testspec, Params, Events) -> + AllFound = lists:flatmap(fun({_All,Found}) when is_tuple(Found) -> + [Found]; + ({_All,Found}) -> + Found; + ({_Gr,_TCs,Found}) when is_tuple(Found) -> + [Found]; + ({_Gr,_TCs,Found}) -> + Found + end, Params), + try check_events(Events, flatten_tests(AllFound)) of + ok -> ok + catch + throw:Reason -> + ct:pal("Test failed for run_groups_with_testspec." + "~nReason: ~p", [Reason]), + throw(failed) + end. + +flatten_tests({conf,[{name,G}|_],{Mod,_I},Tests,_E}) -> + lists:flatten([{group,Mod,G} | flatten_tests(Tests)]); +flatten_tests([{conf,[{name,G}|_],{Mod,_I},Tests,_E} | Confs]) -> + lists:flatten([{group,Mod,G} | flatten_tests(Tests)]) ++ + lists:flatten(flatten_tests(Confs)); +flatten_tests([{_Mod,_TC} = Case | Tests]) -> + lists:flatten([Case | flatten_tests(Tests)]); +flatten_tests([]) -> + []. + +check_events([{_,tc_start,{Mod,{init_per_group,G,_}}} | Evs], + [{group,Mod,G} | Check]) -> + check_events(Evs, Check); +check_events([{_,tc_start,{Mod,TC}} | Evs], + [{Mod,TC} | Check]) when is_atom(TC) -> + check_events(Evs, Check); +check_events([{_,tc_start,{Mod,{init_per_group,G,_}}} | _Evs], Check) -> + ct:pal("CHECK FAILED!~nGroup ~p in ~p not found in ~p.", + [G,Mod,Check]), + throw({test_not_found,{Mod,G}}); +check_events([{_,tc_start,{Mod,TC}} | _Evs], Check) + when is_atom(TC), TC /= init_per_suite, TC /= end_per_suite -> + ct:pal("CHECK FAILED!~nCase ~p in ~p not found in ~p.", + [TC,Mod,Check]), + throw({test_not_found,{Mod,TC}}); +check_events([Group | Evs], Check) when is_list(Group) -> + Check1 = check_events(Group, Check), + check_events(Evs, Check1); +check_events(_, []) -> + ok; +check_events([Elem | Evs], Check) when is_tuple(Elem) -> + check_events(Evs, Check); +check_events([], Check = [_|_]) -> + ct:pal("CHECK FAILED!~nTests remain: ~p", [Check]), + throw({tests_remain,Check}); +check_events([Wut | _],_) -> + throw({unexpected,Wut}). + diff --git a/lib/common_test/test/ct_groups_search_SUITE_data/groups_search_dummy_1_SUITE.erl b/lib/common_test/test/ct_groups_search_SUITE_data/groups_search_dummy_1_SUITE.erl new file mode 100644 index 0000000000..6f6922e686 --- /dev/null +++ b/lib/common_test/test/ct_groups_search_SUITE_data/groups_search_dummy_1_SUITE.erl @@ -0,0 +1,83 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-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% +%% +-module(groups_search_dummy_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + + +all() -> + [{group,top1}, + {group,top2}]. + +groups() -> + [{top1,[],[top1_tc1,top1_tc2,{sub1,[],[sub1_tc1,sub1_tc2]}]}, + {top2,[],[{group,sub2},top2_tc1,top2_tc2]}, + {sub2,[],[sub2_tc1,sub2_tc2]}]. + +%%%----------------------------------------------------------------- +%%% CONFIG FUNCS +%%%----------------------------------------------------------------- + +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(_, Config) -> + Config. + +end_per_group(_, _Config) -> + ok. + +%%%----------------------------------------------------------------- +%%% TEST CASES +%%%----------------------------------------------------------------- + +top1_tc1(_) -> + ok. + +top1_tc2(_) -> + ok. + +sub1_tc1(_) -> + ok. + +sub1_tc2(_) -> + ok. + +top2_tc1(_) -> + ok. + +top2_tc2(_) -> + ok. + +sub2_tc1(_) -> + ok. + +sub2_tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_groups_search_SUITE_data/groups_search_dummy_2_SUITE.erl b/lib/common_test/test/ct_groups_search_SUITE_data/groups_search_dummy_2_SUITE.erl new file mode 100644 index 0000000000..ac3c000079 --- /dev/null +++ b/lib/common_test/test/ct_groups_search_SUITE_data/groups_search_dummy_2_SUITE.erl @@ -0,0 +1,102 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-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% +%% +-module(groups_search_dummy_2_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + + +all() -> + [{group,top1}, + {group,top2}]. + +groups() -> + [{top1,[],[top1_tc1,top_tc2,tc3, + {sub11,[],[sub11_tc1,sub_tc2,tc3]}, + {sub12,[],[sub12_tc1,sub_tc2,tc3, + {sub121,[],[sub121_tc1,sub_tc2,tc3]}]}]}, + + {top2,[],[{group,sub21},top2_tc1,top_tc2,tc3,{group,sub22}]}, + {sub21,[],[sub21_tc1,sub_tc2,tc3,{group,sub2xx}]}, + {sub22,[],[{group,sub221},sub22_tc1,sub_tc2,tc3,{group,sub2xx}]}, + {sub221,[],[sub221_tc1,sub_tc2,tc3]}, + {sub2xx,[],[sub2xx_tc1,sub_tc2,tc3]}]. + +%%%----------------------------------------------------------------- +%%% CONFIG FUNCS +%%%----------------------------------------------------------------- + +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(_, Config) -> + Config. + +end_per_group(_, _Config) -> + ok. + +%%%------------------------------------------------------------------ +%%% TEST CASES +%%%------------------------------------------------------------------ + +top1_tc1(_) -> + ok. + +top_tc2(_) -> + ok. + +tc3(_) -> + ok. + +sub_tc2(_) -> + ok. + +sub11_tc1(_) -> + ok. + +sub12_tc1(_) -> + ok. + +sub121_tc1(_) -> + ok. + +top2_tc1(_) -> + ok. + +sub21_tc1(_) -> + ok. + +sub22_tc1(_) -> + ok. + +sub221_tc1(_) -> + ok. + +sub2xx_tc1(_) -> + ok. diff --git a/lib/diameter/doc/src/.gitignore b/lib/diameter/doc/src/.gitignore index feeb378fd8..5776e1cc76 100644 --- a/lib/diameter/doc/src/.gitignore +++ b/lib/diameter/doc/src/.gitignore @@ -1,2 +1,3 @@ /depend.mk +/seehere.ent diff --git a/lib/diameter/doc/src/Makefile b/lib/diameter/doc/src/Makefile index d1d5e8f869..8ad38ba0d5 100644 --- a/lib/diameter/doc/src/Makefile +++ b/lib/diameter/doc/src/Makefile @@ -34,7 +34,8 @@ XML_REF_FILES = $(XML_REF1_FILES) $(XML_REF3_FILES) $(XML_REF4_FILES) XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) \ $(XML_REF_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) + $(XML_PART_FILES) $(XML_CHAPTER_FILES) \ + seealso.ent INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) @@ -93,7 +94,7 @@ html: gifs $(HTML_REF_MAN_FILE) clean clean_docs: clean_pdf clean_html clean_man rm -f errs core *~ - rm -f depend.mk + rm -f depend.mk seehere.ent clean_pdf: rm -f $(PDFDIR)/* @@ -170,7 +171,9 @@ release_docs_spec: $(LOCAL)docs release_spec: -depend.mk: depend.sed $(XML_REF_FILES) $(XML_CHAPTER_FILES) Makefile +depend.mk: depend.sed Makefile seealso.ent \ + $(XML_REF_FILES) $(XML_CHAPTER_FILES) + sed -f seehere.sed seealso.ent > seehere.ent (for f in $(XML_REF_FILES) $(XML_CHAPTER_FILES); do \ sed -f $< $$f | sed "s@%FILE%@`basename $$f .xml`@g"; \ done) \ diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml index c93a7b2c67..bc42b75c7a 100644 --- a/lib/diameter/doc/src/diameter.xml +++ b/lib/diameter/doc/src/diameter.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -49,15 +54,12 @@ Diameter protocol as defined in RFC 3588.</p> <p> Basic usage consists of creating a representation of a -locally implemented Diameter node and its capabilities with <seealso -marker="#start_service">start_service/2</seealso>, adding transport -capability using <seealso -marker="#add_transport">add_transport/2</seealso> and sending Diameter -requests and receiving Diameter answers with <seealso -marker="#call">call/4</seealso>. +locally implemented Diameter node and its capabilities with +&start_service;, adding transport capability using +&add_transport; and sending Diameter +requests and receiving Diameter answers with &call;. Incoming Diameter requests are communicated as callbacks to a -<seealso -marker="diameter_app">diameter_app(3)</seealso> callback modules as +&man_app; callback modules as specified in the service configuration.</p> <p> @@ -90,7 +92,7 @@ in this module.</p> <item> <p> Types corresponding to RFC 3588 AVP Data Formats. -Defined in <seealso marker="diameter_dict#DATA_TYPES">diameter_dict(4)</seealso>.</p> +Defined in &dict_data_types;.</p> <marker id="application_alias"/> </item> @@ -100,7 +102,7 @@ Defined in <seealso marker="diameter_dict#DATA_TYPES">diameter_dict(4)</seealso> <p> A name identifying a Diameter application in service configuration. -Passed to <seealso marker="#call">call/4</seealso> when sending requests +Passed to &call; when sending requests defined by the application.</p> <marker id="application_module"/> @@ -110,23 +112,22 @@ defined by the application.</p> | [Mod | ExtraArgs] | #diameter_callback{}</c></tag> <item> -<code> +<pre> Mod = atom() ExtraArgs = list() -</code> +</pre> <p> -A module implementing the callback interface defined in <seealso -marker="diameter_app">diameter_app(3)</seealso>, along with any +A module implementing the callback interface defined in &man_app;, +along with any extra arguments to be appended to those documented for the interface. Note that extra arguments specific to an outgoing request can be -specified to <seealso marker="#call">call/4</seealso>, in which case +specified to &call;, in which case those are are appended to any module-specific extra arguments.</p> <p> Specifying a <c>#diameter_callback{}</c> record allows individual -functions to be configured in place of the usual <seealso -marker="diameter_app">diameter_app(3)</seealso> callbacks. +functions to be configured in place of the usual &man_app; callbacks. See that module for details.</p> <marker id="application_opt"/> @@ -141,7 +142,7 @@ Has one the following types.</p> <taglist> -<tag><c>{alias, <seealso marker="#application_alias">application_alias()</seealso>}</c></tag> +<tag><c>{alias, &application_alias;}</c></tag> <item> <p> An unique identifier for the application in the scope of the @@ -156,17 +157,15 @@ unspecified.</p> The name of an encode/decode module for the Diameter messages defined by the application. These modules are generated from a specification file whose format is -documented in <seealso -marker="diameter_dict">diameter_dict(4)</seealso>.</p> +documented in &man_dict;.</p> </item> -<tag><c>{module, <seealso marker="#application_module">application_module()</seealso>}</c></tag> +<tag><c>{module, &application_module;}</c></tag> <item> <p> The callback module with which messages of the Diameter application are handled. -See <seealso marker="diameter_app">diameter_app(3)</seealso> for -the required interface and semantics.</p> +See &man_app; for the required interface and semantics.</p> </item> <tag><c>{state, term()}</c></tag> @@ -174,7 +173,7 @@ the required interface and semantics.</p> <p> The initial callback state. The prevailing state is passed to some -<seealso marker="diameter_app">diameter_app(3)</seealso> +&man_app; callbacks, which can then return a new state. Defaults to the value of the <c>alias</c> option if unspecified.</p> </item> @@ -182,14 +181,13 @@ Defaults to the value of the <c>alias</c> option if unspecified.</p> <tag><c>{call_mutates_state, true|false}</c></tag> <item> <p> -Specifies whether or not the <seealso -marker="diameter_app#pick_peer">pick_peer/4</seealso> +Specifies whether or not the &app_pick_peer; application callback can modify the application state, Defaults to <c>false</c> if unspecified.</p> <note> <p> -<seealso marker="diameter_app#pick_peer">pick_peer</seealso> callbacks +&app_pick_peer; callbacks are serialized when these are allowed to modify state, which is a potential performance bottleneck. A simple Diameter client may suffer no ill effects from using mutable @@ -203,10 +201,8 @@ probably avoid it.</p> <p> Determines the manner in which incoming answer messages containing decode errors are handled. -If <c>callback</c> then errors result in a <seealso -marker="diameter_app#handle_answer">handle_answer/4</seealso> -callback in the same fashion as for <seealso -marker="diameter_app#handle_request">handle_request/3</seealso>, with +If <c>callback</c> then errors result in a &app_handle_answer; +callback in the same fashion as for &app_handle_request;, with errors communicated in the <c>errors</c> field of the <c>#diameter_packet{}</c> record passed to the callback. If <c>report</c> then an answer containing errors is discarded @@ -214,7 +210,7 @@ without a callback and a warning report is written to the log. If <c>discard</c> then an answer containing errors is silently discarded without a callback. In both the <c>report</c> and <c>discard</c> cases the return value -for the <seealso marker="#call">call/4</seealso> invocation in +for the &call; invocation in question is as if a callback had taken place and returned <c>{error, failure}</c>.</p> @@ -231,7 +227,7 @@ Defaults to <c>report</c> if unspecified.</p> <item> <p> -Options available to <seealso marker="#call">call/4</seealso> when +Options available to &call; when sending an outgoing Diameter request. Has one of the following types.</p> @@ -247,18 +243,18 @@ itself. Multiple options append to the argument list.</p> </item> -<tag><c>{filter, <seealso marker="#peer_filter">peer_filter()</seealso>}</c></tag> +<tag><c>{filter, &peer_filter;}</c></tag> <item> <p> A filter to apply to the list of available peers before passing them to -the <seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> +the &app_pick_peer; callback for the application in question. Multiple options are equivalent a single <c>all</c> filter on the corresponding list of filters. Defaults to <c>none</c>.</p> </item> -<tag><c>{timeout, <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{timeout, &dict_Unsigned32;}</c></tag> <item> <p> The number of milliseconds after which the request should @@ -269,21 +265,17 @@ Defaults to 5000.</p> <tag><c>detach</c></tag> <item> <p> -Causes <seealso marker="#call">call/4</seealso> to return <c>ok</c> as +Causes &call; to return <c>ok</c> as soon as the request in question has been encoded instead of waiting for and returning -the result from a subsequent -<seealso marker="diameter_app#handle_answer">handle_answer/4</seealso> -or <seealso -marker="diameter_app#handle_error">handle_error/4</seealso> -callback.</p> +the result from a subsequent &app_handle_answer; or +&app_handle_error; callback.</p> </item> </taglist> <p> -An invalid option will cause <seealso marker="#call">call/4</seealso> -to fail.</p> +An invalid option will cause &call; to fail.</p> <marker id="capability"/> </item> @@ -300,9 +292,9 @@ Has one of the following types.</p> <taglist> -<tag><c>{'Origin-Host', <seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c></tag> -<tag><c>{'Origin-Realm', <seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c></tag> -<tag><c>{'Host-IP-Address', [<seealso marker="diameter_dict#DATA_TYPES">Address()</seealso>]}</c></tag> +<tag><c>{'Origin-Host', &dict_DiameterIdentity;}</c></tag> +<tag><c>{'Origin-Realm', &dict_DiameterIdentity;}</c></tag> +<tag><c>{'Host-IP-Address', [&dict_Address;]}</c></tag> <item> <p> An address list is available to the start function of a @@ -312,24 +304,23 @@ Host-IP-Address need not be specified if the transport start function returns an address list.</p> </item> -<tag><c>{'Vendor-Id', <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> -<tag><c>{'Product-Name', <seealso marker="diameter_dict#DATA_TYPES">UTF8String()</seealso>}</c></tag> -<tag><c>{'Origin-State-Id', <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{'Vendor-Id', &dict_Unsigned32;}</c></tag> +<tag><c>{'Product-Name', &dict_UTF8String;}</c></tag> +<tag><c>{'Origin-State-Id', &dict_Unsigned32;}</c></tag> <item> <p> Origin-State-Id is optional but will be included in outgoing messages sent by diameter itself: CER/CEA, DWR/DWA and DPR/DPA. Setting a value of <c>0</c> (zero) is equivalent to not setting a value as documented in RFC 3588. -The function <seealso -marker="#origin_state_id">origin_state_id/0</seealso> +The function &origin_state_id; can be used as to retrieve a value that is computed when the diameter application is started.</p> </item> -<tag><c>{'Supported-Vendor-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag> -<tag><c>{'Auth-Application-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag> -<tag><c>{'Inband-Security-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag> +<tag><c>{'Supported-Vendor-Id', [&dict_Unsigned32;]}</c></tag> +<tag><c>{'Auth-Application-Id', [&dict_Unsigned32;]}</c></tag> +<tag><c>{'Inband-Security-Id', [&dict_Unsigned32;]}</c></tag> <item> <p> Inband-Security-Id defaults to the empty list, which is equivalent to a @@ -338,9 +329,9 @@ If 1 (= TLS) is specified then TLS is selected if the CER/CEA received from the peer offers it.</p> </item> -<tag><c>{'Acct-Application-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag> -<tag><c>{'Vendor-Specific-Application-Id', [<seealso marker="diameter_dict#DATA_TYPES">Grouped()</seealso>]}</c></tag> -<tag><c>{'Firmware-Revision', <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{'Acct-Application-Id', [&dict_Unsigned32;]}</c></tag> +<tag><c>{'Vendor-Specific-Application-Id', [&dict_Grouped;]}</c></tag> +<tag><c>{'Firmware-Revision', &dict_Unsigned32;}</c></tag> </taglist> @@ -357,7 +348,7 @@ It is an error to specify duplicate tuples.</p> An expression that can be evaluated as a function in the following sense.</p> -<code> +<pre> eval([{M,F,A} | T]) -> apply(M, F, T ++ A); eval([[F|A] | T]) -> @@ -366,10 +357,10 @@ eval([F|A]) -> apply(F, A); eval(F) -> eval([F]). -</code> +</pre> <p> -Applying an <c><seealso marker="#evaluable">evaluable()</seealso></c> +Applying an <c>&evaluable;</c> <c>E</c> to an argument list <c>A</c> is meant in the sense of <c>eval([E|A])</c>.</p> @@ -380,10 +371,7 @@ situations in which the fun is not short-lived and code is to be upgraded at runtime since any processes retaining such a fun will have a reference to old code. In particular, such a value is typically inappropriate in -configuration passed to <seealso -marker="#start_service">start_service/2</seealso> or -<seealso -marker="#add_transport">add_transport/2</seealso>.</p> +configuration passed to &start_service; or &add_transport;.</p> </warning> <marker id="peer_filter"/> @@ -392,10 +380,8 @@ marker="#add_transport">add_transport/2</seealso>.</p> <tag><c>peer_filter() = term()</c></tag> <item> <p> -A filter passed to <seealso marker="#call">call/4</seealso> -in order to select candidate peers for a -<seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> -callback. +A filter passed to &call; in order to select candidate peers for a +&app_pick_peer; callback. Has one of the following types.</p> <taglist> @@ -426,42 +412,42 @@ or any peer if the request does not contain a <c>Destination-Realm</c> AVP.</p> </item> -<tag><c>{host, any|<seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c></tag> +<tag><c>{host, any|&dict_DiameterIdentity;}</c></tag> <item> <p> Matches only those peers whose <c>Origin-Host</c> has the specified value, or all peers if the atom <c>any</c>.</p> </item> -<tag><c>{realm, any|<seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso></c></tag> +<tag><c>{realm, any|&dict_DiameterIdentity;</c></tag> <item> <p> Matches only those peers whose <c>Origin-Realm</c> has the specified value, or all peers if the atom <c>any</c>.</p> </item> -<tag><c>{eval, <seealso marker="#evaluable">evaluable()</seealso>}</c></tag> +<tag><c>{eval, &evaluable;}</c></tag> <item> <p> -Matches only those peers for which the specified <c><seealso -marker="#evaluable">evaluable()</seealso></c> returns +Matches only those peers for which the specified +<c>&evaluable;</c> returns <c>true</c> on the connection's <c>diameter_caps</c> record. Any other return value or exception is equivalent to <c>false</c>.</p> </item> -<tag><c>{neg, <seealso marker="#peer_filter">peer_filter()</seealso>}</c></tag> +<tag><c>{neg, &peer_filter;}</c></tag> <item> <p> Matches only those peers not matched by the specified filter.</p> </item> -<tag><c>{all, [<seealso marker="#peer_filter">peer_filter()</seealso>]}</c></tag> +<tag><c>{all, [&peer_filter;]}</c></tag> <item> <p> Matches only those peers matched by each filter in the specified list.</p> </item> -<tag><c>{any, [<seealso marker="#peer_filter">peer_filter()</seealso>]}</c></tag> +<tag><c>{any, [&peer_filter;]}</c></tag> <item> <p> Matches only those peers matched by at least one filter in the @@ -477,15 +463,12 @@ that matches no peer.</p> <note> <p> The <c>host</c> and <c>realm</c> filters examine the -outgoing request as passed to <seealso marker="#call">call/4</seealso>, -assuming that this is a record- or list-valued <c><seealso -marker="diameter_app#message">diameter_app:message()</seealso></c>, +outgoing request as passed to &call;, +assuming that this is a record- or list-valued <c>&app_message;</c>, and that the message contains at most one of each AVP. -If this is not the case then the <c>{host|realm, <seealso -marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c> +If this is not the case then the <c>{host|realm, &dict_DiameterIdentity;}</c> filters must be used to achieve the desired result. -An empty <c><seealso -marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso></c> +An empty <c>&dict_DiameterIdentity;</c> (which should not be typical) matches all hosts/realms for the purposes of filtering.</p> </note> @@ -504,7 +487,7 @@ candidates list.</p> <item> <p> An event message sent to processes that have subscribed to these using -<seealso marker="#subscribe">subscribe/1</seealso>.</p> +&subscribe;.</p> <p> The <c>info</c> field of the event record can have one of the @@ -527,12 +510,12 @@ implies the termination of all transport processes.</p> <tag><c>{up, Ref, Peer, Config}</c></tag> <tag><c>{down, Ref, Peer, Config}</c></tag> <item> -<code> -Ref = <seealso marker="#transport_ref">transport_ref()</seealso> -Peer = <seealso marker="diameter_app#peer">diameter_app:peer()</seealso> -Config = {connect|listen, [<seealso marker="#transport_opt">transport_opt()</seealso>]} +<pre> +Ref = &transport_ref; +Peer = &app_peer; +Config = {connect|listen, [&transport_opt;]} Pkt = #diameter_packet{} -</code> +</pre> <p> The RFC 3539 watchdog state machine has @@ -546,7 +529,8 @@ connectivity.</p> <p> Note that a single <c>up</c>/<c>down</c> event for a given peer -corresponds to one <seealso marker="diameter_app#peer_up">peer_up/peer_down</seealso> +corresponds to one +<seealso marker="diameter_app#Mod:peer_up-3">peer_up/peer_down</seealso> callback for each of the Diameter applications negotiated during capablilities exchange. That is, the event communicates connectivity with the @@ -556,25 +540,23 @@ respect to individual Diameter applications.</p> <tag><c>{reconnect, Ref, Opts}</c></tag> <item> -<code> -Ref = <seealso marker="#transport_ref">transport_ref()</seealso> -Opts = [<seealso marker="#transport_opt">transport_opt()</seealso>] -</code> +<pre> +Ref = &transport_ref; +Opts = [&transport_opt;] +</pre> <p> A connecting transport is attempting to establish/reestablish a -transport connection with a peer following <seealso -marker="#reconnect_timer">reconnect_timer</seealso> or -<seealso marker="#watchdog_timer">watchdog_timer</seealso> -expiry.</p> +transport connection with a peer following &reconnect_timer; or +&watchdog_timer; expiry.</p> </item> <tag><c>{closed, Ref, Reason, Config}</c></tag> <item> -<code> -Ref = <seealso marker="#transport_ref">transport_ref()</seealso> -Config = {connect|listen, [<seealso marker="#transport_opt">transport_opt()</seealso>]} -</code> +<pre> +Ref = &transport_ref; +Config = {connect|listen, [&transport_opt;]} +</pre> <p> Capabilities exchange has failed. @@ -584,13 +566,13 @@ Capabilities exchange has failed. <tag><c>{'CER', Result, Caps, Pkt}</c></tag> <item> -<code> +<pre> Result = ResultCode | {capabilities_cb, CB, ResultCode|discard} Caps = #diameter_caps{} Pkt = #diameter_packet{} ResultCode = integer() -CB = <seealso marker="#evaluable">evaluable()</seealso> -</code> +CB = &evaluable; +</pre> <p> An incoming CER has been answered with the indicated result code or @@ -604,11 +586,11 @@ contains the rejecting callback.</p> <tag><c>{'CER', Caps, {ResultCode, Pkt}}</c></tag> <item> -<code> +<pre> ResultCode = integer() Caps = #diameter_caps{} Pkt = #diameter_packet{} -</code> +</pre> <p> An incoming CER contained errors and has been answered with the @@ -620,19 +602,18 @@ indicated result code. <tag><c>{'CER', timeout}</c></tag> <item> <p> -An expected CER was not received within <seealso -marker="#capx_timeout">capx_timeout</seealso> of +An expected CER was not received within &capx_timeout; of connection establishment.</p> </item> <tag><c>{'CEA', Result, Caps, Pkt}</c></tag> <item> -<code> +<pre> Result = integer() | atom() | {capabilities_cb, CB, ResultCode|discard} Caps = #diameter_caps{} Pkt = #diameter_packet{} ResultCode = integer() -</code> +</pre> <p> An incoming CEA has been rejected for the indicated reason. @@ -647,10 +628,10 @@ contains the rejecting callback.</p> <tag><c>{'CEA', Caps, Pkt}</c></tag> <item> -<code> +<pre> Caps = #diameter_caps{} Pkt = #diameter_packet{} -</code> +</pre> <p> An incoming CEA contained errors and has been rejected. @@ -661,8 +642,7 @@ An incoming CEA contained errors and has been rejected. <tag><c>{'CEA', timeout}</c></tag> <item> <p> -An expected CEA was not received within <seealso -marker="#capx_timeout">capx_timeout</seealso> +An expected CEA was not received within &capx_timeout; of connection establishment.</p> </item> @@ -671,12 +651,12 @@ of connection establishment.</p> <tag><c>{watchdog, Ref, PeerRef, {From, To}, Config}</c></tag> <item> -<code> -Ref = <seealso marker="#transport_ref">transport_ref()</seealso> -PeerRef = <seealso marker="diameter_app#peer_ref">diameter_app:peer_ref()</seealso> +<pre> +Ref = &transport_ref; +PeerRef = &app_peer_ref; From, To = initial | okay | suspect | down | reopen Config = {connect|listen, [transport_opt()]} -</code> +</pre> <p> An RFC 3539 watchdog state machine has changed state.</p> @@ -694,8 +674,7 @@ info fields of forms other than the above.</p> <tag><c>service_name() = term()</c></tag> <item> <p> -The name of a service as passed to <seealso -marker="#start_service">start_service/2</seealso> and with which the +The name of a service as passed to &start_service; and with which the service is identified. There can be at most one service with a given name on a given node. Note that <seealso marker="erts:erlang#make_ref-0">erlang:make_ref/0</seealso> @@ -707,25 +686,21 @@ can be used to generate a service name that is somewhat unique.</p> <tag><c>service_opt()</c></tag> <item> <p> -An option passed to <seealso -marker="#start_service">start_service/2</seealso>. -Can be any <c><seealso marker="#capability">capability()</seealso></c> as -well as the following.</p> +An option passed to &start_service;. +Can be any <c>&capability;</c> as well as the following.</p> <taglist> -<tag><c>{application, [<seealso marker="#application_opt">application_opt()</seealso>]}</c></tag> +<tag><c>{application, [&application_opt;]}</c></tag> <item> <p> Defines a Diameter application supported by the service.</p> <p> -A service must configure one <seealso -marker="#application">application</seealso> for each Diameter +A service must configure one tuple for each Diameter application it intends to support. -For an outgoing Diameter request, the relevant <c><seealso -marker="#application_alias">application_alias()</seealso></c> is -passed to <seealso marker="#call">call/4</seealso>, while for an +For an outgoing Diameter request, the relevant <c>&application_alias;</c> is +passed to &call;, while for an incoming request the application identifier in the message header determines the application, the identifier being specified in the application's <seealso marker="diameter_dict">dictionary</seealso> @@ -746,7 +721,7 @@ same peer are accepted by the service.</p> If type <c>[node()]</c> then a connection is rejected if another already exists on any of the specified nodes. Values of type <c>false</c>, <c>node</c>, <c>nodes</c> or -<seealso marker="#evaluable">evaluable()</seealso> are equivalent to +&evaluable; are equivalent to values <c>[]</c>, <c>[node()]</c>, <c>[node()|nodes()]</c> and the evaluated value, respectively, evaluation of each expression taking place whenever a new connection is to be established. @@ -761,20 +736,18 @@ by their own peer and watchdog state machines.</p> Defaults to <c>nodes</c>.</p> </item> -<tag><c>{sequence, {H,N} | <seealso - marker="#evaluable">evaluable()</seealso>}</c></tag> +<tag><c>{sequence, {H,N} | &evaluable;}</c></tag> <item> <p> Specifies a constant value <c>H</c> for the topmost <c>32-N</c> bits of of 32-bit End-to-End and Hop-by-Hop identifiers generated by the service, either explicity or as a return value of a function -to be evaluated at <seealso -marker="#start_service">start_service/2</seealso>. +to be evaluated at &start_service;. In particular, an identifier <c>Id</c> is mapped to a new identifier as follows.</p> -<code> +<pre> (H bsl N) bor (Id band ((1 bsl N) - 1)) -</code> +</pre> <p> Note that RFC 3588 requires that End-to-End identifiers remain unique for a period of at least 4 minutes and that this and the call rate @@ -798,13 +771,12 @@ Defaults to <c>{0,32}</c>.</p> <tag><c>transport_opt()</c></tag> <item> <p> -An option passed to <seealso -marker="#add_transport">add_transport/2</seealso>. +An option passed to &add_transport;. Has one of the following types.</p> <taglist> <marker id="applications"/> -<tag><c>{applications, [<seealso marker="#application_alias">application_alias()</seealso>]}</c></tag> +<tag><c>{applications, [&application_alias;]}</c></tag> <item> <p> The list of Diameter applications to which the transport should be @@ -814,7 +786,7 @@ Applications not configured on the service in question are ignored.</p> </item> <marker id="capabilities"/> -<tag><c>{capabilities, [<seealso marker="#capability">capability()</seealso>]}</c></tag> +<tag><c>{capabilities, [&capability;]}</c></tag> <item> <p> AVP's used to construct outgoing CER/CEA messages. @@ -824,19 +796,17 @@ question.</p> <p> Specifying a capability as a transport option may be particularly appropriate for Inband-Security-Id, in case -TLS is desired over TCP as implemented by -<seealso marker="diameter_tcp">diameter_tcp(3)</seealso>.</p> +TLS is desired over TCP as implemented by &man_tcp;.</p> </item> <marker id="capabilities_cb"/> -<tag><c>{capabilities_cb, <seealso marker="#evaluable">evaluable()</seealso>}</c></tag> +<tag><c>{capabilities_cb, &evaluable;}</c></tag> <item> <p> A callback invoked upon reception of CER/CEA during capabilities exchange in order to ask whether or not the connection should be accepted. -Applied to the <c><seealso -marker="#transport_ref">transport_ref()</seealso></c> and +Applied to the <c>&transport_ref;</c> and <c>#diameter_caps{}</c> record of the connection.</p> <p> @@ -871,23 +841,22 @@ Equivalent to returning <c>3010</c>, DIAMETER_UNKNOWN_PEER.</p> <p> Returning anything but <c>ok</c> or a 2xxx series result code causes the transport connection to be broken. -Multiple <seealso marker="#capabilities_cb">capabilities_cb</seealso> +Multiple &capabilities_cb; options can be specified, in which case the corresponding callbacks are applied until either all return <c>ok</c> or one does not.</p> </item> <marker id="capx_timeout"/> -<tag><c>{capx_timeout, - <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{capx_timeout, &dict_Unsigned32;}</c></tag> <item> <p> The number of milliseconds after which a transport process having an established transport connection will be terminated if the expected capabilities exchange message (CER or CEA) is not received from the peer. For a connecting transport, the timing reconnection attempts is -governed by <seealso marker="#watchdog_timer">watchdog_timer</seealso> or -<seealso marker="#reconnect_timer">reconnect_timer</seealso> expiry. +governed by &watchdog_timer; or +&reconnect_timer; expiry. For a listening transport, the peer determines the timing.</p> <p> @@ -895,21 +864,19 @@ Defaults to 10000.</p> </item> <marker id="disconnect_cb"/> -<tag><c>{disconnect_cb, <seealso marker="#evaluable">evaluable()</seealso>}</c></tag> +<tag><c>{disconnect_cb, &evaluable;}</c></tag> <item> <p> A callback invoked prior to terminating the transport process of a transport connection having watchdog state <c>OKAY</c>. Applied to <c>Reason=transport|service|application</c> and the -<c><seealso marker="#transport_ref">transport_ref()</seealso></c> and -<c><seealso marker="diameter_app#peer">diameter_app:peer()</seealso></c> +<c>&transport_ref;</c> and +<c>&app_peer;</c> in question, <c>Reason</c> indicating whether the the diameter application is being stopped, the service in question is being stopped -at <seealso -marker="#stop_service">stop_service/1</seealso> or -the transport in question is being removed at <seealso -marker="#remove_transport">remove_transport/2</seealso>, +at &stop_service; or +the transport in question is being removed at &remove_transport;, respectively.</p> <p> @@ -934,8 +901,7 @@ Defaults to <c>rebooting</c> for <c>Reason=service|application</c> and <c>goaway</c> for <c>Reason=transport</c>.</p> </item> -<tag><c>{timeout, - <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{timeout, &dict_Unsigned32;}</c></tag> <item> <p> The number of milliseconds after which the transport process is @@ -966,7 +932,7 @@ Equivalent to not having configured the callback.</p> </taglist> <p> -Multiple <seealso marker="#disconnect_cb">disconnect_cb</seealso> +Multiple &disconnect_cb; options can be specified, in which case the corresponding callbacks are applied until one of them returns a value other than <c>ignore</c>. @@ -980,17 +946,16 @@ Defaults to a single callback returning <c>dpr</c>.</p> <marker id="reconnect_timer"/> <tag><c>{reconnect_timer, Tc}</c></tag> <item> -<code> -Tc = <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso> -</code> +<pre> +Tc = &dict_Unsigned32; +</pre> <p> For a connecting transport, the RFC 3588 Tc timer, in milliseconds. Note that this timer determines the frequency with which a transport will attempt to establish a connection with its peer only <em>before</em> an initial connection is established: once there is an initial -connection it's <seealso -marker="#watchdog_timer">watchdog_timer</seealso> that determines the +connection it's &watchdog_timer; that determines the frequency of reconnection attempts, as required by RFC 3539.</p> <p> @@ -1000,8 +965,7 @@ regarded as an initial connection rather than a reestablishment, causing the RFC 3539 state machine to pass to state OKAY rather than REOPEN. Note that these semantics are not governed by the RFC and -that a listening transport's <seealso -marker="#reconnect_timer">reconnect_timer</seealso> should be greater +that a listening transport's &reconnect_timer; should be greater than its peer's Tw plus jitter.</p> <p> @@ -1011,13 +975,11 @@ transport.</p> <marker id="transport_config"/> <tag><c>{transport_config, term()}</c></tag> -<tag><c>{transport_config, term(), <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{transport_config, term(), &dict_Unsigned32;}</c></tag> <item> <p> -A term passed as the third argument to the <seealso -marker="diameter_transport#start">start/3</seealso> function of -the relevant <seealso -marker="#transport_module">transport_module</seealso> in order to +A term passed as the third argument to the &transport_start; function of +the relevant &transport_module; in order to start a transport process. Defaults to the empty list if unspecified.</p> @@ -1029,12 +991,12 @@ For example, the following options on a connecting transport request a connection with one peer over SCTP or another (typically the same) over TCP.</p> -<code> +<pre> {transport_module, diameter_sctp} {transport_config, SctpOpts, 5000} {transport_module, diameter_tcp} {transport_config, TcpOpts} -</code> +</pre> <p> To listen on both SCTP and TCP, define one transport for each.</p> @@ -1044,17 +1006,15 @@ To listen on both SCTP and TCP, define one transport for each.</p> <tag><c>{transport_module, atom()}</c></tag> <item> <p> -A module implementing a transport process as defined in <seealso -marker="diameter_transport">diameter_transport(3)</seealso>. +A module implementing a transport process as defined in &man_transport;. Defaults to <c>diameter_tcp</c> if unspecified.</p> <p> -Multiple <c>transport_module</c> and <seealso -marker="#transport_config">transport_config</seealso> +Multiple <c>transport_module</c> and &transport_config; options are allowed. The order of these is significant in this case (and only in this case), a <c>transport_module</c> being paired with the first -<seealso marker="#transport_config">transport_config</seealso> +&transport_config; following it in the options list, or the default value for trailing modules. Transport starts will be attempted with each of the @@ -1065,10 +1025,10 @@ corresponding timeout (see below) or all fail.</p> <marker id="watchdog_timer"/> <tag><c>{watchdog_timer, TwInit}</c></tag> <item> -<code> -TwInit = <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso> +<pre> +TwInit = &dict_Unsigned32; | {M,F,A} -</code> +</pre> <p> The RFC 3539 watchdog timer. @@ -1088,10 +1048,8 @@ Defaults to 30000 if unspecified.</p> <p> Unrecognized options are silently ignored but are returned unmodified -by <seealso -marker="#service_info">service_info/2</seealso> and can be referred to -in predicate functions passed to <seealso -marker="#remove_transport">remove_transport/2</seealso>.</p> +by &service_info; and can be referred to +in predicate functions passed to &remove_transport;.</p> <marker id="transport_ref"/> </item> @@ -1099,8 +1057,7 @@ marker="#remove_transport">remove_transport/2</seealso>.</p> <tag><c>transport_ref() = reference()</c></tag> <item> <p> -An reference returned by <seealso -marker="#add_transport">add_transport/2</seealso> that +An reference returned by &add_transport; that identifies the configuration.</p> </item> @@ -1108,7 +1065,6 @@ identifies the configuration.</p> </section> -<marker id="add_transport"/> <funcs> <!-- ===================================================================== --> @@ -1118,9 +1074,9 @@ identifies the configuration.</p> -> {ok, Ref} | {error, Reason}</name> <fsummary>Add transport capability to a service.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> -<v>Opt = <seealso marker="#transport_opt">transport_opt()</seealso></v> -<v>Ref = <seealso marker="#transport_ref">transport_ref()</seealso></v> +<v>SvcName = &service_name;</v> +<v>Opt = &transport_opt;</v> +<v>Ref = &transport_ref;</v> <v>Reason = term()</v> </type> <desc> @@ -1139,8 +1095,7 @@ one peer, an listening transport potentially with many.</p> The diameter application takes responsibility for exchanging CER/CEA with the peer. Upon successful completion of capabilities exchange the service -calls each relevant application module's <seealso -marker="diameter_app#peer_up">peer_up/3</seealso> callback +calls each relevant application module's &app_peer_up; callback after which the caller can exchange Diameter messages with the peer over the transport. In addition to CER/CEA, the service takes responsibility for the @@ -1159,7 +1114,6 @@ been configured: a service can be started after configuring its transports.</p> </note> -<marker id="call"/> </desc> </func> @@ -1169,11 +1123,11 @@ its transports.</p> <name>call(SvcName, App, Request, [Opt]) -> Answer | ok | {error, Reason}</name> <fsummary>Send a Diameter request message.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> -<v>App = <seealso marker="#application_alias">application_alias()</seealso></v> -<v>Request = <seealso marker="diameter_app#message">diameter_app:message()</seealso></v> +<v>SvcName = &service_name;</v> +<v>App = &application_alias;</v> +<v>Request = &app_message;</v> <v>Answer = term()</v> -<v>Opt = <seealso marker="#call_opt">call_opt()</seealso></v> +<v>Opt = &call_opt;</v> </type> <desc> <p> @@ -1182,37 +1136,29 @@ Send a Diameter request message.</p> <p> <c>App</c> specifies the Diameter application in which the request is defined and callbacks to the corresponding callback module -will follow as described below and in <seealso -marker="diameter_app">diameter_app(3)</seealso>. +will follow as described below and in &man_app;. Unless the <c>detach</c> option is specified, the call returns either when an answer message is received from the peer or an error occurs. In the answer case, the return value is as returned by a -<seealso -marker="diameter_app#handle_answer">handle_answer/4</seealso> -callback. +&app_handle_answer; callback. In the error case, whether or not the error is returned directly -by diameter or from a <seealso -marker="diameter_app#handle_error">handle_error/4</seealso> +by diameter or from a &app_handle_error; callback depends on whether or not the outgoing request is successfully encoded for transmission to the peer, the cases being documented below.</p> <p> If there are no suitable peers, or if -<seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> +&app_pick_peer; rejects them by returning <c>false</c>, then <c>{error,no_connection}</c> is returned. -Otherwise <seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> -is followed by a -<seealso -marker="diameter_app#prepare_request">prepare_request/3</seealso> -callback, the message is encoded and then sent.</p> +Otherwise &app_pick_peer; is followed by a +&app_prepare_request; callback, the message is encoded and then sent.</p> <p> There are several error cases which may prevent an answer from being received and passed to a -<seealso marker="diameter_app#handle_answer">handle_answer/4</seealso> -callback:</p> +&app_handle_answer; callback:</p> <list> @@ -1227,16 +1173,14 @@ is returned.</p> <p> If the request is successfully encoded and sent but the answer times out then a -<seealso marker="diameter_app#handle_error">handle_error/4</seealso> -callback takes place with <c>Reason = timeout</c>.</p> +&app_handle_error; callback takes place with <c>Reason = timeout</c>.</p> </item> <item> <p> If the request is successfully encoded and sent but the service in question is stopped before an answer is received then a -<seealso marker="diameter_app#handle_error">handle_error/4</seealso> -callback takes place with <c>Reason = cancel</c>.</p> +&app_handle_error; callback takes place with <c>Reason = cancel</c>.</p> </item> <item> @@ -1245,18 +1189,11 @@ If the transport connection with the peer goes down after the request has been sent but before an answer has been received then an attempt is made to resend the request to an alternate peer. If no such peer is available, or if the subsequent -<seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> -callback rejects the candidates, then a -<seealso marker="diameter_app#handle_error">handle_error/4</seealso> -callback takes place with <c>Reason = failover</c>. -If a peer is selected then a -<seealso -marker="diameter_app#prepare_retransmit">prepare_retransmit/3</seealso> +&app_pick_peer; callback rejects the candidates, then a +&app_handle_error; callback takes place with <c>Reason = failover</c>. +If a peer is selected then a &app_prepare_retransmit; callback takes place, after which the semantics are the same as -following an initial -<seealso marker="diameter_app#prepare_request"> -prepare_request/3</seealso> -callback.</p> +following an initial &app_prepare_request; callback.</p> </item> <item> @@ -1283,14 +1220,13 @@ Note that <c>{error,encode}</c> is the only return value which guarantees that the request has <em>not</em> been sent over the transport connection.</p> -<marker id="origin_state_id"/> </desc> </func> <!-- ===================================================================== --> <func> -<name>origin_state_id() -> <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso></name> +<name>origin_state_id() -> &dict_Unsigned32;</name> <fsummary>Returns a reasonable Origin-State-Id.</fsummary> <desc> <p> @@ -1299,10 +1235,9 @@ outgoing messages.</p> <p> The value returned is the number of seconds since 19680120T031408Z, -the first value that can be encoded as a Diameter <c><seealso marker="diameter_dict#DATA_TYPES">Time()</seealso></c>, +the first value that can be encoded as a Diameter <c>&dict_Time;</c>, at the time the diameter application was started.</p> -<marker id="remove_transport"/> </desc> </func> @@ -1312,11 +1247,11 @@ at the time the diameter application was started.</p> <name>remove_transport(SvcName, Pred) -> ok | {error, Reason}</name> <fsummary>Remove previously added transports.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> -<v>Pred = Fun | MFA | <seealso marker="#transport_ref">transport_ref()</seealso> | list() | true | false</v> +<v>SvcName = &service_name;</v> +<v>Pred = Fun | MFA | &transport_ref; | list() | true | false</v> <v></v> -<v>Fun = fun((<seealso marker="#transport_ref">transport_ref()</seealso>, connect|listen, list()) -> boolean())</v> -<v> | fun((<seealso marker="#transport_ref">transport_ref()</seealso>, list()) -> boolean())</v> +<v>Fun = fun((&transport_ref;, connect|listen, list()) -> boolean())</v> +<v> | fun((&transport_ref;, list()) -> boolean())</v> <v> | fun((list()) -> boolean())</v> <v>MFA = {atom(), atom(), list()}</v> <v>Reason = term()</v> @@ -1329,12 +1264,11 @@ Remove previously added transports.</p> <c>Pred</c> determines which transports to remove. An arity-3-valued <c>Pred</c> removes all transports for which <c>Pred(Ref, Type, Opts)</c> returns <c>true</c>, where <c>Type</c> and -<c>Opts</c> are as passed to <seealso -marker="#add_transport">add_transport/2</seealso> and <c>Ref</c> is +<c>Opts</c> are as passed to &add_transport; and <c>Ref</c> is as returned by it. The remaining forms are equivalent to an arity-3 fun as follows.</p> -<code> +<pre> Pred = fun(transport_ref(), list()): fun(Ref, _, Opts) -> Pred(Ref, Opts) end Pred = fun(list()): fun(_, _, Opts) -> Pred(Opts) end Pred = transport_ref(): fun(Ref, _, _) -> Pred == Ref end @@ -1342,17 +1276,15 @@ Pred = list(): fun(_, _, Opts) -> [] == Pred -- Opts end Pred = true: fun(_, _, _) -> true end Pred = false: fun(_, _, _) -> false end Pred = {M,F,A}: fun(Ref, Type, Opts) -> apply(M, F, [Ref, Type, Opts | A]) end -</code> +</pre> <p> Removing a transport causes the corresponding transport processes to be terminated. Whether or not a DPR message is sent to a peer is -controlled by -value of <seealso marker="disconnect_cb">disconnect_cb</seealso> +controlled by value of &disconnect_cb; configured on the transport.</p> -<marker id="service_info"/> </desc> </func> @@ -1362,7 +1294,7 @@ configured on the transport.</p> <name>service_info(SvcName, Info) -> term()</name> <fsummary>Return information about a started service.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> <v>Info = Item | [Info]</v> <v>Item = atom()</v> </type> @@ -1393,15 +1325,13 @@ returned.</p> <tag><c>'Firmware-Revision'</c></tag> <item> <p> -Return a capability value as configured with <seealso -marker="#start_service">start_service/2</seealso>.</p> +Return a capability value as configured with &start_service;.</p> </item> <tag><c>applications</c></tag> <item> <p> -Return the list of applications as configured with <seealso -marker="#start_service">start_service/2</seealso>. +Return the list of applications as configured with &start_service;. </p> </item> @@ -1409,23 +1339,21 @@ marker="#start_service">start_service/2</seealso>. <item> <p> Return a tagged list of all capabilities values as configured with -<seealso -marker="#start_service">start_service/2</seealso>.</p> +&start_service;.</p> </item> <tag><c>transport</c></tag> <item> <p> Return a list containing one entry for each of the service's transport -as configured with <seealso -marker="#add_transport">add_transport/2</seealso>. +as configured with &add_transport;. Each entry is a tagged list containing both configuration and information about established peer connections. An example return value with for a client service with Origin-Host "client.example.com" configured with a single transport connected to "server.example.com" might look as follows.</p> -<code> +<pre> [[{ref,#Ref<0.0.0.93>}, {type,connect}, {options,[{transport_module,diameter_tcp}, @@ -1470,23 +1398,18 @@ An example return value with for a client service with Origin-Host {{{0,258,0},recv,{'Result-Code',2001}},3}, {{{0,280,1},recv},2}, {{{0,280,0},send},2}]}]] -</code> +</pre> <p> -Here <c>ref</c> is a <c><seealso -marker="#transport_ref">transport_ref()</seealso></c> and <c>options</c> -the corresponding <c><seealso -marker="#transport_opt">transport_opt()</seealso></c> list passed to <seealso -marker="#add_transport">add_transport/2</seealso>. +Here <c>ref</c> is a <c>&transport_ref;</c> and <c>options</c> +the corresponding <c>&transport_opt;</c> list passed to +&add_transport;. The <c>watchdog</c> entry shows the state of a connection's RFC 3539 watchdog state machine. -The <c>peer</c> entry identifies the <c><seealso -marker="diameter_app#peer_ref">diameter_app:peer_ref()</seealso></c> for -which there will have been <seealso -marker="diameter_app#peer_up">peer_up</seealso> callbacks for the +The <c>peer</c> entry identifies the <c>&app_peer_ref;</c> for +which there will have been &app_peer_up; callbacks for the Diameter applications identified by the <c>apps</c> entry, -<c>common</c> being the <c><seealso -marker="#application_alias">application_alias()</seealso></c>. +<c>common</c> being the <c>&application_alias;</c>. The <c>caps</c> entry identifies the capabilities sent by the local node and received from the peer during capabilities exchange. The <c>port</c> entry displays socket-level information about the @@ -1505,12 +1428,12 @@ during the lifetime of the transport configuration.</p> <p> A listening transport presents its information slightly differently -since there may be multiple accepted connections for the same <c><seealso -marker="#transport_ref">transport_ref()</seealso></c>. +since there may be multiple accepted connections for the same +<c>&transport_ref;</c>. The <c>transport</c> info returned by a server with a single client connection might look as follows.</p> -<code> +<pre> [[{ref,#Ref<0.0.0.61>}, {type,listen}, {options,[{transport_module,diameter_tcp}, @@ -1557,7 +1480,7 @@ connection might look as follows.</p> {{{0,280,0},send},5}, {{{0,257,1},recv},1}, {{{0,257,0},send},1}]}]] -</code> +</pre> <p> The information presented here is as in the <c>connect</c> case except @@ -1576,7 +1499,7 @@ connections and for which Diameter-level statistics are accumulated only for the lifetime of the transport connection. A return value for the server above might look as follows.</p> -<code> +<pre> [[{ref,#Ref<0.0.0.61>}, {type,accept}, {options,[{transport_module,diameter_tcp}, @@ -1622,7 +1545,7 @@ A return value for the server above might look as follows.</p> {{{0,280,0},send},66}, {{{0,257,1},recv},1}, {{{0,257,0},send},1}]}]] -</code> +</pre> <p> Note that there may be multiple entries with the same <c>ref</c>, in @@ -1633,41 +1556,37 @@ contrast to <c>transport</c> info.</p> <item> <p> Return a <c>{{Counter, Ref}, non_neg_integer()}</c> list of counter values. -<c>Ref</c> can be either a <c><seealso -marker="#transport_ref">transport_ref()</seealso></c> -or a <c><seealso -marker="diameter_app#peer_ref">diameter_app:peer_ref()</seealso></c>. +<c>Ref</c> can be either a <c>&transport_ref;</c> +or a <c>&app_peer_ref;</c>. Entries for the latter are folded into corresponding entries for the former as peer connections go down. -Entries for both are removed at <seealso -marker="#remove_transport">remove_transport/2</seealso>. +Entries for both are removed at &remove_transport;. The Diameter-level statistics returned by <c>transport</c> and <c>connections</c> info are based upon these entries.</p> </item> -<tag><c><seealso marker="diameter_app#peer_ref">diameter_app:peer_ref()</seealso></c></tag> +<tag><c>&app_peer_ref;</c></tag> <item> <p> Return transport configuration associated with a single peer, as -passed to <seealso marker="#add_transport">add_transport/2</seealso>. +passed to &add_transport;. The returned list is empty if the peer is unknown. Otherwise it contains the <c>ref</c>, <c>type</c> and <c>options</c> tuples as in <c>transport</c> and <c>connections</c> info above. For example:</p> -<code> +<pre> [{ref,#Ref<0.0.0.61>}, {type,accept}, {options,[{transport_module,diameter_tcp}, {transport_config,[{reuseaddr,true}, {ip,{127,0,0,1}}, {port,3868}]}]}] -</code> +</pre> </item> </taglist> -<marker id="services"/> </desc> </func> @@ -1677,23 +1596,22 @@ For example:</p> <name>services() -> [SvcName]</name> <fsummary>Return the list of started services.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> </type> <desc> <p> Return the list of started services.</p> -<marker id="session_id"/> </desc> </func> <!-- ===================================================================== --> <func> -<name>session_id(Ident) -> <seealso marker="diameter_dict#DATA_TYPES">OctetString()</seealso></name> +<name>session_id(Ident) -> &dict_OctetString;</name> <fsummary>Return a value for a Session-Id AVP.</fsummary> <type> -<v>Ident = <seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso></v> +<v>Ident = &dict_DiameterIdentity;</v> </type> <desc> <p> @@ -1704,7 +1622,6 @@ The value has the form required by section 8.8 of RFC 3588. Ident should be the Origin-Host of the peer from which the message containing the returned value will be sent.</p> -<marker id="start"/> </desc> </func> @@ -1721,7 +1638,6 @@ The diameter application must be started before starting a service. In a production system this is typically accomplished by a boot file, not by calling <c>start/0</c> explicitly.</p> -<marker id="start_service"/> </desc> </func> @@ -1730,8 +1646,8 @@ file, not by calling <c>start/0</c> explicitly.</p> <name>start_service(SvcName, Options) -> ok | {error, Reason}</name> <fsummary>Start a Diameter service.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> -<v>Options = [<seealso marker="#service_opt">service_opt()</seealso>]</v> +<v>SvcName = &service_name;</v> +<v>Options = [&service_opt;]</v> <v>Reason = term()</v> </type> <desc> @@ -1741,8 +1657,7 @@ Start a diameter service.</p> <p> A service defines a locally-implemented Diameter node, specifying the capabilities to be advertised during capabilities exchange. -Transports are added to a service using <seealso -marker="#add_transport">add_transport/2</seealso>. +Transports are added to a service using &add_transport;. </p> <note> @@ -1753,7 +1668,6 @@ capabilities and restrict its supported Diameter applications so necessarily the case.</p> </note> -<marker id="stop_service"/> </desc> </func> @@ -1768,7 +1682,6 @@ Stop the diameter application.</p> <p> </p> -<marker id="stop_service"/> </desc> </func> @@ -1777,7 +1690,7 @@ Stop the diameter application.</p> <name>stop_service(SvcName) -> ok | {error, Reason}</name> <fsummary>Stop a Diameter service.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> <v>Reason = term()</v> </type> <desc> @@ -1787,17 +1700,15 @@ Stop a diameter service.</p> <p> Stopping a service causes all associated transport connections to be broken. -A DPR message with be sent as in the case of <seealso -marker="#remove_transport">remove_transport/2</seealso>.</p> +A DPR message with be sent as in the case of &remove_transport;.</p> <note> <p> -Stopping a transport does not remove any associated transports: -<seealso marker="#remove_transport">remove_transport/2</seealso> must +Stopping a service does not remove any associated transports: +&remove_transport; must be called to remove transport configuration.</p> </note> -<marker id="subscribe"/> </desc> </func> @@ -1807,12 +1718,11 @@ be called to remove transport configuration.</p> <name>subscribe(SvcName) -> true</name> <fsummary>Subscribe to event messages.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> </type> <desc> <p> -Subscribe to <c><seealso -marker="#service_event">service_event()</seealso></c> messages from +Subscribe to <c>&service_event;</c> messages from a service.</p> <p> @@ -1821,7 +1731,6 @@ that does not yet exist. Doing so before adding transports is required to guarantee the reception of all related events.</p> -<marker id="unsubscribe"/> </desc> </func> @@ -1831,7 +1740,7 @@ reception of all related events.</p> <name>unsubscribe(SvcName) -> true</name> <fsummary>Unsubscribe to event messages.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> </type> <desc> <p> @@ -1848,9 +1757,7 @@ Unsubscribe to event messages from a service.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter_app">diameter_app(3)</seealso>, -<seealso marker="diameter_transport">diameter_transport(3)</seealso>, -<seealso marker="diameter_dict">diameter_dict(4)</seealso></p> +&man_app;, &man_transport;, &man_dict;</p> </section> diff --git a/lib/diameter/doc/src/diameter_app.xml b/lib/diameter/doc/src/diameter_app.xml index b6870f7c28..304c69ebda 100644 --- a/lib/diameter/doc/src/diameter_app.xml +++ b/lib/diameter/doc/src/diameter_app.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -41,15 +46,13 @@ Callback module of a Diameter application.</modulesummary> <description> <p> -A diameter service as started by <seealso -marker="diameter#start_service">diameter:start_service/2</seealso> +A diameter service as started by &mod_start_service; configures one of more Diameter applications, each of whose configuration specifies a callback that handles messages specific to the application. The messages and AVPs of the application are defined in a dictionary file whose format is documented in -<seealso marker="diameter_dict">diameter_dict(4)</seealso> -while the callback module is documented here. +&man_dict; while the callback module is documented here. The callback module implements the Diameter application-specific functionality of a service.</p> @@ -60,26 +63,24 @@ The functions themselves are of three distinct flavours:</p> <list> <item> <p> -<seealso marker="#peer_up">peer_up/3</seealso> and -<seealso marker="#peer_down">peer_down/3</seealso> signal the +&peer_up; and &peer_down; signal the attainment or loss of connectivity with a Diameter peer.</p> </item> <item> <p> -<seealso marker="#pick_peer">pick_peer/4</seealso>, -<seealso marker="#prepare_request">prepare_request/3</seealso>, -<seealso marker="#prepare_retransmit">prepare_retransmit/3</seealso>, -<seealso marker="#handle_answer">handle_answer/4</seealso> -and <seealso marker="#handle_error">handle_error/4</seealso> are (or may -be) called as a consequence of a call to <seealso -marker="diameter#call">diameter:call/4</seealso> to send an outgoing +&pick_peer;, +&prepare_request;, +&prepare_retransmit;, +&handle_answer; +and &handle_error; are (or may be) called as a consequence of a call +to &mod_call; to send an outgoing Diameter request message.</p> </item> <item> <p> -<seealso marker="#handle_request">handle_request/3</seealso> +&handle_request; is called in response to an incoming Diameter request message.</p> </item> @@ -92,10 +93,9 @@ is called in response to an incoming Diameter request message.</p> The arities given for the the callback functions here assume no extra arguments. All functions will also be passed any extra arguments configured with -the callback module itself when calling <seealso -marker="diameter#start_service">diameter:start_service/2</seealso> +the callback module itself when calling &mod_start_service; and, for the call-specific callbacks, any extra arguments passed to -<seealso marker="diameter#call">diameter:call/4</seealso>.</p> +&mod_call;.</p> </note> <!-- ===================================================================== --> @@ -128,7 +128,7 @@ mandatory values as the bare value.</p> <item> <p> The representation of a Diameter message as passed to -<seealso marker="diameter#call">diameter:call/4</seealso>. +&mod_call;. The record representation is as outlined in <seealso marker="diameter_dict#MESSAGE_RECORDS">diameter_dict(4)</seealso>: @@ -145,7 +145,7 @@ whose head is a <c>#diameter_header{}</c> record and whose tail is a list of <c>#diameter_avp{}</c> records. This representation is used by diameter itself when relaying requests as directed by the return value of a -<seealso marker="#handle_request">handle_request/3</seealso> +&handle_request; callback. It differs from the other other two in that it bypasses the checks for messages that do not agree with their definitions in the dictionary in @@ -174,9 +174,7 @@ A term identifying a transport connection with a Diameter peer.</p> <marker id="peer"/> -<tag><c>peer() = - {<seealso marker="#peer_ref">peer_ref()</seealso>, - <seealso marker="#capabilities">capabilities()</seealso>}</c></tag> +<tag><c>peer() = {&peer_ref;, &capabilities;}</c></tag> <item> <p> A tuple representing a Diameter peer connection.</p> @@ -188,13 +186,9 @@ A tuple representing a Diameter peer connection.</p> <item> <p> The state maintained by the application callback functions -<seealso marker="#peer_up">peer_up/3</seealso>, -<seealso marker="#peer_down">peer_down/3</seealso> and (optionally) -<seealso marker="#pick_peer">pick_peer/4</seealso>. +&peer_up;, &peer_down; and (optionally) &pick_peer;. The initial state is configured in the call to -<seealso -marker="diameter#start_service">diameter:start_service/2</seealso> -that configures the application on a service. +&mod_start_service; that configures the application on a service. Callback functions returning a state are evaluated in a common service-specific process while those not returning state are evaluated in a request-specific @@ -215,9 +209,9 @@ process.</p> <name>Mod:peer_up(SvcName, Peer, State) -> NewState</name> <fsummary>Invoked when a transport connection has been established</fsummary> <type> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> -<v>State = NewState = <seealso marker="#state">state()</seealso></v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> +<v>State = NewState = &state;</v> </type> <desc> <p> @@ -238,14 +232,10 @@ new peer_ref().</p> <note> <p> There is no requirement that a callback return before incoming -requests are received: <seealso -marker="#handle_request">handle_request/3</seealso> callbacks must be -handled independently of <seealso -marker="#peer_up">peer_up/3</seealso> and <seealso -marker="#peer_down">peer_down/3</seealso>.</p> +requests are received: &handle_request; callbacks must be +handled independently of &peer_up; and &peer_down;.</p> </note> -<marker id="peer_down"/> </desc> </func> @@ -253,21 +243,18 @@ marker="#peer_down">peer_down/3</seealso>.</p> <name>Mod:peer_down(SvcName, Peer, State) -> NewState</name> <fsummary>Invoked when a transport connection has been lost.</fsummary> <type> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> -<v>State = NewState = <seealso marker="#state">state()</seealso></v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> +<v>State = NewState = &state;</v> </type> <desc> <p> Invoked to signal that a peer connection is no longer available -following a previous call to <seealso -marker="#peer_up">peer_up/3</seealso>. +following a previous call to &peer_up;. In particular, that the RFC 3539 watchdog state machine for the connection has left state <c>OKAY</c> and the peer will no longer be a -candidate in <seealso marker="#pick_peer">pick_peer()</seealso> -callbacks.</p> +candidate in &pick_peer; callbacks.</p> -<marker id="pick_peer"/> </desc> </func> @@ -276,16 +263,15 @@ callbacks.</p> -> Selection | false</name> <fsummary>Select a target peer for an outgoing request.</fsummary> <type> -<v>Candidates = [<seealso marker="#peer">peer()</seealso>]</v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>State = NewState = <seealso marker="#state">state()</seealso></v> +<v>Candidates = [&peer;]</v> +<v>SvcName = &mod_service_name;</v> +<v>State = NewState = &state;</v> <v>Selection = {ok, Peer} | {Peer, NewState}</v> -<v>Peer = <seealso marker="#peer">peer()</seealso> | false</v> +<v>Peer = &peer; | false</v> </type> <desc> <p> -Invoked as a consequence of a call to <seealso -marker="diameter#call">diameter:call/4</seealso> to select a destination +Invoked as a consequence of a call to &mod_call; to select a destination peer for an outgoing request. The return value indicates the selected peer.</p> @@ -293,39 +279,34 @@ The return value indicates the selected peer.</p> The candidate list contains only those peers that have advertised support for the Diameter application in question during capabilities exchange, that have not be excluded by a <c>filter</c> option in -the call to <seealso marker="diameter#call">diameter:call/4</seealso> +the call to &mod_call; and whose watchdog state machine is in the <c>OKAY</c> state. The order of the elements is unspecified except that any peers whose Origin-Host and Origin-Realm matches that of the outgoing request (in the sense of a <c>{filter, {all, [host, realm]}}</c> -option to <seealso marker="diameter#call">diameter:call/4</seealso>) +option to &mod_call;) will be placed at the head of the list.</p> <p> A callback that returns a peer() will be followed by a -<seealso marker="#prepare_request">prepare_request/3</seealso> +&prepare_request; callback and, if the latter indicates that the request should be sent, -by either <seealso marker="#handle_answer">handle_answer/4</seealso> -or <seealso marker="#handle_error">handle_error/4</seealso> depending +by either &handle_answer; +or &handle_error; depending on whether or not an answer message is received from the peer. -If the transport becomes unavailable after <seealso -marker="#prepare_request">prepare_request/3</seealso> then a new <seealso -marker="#pick_peer">pick_peer/4</seealso> callback may take place to -failover to an alternate peer, after which <seealso -marker="#prepare_retransmit">prepare_retransmit/3</seealso> takes the -place of <seealso -marker="#prepare_request">prepare_request/3</seealso> in resending the +If the transport becomes unavailable after &prepare_request; then a +new &pick_peer; callback may take place to +failover to an alternate peer, after which &prepare_retransmit; takes the +place of &prepare_request; in resending the request. -There is no guarantee that a <seealso -marker="#pick_peer">pick_peer/4</seealso> callback to select +There is no guarantee that a &pick_peer; callback to select an alternate peer will be followed by any additional callbacks since a retransmission to an alternate peer is abandoned if an answer is received from a previously selected peer.</p> <p> Returning <c>false</c> or <c>{false, NewState}</c> causes <c>{error, -no_connection}</c> to be returned from <seealso -marker="diameter#call">diameter:call/4</seealso>.</p> +no_connection}</c> to be returned from &mod_call;.</p> <p> The return values <c>false</c> and <c>{false, State}</c> (that is, @@ -335,16 +316,14 @@ The return values <c>false</c> and <c>{false, State}</c> (that is, <note> <p> The return value <c>{Peer, NewState}</c> is only allowed if -the Diameter application in question was configured with the <seealso -marker="diameter#application_opt">diameter:application_opt()</seealso> -<c>{call_mutates_state, true}</c>. +the Diameter application in question was configured with the +&mod_application_opt; <c>{call_mutates_state, true}</c>. Otherwise, the <c>State</c> argument is always the intial value as configured on the application, not any subsequent -value returned by a <seealso marker="#peer_up">peer_up/3</seealso> -or <seealso marker="#peer_down">peer_down/3</seealso> callback.</p> +value returned by a &peer_up; +or &peer_down; callback.</p> </note> -<marker id="prepare_request"/> </desc> </func> @@ -353,15 +332,13 @@ or <seealso marker="#peer_down">peer_down/3</seealso> callback.</p> <name>Mod:prepare_request(Packet, SvcName, Peer) -> Action</name> <fsummary>Return a request for encoding and transport.</fsummary> <type> -<v>Packet = <seealso marker="#packet">packet()</seealso></v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> +<v>Packet = &packet;</v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> <v>Action = Send | Discard | {eval_packet, Action, PostF}</v> -<v>Send = {send, <seealso marker="#packet">packet()</seealso> - | <seealso marker="#message">message()</seealso>}</v> +<v>Send = {send, &packet; | &message;}</v> <v>Discard = {discard, Reason} | discard</v> -<v>PostF = - <seealso marker="diameter#evaluable">diameter:evaluable()</seealso>}</v> +<v>PostF = &mod_evaluable;}</v> </type> <desc> <p> @@ -371,16 +348,15 @@ to modify the outgoing request. Many implementations may simply want to return <c>{send, Packet}</c></p> <p> -A returned <seealso marker="#packet">packet()</seealso> should set the +A returned &packet; should set the request to be encoded in its <c>msg</c> field and can set the <c>transport_data</c> field in order to pass information to the transport process. -Extra arguments passed to <seealso -marker="diameter#call">diameter:call/4</seealso> can be used to +Extra arguments passed to &mod_call; can be used to communicate transport (or any other) data to the callback.</p> <p> -A returned <seealso marker="#packet">packet()</seealso> can set +A returned &packet; can set the <c>header</c> field to a <c>#diameter_header{}</c> to specify values that should be preserved in the outgoing request, values otherwise being those in @@ -396,13 +372,11 @@ The return value is ignored.</p> <p> Returning <c>{discard, Reason}</c> causes the request to be aborted -and the <seealso -marker="diameter#call">diameter:call/4</seealso> for which the +and the &mod_call; for which the callback has taken place to return <c>{error, Reason}</c>. Returning <c>discard</c> is equivalent to returning <c>{discard, discarded}</c>.</p> -<marker id="prepare_retransmit"/> </desc> </func> @@ -410,35 +384,29 @@ discarded}</c>.</p> <name>Mod:prepare_retransmit(Packet, SvcName, Peer) -> Action</name> <fsummary>Return a request for encoding and retransmission.</fsummary> <type> -<v>Packet = <seealso marker="#packet">packet()</seealso></v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> +<v>Packet = &packet;</v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> <v>Action = Send | Discard | {eval_packet, Action, PostF}</v> -<v>Send = {send, <seealso marker="#packet">packet()</seealso> - | <seealso marker="#message">message()</seealso>}</v> +<v>Send = {send, &packet; | &message;}</v> <v>Discard = {discard, Reason} | discard</v> -<v>PostF = - <seealso marker="diameter#evaluable">diameter:evaluable()</seealso>}</v> +<v>PostF = &mod_evaluable;}</v> </type> <desc> <p> Invoked to return a request for encoding and retransmission. -Has the same role as <seealso -marker="#prepare_request">prepare_request/3</seealso> in the case that +Has the same role as &prepare_request; in the case that a peer connection is lost an an alternate peer selected but the -argument <seealso marker="#packet">packet()</seealso> is as returned -by the initial <seealso -marker="#prepare_request">prepare_request/3</seealso>.</p> +argument &packet; is as returned +by the initial &prepare_request;.</p> <p> Returning <c>{discard, Reason}</c> causes the request to be aborted -and a <seealso -marker="#handle_error">handle_error/4</seealso> callback to +and a &handle_error; callback to take place with <c>Reason</c> as initial argument. Returning <c>discard</c> is equivalent to returning <c>{discard, discarded}</c>.</p> -<marker id="handle_answer"/> </desc> </func> @@ -446,52 +414,43 @@ discarded}</c>.</p> <name>Mod:handle_answer(Packet, Request, SvcName, Peer) -> Result</name> <fsummary>Receive an answer message from a peer.</fsummary> <type> -<v>Packet = <seealso marker="#packet">packet()</seealso></v> -<v>Request = <seealso marker="#message">message()</seealso></v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> +<v>Packet = &packet;</v> +<v>Request = &message;</v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> <v>Result = term()</v> </type> <desc> <p> Invoked when an answer message is received from a peer. -The return value is returned from <seealso -marker="diameter#call">diameter:call/4</seealso> unless the +The return value is returned from &mod_call; unless the <c>detach</c> option was specified.</p> <p> The decoded answer record and undecoded binary are in the <c>msg</c> and <c>bin</c> fields of the argument -<seealso marker="#packet">packet()</seealso> respectively. +&packet; respectively. <c>Request</c> is the outgoing request message as was returned from -<seealso marker="#prepare_request">prepare_request/3</seealso> or -<seealso - marker="#prepare_retransmit">prepare_retransmit/3</seealso>.</p> +&prepare_request; or &prepare_retransmit;.</p> <p> -For any given call to <seealso -marker="diameter#call">diameter:call/4</seealso> there is at most one -<seealso marker="#handle_answer">handle_answer/4</seealso> callback: any +For any given call to &mod_call; there is at most one +&handle_answer; callback: any duplicate answer (due to retransmission or otherwise) is discarded. -Similarly, only one of <seealso -marker="#handle_answer">handle_answer/4</seealso> or -<seealso marker="#handle_error">handle_error/4</seealso> is -called.</p> +Similarly, only one of &handle_answer; or +&handle_error; is called.</p> <p> By default, an incoming answer message that cannot be successfully decoded causes the request process to fail, causing -<seealso marker="diameter#call">diameter:call/4</seealso> +&mod_call; to return <c>{error, failure}</c> unless the <c>detach</c> option was specified. -In particular, there is no <seealso -marker="#handle_error">handle_error/4</seealso> callback in this +In particular, there is no &handle_error; callback in this case. -The <seealso -marker="diameter#application_opt">diameter:application_opt()</seealso> +The &mod_application_opt; <c>answer_errors</c> can be set to change this behaviour.</p> -<marker id="handle_error"/> </desc> </func> @@ -500,29 +459,26 @@ marker="diameter#application_opt">diameter:application_opt()</seealso> <fsummary>Return an error from a outgoing request.</fsummary> <type> <v>Reason = timeout | failover | term()</v> -<v>Request = <seealso marker="#message">message()</seealso></v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> +<v>Request = &message;</v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> <v>Result = term()</v> </type> <desc> <p> Invoked when an error occurs before an answer message is received in response to an outgoing request. -The return value is returned from <seealso -marker="diameter#call">diameter:call/4</seealso> unless the +The return value is returned from &mod_call; unless the <c>detach</c> option was specified.</p> <p> Reason <c>timeout</c> indicates that an answer message has not been -received within the time specified with the corresponding <seealso -marker="diameter#call_opt">diameter:call_opt()</seealso>. +received within the time specified with the corresponding &mod_call_opt;. Reason <c>failover</c> indicates that the transport connection to the peer to which the request has been sent has become unavailable and that not alternate peer was not selected.</p> -<marker id="handle_request"/> </desc> </func> @@ -530,25 +486,23 @@ not selected.</p> <name>Mod:handle_request(Packet, SvcName, Peer) -> Action</name> <fsummary>Receive an incoming request.</fsummary> <type> -<v>Packet = <seealso marker="#packet">packet()</seealso></v> +<v>Packet = &packet;</v> <v>SvcName = term()</v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> +<v>Peer = &peer;</v> <v>Action = Reply | {relay, [Opt]} | discard | {eval|eval_packet, Action, PostF}</v> -<v>Reply = {reply, <seealso marker="#packet">packet()</seealso> - | <seealso marker="#message">message()</seealso>} +<v>Reply = {reply, &packet; | &message;} | {protocol_error, 3000..3999}</v> -<v>Opt = <seealso marker="diameter#call_opt">diameter:call_opt()</seealso></v> -<v>PostF = <seealso marker="diameter#evaluable">diameter:evaluable()</seealso></v> +<v>Opt = &mod_call_opt;</v> +<v>PostF = &mod_evaluable;</v> </type> <desc> <p> Invoked when a request message is received from a peer. The application in which the callback takes place (that is, the -callback module as configured with <seealso -marker="diameter#start_service">diameter:start_service/2</seealso>) +callback module as configured with &mod_start_service;) is determined by the Application Identifier in the header of the incoming request message, the selected module being the one whose corresponding <seealso @@ -557,16 +511,16 @@ itself as defining either the application in question or the Relay application.</p> <p> -The argument <seealso marker="#packet">packet()</seealso> has the following signature.</p> +The argument &packet; has the following signature.</p> -<code> +<pre> #diameter_packet{header = #diameter_header{}, avps = [#diameter_avp{}], msg = record() | undefined, - errors = [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso> | {<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>, #diameter_avp{}}], + errors = [&dict_Unsigned32; | {&dict_Unsigned32;, #diameter_avp{}}], bin = binary(), transport_data = term()} -</code> +</pre> <p> The <c>msg</c> field will be <c>undefined</c> in case the request has @@ -580,8 +534,8 @@ The <c>errors</c> field specifies any Result-Code's identifying errors that were encountered in decoding the request. In this case diameter will set both Result-Code and Failed-AVP AVP's in a returned -answer <seealso marker="#message">message()</seealso> before sending it to the peer: -the returned <seealso marker="#message">message()</seealso> need only set any other required AVP's. +answer &message; before sending it to the peer: +the returned &message; need only set any other required AVP's. Note that the errors detected by diameter are all of the 5xxx series (Permanent Failures). The <c>errors</c> list is empty if the request has been received in @@ -591,21 +545,19 @@ the relay application.</p> The <c>transport_data</c> field contains an arbitrary term passed into diameter from the transport module in question, or the atom <c>undefined</c> if the transport specified no data. -The term is preserved if a <seealso -marker="#packet">message()</seealso> is returned but must be set -explicitly in a returned <seealso marker="#packet">packet()</seealso>.</p> +The term is preserved if a &message; is returned but must be set +explicitly in a returned &packet;.</p> <p> The semantics of each of the possible return values are as follows.</p> <taglist> -<tag><c>{reply, <seealso marker="#packet">packet()</seealso> - | <seealso marker="#message">message()</seealso>}</c></tag> +<tag><c>{reply, &packet; | &message;}</c></tag> <item> <p> Send the specified answer message to the peer. -In the case of a <seealso marker="#packet">packet()</seealso>, the +In the case of a &packet;, the message to be sent must be set in the <c>msg</c> field and the <c>header</c> field can be set to a <c>#diameter_header{}</c> to specify values that should be @@ -619,9 +571,9 @@ being set by diameter.</p> Send an answer message to the peer containing the specified protocol error. Equivalent to</p> -<code> +<pre> {reply, ['answer-message' | Avps] -</code> +</pre> <p> where <c>Avps</c> sets the Origin-Host, Origin-Realm, the specified Result-Code and (if the request sent one) Session-Id AVP's.</p> @@ -640,23 +592,22 @@ Relay a request to another peer in the role of a Diameter relay agent. If a routing loop is detected then the request is answered with 3005 (DIAMETER_LOOP_DETECTED). Otherwise a Route-Record AVP (containing the sending peer's Origin-Host) is -added to the request and <seealso marker="#pick_peer">pick_peer/4</seealso> -and subsequent callbacks take place just as if <seealso -marker="diameter#call">diameter:call/4</seealso> had been called +added to the request and &pick_peer; +and subsequent callbacks take place just as if &mod_call; had been called explicitly. The End-to-End Identifier of the incoming request is preserved in the header of the relayed request.</p> <p> The returned <c>Opts</c> should not specify <c>detach</c>. -A subsequent <seealso marker="#handle_answer">handle_answer/4</seealso> +A subsequent &handle_answer; callback for the relayed request must return its first argument, the <c>#diameter_packet{}</c> record containing the answer message. Note that the <c>extra</c> option can be specified to supply arguments that can distinguish the relay case from others if so desired. Any other return value (for example, from a -<seealso marker="#handle_error">handle_error/4</seealso> callback) +&handle_error; callback) causes the request to be answered with 3002 (DIAMETER_UNABLE_TO_DELIVER).</p> </item> diff --git a/lib/diameter/doc/src/diameter_compile.xml b/lib/diameter/doc/src/diameter_compile.xml index 7a6ca48798..eb6de80c11 100644 --- a/lib/diameter/doc/src/diameter_compile.xml +++ b/lib/diameter/doc/src/diameter_compile.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!DOCTYPE comref SYSTEM "comref.dtd"> +<!DOCTYPE comref SYSTEM "comref.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <comref> <header> @@ -122,7 +127,7 @@ Returns 0 on success, non-zero on failure.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter_dict">diameter_dict(4)</seealso></p> +&man_dict;</p> </section> diff --git a/lib/diameter/doc/src/diameter_dict.xml b/lib/diameter/doc/src/diameter_dict.xml index 98adebf145..4a6cccc276 100644 --- a/lib/diameter/doc/src/diameter_dict.xml +++ b/lib/diameter/doc/src/diameter_dict.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "fileref.dtd"> +<!DOCTYPE erlref SYSTEM "fileref.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <fileref> <header> @@ -40,8 +45,7 @@ under the License. <description> <p> -A diameter service as configured with <seealso -marker="diameter#start_service">diameter:start_service/2</seealso> +A diameter service as configured with &mod_start_service; specifies one or more supported Diameter applications. Each Diameter application specifies a dictionary module that knows how to encode and decode its messages and AVPs. @@ -58,8 +62,7 @@ resulting dictionaries modules on a service.</p> The codec generation also results in a hrl file that defines records for the messages and grouped AVPs defined for the application, these records being what a user of the diameter application sends and receives. -(Modulo other available formats as discussed in <seealso -marker="diameter_app">diameter_app(3)</seealso>.) +(Modulo other available formats as discussed in &man_app;.) These records and the underlying Erlang data types corresponding to Diameter data formats are discussed in <seealso marker="#MESSAGE_RECORDS">MESSAGE RECORDS</seealso> and <seealso @@ -125,9 +128,9 @@ is used to identify the relevant dictionary module.</p> <p> Example:</p> -<code> +<pre> @id 16777231 -</code> +</pre> </item> @@ -146,9 +149,9 @@ with existing modules in the system.</p> <p> Example:</p> -<code> +<pre> @name etsi_e2 -</code> +</pre> </item> @@ -169,9 +172,9 @@ different Diameter applications.</p> <p> Example:</p> -<code> +<pre> @prefix etsi_e2 -</code> +</pre> </item> @@ -189,9 +192,9 @@ The section has empty content.</p> <p> Example:</p> -<code> +<pre> @vendor 13019 ETSI -</code> +</pre> </item> @@ -205,13 +208,13 @@ The section content consists of AVP names.</p> <p> Example:</p> -<code> +<pre> @avp_vendor_id 2937 WWW-Auth Domain-Index Region-Set -</code> +</pre> </item> @@ -244,9 +247,9 @@ All dictionaries should typically inherit RFC3588 AVPs from <p> Example:</p> -<code> +<pre> @inherits diameter_gen_base_rfc3588 -</code> +</pre> </item> @@ -268,12 +271,12 @@ none are to be set.</p> <p> Example:</p> -<code> +<pre> @avp_types Location-Information 350 Grouped MV Requested-Information 353 Enumerated V -</code> +</pre> <warning> <p> @@ -298,11 +301,11 @@ encode/decode.</p> <p> Example:</p> -<code> +<pre> @custom_types rfc4005_avps Framed-IP-Address -</code> +</pre> </item> <tag><c>@codecs Mod</c></tag> @@ -315,11 +318,11 @@ Like <c>@custom_types</c> but requires the specified module to export <p> Example:</p> -<code> +<pre> @codecs rfc4005_avps Framed-IP-Address -</code> +</pre> </item> <tag><c>@messages</c></tag> @@ -330,7 +333,7 @@ The section content consists of definitions of the form specified in section 3.2 of RFC 3588, "Command Code ABNF specification".</p> <!-- RFC 4740 RTR/RTA --> -<code> +<pre> @messages RTR ::= < Diameter Header: 287, REQ, PXY > @@ -363,7 +366,7 @@ RTA ::= < Diameter Header: 287, PXY > * [ Proxy-Info ] * [ Route-Record ] * [ AVP ] -</code> +</pre> </item> @@ -378,14 +381,14 @@ section 4.4 of RFC 3588, "Grouped AVP Values".</p> <p> Example:</p> -<code> +<pre> @grouped SIP-Deregistration-Reason ::= < AVP Header: 383 > { SIP-Reason-Code } [ SIP-Reason-Info ] * [ AVP ] -</code> +</pre> <p> Specifying a Vendor-Id in the definition of a grouped AVP is @@ -408,14 +411,14 @@ otherwise defined in another dictionary.</p> <p> Example:</p> -<code> +<pre> @enum SIP-Reason-Code PERMANENT_TERMINATION 0 NEW_SIP_SERVER_ASSIGNED 1 SIP_SERVER_CHANGE 2 REMOVE_SIP_SERVER 3 -</code> +</pre> </item> <tag><c>@end</c></tag> @@ -450,22 +453,22 @@ contained in the message or grouped AVP in the order specified in the definition in question. For example, the grouped AVP</p> -<code> +<pre> SIP-Deregistration-Reason ::= < AVP Header: 383 > { SIP-Reason-Code } [ SIP-Reason-Info ] * [ AVP ] -</code> +</pre> <p> will result in the following record definition given an empty prefix.</p> -<code> +<pre> -record('SIP-Deregistration-Reason' {'SIP-Reason-Code', 'SIP-Reason-Info', 'AVP'}). -</code> +</pre> <p> The values encoded in the fields of generated records depends on the @@ -488,11 +491,9 @@ types being described below.</p> The data formats defined in sections 4.2 ("Basic AVP Data Formats") and 4.3 ("Derived AVP Data Formats") of RFC 3588 are encoded as values of the types defined here. -Values are passed to <seealso -marker="diameter#call">diameter:call/4</seealso> +Values are passed to &mod_call; in a request record when sending a request, returned in a resulting -answer record and passed to a <seealso -marker="diameter_app#handle_request">handle_request</seealso> +answer record and passed to a &app_handle_request; callback upon reception of an incoming request.</p> <p> @@ -507,7 +508,7 @@ callback upon reception of an incoming request.</p> <marker id="Float64"/> <marker id="Grouped"/> -<code> +<pre> OctetString() = [0..255] Integer32() = -2147483647..2147483647 Integer64() = -9223372036854775807..9223372036854775807 @@ -516,7 +517,7 @@ Unsigned64() = 0..18446744073709551615 Float32() = '-infinity' | float() | infinity Float64() = '-infinity' | float() | infinity Grouped() = record() -</code> +</pre> <p> On encode, an OctetString() can be specified as an iolist(), @@ -530,10 +531,10 @@ section.</p> <em>Derived AVP Data Formats</em></p> <marker id="Address"/> -<code> +<pre> Address() = OctetString() | tuple() -</code> +</pre> <p> On encode, an OctetString() IPv4 address is parsed in the usual @@ -545,7 +546,7 @@ An IPv6 tuple() has length 8 and contains values of type 0..65535. The tuple representation is used on decode.</p> <marker id="Time"/> -<code> +<pre> Time() = {date(), time()} where @@ -559,7 +560,7 @@ where Hour = 0..23 Minute = 0..59 Second = 0..59 -</code> +</pre> <p> Additionally, values that can be encoded are @@ -569,9 +570,9 @@ In particular, only values between <c>{{1968,1,20},{3,14,8}}</c> and <c>{{2104,2,26},{9,42,23}}</c> (both inclusive) can be encoded.</p> <marker id="UTF8String"/> -<code> +<pre> UTF8String() = [integer()] -</code> +</pre> <p> List elements are the UTF-8 encodings of the individual characters @@ -579,15 +580,15 @@ in the string. Invalid codepoints will result in encode/decode failure.</p> <marker id="DiameterIdentity"/> -<code> +<pre> DiameterIdentity() = OctetString() -</code> +</pre> <p> A value must have length at least 1.</p> <marker id="DiameterURI"/> -<code> +<pre> DiameterURI() = OctetString() | #diameter_URI{type = Type, fqdn = FQDN, @@ -602,7 +603,7 @@ where Port = integer() Transport = sctp | tcp Protocol = diameter | radius | 'tacacs+' -</code> +</pre> <p> On encode, fields port, transport and protocol default to 3868, sctp @@ -612,9 +613,9 @@ section 4.3 of RFC 3588. The record representation is used on decode.</p> <marker id="Enumerated"/> -<code> +<pre> Enumerated() = Integer32() -</code> +</pre> <p> On encode, values can be specified using the macros defined in a @@ -622,10 +623,10 @@ dictionary's hrl file.</p> <marker id="IPFilterRule"/> <marker id="QoSFilterRule"/> -<code> +<pre> IPFilterRule() = OctetString() QoSFilterRule() = OctetString() -</code> +</pre> <p> Values of these types are not currently parsed by diameter.</p> @@ -639,9 +640,7 @@ Values of these types are not currently parsed by diameter.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameterc">diameterc(1)</seealso>, -<seealso marker="diameter">diameter(3)</seealso>, -<seealso marker="diameter_app">diameter_app(3)</seealso></p> +&man_compile;, &man_main;, &man_app;</p> </section> diff --git a/lib/diameter/doc/src/diameter_sctp.xml b/lib/diameter/doc/src/diameter_sctp.xml index 709b17c0d2..a023a9bc08 100644 --- a/lib/diameter/doc/src/diameter_sctp.xml +++ b/lib/diameter/doc/src/diameter_sctp.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -41,10 +46,9 @@ under the License. This module implements diameter transport over SCTP using <seealso marker="kernel:gen_sctp">gen_sctp</seealso>. It can be specified as the value of a transport_module option to -<seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> +&mod_add_transport; and implements the behaviour documented in -<seealso marker="diameter_transport">diameter_transport(3)</seealso>.</p> +&man_transport;.</p> <marker id="start"/> </description> @@ -59,7 +63,7 @@ and implements the behaviour documented in <fsummary>Start a transport process.</fsummary> <type> <v>Type = connect | accept</v> -<v>Ref = <seealso marker="diameter#transport_ref">diameter:transport_ref()</seealso></v> +<v>Ref = &mod_transport_ref;</v> <v>Svc = #diameter_service{}</v> <v>Opt = {raddr, <seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso>} | {rport, integer()} | term()</v> <v>Pid = pid()</v> @@ -69,8 +73,7 @@ and implements the behaviour documented in <desc> <p> -The start function required by <seealso -marker="diameter_transport#start">diameter_transport(3)</seealso>.</p> +The start function required by &man_transport;.</p> <p> The only diameter_sctp-specific argument is the options list. @@ -115,16 +118,13 @@ diameter_sctp uses the <c>transport_data</c> field of the <c>#diameter_packet{}</c> record to communicate the stream on which an inbound message has been received, or on which an outbound message should be sent: the value will be of the form <c>{stream, Id}</c> -on an inbound message passed to a <seealso -marker="diameter_app#handle_request">handle_request</seealso> or <seealso -marker="diameter_app#handle_answer">handle_answer</seealso> callback. +on an inbound message passed to a &app_handle_request; or +&app_handle_answer; callback. For an outbound message, either <c>undefined</c> (explicitly or by receiving the outbound message as a <c>binary()</c>) or a tuple -should be set in the return value of <seealso -marker="diameter_app#handle_request">handle_request</seealso> +should be set in the return value of &app_handle_request; (typically by retaining the value passed into this function) -or <seealso -marker="diameter_app#prepare_request">prepare_request</seealso>. +or &app_prepare_request;. The value <c>undefined</c> uses a "next outbound stream" id and increments this modulo the total number outbound streams. That is, successive values of <c>undefined</c> cycle through all @@ -145,7 +145,8 @@ outbound streams.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter_transport">diameter_transport(3)</seealso>, +&man_main;, +&man_transport;, <seealso marker="kernel:gen_sctp">gen_sctp(3)</seealso>, <seealso marker="kernel:inet">inet(3)</seealso></p> diff --git a/lib/diameter/doc/src/diameter_tcp.xml b/lib/diameter/doc/src/diameter_tcp.xml index 3ffcebfd90..be8a938115 100644 --- a/lib/diameter/doc/src/diameter_tcp.xml +++ b/lib/diameter/doc/src/diameter_tcp.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -41,10 +46,9 @@ under the License. This module implements diameter transport over TCP using <seealso marker="kernel:gen_tcp">gen_tcp</seealso>. It can be specified as the value of a <c>transport_module</c> option to -<seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> +&mod_add_transport; and implements the behaviour documented in -<seealso marker="diameter_transport">diameter_transport(3)</seealso>. +&man_transport;. TLS security is supported, both as an upgrade following capabilities exchange as specified by RFC 3588 and at connection establishment as in the current draft standard.</p> @@ -66,7 +70,7 @@ before configuring TLS capability on diameter transports.</p> <fsummary>Start a transport process.</fsummary> <type> <v>Type = connect | accept</v> -<v>Ref = <seealso marker="diameter#transport_ref">diameter:transport_ref()</seealso></v> +<v>Ref = &mod_transport_ref;</v> <v>Svc = #diameter_service{}</v> <v>Opt = OwnOpt | SslOpt | TcpOpt</v> <v>Pid = pid()</v> @@ -81,8 +85,7 @@ before configuring TLS capability on diameter transports.</p> <desc> <p> -The start function required by <seealso -marker="diameter_transport#start">diameter_transport(3)</seealso>.</p> +The start function required by &man_transport;.</p> <p> The only diameter_tcp-specific argument is the options list. @@ -115,10 +118,8 @@ Note that the option <c>ip</c> specifies the local address.</p> An <c>ssl_options</c> list must be specified if and only if the transport in question has set <c>Inband-Security-Id</c> to 1 (<c>TLS</c>), as -specified to either <seealso -marker="diameter#start_service">start_service/2</seealso> or -<seealso -marker="diameter#add_transport">add_transport/2</seealso>, +specified to either &mod_start_service; or +&mod_add_transport;, so that the transport process will receive notification of whether or not to commence with a TLS handshake following capabilities exchange. @@ -149,8 +150,8 @@ The returned local address list has length one.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter">diameter(3)</seealso>, -<seealso marker="diameter_transport">diameter_transport(3)</seealso>, +&man_main;, +&man_transport;, <seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso>, <seealso marker="kernel:inet">inet(3)</seealso>, <seealso marker="ssl:ssl">ssl(3)</seealso></p> diff --git a/lib/diameter/doc/src/diameter_transport.xml b/lib/diameter/doc/src/diameter_transport.xml index 0c8b41397a..0507af63a8 100644 --- a/lib/diameter/doc/src/diameter_transport.xml +++ b/lib/diameter/doc/src/diameter_transport.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -38,8 +43,7 @@ under the License. <description> <p> -A module specified as a <c>transport_module</c> to <seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> +A module specified as a <c>transport_module</c> to &mod_add_transport; must implement the interface documented here. The interface consists of a function with which diameter starts a transport process and a message interface with which @@ -59,7 +63,7 @@ parent).</p> <fsummary>Start a transport process.</fsummary> <type> <v>Type = connect | accept</v> -<v>Ref = <seealso marker="diameter#transport_ref">diameter:transport_ref()</seealso></v> +<v>Ref = &mod_transport_ref;</v> <v>Svc = #diameter_service{}</v> <v>Config = term()</v> <v>Pid = pid()</v> @@ -69,8 +73,7 @@ parent).</p> <desc> <p> Start a transport process. -Called by diameter as a consequence of a call to <seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> in +Called by diameter as a consequence of a call to &mod_add_transport; in order to establish or accept a transport connection respectively. A transport process maintains a connection with a single remote peer.</p> @@ -82,22 +85,18 @@ In the latter case, transport processes are started as required to accept connections from multiple peers.</p> <p> -Ref is the value that was returned from the call to <seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> +Ref is the value that was returned from the call to &mod_add_transport; that has lead to starting of a transport process.</p> <p> -<c>Svc</c> contains the capabilities passed to <seealso -marker="diameter#start_service">diameter:start_service/2</seealso> and -<seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso>, +<c>Svc</c> contains the capabilities passed to &mod_start_service; and +&mod_add_transport;, values passed to the latter overriding those passed to the former.</p> <p> <c>Config</c> is as passed in <c>transport_config</c> tuple in the -<seealso marker="diameter#transport_opt">diameter:transport_opt()</seealso> -list passed to <seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso>.</p> +&mod_transport_opt; +list passed to &mod_add_transport;.</p> <p> The start function should use the <c>Host-IP-Address</c> list and/or @@ -245,8 +244,7 @@ A transport must exit if a handshake is not successful.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter_tcp">diameter_tcp(3)</seealso>, -<seealso marker="diameter_sctp">diameter_sctp(3)</seealso></p> +&man_tcp;, &man_sctp;</p> </section> diff --git a/lib/diameter/doc/src/files.mk b/lib/diameter/doc/src/files.mk index 79d53abceb..89ec1031e6 100644 --- a/lib/diameter/doc/src/files.mk +++ b/lib/diameter/doc/src/files.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2010-2011. All Rights Reserved. +# Copyright Ericsson AB 2010-2012. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/diameter/doc/src/notes.xml b/lib/diameter/doc/src/notes.xml index e57958ac09..b89d84a4f6 100644 --- a/lib/diameter/doc/src/notes.xml +++ b/lib/diameter/doc/src/notes.xml @@ -1,11 +1,17 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> +<!DOCTYPE chapter SYSTEM "chapter.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <chapter> <header> <copyright> <year>2011</year> +<year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -136,6 +142,33 @@ first.</p> </section> +<section><title>Diameter 1.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Fix fault in sending of 'closed' events.</p> + <p> + The fault made it possible for the 'closed' event not to + be sent following a failed capabilities exchange.</p> + <p> + Own Id: OTP-9824</p> + </item> + <item> + <p> + Fix faulty diameterc -name/-prefix.</p> + <p> + A minor blunder when introducing the new dictionary + parser in diameter-1.0 broke these options.</p> + <p> + Own Id: OTP-9826</p> + </item> + </list> + </section> + +</section> + <section><title>Diameter 1.0</title> <section><title>Fixed Bugs and Malfunctions</title> @@ -395,8 +428,7 @@ Known issues or limitations:</p> Some agent-related functionality is not entirely complete. In particular, support for proxy agents, that advertise specific Diameter applications but otherwise relay messages in much the same -way as relay agents (for which a <seealso -marker="diameter_app#handle_request">handle_request/3</seealso> +way as relay agents (for which a &handle_request; callback can return a <c>relay</c> tuple), will be completed in an upcoming release. There may also be more explicit support for redirect agents, although @@ -428,8 +460,7 @@ could likely be expanded upon.</p> <item> <p> -The function <seealso -marker="diameter#service_info">diameter:service_info/2</seealso> +The function &service_info; can be used to retrieve information about a started service (statistics, information about connected peers, etc) but this is not yet documented and both the input and output may change diff --git a/lib/diameter/doc/src/seealso.ent b/lib/diameter/doc/src/seealso.ent new file mode 100644 index 0000000000..6f67630220 --- /dev/null +++ b/lib/diameter/doc/src/seealso.ent @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="iso-8859-1" ?> + +<!-- + +%CopyrightBegin% + +Copyright Ericsson AB 2012. All Rights Reserved. + +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. + +%CopyrightEnd% + +--> + +<!-- + +Entities for cross references: less to type, easier to read and +less error prone. + +Additional intra-document entities are generated by seehere.sed. +That each definition is on a single (hideously long) line is +significant. + +--> + +<!-- diameter --> + +<!ENTITY mod_add_transport '<seealso marker="diameter#add_transport-2">diameter:add_transport/2</seealso>'> +<!ENTITY mod_call '<seealso marker="diameter#call-4">diameter:call/4</seealso>'> +<!ENTITY mod_origin_state_id '<seealso marker="diameter#origin_state_id-0">diameter:origin_state_id/0</seealso>'> +<!ENTITY mod_remove_transport '<seealso marker="diameter#remove_transport-2">diameter:remove_transport/2</seealso>'> +<!ENTITY mod_service_info '<seealso marker="diameter#service_info-2">diameter:service_info/2</seealso>'> +<!ENTITY mod_services '<seealso marker="diameter#services-0">diameter:services/0</seealso>'> +<!ENTITY mod_start_service '<seealso marker="diameter#start_service-2">diameter:start_service/2</seealso>'> +<!ENTITY mod_stop_service '<seealso marker="diameter#stop_service-1">diameter:stop_service/1</seealso>'> +<!ENTITY mod_subscribe '<seealso marker="diameter#subscribe-1">diameter:subscribe/1</seealso>'> + +<!ENTITY mod_application_alias '<seealso marker="diameter#application_alias">diameter:application_alias()</seealso>'> +<!ENTITY mod_application_module '<seealso marker="diameter#application_module">diameter:application_module()</seealso>'> +<!ENTITY mod_application_opt '<seealso marker="diameter#application_opt">diameter:application_opt()</seealso>'> +<!ENTITY mod_call_opt '<seealso marker="diameter#call_opt">diameter:call_opt()</seealso>'> +<!ENTITY mod_capability '<seealso marker="diameter#capability">diameter:capability()</seealso>'> +<!ENTITY mod_evaluable '<seealso marker="diameter#evaluable">diameter:evaluable()</seealso>'> +<!ENTITY mod_peer_filter '<seealso marker="diameter#peer_filter">diameter:peer_filter()</seealso>'> +<!ENTITY mod_service_event '<seealso marker="diameter#service_event">diameter:service_event()</seealso>'> +<!ENTITY mod_service_name '<seealso marker="diameter#service_name">diameter:service_name()</seealso>'> +<!ENTITY mod_service_opt '<seealso marker="diameter#service_opt">diameter:service_opt()</seealso>'> +<!ENTITY mod_transport_opt '<seealso marker="diameter#transport_opt">diameter:transport_opt()</seealso>'> +<!ENTITY mod_transport_ref '<seealso marker="diameter#transport_ref">diameter:transport_ref()</seealso>'> + +<!ENTITY capabilities_cb '<seealso marker="#capabilities_cb">capabilities_cb</seealso>'> +<!ENTITY capx_timeout '<seealso marker="#capx_timeout">capx_timeout</seealso>'> +<!ENTITY disconnect_cb '<seealso marker="#disconnect_cb">disconnect_cb</seealso>'> +<!ENTITY transport_config '<seealso marker="#transport_config">transport_config</seealso>'> +<!ENTITY transport_module '<seealso marker="#transport_module">transport_module</seealso>'> +<!ENTITY reconnect_timer '<seealso marker="#reconnect_timer">reconnect_timer</seealso>'> +<!ENTITY watchdog_timer '<seealso marker="#watchdog_timer">watchdog_timer</seealso>'> + +<!-- diameter_app --> + +<!ENTITY app_handle_answer '<seealso marker="diameter_app#Mod:handle_answer-4">handle_answer/4</seealso>'> +<!ENTITY app_handle_request '<seealso marker="diameter_app#Mod:handle_request-3">handle_request/3</seealso>'> +<!ENTITY app_handle_error '<seealso marker="diameter_app#Mod:handle_error-4">handle_error/4</seealso>'> +<!ENTITY app_peer_down '<seealso marker="diameter_app#Mod:peer_down-3">peer_up/3</seealso>'> +<!ENTITY app_peer_up '<seealso marker="diameter_app#Mod:peer_up-3">peer_up/3</seealso>'> +<!ENTITY app_pick_peer '<seealso marker="diameter_app#Mod:pick_peer-4">pick_peer/4</seealso>'> +<!ENTITY app_prepare_retransmit '<seealso marker="diameter_app#Mod:prepare_retransmit-3">prepare_retransmit/3</seealso>'> +<!ENTITY app_prepare_request '<seealso marker="diameter_app#Mod:prepare_request-3">prepare_request/3</seealso>'> + +<!ENTITY app_capabilities '<seealso marker="diameter_app#capabilities">diameter_app:capabilities()</seealso>'> +<!ENTITY app_message '<seealso marker="diameter_app#message">diameter_app:message()</seealso>'> +<!ENTITY app_packet '<seealso marker="diameter_app#packet">diameter_app:packet()</seealso>'> +<!ENTITY app_peer '<seealso marker="diameter_app#peer">diameter_app:peer()</seealso>'> +<!ENTITY app_peer_ref '<seealso marker="diameter_app#peer_ref">diameter_app:peer_ref()</seealso>'> +<!ENTITY app_state '<seealso marker="diameter_app#state">diameter_app:state()</seealso>'> + +<!-- diameter_dict --> + +<!ENTITY dict_data_types '<seealso marker="diameter_dict#DATA_TYPES">diameter_dict(4)</seealso>'> + +<!ENTITY dict_Address '<seealso marker="diameter_dict#DATA_TYPES">Address()</seealso>'> +<!ENTITY dict_DiameterIdentity '<seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>'> +<!ENTITY dict_Grouped '<seealso marker="diameter_dict#DATA_TYPES">Grouped()</seealso>'> +<!ENTITY dict_OctetString '<seealso marker="diameter_dict#DATA_TYPES">OctetString()</seealso>'> +<!ENTITY dict_Time '<seealso marker="diameter_dict#DATA_TYPES">Time()</seealso>'> +<!ENTITY dict_UTF8String '<seealso marker="diameter_dict#DATA_TYPES">UTF8String()</seealso>'> +<!ENTITY dict_Unsigned32 '<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>'> + +<!-- diameter_transport --> + +<!ENTITY transport_start + '<seealso marker="diameter_transport#Mod:start-3">start/3</seealso>'> + +<!-- reference pages --> + +<!ENTITY man_compile '<seealso marker="diameterc">diameterc(1)</seealso>'> +<!ENTITY man_main '<seealso marker="diameter">diameter(3)</seealso>'> +<!ENTITY man_app '<seealso marker="diameter_app">diameter_app(3)</seealso>'> +<!ENTITY man_dict '<seealso marker="diameter_dict">diameter_dict(4)</seealso>'> +<!ENTITY man_transport + '<seealso marker="diameter_transport">diameter_transport(3)</seealso>'> +<!ENTITY man_sctp '<seealso marker="diameter_sctp">diameter_sctp(3)</seealso>'> +<!ENTITY man_tcp '<seealso marker="diameter_tcp">diameter_tcp(3)</seealso>'> diff --git a/lib/diameter/doc/src/seehere.sed b/lib/diameter/doc/src/seehere.sed new file mode 100644 index 0000000000..c62a783d40 --- /dev/null +++ b/lib/diameter/doc/src/seehere.sed @@ -0,0 +1,35 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2012. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +# +# Map entities for inter-document references to ones for +# intra-document references like this: +# +# <!ENTITY aaa_xxx '<seealso marker="bbb#yyy">ccc:zzz</seealso>'> +# +# ===> +# +# <!ENTITY xxx '<seealso marker="#yyy">zzz</seealso>'> +# + +/<!ENTITY/!d +/#/!d +/"#/d +s@ [^_]*_@ @ +s@"[^#]*#@"#@ +s@>[^:]*:@>@ diff --git a/lib/diameter/src/base/diameter.appup.src b/lib/diameter/src/base/diameter.appup.src index 9b2a7d18ab..5655f98c1b 100644 --- a/lib/diameter/src/base/diameter.appup.src +++ b/lib/diameter/src/base/diameter.appup.src @@ -20,30 +20,38 @@ {"%VSN%", [ - {"0.9", [{restart_application, diameter}]}, - {"0.10", [{restart_application, diameter}]}, - {"1.0", [{restart_application, diameter}]}, - {"1.1", [%% new code - {add_module, diameter_transport}, - %% modified code - {load, diameter_sctp}, - {load, diameter_stats}, - {load, diameter_service}, - {load, diameter_config}, - {load, diameter_codec}, - {load, diameter_watchdog}, - {load, diameter_peer}, - {load, diameter_peer_fsm}, - {load, diameter}, - %% unmodified but including modified diameter.hrl - {load, diameter_callback}, - {load, diameter_capx}, - {load, diameter_types}]} + {"0.9", [{restart_application, diameter}]}, + {"0.10", [{restart_application, diameter}]}, + {"1.0", [{restart_application, diameter}]}, + {"1.1", [{restart_application, diameter}]}, + {"1.2", [{load, diameter}, + {load, diameter_capx}, + {load, diameter_codec}, + {load, diameter_peer}, + {load, diameter_reg}, + %% order significant from here + {load, diameter_session}, + {load, diameter_peer_fsm}, + {load, diameter_service}, + {load, diameter_watchdog}, + {load, diameter_config}]}, + {"1.2.1", [{load, diameter}, + {load, diameter_capx}, + {load, diameter_peer}, + {load, diameter_reg}, + %% order significant from here + {load, diameter_session}, + {load, diameter_peer_fsm}, + {load, diameter_service}, + {load, diameter_watchdog}, + {load, diameter_config}]} ], [ - {"0.9", [{restart_application, diameter}]}, - {"0.10", [{restart_application, diameter}]}, - {"1.0", [{restart_application, diameter}]}, - {"1.1", [{restart_application, diameter}]} + {"0.9", [{restart_application, diameter}]}, + {"0.10", [{restart_application, diameter}]}, + {"1.0", [{restart_application, diameter}]}, + {"1.1", [{restart_application, diameter}]}, + {"1.2", [{restart_application, diameter}]}, + {"1.2.1", [{restart_application, diameter}]} ] }. diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl index 29046e6462..a4a0b80348 100644 --- a/lib/diameter/src/base/diameter_service.erl +++ b/lib/diameter/src/base/diameter_service.erl @@ -3231,9 +3231,6 @@ peer_acc(ConnT, Acc, #peer{pid = Pid, | info_conn(ConnT, TPid, WS /= ?WD_DOWN)], Acc). -info_conn(ConnT, [TPid], B) -> - info_conn(ConnT, TPid, B); - info_conn(ConnT, TPid, true) when is_pid(TPid) -> try ets:lookup(ConnT, TPid) of diff --git a/lib/diameter/test/diameter_compiler_SUITE.erl b/lib/diameter/test/diameter_compiler_SUITE.erl index 4b792b5426..79bf9d32db 100644 --- a/lib/diameter/test/diameter_compiler_SUITE.erl +++ b/lib/diameter/test/diameter_compiler_SUITE.erl @@ -31,8 +31,8 @@ %% testcases -export([format/1, format/2, replace/1, replace/2, - generate/1, generate/4, generate/0, - examples/1, examples/0]). + generate/1, generate/4, + examples/1]). -export([dict/0]). %% fake dictionary module @@ -339,7 +339,7 @@ %% =========================================================================== suite() -> - [{timetrap, {minutes, 2}}]. + [{timetrap, {minutes, 10}}]. all() -> [format, @@ -407,9 +407,6 @@ re({RE, Repl}, Bin) -> %% %% Ensure success when generating code and compiling. -generate() -> - [{timetrap, {seconds, 2*length(?REPLACE)}}]. - generate(Config) -> Bin = proplists:get_value(base, Config), Rs = lists:zip(?REPLACE, lists:seq(1, length(?REPLACE))), @@ -436,9 +433,6 @@ generate(Mods, Bin, N, Mode) -> %% %% Compile dictionaries extracted from various standards. -examples() -> - [{timetrap, {seconds, 3*length(?EXAMPLES)}}]. - examples(_Config) -> Dir = filename:join([code:lib_dir(diameter, examples), "dict"]), [D || D <- ?EXAMPLES, _ <- [examples(?S(D), Dir)]]. diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index fa9333a226..c157b0e304 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -183,14 +183,14 @@ suite() -> all() -> [start, start_services, add_transports, result_codes] - ++ [{group, name([E,C]), P} || E <- ?ENCODINGS, - C <- ?CONNECTIONS, - P <- [[], [parallel]]] + ++ [{group, ?util:name([E,C]), P} || E <- ?ENCODINGS, + C <- ?CONNECTIONS, + P <- [[], [parallel]]] ++ [remove_transports, stop_services, stop]. groups() -> Ts = tc(), - [{name([E,C]), [], Ts} || E <- ?ENCODINGS, C <- ?CONNECTIONS]. + [{?util:name([E,C]), [], Ts} || E <- ?ENCODINGS, C <- ?CONNECTIONS]. init_per_group(Name, Config) -> [{group, Name} | Config]. @@ -559,7 +559,7 @@ call(Config, Req) -> call(Config, Req, Opts) -> Name = proplists:get_value(testcase, Config), - [Encoding, Client] = name(proplists:get_value(group, Config)), + [Encoding, Client] = ?util:name(proplists:get_value(group, Config)), diameter:call(?CLIENT, dict(Req), req(Req, Encoding), @@ -599,17 +599,6 @@ set(Dict, E, FV, Rec) set(_, _, _, Rec) -> Rec. -%% Contruct and deconstruct names to work around group names being -%% restricted to atoms. - -name(Names) - when is_list(Names) -> - ?A(string:join([?L(A) || A <- Names], ",")); - -name(A) - when is_atom(A) -> - [?A(S) || S <- string:tokens(?L(A), ",")]. - %% =========================================================================== %% diameter callbacks diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl index 890d24f6f8..5af4ad9ba5 100644 --- a/lib/diameter/test/diameter_util.erl +++ b/lib/diameter/test/diameter_util.erl @@ -24,7 +24,8 @@ %% %% generic --export([consult/2, +-export([name/1, + consult/2, run/1, fold/3, foldl/3, @@ -45,6 +46,21 @@ -define(L, atom_to_list). + +%% --------------------------------------------------------------------------- +%% name/2 +%% +%% Contruct and deconstruct lists of atoms as atoms to work around +%% group names in common_test being restricted to atoms. + +name(Names) + when is_list(Names) -> + list_to_atom(string:join([atom_to_list(A) || A <- Names], ",")); + +name(A) + when is_atom(A) -> + [list_to_atom(S) || S <- string:tokens(atom_to_list(A), ",")]. + %% --------------------------------------------------------------------------- %% consult/2 %% diff --git a/lib/diameter/vsn.mk b/lib/diameter/vsn.mk index 48e6596e72..c9f74ffcec 100644 --- a/lib/diameter/vsn.mk +++ b/lib/diameter/vsn.mk @@ -18,7 +18,7 @@ # %CopyrightEnd% APPLICATION = diameter -DIAMETER_VSN = 1.2 +DIAMETER_VSN = 1.3 PRE_VSN = APP_VSN = "$(APPLICATION)-$(DIAMETER_VSN)$(PRE_VSN)" diff --git a/lib/erl_docgen/priv/xsl/Makefile b/lib/erl_docgen/priv/xsl/Makefile index 1510387d72..58589672b8 100644 --- a/lib/erl_docgen/priv/xsl/Makefile +++ b/lib/erl_docgen/priv/xsl/Makefile @@ -42,7 +42,8 @@ XSL_FILES = \ db_pdf_params.xsl \ db_html.xsl \ db_html_params.xsl \ - db_man.xsl + db_man.xsl \ + db_eix.xsl # ---------------------------------------------------- diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index 4bc5abb364..ab5f24c406 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -578,8 +578,22 @@ <xsl:param name="curModule"/> <html> <head> - <link rel="stylesheet" href="{$topdocdir}/otp_doc.css" type="text/css"/> - <title>Erlang -- <xsl:value-of select="header/title"/></title> + <xsl:choose> + <xsl:when test="string-length($stylesheet) > 0"> + <link rel="stylesheet" href="{$topdocdir}/{$stylesheet}" type="text/css"/> + </xsl:when> + <xsl:otherwise> + <link rel="stylesheet" href="{$topdocdir}/otp_doc.css" type="text/css"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="string-length($winprefix) > 0"> + <title><xsl:value-of select="$winprefix"/> -- <xsl:value-of select="header/title"/></title> + </xsl:when> + <xsl:otherwise> + <title>Erlang -- <xsl:value-of select="header/title"/></title> + </xsl:otherwise> + </xsl:choose> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"> @@ -719,7 +733,14 @@ <xsl:template name="menu_top"> - <img alt="Erlang logo" src="{$topdocdir}/erlang-logo.png"/> + <xsl:choose> + <xsl:when test="string-length($logo) > 0"> + <img alt="Erlang logo" src="{$topdocdir}/{$logo}"/> + </xsl:when> + <xsl:otherwise> + <img alt="Erlang logo" src="{$topdocdir}/erlang-logo.png"/> + </xsl:otherwise> + </xsl:choose> <br/> <small> <xsl:if test="boolean(/book/parts/part)"> @@ -731,7 +752,14 @@ <xsl:if test="boolean(/book/releasenotes)"> <a href="release_notes.html">Release Notes</a><br/> </xsl:if> - <a href="{$pdfdir}/{$appname}-{$appver}.pdf">PDF</a><br/> + <xsl:choose> + <xsl:when test="string-length($pdfname) > 0"> + <a href="{$pdfdir}/{$pdfname}.pdf">PDF</a><br/> + </xsl:when> + <xsl:otherwise> + <a href="{$pdfdir}/{$appname}-{$appver}.pdf">PDF</a><br/> + </xsl:otherwise> + </xsl:choose> <a href="{$topdocdir}/index.html">Top</a> </small> </xsl:template> diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index da96052462..7de5af2a49 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -650,7 +650,7 @@ <fo:flow flow-name="xsl-region-body"> <fo:block xsl:use-attribute-sets="cover.logo"> - <fo:external-graphic src="{$docgen}/priv/images/erlang-logo.gif"/> + <fo:external-graphic src="{$logo}"/> </fo:block> <fo:block xsl:use-attribute-sets="cover.title" id="cover-page"> <xsl:apply-templates/> diff --git a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl index 4d9c08d0c3..4e61f1f476 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl @@ -87,7 +87,7 @@ <xsl:attribute-set name="cover.title"> <xsl:attribute name="border-before-style">solid</xsl:attribute> <xsl:attribute name="border-before-width">10pt</xsl:attribute> - <xsl:attribute name="border-color">#960003</xsl:attribute> + <xsl:attribute name="border-color"><xsl:value-of select="$pdfcolor"/></xsl:attribute> <xsl:attribute name="font-size">2.3em</xsl:attribute> <xsl:attribute name="padding-before">0.5em</xsl:attribute> <xsl:attribute name="text-align">end</xsl:attribute> @@ -101,7 +101,7 @@ <xsl:attribute-set name="cover.inner.copyright"> <xsl:attribute name="border-before-style">solid</xsl:attribute> <xsl:attribute name="border-before-width">1pt</xsl:attribute> - <xsl:attribute name="border-color">#960003</xsl:attribute> + <xsl:attribute name="border-color"><xsl:value-of select="$pdfcolor"/></xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="padding-before">0.5em</xsl:attribute> <xsl:attribute name="space-before">200mm</xsl:attribute> @@ -160,7 +160,7 @@ <xsl:attribute-set name="h1"> <xsl:attribute name="border-after-style">solid</xsl:attribute> <xsl:attribute name="border-after-width">1pt</xsl:attribute> - <xsl:attribute name="border-color">#960003</xsl:attribute> + <xsl:attribute name="border-color"><xsl:value-of select="$pdfcolor"/></xsl:attribute> <xsl:attribute name="break-before">page</xsl:attribute> <xsl:attribute name="font-family">sans-serif</xsl:attribute> <xsl:attribute name="font-size">1.83em</xsl:attribute> @@ -226,7 +226,7 @@ <xsl:attribute-set name="page-header"> <xsl:attribute name="border-after-style">solid</xsl:attribute> <xsl:attribute name="border-after-width">2pt</xsl:attribute> - <xsl:attribute name="border-color">#960003</xsl:attribute> + <xsl:attribute name="border-color"><xsl:value-of select="$pdfcolor"/></xsl:attribute> <xsl:attribute name="font-family">sans-serif</xsl:attribute> <xsl:attribute name="font-size">0.9em</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> diff --git a/lib/erl_docgen/vsn.mk b/lib/erl_docgen/vsn.mk index b05df254a6..2599dc0ff7 100644 --- a/lib/erl_docgen/vsn.mk +++ b/lib/erl_docgen/vsn.mk @@ -1,2 +1,2 @@ -ERL_DOCGEN_VSN = 0.3.2 +ERL_DOCGEN_VSN = 0.3.3 diff --git a/lib/erl_interface/aclocal.m4 b/lib/erl_interface/aclocal.m4 index b1cf1fe404..9578cd35c4 100644 --- a/lib/erl_interface/aclocal.m4 +++ b/lib/erl_interface/aclocal.m4 @@ -740,11 +740,16 @@ dnl Try to find POSIX threads dnl The usual pthread lib... AC_CHECK_LIB(pthread, pthread_create, THR_LIBS="-lpthread") -dnl FreeBSD has pthreads in special c library, c_r... +dnl Very old versions of FreeBSD have pthreads in special c library, c_r... if test "x$THR_LIBS" = "x"; then AC_CHECK_LIB(c_r, pthread_create, THR_LIBS="-lc_r") fi +dnl QNX has pthreads in standard C library + if test "x$THR_LIBS" = "x"; then + AC_CHECK_FUNC(pthread_create, THR_LIBS="none_needed") + fi + dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" = "x"; then AC_MSG_CHECKING([if the '-pthread' switch can be used]) @@ -765,6 +770,9 @@ dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" != "x"; then THR_DEFS="$THR_DEFS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS" THR_LIB_NAME=pthread + if test "x$THR_LIBS" = "xnone_needed"; then + THR_LIBS= + fi case $host_os in solaris*) THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS" ;; diff --git a/lib/erl_interface/configure.in b/lib/erl_interface/configure.in index c958f80065..f1c9ebbb6f 100644 --- a/lib/erl_interface/configure.in +++ b/lib/erl_interface/configure.in @@ -79,7 +79,7 @@ AC_ARG_ENABLE(threads, no) threads_disabled=yes ;; *) threads_disabled=no ;; esac ], -[ threads_disabled=no ]) +[ threads_disabled=maybe ]) dnl ---------------------------------------------------------------------- dnl Checks for programs @@ -237,12 +237,16 @@ AC_SUBST(THR_DEFS) AC_SUBST(EI_THREADS) case "$threads_disabled" in - no) + no|maybe) LM_CHECK_THR_LIB case "$THR_LIB_NAME" in "") EI_THREADS="false" + # Fail if --enable-threads given and no threads found + if test "x$threads_disabled" = "xno"; then + AC_MSG_ERROR(No threads support found) + fi ;; win32_threads) EI_THREADS="true" diff --git a/lib/odbc/aclocal.m4 b/lib/odbc/aclocal.m4 index b1cf1fe404..9578cd35c4 100644 --- a/lib/odbc/aclocal.m4 +++ b/lib/odbc/aclocal.m4 @@ -740,11 +740,16 @@ dnl Try to find POSIX threads dnl The usual pthread lib... AC_CHECK_LIB(pthread, pthread_create, THR_LIBS="-lpthread") -dnl FreeBSD has pthreads in special c library, c_r... +dnl Very old versions of FreeBSD have pthreads in special c library, c_r... if test "x$THR_LIBS" = "x"; then AC_CHECK_LIB(c_r, pthread_create, THR_LIBS="-lc_r") fi +dnl QNX has pthreads in standard C library + if test "x$THR_LIBS" = "x"; then + AC_CHECK_FUNC(pthread_create, THR_LIBS="none_needed") + fi + dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" = "x"; then AC_MSG_CHECKING([if the '-pthread' switch can be used]) @@ -765,6 +770,9 @@ dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" != "x"; then THR_DEFS="$THR_DEFS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS" THR_LIB_NAME=pthread + if test "x$THR_LIBS" = "xnone_needed"; then + THR_LIBS= + fi case $host_os in solaris*) THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS" ;; diff --git a/lib/public_key/doc/src/cert_records.xml b/lib/public_key/doc/src/cert_records.xml index edef664245..94c7c46350 100644 --- a/lib/public_key/doc/src/cert_records.xml +++ b/lib/public_key/doc/src/cert_records.xml @@ -39,8 +39,8 @@ describe the data types and not to specify the meaning of each component for this we refer you to <url href="http://www.ietf.org/rfc/rfc5280.txt">RFC 5280</url>. Also - descirbed is <p>CertificationRequest</p> that is defined by <url - href=http://www.rsa.com/rsalabs/node.asp?id=2124">PKCS-10</url>. + descirbed is <p>CertificationRequest</p> that is defined by + <url href="http://www.rsa.com/rsalabs/node.asp?id=2124">PKCS-10</url>. </p> <p>Use the following include directive to get access to the diff --git a/lib/public_key/doc/src/introduction.xml b/lib/public_key/doc/src/introduction.xml index b1d1114a6c..e0dd5603f7 100644 --- a/lib/public_key/doc/src/introduction.xml +++ b/lib/public_key/doc/src/introduction.xml @@ -39,7 +39,8 @@ <p> This application provides an API to public key infrastructure from <url href="http://www.ietf.org/rfc/rfc5280.txt">RFC 5280</url> (X.509 certificates) and public key formats defined by - the <url href=http://www.rsa.com/rsalabs/node.asp?id=2124"> PKCS-standard</url></p> + the <url href="http://www.rsa.com/rsalabs/node.asp?id=2124"> + PKCS-standard</url></p> </section> <section> diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index c1086a09ef..eb71bc61e9 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -2478,9 +2478,9 @@ handle_unrecv_data(StateName, #state{socket = Socket, transport_cb = Transport} handle_close_alert(Data, StateName, State) end. -handle_close_alert(Data, StateName, State) -> - case next_tls_record(Data, State) of - #ssl_tls{type = ?ALERT, fragment = EncAlerts} -> +handle_close_alert(Data, StateName, State0) -> + case next_tls_record(Data, State0) of + {#ssl_tls{type = ?ALERT, fragment = EncAlerts}, State} -> [Alert|_] = decode_alerts(EncAlerts), handle_normal_shutdown(Alert, StateName, State); _ -> diff --git a/lib/wx/aclocal.m4 b/lib/wx/aclocal.m4 index b1cf1fe404..9578cd35c4 100644 --- a/lib/wx/aclocal.m4 +++ b/lib/wx/aclocal.m4 @@ -740,11 +740,16 @@ dnl Try to find POSIX threads dnl The usual pthread lib... AC_CHECK_LIB(pthread, pthread_create, THR_LIBS="-lpthread") -dnl FreeBSD has pthreads in special c library, c_r... +dnl Very old versions of FreeBSD have pthreads in special c library, c_r... if test "x$THR_LIBS" = "x"; then AC_CHECK_LIB(c_r, pthread_create, THR_LIBS="-lc_r") fi +dnl QNX has pthreads in standard C library + if test "x$THR_LIBS" = "x"; then + AC_CHECK_FUNC(pthread_create, THR_LIBS="none_needed") + fi + dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" = "x"; then AC_MSG_CHECKING([if the '-pthread' switch can be used]) @@ -765,6 +770,9 @@ dnl On ofs1 the '-pthread' switch should be used if test "x$THR_LIBS" != "x"; then THR_DEFS="$THR_DEFS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS" THR_LIB_NAME=pthread + if test "x$THR_LIBS" = "xnone_needed"; then + THR_LIBS= + fi case $host_os in solaris*) THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS" ;; diff --git a/make/otp.mk.in b/make/otp.mk.in index 756cc85443..d74220588c 100644 --- a/make/otp.mk.in +++ b/make/otp.mk.in @@ -215,6 +215,22 @@ TEXDIR = . SPECDIR = $(DOCDIR)/specs +ifeq ($(CSS_FILE),) +CSS_FILE = otp_doc.css +endif +ifeq ($(WINPREFIX),) +WINPREFIX = Erlang +endif +ifeq ($(HTMLLOGO),) +HTMLLOGO_FILE = erlang-logo.png +endif +ifeq ($(PDFLOGO),) +PDFLOGO_FILE = $(DOCGEN)/priv/images/erlang-logo.gif +endif +ifeq ($(PDFCOLOR),) +PDFCOLOR = \#960003 +endif + # HTML & GIF files that always are generated and must be delivered SGML_COLL_FILES = $(SGML_APPLICATION_FILES) $(SGML_PART_FILES) XML_COLL_FILES = $(XML_APPLICATION_FILES) $(XML_PART_FILES) @@ -256,12 +272,10 @@ $(MAN1DIR)/%.1: %.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< - $(MAN2DIR)/%.2: %.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< - ifneq ($(wildcard $(SPECDIR)),) $(MAN3DIR)/%.3: %.xml $(SPECDIR)/specs_%.xml date=`date +"%B %e %Y"`; \ diff --git a/make/otp_release_targets.mk b/make/otp_release_targets.mk index 67243b5ffd..0be0a2de56 100644 --- a/make/otp_release_targets.mk +++ b/make/otp_release_targets.mk @@ -42,17 +42,34 @@ $(HTMLDIR)/index.html: $(XML_FILES) $(SPECS_FILES) --stringparam gendate "$$date" \ --stringparam appname "$(APPLICATION)" \ --stringparam appver "$(VSN)" \ + --stringparam stylesheet "$(CSS_FILE)" \ + --stringparam winprefix "$(WINPREFIX)" \ + --stringparam logo "$(HTMLLOGO_FILE)" \ + --stringparam pdfname "$(PDFNAME)" \ -path $(DOCGEN)/priv/dtd \ -path $(DOCGEN)/priv/dtd_html_entities \ $(DOCGEN)/priv/xsl/db_html.xsl book.xml + endif $(HTMLDIR)/users_guide.html: $(XML_FILES) date=`date +"%B %e %Y"`; \ - $(XSLTPROC) --noout --stringparam outdir $(HTMLDIR) --stringparam docgen "$(DOCGEN)" --stringparam topdocdir "$(TOPDOCDIR)" \ + $(XSLTPROC) --noout \ + --stringparam outdir $(HTMLDIR) \ + --stringparam docgen "$(DOCGEN)" \ + --stringparam topdocdir "$(TOPDOCDIR)" \ --stringparam pdfdir "$(PDFDIR)" \ - --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude \ - -path $(DOCGEN)/priv/dtd -path $(DOCGEN)/priv/dtd_html_entities $(DOCGEN)/priv/xsl/db_html.xsl book.xml + --stringparam gendate "$$date" \ + --stringparam appname "$(APPLICATION)" \ + --stringparam appver "$(VSN)" \ + --stringparam stylesheet "$(CSS_FILE)" \ + --stringparam winprefix "$(WINPREFIX)" \ + --stringparam logo "$(HTMLLOGO_FILE)" \ + --stringparam pdfname "$(PDFNAME)" \ + --xinclude \ + -path $(DOCGEN)/priv/dtd \ + -path $(DOCGEN)/priv/dtd_html_entities \ + $(DOCGEN)/priv/xsl/db_html.xsl book.xml %.fo: $(XML_FILES) $(SPECS_FILES) date=`date +"%B %e %Y"`; \ @@ -61,6 +78,8 @@ $(HTMLDIR)/users_guide.html: $(XML_FILES) --stringparam gendate "$$date" \ --stringparam appname "$(APPLICATION)" \ --stringparam appver "$(VSN)" \ + --stringparam logo "$(PDFLOGO_FILE)" \ + --stringparam pdfcolor "$(PDFCOLOR)" \ --xinclude $(TOP_SPECS_PARAM) \ -path $(DOCGEN)/priv/dtd \ -path $(DOCGEN)/priv/dtd_html_entities \ @@ -77,8 +96,13 @@ ifneq ($(XML_FILES),) $(HTMLDIR)/$(APPLICATION).eix: $(XML_FILES) $(SPECS_FILES) date=`date +"%B %e %Y"`; \ $(XSLTPROC) --stringparam docgen "$(DOCGEN)" \ - --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude $(TOP_SPECS_PARAM) \ - -path $(DOCGEN)/priv/dtd -path $(DOCGEN)/priv/dtd_html_entities $(DOCGEN)/priv/xsl/db_eix.xsl book.xml > $@ + --stringparam gendate "$$date" \ + --stringparam appname "$(APPLICATION)" \ + --stringparam appver "$(VSN)" \ + -xinclude $(TOP_SPECS_PARAM) \ + -path $(DOCGEN)/priv/dtd \ + -path $(DOCGEN)/priv/dtd_html_entities \ + $(DOCGEN)/priv/xsl/db_eix.xsl book.xml > $@ docs: $(HTMLDIR)/$(APPLICATION).eix diff --git a/system/doc/top/Makefile b/system/doc/top/Makefile index 9b305eb13b..673ba44c94 100644 --- a/system/doc/top/Makefile +++ b/system/doc/top/Makefile @@ -163,17 +163,34 @@ $(MAN_INDEX): $(MAN_INDEX_SCRIPT) $(HTMLDIR)/highlights.html: highlights.xml date=`date +"%B %e %Y"`; \ - $(XSLTPROC) --output $(@) --stringparam docgen "$(DOCGEN)" --stringparam topdocdir "$(TOPDOCDIR)" \ - --stringparam pdfdir "$(PDFREFDIR)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" \ - --stringparam appver "$(VSN)" -path $(DOCGEN)/priv/dtd -path $(DOCGEN)/priv/dtd_html_entities \ + $(XSLTPROC) --output $(@) \ + --stringparam docgen "$(DOCGEN)" \ + --stringparam topdocdir "$(TOPDOCDIR)" \ + --stringparam pdfdir "$(PDFREFDIR)" \ + --stringparam gendate "$$date" \ + --stringparam appname "$(APPLICATION)" \ + --stringparam appver "$(VSN)" \ + --stringparam stylesheet "$(CSS_FILE)" \ + --stringparam winprefix "$(WINPREFIX)" \ + --stringparam logo "$(HTMLLOGO_FILE)" \ + -path $(DOCGEN)/priv/dtd \ + -path $(DOCGEN)/priv/dtd_html_entities \ $(DOCGEN)/priv/xsl/db_html.xsl $< $(HTMLDIR)/incompatible.html: incompatible.xml date=`date +"%B %e %Y"`; \ - $(XSLTPROC) --output $(@) --stringparam docgen "$(DOCGEN)" --stringparam topdocdir "$(TOPDOCDIR)" \ - --stringparam pdfdir "$(PDFREFDIR)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" \ - --stringparam appver "$(VSN)" -path $(DOCGEN)/priv/dtd -path $(DOCGEN)/priv/dtd_html_entities \ + $(XSLTPROC) --output $(@) --stringparam docgen "$(DOCGEN)" \ + --stringparam topdocdir "$(TOPDOCDIR)" \ + --stringparam pdfdir "$(PDFREFDIR)" \ + --stringparam gendate "$$date" \ + --stringparam appname "$(APPLICATION)" \ + --stringparam appver "$(VSN)" \ + --stringparam stylesheet "$(CSS_FILE)" \ + --stringparam winprefix "$(WINPREFIX)" \ + --stringparam logo "$(HTMLLOGO_FILE)" \ + -path $(DOCGEN)/priv/dtd \ + -path $(DOCGEN)/priv/dtd_html_entities \ $(DOCGEN)/priv/xsl/db_html.xsl $< #-------------------------------------------------------------------------- |