diff options
Diffstat (limited to 'lib/reltool')
-rw-r--r-- | lib/reltool/src/reltool_utils.erl | 2 | ||||
-rw-r--r-- | lib/reltool/test/reltool_server_SUITE.erl | 9 | ||||
-rw-r--r-- | lib/reltool/test/reltool_test_lib.erl | 53 |
3 files changed, 54 insertions, 10 deletions
diff --git a/lib/reltool/src/reltool_utils.erl b/lib/reltool/src/reltool_utils.erl index 9af8f6bae8..5a3f34506d 100644 --- a/lib/reltool/src/reltool_utils.erl +++ b/lib/reltool/src/reltool_utils.erl @@ -589,6 +589,8 @@ throw_error(Format, Args) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +decode_regexps(Key, Regexps, undefined) -> + decode_regexps(Key, Regexps, []); decode_regexps(Key, {add, Regexps}, Old) when is_list(Regexps) -> do_decode_regexps(Key, Regexps, Old); decode_regexps(_Key, {del, Regexps}, Old) when is_list(Regexps) -> diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index feeac9e099..bfe5d39d53 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -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() -> []. @@ -2506,6 +2507,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..530d0a9985 100644 --- a/lib/reltool/test/reltool_test_lib.erl +++ b/lib/reltool/test/reltool_test_lib.erl @@ -258,8 +258,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 +267,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 +320,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 +338,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() -> |