From 4ca6c1a49d6c06e01eac06dd5df996def23fb253 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 12 Oct 2010 11:01:24 +0200 Subject: Update jinterface tests to conform with common_test standard --- lib/jinterface/test/jinterface_SUITE.erl | 98 +++++++------------------------- lib/jinterface/test/nc_SUITE.erl | 39 +++++++------ 2 files changed, 38 insertions(+), 99 deletions(-) (limited to 'lib/jinterface/test') diff --git a/lib/jinterface/test/jinterface_SUITE.erl b/lib/jinterface/test/jinterface_SUITE.erl index ea097680dd..5c31469849 100644 --- a/lib/jinterface/test/jinterface_SUITE.erl +++ b/lib/jinterface/test/jinterface_SUITE.erl @@ -18,7 +18,7 @@ %% -module(jinterface_SUITE). --export([all/1, init_per_suite/1, end_per_suite/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2]). -export([nodename/1, register_and_whereis/1, get_names/1, boolean_atom/1, @@ -31,13 +31,13 @@ erl_link_java_exit/1, java_link_erl_exit/1, internal_link_linking_exits/1, internal_link_linked_exits/1, internal_unlink_linking_exits/1, internal_unlink_linked_exits/1, - normal_exit/1, kill_mbox/1, kill_erl_proc_from_java/1, - kill_mbox_from_erlang/1, erl_exit_with_reason_any_term/1, + normal_exit/1, kill_erl_proc_from_java/1, + erl_exit_with_reason_any_term/1, java_exit_with_reason_any_term/1, status_handler_localStatus/1, status_handler_remoteStatus/1, status_handler_connAttempt/1]). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -define(debug,true). @@ -80,14 +80,21 @@ %%%----------------------------------------------------------------- %%% INIT/END %%%----------------------------------------------------------------- -all(suite) -> - lists:append([ - fundamental(), - ping(), - send_receive(), - link_unlink(), - status_handler() - ]). +all() -> +lists:append([fundamental(), ping(), send_receive(), + link_unlink(), status_handler()]). + +groups() -> + [{kill_mbox, [], {skip, "Not yet implemented"}}, + {kill_mbox_from_erlang, [], + {skip, "Not yet implemented"}}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + fundamental() -> [ @@ -476,59 +483,6 @@ normal_exit(Config) when is_list(Config) -> %%%----------------------------------------------------------------- -kill_mbox(doc) -> - ["MboxLinkUnlink.java: " - "Test that mbox.exit(new OtpErlangAtom(\"kill\") causes linked " - "processes to exit with reason 'killed', which can be trapped."]; -kill_mbox(suite) -> - {skip, "Not yet implemented"}; -kill_mbox(Config) when is_list(Config) -> - Fun = - fun() -> - register(erl_link_server,self()), - process_flag(trap_exit,true), - receive - {Main,Mbox} when is_pid(Main), is_pid(Mbox) -> - ?dbg("Erlang sending \"~p\"",[kill_mbox]), - Pid = spawn_link(fun() -> - process_flag(trap_exit,true), - link(Mbox), - Mbox ! {?kill_mbox}, - receive - {'EXIT',Mbox,killed} -> - exit(correct_reason); - {'EXIT',Mbox,R} -> - exit({faulty_reason,R}) - end - end), - receive - {'EXIT',Pid,{faulty_reason,Reason}} -> - receive done -> Main ! done end, - exit({faulty_reason,Reason}); - {'EXIT',Pid,im_killed} -> - receive done -> Main ! done end - after 1000 -> - receive - Other -> - ?dbg("Got garbage when waiting for exit:" - " ~p", [Other]), - Main ! done, - exit({got_unexpected,Other}) - after 0 -> - ok - end - end; - Other -> - ?dbg("Got garbage: ~p",[Other]), - exit(Other) - end - end, - - spawn_link(Fun), - ok = jitu:java(?config(java, Config), - ?config(data_dir, Config), - "MboxLinkUnlink", - [erlang:get_cookie(),node()]). %%%----------------------------------------------------------------- kill_erl_proc_from_java(doc) -> @@ -547,20 +501,6 @@ kill_erl_proc_from_java(Config) when is_list(Config) -> erl_java_link(LinkFun,kill_erl_proc_from_java,killed,Config). %%%----------------------------------------------------------------- -kill_mbox_from_erlang(doc) -> - ["MboxLinkUnlink.java: " - "Test that exit(Mbox,kill) causes linked the Mbox to be killed, and" - "linked processes to exit with reason 'killed', even if trapping exits"]; -kill_mbox_from_erlang(suite) -> - {skip, "Not yet implemented"}; -kill_mbox_from_erlang(Config) when is_list(Config) -> - LinkFun = fun(Mbox) -> - link(Mbox), - Mbox ! {?kill_mbox_from_erlang}, - exit(Mbox,kill), - receive after infinity -> ok end - end, - erl_java_link(LinkFun,kill_mbox_from_erlang,killed,Config). %%%----------------------------------------------------------------- erl_exit_with_reason_any_term(doc) -> diff --git a/lib/jinterface/test/nc_SUITE.erl b/lib/jinterface/test/nc_SUITE.erl index 82dd3c2535..a96b3495aa 100644 --- a/lib/jinterface/test/nc_SUITE.erl +++ b/lib/jinterface/test/nc_SUITE.erl @@ -19,11 +19,11 @@ -module(nc_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). --export([all/1, +-export([all/0,groups/0,init_per_group/2,end_per_group/2, init_per_suite/1, end_per_suite/1, init_per_testcase/2, @@ -50,24 +50,23 @@ %% Top of cases -all(doc) -> []; -all(suite) -> [pid_roundtrip, - port_roundtrip, - ref_roundtrip, - new_float, - old_stuff, - binary_roundtrip, - decompress_roundtrip, - compress_roundtrip, - integer_roundtrip, - fun_roundtrip, - lists_roundtrip, - lists_roundtrip_2, - lists_iterator, - unicode, - unicode_list_to_string, - unicode_string_to_list, - connect]. +all() -> +[pid_roundtrip, port_roundtrip, ref_roundtrip, + new_float, old_stuff, binary_roundtrip, + decompress_roundtrip, compress_roundtrip, + integer_roundtrip, fun_roundtrip, lists_roundtrip, + lists_roundtrip_2, lists_iterator, unicode, + unicode_list_to_string, unicode_string_to_list, connect]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -- cgit v1.2.3