Skip to content

Commit 454e26f

Browse files
authored
Merge pull request #4693 from esl/log-unexpected-errors
MIM-2662 Report only unexpected errors in logged_errors report
2 parents 66a410f + 11b4718 commit 454e26f

8 files changed

Lines changed: 909 additions & 89 deletions

File tree

big_tests/default.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
{suites, "tests", cets_disco_SUITE}.
104104
{suites, "tests", start_node_id_SUITE}.
105105
{suites, "tests", tr_util_SUITE}.
106+
{suites, "tests", cth_error_report_SUITE}.
106107

107108
%% the below suites restart MIM nodes, so they were moved to the end
108109
%% to minimise impact on other tests

big_tests/run_common_test.erl

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ main(RawArgs) ->
6262
timer:sleep(50),
6363
CTRunDirsAfterRun = ct_run_dirs(),
6464
inject_error_report_link(CTRunDirsBeforeRun, CTRunDirsAfterRun),
65+
ErrorLimitExceeded = check_error_limit_exceeded(CTRunDirsBeforeRun, CTRunDirsAfterRun),
6566
ExitStatusByGroups = exit_status_by_groups(CTRunDirsBeforeRun, CTRunDirsAfterRun, Results),
6667
ExitStatusByTestCases = process_results(Results),
67-
case ExitStatusByGroups of
68+
ExitStatus = case ExitStatusByGroups of
6869
undefined ->
6970
io:format("Exiting by test cases summary: ~p~n", [ExitStatusByTestCases]),
70-
init:stop(ExitStatusByTestCases);
71+
ExitStatusByTestCases;
7172
_ when is_integer(ExitStatusByGroups) ->
7273
%% FIXME: This is incorrect assumption, it ignores results of all individual
7374
%% tests cases and groups w/o 'repeat_until_all_ok' flag. So we can return
@@ -76,8 +77,17 @@ main(RawArgs) ->
7677
%% may result in squashing ct output, since execution of run_common_test.erl
7778
%% is wrapped using silent_exec.sh tool.
7879
io:format("Exiting by groups summary: ~p~n", [ExitStatusByGroups]),
79-
init:stop(ExitStatusByGroups)
80-
end
80+
ExitStatusByGroups
81+
end,
82+
FinalStatus = case {ExitStatus, ErrorLimitExceeded} of
83+
{0, {true, Details}} ->
84+
io:format("~n**** Failing due to unexpected error"
85+
" log limit exceeded:~n~s", [Details]),
86+
1;
87+
_ ->
88+
ExitStatus
89+
end,
90+
init:stop(FinalStatus)
8191
catch Type:Reason:StackTrace ->
8292
io:format("TEST CRASHED~n Error type: ~p~n Reason: ~p~n Stacktrace:~n~p~n",
8393
[Type, Reason, StackTrace]),
@@ -683,6 +693,20 @@ handle_file_error(_FileName, Other) ->
683693
ct_run_dirs() ->
684694
filelib:wildcard("ct_report/ct_run*").
685695

696+
check_error_limit_exceeded(Before, After) ->
697+
case After -- Before of
698+
[RunDir] ->
699+
Marker = filename:join([RunDir, "logged_errors", "limit_exceeded"]),
700+
case file:read_file(Marker) of
701+
{ok, Content} ->
702+
{true, Content};
703+
_ ->
704+
false
705+
end;
706+
_ ->
707+
false
708+
end.
709+
686710
inject_error_report_link(Before, After) ->
687711
case After -- Before of
688712
[RunDir] ->

0 commit comments

Comments
 (0)