diff options
author | omarkj <omarkj@gmail.com> | 2014-11-26 10:09:03 -0800 |
---|---|---|
committer | omarkj <omarkj@gmail.com> | 2014-11-26 10:18:29 -0800 |
commit | b0a48436bfe710d8cc2f9f6c6d1d3c992cf0e069 (patch) | |
tree | cbc589e26bd628b5a0efad1787f40bee4c152682 | |
parent | 94e474e471276171cc9bfeaf4edef73b7c10a29c (diff) |
Return errors when tests fail.
-rw-r--r-- | src/rebar_prv_common_test.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index 2e847a2..7313527 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -36,13 +36,20 @@ do(State) -> {Opts, _} = rebar_state:command_parsed_args(State), Opts1 = transform_opts(Opts), ok = create_dirs(Opts1), - expand_test_deps(filename:absname(rebar_state:get(State, test_deps_dir, ?DEFAULT_TEST_DEPS_DIR))), - ct:run_test(Opts1), - {ok, State}. + expand_test_deps(filename:absname(rebar_state:get(State, test_deps_dir, + ?DEFAULT_TEST_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}}} + end. -spec format_error(any()) -> iolist(). -format_error(Reason) -> - io_lib:format("~p", [Reason]). +format_error({failures_running_tests, FailedCount}) -> + io_lib:format("Failures occured running tests: ~p", [FailedCount]); +format_error({error_running_tests, Reason}) -> + io_lib:format("Error running tests: ~p", [Reason]). expand_test_deps(Dir) -> Apps = filelib:wildcard(filename:join([Dir, "*", "ebin"])), |