From 0a5c83dc4cbf10e46ab6afa8c8cad05005406263 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 10 Dec 2010 15:57:24 +0100 Subject: Update test support so that if common test fails to be stopped in a suite, the ct node is restarted and the test case fails --- lib/common_test/test/ct_test_support.erl | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'lib/common_test') diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl index 981504b660..b4f1a0e71f 100644 --- a/lib/common_test/test/ct_test_support.erl +++ b/lib/common_test/test/ct_test_support.erl @@ -58,6 +58,10 @@ init_per_suite(Config, Level) -> _ -> ok end, + + start_slave(Config, Level). + +start_slave(Config,Level) -> [_,Host] = string:tokens(atom_to_list(node()), "@"), test_server:format(0, "Trying to start ~s~n", ["ct@"++Host]), @@ -136,9 +140,16 @@ init_per_testcase(_TestCase, Config) -> end_per_testcase(_TestCase, Config) -> CTNode = ?config(ct_node, Config), - wait_for_ct_stop(CTNode), - ok. - + case wait_for_ct_stop(CTNode) of + %% Common test was not stopped to we restart node. + false -> + cover:stop(CTNode), + slave:stop(CTNode), + start_slave(Config,proplists:get_value(trace_level,Config)), + {fail, "Could not stop common_test"}; + true -> + ok + end. %%%----------------------------------------------------------------- %%% @@ -229,11 +240,11 @@ wait_for_ct_stop(CTNode) -> wait_for_ct_stop(0, CTNode) -> test_server:format(0, "Giving up! Stopping ~p.", [CTNode]), - ok; + false; wait_for_ct_stop(Retries, CTNode) -> case rpc:call(CTNode, erlang, whereis, [ct_util_server]) of undefined -> - ok; + true; Pid -> test_server:format(0, "Waiting for CT (~p) to finish (~p)...", [Pid,Retries]), -- cgit v1.2.3