diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2017-05-11 08:27:39 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2017-05-11 08:27:39 -0400 |
commit | f4ca27d58fa81521808f530cfa50b9b314e93aa2 (patch) | |
tree | bcadca71b902dfdbff61d0cf4f8d60ec085021f1 | |
parent | ce0d8ee15c92968c987b173047e8b14d14a63318 (diff) |
Handle internal CT failures
This is based on issue #1517 where out of nowhere, CT has returned a
user's error code directly. This in turn caused a crashdump in rebar3
itself.
This patch handles the unexpected cases by:
a) not trying to format them
b) converting them to an error whenever they happen
The execution flow is still interrupted, but we should fail with a
clearer error than a crashdump.
-rw-r--r-- | src/rebar_prv_common_test.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index e6788f8..3df8b75 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -650,7 +650,11 @@ handle_results(_) -> sum_results({Passed, Failed, {UserSkipped, AutoSkipped}}, {Passed2, Failed2, {UserSkipped2, AutoSkipped2}}) -> {Passed+Passed2, Failed+Failed2, - {UserSkipped+UserSkipped2, AutoSkipped+AutoSkipped2}}. + {UserSkipped+UserSkipped2, AutoSkipped+AutoSkipped2}}; +sum_results(_, {error, Reason}) -> + {error, Reason}; +sum_results(Unknown, _) -> + {error, Unknown}. handle_quiet_results(_, {error, _} = Result) -> handle_results(Result); @@ -673,7 +677,10 @@ format_result({Passed, 0, {0, 0}}) -> format_result({Passed, Failed, Skipped}) -> Format = [format_failed(Failed), format_skipped(Skipped), format_passed(Passed)], - ?CONSOLE("~s", [Format]). + ?CONSOLE("~s", [Format]); +format_result(_Unknown) -> + %% Happens when CT itself encounters a bug + ok. format_failed(0) -> []; |