diff options
Diffstat (limited to 'lib/reltool/test')
-rw-r--r-- | lib/reltool/test/reltool_app_SUITE.erl | 9 | ||||
-rw-r--r-- | lib/reltool/test/reltool_server_SUITE.erl | 18 | ||||
-rw-r--r-- | lib/reltool/test/reltool_test_lib.erl | 60 |
3 files changed, 66 insertions, 21 deletions
diff --git a/lib/reltool/test/reltool_app_SUITE.erl b/lib/reltool/test/reltool_app_SUITE.erl index a6e00cde08..9abc7fea41 100644 --- a/lib/reltool/test/reltool_app_SUITE.erl +++ b/lib/reltool/test/reltool_app_SUITE.erl @@ -26,6 +26,7 @@ -compile(export_all). -include("reltool_test_lib.hrl"). +-include_lib("common_test/include/ct.hrl"). t() -> reltool_test_lib:t(?MODULE). @@ -64,7 +65,7 @@ end_per_testcase(Func,Config) -> suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [fields, modules, export_all, app_depend, undef_funcs]. + [fields, modules, export_all, app_depend, undef_funcs, appup]. groups() -> []. @@ -290,3 +291,9 @@ key1search(Key, L) -> {value, {Key, Value}} -> Value end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Test that the reltool appup file is ok +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(reltool). diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index feeac9e099..b3b7afd1a9 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-2014. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -143,7 +143,8 @@ all() -> mod_incl_cond_derived, use_selected_vsn, use_selected_vsn_relative_path, - non_standard_vsn_id]. + non_standard_vsn_id, + undefined_regexp]. groups() -> []. @@ -1204,14 +1205,9 @@ create_slim(Config) -> RootDir = code:root_dir(), Erl = filename:join([RootDir, "bin", "erl"]), - EscapedQuote = - case os:type() of - {win32,_} -> "\\\""; - _ -> "\"" - end, Args = ["-boot_var", "RELTOOL_EXT_LIB", TargetLibDir, "-boot", filename:join(TargetRelVsnDir,RelName), - "-sasl", "releases_dir", EscapedQuote++TargetRelDir++EscapedQuote], + "-sasl", "releases_dir", "\""++TargetRelDir++"\""], {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl, Args)), ?msym(RootDir, rpc:call(Node, code, root_dir, [])), wait_for_app(Node,sasl,50), @@ -2506,6 +2502,12 @@ non_standard_vsn_id(Config) -> reltool_server:get_app(Pid2,b)), ok. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +undefined_regexp(_Config) -> + ?msym({ok,_}, + reltool:get_config([{sys,[{app,asn1,[{excl_app_filters, + {add, ["^priv"]}}]}]}])), + ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Library functions diff --git a/lib/reltool/test/reltool_test_lib.erl b/lib/reltool/test/reltool_test_lib.erl index 3485365ed9..fa12f19aa7 100644 --- a/lib/reltool/test/reltool_test_lib.erl +++ b/lib/reltool/test/reltool_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-2014. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,12 +20,13 @@ -compile(export_all). -include("reltool_test_lib.hrl"). +-define(timeout, 20). % minutes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init_per_suite(Config) when is_list(Config)-> global:register_name(reltool_global_logger, group_leader()), - incr_timetrap(Config, 10). + incr_timetrap(Config, ?timeout). end_per_suite(Config) when is_list(Config)-> global:unregister_name(reltool_global_logger), @@ -51,7 +52,7 @@ set_kill_timer(Config) -> Time = case lookup_config(tc_timeout, Config) of [] -> - timer:minutes(10); + timer:minutes(?timeout); ConfigTime when is_integer(ConfigTime) -> ConfigTime end, @@ -258,8 +259,8 @@ run_test([{Module, TC} | Rest], Config) -> true -> [do_run_test(Module, TC, NewConfig)] end, - Module:end_per_suite(NewConfig), - Res ++ run_test(Rest, NewConfig); + CommonTestRes = worst_res(Res), + Res ++ run_test(Rest, [{tc_status,CommonTestRes}|NewConfig]); Error -> ?error("Test suite skipped: ~w~n", [Error]), [{skipped, Error}] @@ -267,6 +268,36 @@ run_test([{Module, TC} | Rest], Config) -> run_test([], _Config) -> []. +worst_res(Res) -> + NewRes = [{dummy, {ok,dummy, dummy}} | Res], + [{_,WorstRes}|_] = lists:sort(fun compare_res/2, NewRes), + common_test_res(WorstRes). + +common_test_res(ok) -> + ok; +common_test_res({Res,_,Reason}) -> + common_test_res({Res,Reason}); +common_test_res({Res,Reason}) -> + case Res of + ok -> ok; + skip -> {skipped, Reason}; + skipped -> {skipped, Reason}; + failed -> {failed, Reason}; + crash -> {failed, Reason} + end. + +% crash < failed < skip < ok +compare_res({_,{ResA,_,_}},{_,{ResB,_,_}}) -> + res_to_int(ResA) < res_to_int(ResB). + +res_to_int(Res) -> + case Res of + ok -> 4; + skip -> 3; + failed -> 2; + crash -> 1 + end. + do_run_test(Module, all, Config) -> All = [{Module, Test} || Test <- Module:all()], run_test(All, Config); @@ -290,9 +321,10 @@ eval_test_case(Mod, Fun, Config) -> test_case_evaluator(Mod, Fun, [Config]) -> NewConfig = Mod:init_per_testcase(Fun, Config), - R = apply(Mod, Fun, [NewConfig]), - Mod:end_per_testcase(Fun, NewConfig), - exit({test_case_ok, R}). + Res = apply(Mod, Fun, [NewConfig]), + CommonTestRes = common_test_res(Res), + Mod:end_per_testcase(Fun, [{tc_status,CommonTestRes}|NewConfig]), + exit({test_case_ok, Res}). wait_for_evaluator(Pid, Mod, Fun, Config) -> receive @@ -307,13 +339,17 @@ wait_for_evaluator(Pid, Mod, Fun, Config) -> {'EXIT', Pid, {skipped, Reason}} -> log("<WARNING> Test case ~w skipped, because ~p~n", [{Mod, Fun}, Reason]), - Mod:end_per_testcase(Fun, Config), - {skip, {Mod, Fun}, Reason}; + Res = {skipped, {Mod, Fun}, Reason}, + CommonTestRes = common_test_res(Res), + Mod:end_per_testcase(Fun, [{tc_status,CommonTestRes}|Config]), + Res; {'EXIT', Pid, Reason} -> log("<ERROR> Eval process ~w exited, because\n\t~p~n", [{Mod, Fun}, Reason]), - Mod:end_per_testcase(Fun, Config), - {crash, {Mod, Fun}, Reason} + Res = {crash, {Mod, Fun}, Reason}, + CommonTestRes = common_test_res(Res), + Mod:end_per_testcase(Fun, [{tc_status,CommonTestRes}|Config]), + Res end. flush() -> |