diff options
Diffstat (limited to 'lib/common_test/test')
-rw-r--r-- | lib/common_test/test/ct_test_support.erl | 14 | ||||
-rw-r--r-- | lib/common_test/test/ct_verbosity_SUITE.erl | 26 |
2 files changed, 35 insertions, 5 deletions
diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl index 6bcac12326..4132995bf6 100644 --- a/lib/common_test/test/ct_test_support.erl +++ b/lib/common_test/test/ct_test_support.erl @@ -36,6 +36,8 @@ verify_events/3, verify_events/4, reformat/2, log_events/4, join_abs_dirs/2]). +-export([start_slave/3, slave_stop/1]). + -export([ct_test_halt/1]). -include_lib("kernel/include/file.hrl"). @@ -66,10 +68,14 @@ init_per_suite(Config, Level) -> start_slave(Config, Level). -start_slave(Config,Level) -> +start_slave(Config, Level) -> + start_slave(ct, Config, Level). + +start_slave(NodeName, Config, Level) -> [_,Host] = string:tokens(atom_to_list(node()), "@"), - test_server:format(0, "Trying to start ~s~n", ["ct@"++Host]), - case slave:start(Host, ct, []) of + test_server:format(0, "Trying to start ~s~n", + [atom_to_list(NodeName)++"@"++Host]), + case slave:start(Host, NodeName, []) of {error,Reason} -> test_server:fail(Reason); {ok,CTNode} -> @@ -77,7 +83,7 @@ start_slave(Config,Level) -> IsCover = test_server:is_cover(), if IsCover -> cover:start(CTNode); - true-> + true -> ok end, diff --git a/lib/common_test/test/ct_verbosity_SUITE.erl b/lib/common_test/test/ct_verbosity_SUITE.erl index 32488b1db9..1aa71953ec 100644 --- a/lib/common_test/test/ct_verbosity_SUITE.erl +++ b/lib/common_test/test/ct_verbosity_SUITE.erl @@ -53,9 +53,19 @@ init_per_suite(Config) -> end_per_suite(Config) -> ct_test_support:end_per_suite(Config). +init_per_testcase(no_crashing, Config) -> + Opts = ct_test_support:start_slave(ctX, Config, 50), + XNode = proplists:get_value(ct_node, Opts), + ct:pal("Node ~p started!", [XNode]), + [{xnode,XNode} | Config]; init_per_testcase(TestCase, Config) -> ct_test_support:init_per_testcase(TestCase, Config). +end_per_testcase(no_crashing, Config) -> + XNode = proplists:get_value(xnode, Config), + ct_test_support:slave_stop(XNode), + ct:pal("Node ~p stopped!", [XNode]), + ok; end_per_testcase(TestCase, Config) -> ct_test_support:end_per_testcase(TestCase, Config). @@ -72,7 +82,8 @@ all() -> combine_categories, testspec_only, merge_with_testspec, - possible_deadlock + possible_deadlock, + no_crashing ]. %%-------------------------------------------------------------------- @@ -189,6 +200,19 @@ possible_deadlock(Config) -> %%%----------------------------------------------------------------- +%%% +no_crashing(Config) -> + XNode = proplists:get_value(xnode, Config), + ok = rpc:call(XNode, ct, print, ["hello",[]]), + ok = rpc:call(XNode, ct, pal, ["hello",[]]), + ok = rpc:call(XNode, ct, log, ["hello",[]]), + Data = io_lib:format("hello", []), + {badrpc,{'EXIT',{noproc,_}}} = + (catch rpc:call(XNode, test_server_io, print_unexpected, [Data])), + ok. + + +%%%----------------------------------------------------------------- %%% HELP FUNCTIONS %%%----------------------------------------------------------------- |