[erlang-questions] Eunit multinode test help.

fess fess-erlang@REDACTED
Thu Jan 31 01:53:42 CET 2008


Where is the best place for questions about eunit?  I can't find any  
hints of mailing lists or forums [ except a comments trail http:// 
support.process-one.net/doc/display/CONTRIBS/EUnit which looks  
inappropriate. ]

Running the following test:

start_node_fixture_test_() ->
   { Node, Host } = split_node(node()),
   S  = Node ++ "_slave",
   RN = erlang:list_to_atom( S ++ "@" ++ Host),
   { node, RN, { setup,    { spawn, RN },    fun  
start_node_test_setup/0,
     fun start_node_test_cleanup/1,
     [
       % w/out the list eunit doesn't run test_1 on remote node?
       fun start_node_test_1/0
     ]
   }}.

I get the following error:

*unexpected termination of test process*
::{badarg,[{erlang,atom_to_list,[[]]},
            {eunit_lib,fun_parent,1},
            {eunit_data,parse_function,1},
            {eunit_data,next,1},
            {eunit_data,iter_next,1},
            {eunit_data,iter_do,3},
            {eunit_proc,tests_inorder,3},
            {eunit_proc,with_timeout,3}]}


and I'm at a loss.   Any help is greatly appreciated.

The full code and output follow.
erl -sname $$ -pa ../src -boot start_sasl
[...]
(24078@REDACTED)1> c(eunit_node_test).
{ok,eunit_node_test}
(24078@REDACTED)2> eunit_node_test:test().

=PROGRESS REPORT==== 30-Jan-2008::16:34:32 ===
           supervisor: {local,inet_gethost_native_sup}
              started: [{pid,<0.62.0>},{mfa,{inet_gethost_native,init, 
[[]]}}]

=PROGRESS REPORT==== 30-Jan-2008::16:34:32 ===
           supervisor: {local,kernel_safe_sup}
              started: [{pid,<0.61.0>},
                        {name,inet_gethost_native_sup},
                        {mfa,{inet_gethost_native,start_link,[]}},
                        {restart_type,temporary},
                        {shutdown,1000},
                        {child_type,worker}]
setup is on: '24078@REDACTED'
cleanup is on: '24078@REDACTED'

*unexpected termination of test process*
::{badarg,[{erlang,atom_to_list,[[]]},
            {eunit_lib,fun_parent,1},
            {eunit_data,parse_function,1},
            {eunit_data,next,1},
            {eunit_data,iter_next,1},
            {eunit_data,iter_do,3},
            {eunit_proc,tests_inorder,3},
            {eunit_proc,with_timeout,3}]}

=======================================================
   Failed: 0.  Aborted: 0.  Skipped: 1.  Succeeded: 0.
error


the code follows:

---- BEGIN eunit_node_test.erl ---
-module(eunit_node_test).
-include_lib ("eunit/include/eunit.hrl").


start_node_fixture_test_() ->
   { Node, Host } = split_node(node()),
   S  = Node ++ "_slave",
   RN = erlang:list_to_atom( S ++ "@" ++ Host),
   { node, RN, { setup,    { spawn, RN },    fun  
start_node_test_setup/0,
     fun start_node_test_cleanup/1,
     [
       % w/out the list eunit doesn't even try to run test_1 on  
remote node? weird.
       fun start_node_test_1/0
     ]
   }}.

start_node_test_setup() ->
     io:format(user, "setup is on: ~p~n", [ node() ]).

start_node_test_cleanup(_) ->
     io:format(user, "cleanup is on: ~p~n", [ node() ]).

start_node_test_1() ->
     io:format(user, "Where does this go: ~p~n", [ node() ]).

split_node(Node) when is_atom(Node) ->
   split_node(atom_to_list(Node), []).
split_node([], UseAsHost )    -> { [], UseAsHost };
split_node([ $@ | T ], Node ) -> { Node, T };
split_node([ H | T ], Node )  -> split_node(T,  Node ++ [H] ).
---- END eunit_node_test.erl ---




More information about the erlang-questions mailing list