diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_prv_common_test.erl | 26 |
1 files changed, 21 insertions, 5 deletions
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}}. |