summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoromarkj <omarkj@gmail.com>2014-12-04 18:11:04 -0800
committeromarkj <omarkj@gmail.com>2014-12-04 18:11:04 -0800
commitb649d3e254a6883596474e88c5d54e7c7a4877c1 (patch)
treea0a61246a51ff01171c1002a9b27ceb33ee02d41 /src
parent1a88cc285375e5558b12de502b515ef2ce503028 (diff)
Handle more ct_run return values.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_common_test.erl26
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}}.