diff options
author | Lukas Larsson <[email protected]> | 2010-12-10 15:57:24 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2010-12-10 15:57:24 +0100 |
commit | 0a5c83dc4cbf10e46ab6afa8c8cad05005406263 (patch) | |
tree | 1f24e09a5edbbcb521e8bec144069f5ea1a175f9 /lib/common_test/test | |
parent | 9cedf681e9b3f2144cf44fbb4ae7f4a0e4aa9bf6 (diff) | |
download | otp-0a5c83dc4cbf10e46ab6afa8c8cad05005406263.tar.gz otp-0a5c83dc4cbf10e46ab6afa8c8cad05005406263.tar.bz2 otp-0a5c83dc4cbf10e46ab6afa8c8cad05005406263.zip |
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
Diffstat (limited to 'lib/common_test/test')
-rw-r--r-- | lib/common_test/test/ct_test_support.erl | 21 |
1 files changed, 16 insertions, 5 deletions
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]), |