diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/diameter/doc/src/notes.xml | 18 | ||||
-rw-r--r-- | lib/diameter/src/base/diameter_config.erl | 40 | ||||
-rw-r--r-- | lib/diameter/test/diameter_config_SUITE.erl | 15 | ||||
-rw-r--r-- | lib/observer/test/ttb_SUITE.erl | 7 | ||||
-rw-r--r-- | lib/reltool/test/reltool_server_SUITE.erl | 50 | ||||
-rw-r--r-- | lib/ssh/src/ssh_cli.erl | 7 | ||||
-rw-r--r-- | lib/stdlib/doc/src/sys.xml | 8 |
7 files changed, 108 insertions, 37 deletions
diff --git a/lib/diameter/doc/src/notes.xml b/lib/diameter/doc/src/notes.xml index 2daf84b0d4..ad61f12b5b 100644 --- a/lib/diameter/doc/src/notes.xml +++ b/lib/diameter/doc/src/notes.xml @@ -42,7 +42,7 @@ first.</p> <!-- ===================================================================== --> -<section><title>Diameter 1.4.1.1</title> +<section><title>diameter 1.4.1.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> @@ -79,7 +79,7 @@ first.</p> </section> -<section><title>Diameter 1.4.1</title> +<section><title>diameter 1.4.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> @@ -166,7 +166,7 @@ first.</p> </section> -<section><title>Diameter 1.4</title> +<section><title>diameter 1.4</title> <section><title>Fixed Bugs and Malfunctions</title> <list> @@ -245,7 +245,7 @@ first.</p> </section> -<section><title>Diameter 1.3.1</title> +<section><title>diameter 1.3.1</title> <section><title>Known Bugs and Problems</title> <list> @@ -261,7 +261,7 @@ first.</p> </section> -<section><title>Diameter 1.3</title> +<section><title>diameter 1.3</title> <section><title>Fixed Bugs and Malfunctions</title> <list> @@ -418,7 +418,7 @@ first.</p> </section> -<section><title>Diameter 1.2</title> +<section><title>diameter 1.2</title> <section><title>Fixed Bugs and Malfunctions</title> <list> @@ -518,7 +518,7 @@ first.</p> </section> -<section><title>Diameter 1.1</title> +<section><title>diameter 1.1</title> <section><title>Fixed Bugs and Malfunctions</title> <list> @@ -545,7 +545,7 @@ first.</p> </section> -<section><title>Diameter 1.0</title> +<section><title>diameter 1.0</title> <section><title>Fixed Bugs and Malfunctions</title> <list> @@ -659,7 +659,7 @@ first.</p> </section> -<section><title>Diameter 0.10</title> +<section><title>diameter 0.10</title> <section><title>Fixed Bugs and Malfunctions</title> <list> diff --git a/lib/diameter/src/base/diameter_config.erl b/lib/diameter/src/base/diameter_config.erl index 1282930145..2a145c874b 100644 --- a/lib/diameter/src/base/diameter_config.erl +++ b/lib/diameter/src/base/diameter_config.erl @@ -614,30 +614,38 @@ stop_transport(SvcName, Refs) -> %% make_config/2 make_config(SvcName, Opts) -> - Apps = init_apps(Opts), + AppOpts = [T || {application, _} = T <- Opts], + Apps = init_apps(AppOpts), + [] == Apps andalso ?THROW(no_apps), %% Use the fact that diameter_caps has the same field names as CER. Fields = ?BASE:'#info-'(diameter_base_CER) -- ['AVP'], - COpts = [T || {K,_} = T <- Opts, lists:member(K, Fields)], - Caps = make_caps(#diameter_caps{}, COpts), + CapOpts = [T || {K,_} = T <- Opts, lists:member(K, Fields)], + Caps = make_caps(#diameter_caps{}, CapOpts), - ok = encode_CER(COpts), + ok = encode_CER(CapOpts), - Os = split(Opts, fun opt/2, [{false, share_peers}, - {false, use_shared_peers}, - {false, monitor}, - {?NOMASK, sequence}, - {nodes, restrict_connections}]), + SvcOpts = make_opts((Opts -- AppOpts) -- CapOpts, + [{false, share_peers}, + {false, use_shared_peers}, + {false, monitor}, + {?NOMASK, sequence}, + {nodes, restrict_connections}]), #service{name = SvcName, rec = #diameter_service{applications = Apps, capabilities = Caps}, - options = Os}. + options = SvcOpts}. + +make_opts(Opts, Defs) -> + Known = [{K, get_opt(K, Opts, D)} || {D,K} <- Defs], + Unknown = Opts -- Known, + + [] == Unknown orelse ?THROW({invalid, hd(Unknown)}), -split(Opts, F, Defs) -> - [{K, F(K, get_opt(K, Opts, D))} || {D,K} <- Defs]. + [{K, opt(K,V)} || {K,V} <- Known]. opt(K, false = B) when K /= sequence -> @@ -728,8 +736,8 @@ encode_CER(Opts) -> init_apps(Opts) -> lists:foldl(fun app_acc/2, [], lists:reverse(Opts)). -app_acc({application, Opts}, Acc) -> - is_list(Opts) orelse ?THROW({application, Opts}), +app_acc({application, Opts} = T, Acc) -> + is_list(Opts) orelse ?THROW(T), [Dict, Mod] = get_opt([dictionary, module], Opts), Alias = get_opt(alias, Opts, Dict), @@ -745,9 +753,7 @@ app_acc({application, Opts}, Acc) -> mutable = M, options = [{answer_errors, A}, {request_errors, P}]} - | Acc]; -app_acc(_, Acc) -> - Acc. + | Acc]. init_mod(#diameter_callback{} = R) -> init_mod([diameter_callback, R]); diff --git a/lib/diameter/test/diameter_config_SUITE.erl b/lib/diameter/test/diameter_config_SUITE.erl index 47def9c8c9..46ff63756d 100644 --- a/lib/diameter/test/diameter_config_SUITE.erl +++ b/lib/diameter/test/diameter_config_SUITE.erl @@ -82,7 +82,11 @@ [[true], [false], [[node(), node()]]], - [[x]]}]). + [[x]]}, + {invalid_option, %% invalid service options are rejected + [], + [[x], + [x,x]]}]). -define(TRANSPORT_CONFIG, [{transport_module, @@ -167,7 +171,14 @@ [[{okay, 1}]], [[{suspect, 2}]]], [[x], - [[{open, 0}]]]}]). + [[{open, 0}]]]}, + {private, + [[x]], + []}, + {invalid_option, %% invalid transport options are silently ignored + [[x], + [x,x]], + []}]). %% =========================================================================== diff --git a/lib/observer/test/ttb_SUITE.erl b/lib/observer/test/ttb_SUITE.erl index f3fcd9f283..fd32e6aa71 100644 --- a/lib/observer/test/ttb_SUITE.erl +++ b/lib/observer/test/ttb_SUITE.erl @@ -1483,12 +1483,19 @@ logic(N, M, TracingType) -> ?t:stop_node(ttb_helper:get_node(client)), timer:sleep(2500), ?line {ok,_ClientNode} = ?t:start_node(client,slave,[]), + ct:log("client started",[]), ?line ok = ttb_helper:c(code, add_paths, [code:get_path()]), + ct:log("paths added",[]), ?line ttb_helper:c(client, init, []), + ct:log("client initiated",[]), ?line helper_msgs(N, TracingType), + ct:log("helper msgs sent and flushed",[]), ?line {_, D} = ttb:stop([return_fetch_dir]), + ct:log("stopped ~p",[D]), ?line ttb:format(D, [{out, ?OUTPUT}, {handler, ret_caller_call_handler2()}]), + ct:log("formatted ~p",[{D,?OUTPUT}]), ?line {ok, Ret} = file:consult(?OUTPUT), + ct:log("consulted: ~p",[Ret]), ?line M = length(Ret). begin_trace_with_resume(ServerNode, ClientNode, Dest) -> diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index adea716e99..b1e1787f18 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -28,6 +28,7 @@ -include_lib("reltool/src/reltool.hrl"). -include("reltool_test_lib.hrl"). -include_lib("common_test/include/ct.hrl"). +-include_lib("kernel/include/file.hrl"). -define(NODE_NAME, '__RELTOOL__TEMPORARY_TEST__NODE__'). -define(WORK_DIR, "reltool_work_dir"). @@ -36,8 +37,9 @@ %% Initialization functions. init_per_suite(Config) -> + {ok,Cwd} = file:get_cwd(), ?ignore(file:make_dir(?WORK_DIR)), - reltool_test_lib:init_per_suite(Config). + [{cwd,Cwd}|reltool_test_lib:init_per_suite(Config)]. end_per_suite(Config) -> reltool_test_lib:end_per_suite(Config). @@ -49,9 +51,49 @@ init_per_testcase(Func,Config) -> pang -> ok end, reltool_test_lib:init_per_testcase(Func,Config). -end_per_testcase(Func,Config) -> +end_per_testcase(Func,Config) -> + ok = file:set_cwd(filename:join(?config(cwd,Config),?WORK_DIR)), + {ok,All} = file:list_dir("."), + Files = [F || F <- All, false == lists:prefix("save.",F)], + case ?config(tc_status,Config) of + ok -> + ok; + _Fail -> + SaveDir = "save."++atom_to_list(Func), + ok = file:make_dir(SaveDir), + save_test_result(Files,SaveDir) + end, + rm_files(Files), + ok = file:set_cwd(?config(cwd,Config)), reltool_test_lib:end_per_testcase(Func,Config). + +save_test_result(Files,DestDir) -> + Tar = "copy.tar", + ok = erl_tar:create(Tar, Files), + ok = erl_tar:extract(Tar, [{cwd,DestDir}]), + ok = file:delete(Tar), + ok. + +rm_files([F | Fs]) -> + case file:read_file_info(F) of + {ok,#file_info{type=directory}} -> + rm_dir(F); + {ok,_Regular} -> + ok = file:delete(F) + end, + rm_files(Fs); +rm_files([]) -> + ok. + +rm_dir(Dir) -> + {ok,Files} = file:list_dir(Dir), + rm_files([filename:join(Dir, F) || F <- Files]), + ok = file:del_dir(Dir). + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% SUITE specification @@ -506,7 +548,7 @@ create_script(_Config) -> %% ?m(OrigScript2, Script2), ?m(equal, diff_script(OrigScript, Script)), - + %% Stop server ?m(ok, reltool:stop(Pid)), ok. @@ -755,7 +797,7 @@ create_target(_Config) -> Erl = filename:join([TargetDir, "bin", "erl"]), {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl)), ?msym(ok, stop_node(Node)), - + ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/ssh/src/ssh_cli.erl b/lib/ssh/src/ssh_cli.erl index 7232cc482c..0531ad7830 100644 --- a/lib/ssh/src/ssh_cli.erl +++ b/lib/ssh/src/ssh_cli.erl @@ -189,7 +189,12 @@ terminate(_Reason, _State) -> %%-------------------------------------------------------------------- exec(Cmd) -> - eval(parse(scan(Cmd))). + case eval(parse(scan(Cmd))) of + {error, _} -> + {Cmd, 0}; %% This should be an external call + Term -> + Term + end. scan(Cmd) -> erl_scan:string(Cmd). diff --git a/lib/stdlib/doc/src/sys.xml b/lib/stdlib/doc/src/sys.xml index a177b80739..0ffc5bc433 100644 --- a/lib/stdlib/doc/src/sys.xml +++ b/lib/stdlib/doc/src/sys.xml @@ -234,8 +234,8 @@ <p>These functions are intended only to help with debugging. They are provided for convenience, allowing developers to avoid having to create their own state extraction functions and also avoid having to interactively extract state from the return values of - <c><seealso marker="get_status/1">get_status/1</seealso></c> or - <c><seealso marker="get_status/2">get_status/2</seealso></c> while debugging.</p> + <c><seealso marker="#get_status-1">get_status/1</seealso></c> or + <c><seealso marker="#get_status-2">get_status/2</seealso></c> while debugging.</p> </note> <p>The value of <c><anno>State</anno></c> varies for different types of processes. For a <c>gen_server</c> process, the returned <c><anno>State</anno></c> @@ -247,8 +247,8 @@ <c>Id</c> is the handler's ID (which is the value <c>false</c> if it was registered without an ID), and <c>HandlerState</c> is the handler's state.</p> <p>To obtain more information about a process, including its state, see - <seealso marker="get_status/1">get_status/1</seealso> and - <seealso marker="get_status/2">get_status/2</seealso>.</p> + <seealso marker="#get_status-1">get_status/1</seealso> and + <seealso marker="#get_status-2">get_status/2</seealso>.</p> </desc> </func> <func> |