aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_server/src/ts_run.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-09-14 15:52:38 +0200
committerBjörn Gustavsson <[email protected]>2012-09-20 11:31:00 +0200
commit5de847a30702a96fd1c7286172e3941a62d78436 (patch)
treeb9a3edb33d77014624a16091054593540f12ff4b /lib/test_server/src/ts_run.erl
parentc24f87e19cc01437c3c7b84e9c3fbeceb8c3b736 (diff)
downloadotp-5de847a30702a96fd1c7286172e3941a62d78436.tar.gz
otp-5de847a30702a96fd1c7286172e3941a62d78436.tar.bz2
otp-5de847a30702a96fd1c7286172e3941a62d78436.zip
ts_run: Make errors from ct:run_test/1 visible
The ts wrapper module invokes common_test by calling the ct:run_test/1 function using "erl -eval Cmd". Since ct:run_test/1 is intended to by called from the Erlang shell, it returns error values rather than printing them. Therefore, when an error occurs, users of ts may not see any error indication. Introduce the ts_run:ct_run_test/2 wrapper which invokes ct:run_test/1 and prints out any error that occurs.
Diffstat (limited to 'lib/test_server/src/ts_run.erl')
-rw-r--r--lib/test_server/src/ts_run.erl23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/test_server/src/ts_run.erl b/lib/test_server/src/ts_run.erl
index e108a22839..f4d5b3e3b1 100644
--- a/lib/test_server/src/ts_run.erl
+++ b/lib/test_server/src/ts_run.erl
@@ -21,7 +21,7 @@
-module(ts_run).
--export([run/4]).
+-export([run/4,ct_run_test/2]).
-define(DEFAULT_MAKE_TIMETRAP_MINUTES, 60).
-define(DEFAULT_UNMAKE_TIMETRAP_MINUTES, 15).
@@ -87,6 +87,24 @@ execute([Hook|Rest], Vars0, Spec0, St0) ->
execute([], Vars, Spec, St) ->
{ok, Vars, Spec, St}.
+%% Wrapper to run tests using ct:run_test/1 and handle any errors.
+
+ct_run_test(Dir, CommonTestArgs) ->
+ try
+ ok = file:set_cwd(Dir),
+ case ct:run_test(CommonTestArgs) of
+ {_,_,_} ->
+ ok;
+ {error,Error} ->
+ io:format("ERROR: ~P\n", [Error,20]);
+ Other ->
+ io:format("~P\n", [Other,20])
+ end
+ catch
+ _:Crash ->
+ io:format("CRASH: ~P\n", [Crash,20])
+ end.
+
%%
%% Deletes File from Files when File is on the form .../<SUITE>_data/<file>
%% when all of <SUITE> has been skipped in Spec, i.e. there
@@ -230,8 +248,7 @@ make_command(Vars, Spec, State) ->
" -boot start_sasl -sasl errlog_type error",
" -pz \"",Cwd,"\"",
" -ct_test_vars ",TestVars,
- " -eval \"file:set_cwd(\\\"",TestDir,"\\\")\" "
- " -eval \"ct:run_test(",
+ " -eval \"ts_run:ct_run_test(\\\"",TestDir,"\\\", ",
backslashify(lists:flatten(State#state.test_server_args)),")\""
" ",
ExtraArgs],