From b649d3e254a6883596474e88c5d54e7c7a4877c1 Mon Sep 17 00:00:00 2001 From: omarkj Date: Thu, 4 Dec 2014 18:11:04 -0800 Subject: Handle more ct_run return values. --- src/rebar_prv_common_test.erl | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index 3d64517..20d554e 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -38,11 +38,11 @@ do(State) -> Opts1 = transform_opts(Opts), ok = create_dirs(Opts1), expand_test_deps(filename:join(rebar_dir:profile_dir(State), ?DEFAULT_DEPS_DIR)), - case ct:run_test(Opts1) of - {_, 0, _} -> {ok, State}; - {_, FailedCount, _} -> {error, {?MODULE, {failures_running_tests, - FailedCount}}}; - {error, Reason} -> {error, {?MODULE, {error_running_tests, Reason}}} + case handle_results(ct:run_test(Opts1)) of + {error, Reason} -> + {error, {?MODULE, Reason}}; + ok -> + {ok, State} end. -spec format_error(any()) -> iolist(). @@ -240,3 +240,19 @@ help(ct_hooks) -> ""; help(userconfig) -> "". + +handle_results([Result]) -> + handle_results(Result); +handle_results([Result|Results]) when is_list(Results) -> + case handle_results(Result) of + ok -> + handle_results(Results); + Error -> + Error + end; +handle_results({_, 0, _}) -> + ok; +handle_results({_, FailedCount, _}) -> + {error, {failures_running_tests, FailedCount}}; +handle_results({error, Reason}) -> + {error, {error_running_tests, Reason}}. -- cgit v1.1