aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-09-14 15:59:45 +0200
committerBjörn Gustavsson <[email protected]>2012-09-19 11:51:35 +0200
commit1a2b1519b290bcf9842fcad6152ab1ee7edb1e14 (patch)
tree620deeb8fb943468b39312ec64695f3859c8fc39 /lib/common_test/src
parent4be621ce3f116185500d6ef7282222cec3dc743e (diff)
downloadotp-1a2b1519b290bcf9842fcad6152ab1ee7edb1e14.tar.gz
otp-1a2b1519b290bcf9842fcad6152ab1ee7edb1e14.tar.bz2
otp-1a2b1519b290bcf9842fcad6152ab1ee7edb1e14.zip
Teach test_server to report severe errors to common_test
If a severe error occurs in test_server (e.g. failing to write to log files), test_server would terminate without commont_test knowing about it. Since ct_run can now return an exit code, it is important that common_test is aware of severe problem so that it can indicate that an error has occurred.
Diffstat (limited to 'lib/common_test/src')
-rw-r--r--lib/common_test/src/ct_framework.erl6
-rw-r--r--lib/common_test/src/ct_run.erl9
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl
index 4d47731239..bec3368869 100644
--- a/lib/common_test/src/ct_framework.erl
+++ b/lib/common_test/src/ct_framework.erl
@@ -1529,6 +1529,12 @@ report(What,Data) ->
end;
tests_done ->
ok;
+ severe_error ->
+ ct_event:sync_notify(#event{name=What,
+ node=node(),
+ data=Data}),
+ ct_util:set_testdata({What,Data}),
+ ok;
tc_start ->
%% Data = {{Suite,Func},LogFileName}
ct_event:sync_notify(#event{name=tc_logfile,
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl
index 3383244bf4..4a6a3cdcac 100644
--- a/lib/common_test/src/ct_run.erl
+++ b/lib/common_test/src/ct_run.erl
@@ -2192,6 +2192,15 @@ do_run_test(Tests, Skip, Opts) ->
end, CleanUp),
[code:del_path(Dir) || Dir <- AddedToPath],
+ %% If a severe error has occurred in the test_server,
+ %% we will generate an exception here.
+ case ct_util:get_testdata(severe_error) of
+ undefined -> ok;
+ SevereError ->
+ ct_logs:log("SEVERE ERROR", "~p\n", [SevereError]),
+ exit(SevereError)
+ end,
+
case ct_util:get_testdata(stats) of
Stats = {_Ok,_Failed,{_UserSkipped,_AutoSkipped}} ->
Stats;