[erlang-questions] rebar3 and CT's main node

Roberto Ostinelli roberto@REDACTED
Sun Mar 20 10:07:03 CET 2016


Thank you for the help.

On Sat, Mar 19, 2016 at 1:14 PM, Fred Hebert <mononcqc@REDACTED> wrote:

> If the default mode isn't enough, the easiest solution is always:
>
>     ct_run -dir test -pa `rebar3 path`
>
> Which makes your whole app available to the tests. You can bypass rebar3
> for the run, but still use it for the rest.
>

This fixes the node naming issue, but unfortunately this not enough to make
it work.

Long story short: in my tests I define some callback functions that need to
be called for the tests to pass.
However, I need to specify the path to the test directory too, because
otherwise my slave node doesn't have these functions defined.

This is how I do the trick now:
https://github.com/ostinelli/syn/blob/1.2.0/test/syn_test_suite_helper.erl#L59
(this passes)
https://github.com/ostinelli/syn/blob/1.2.0/test/syn_test_suite_helper.erl#L60
(this directory does not exist when I use rebar3).

SO: is there a way to have rebar copy the test directory to:
syn/_build/default/lib/syn/test

?

You may want to try:
>
>     rebar3 shell --sname=mynode
>      ...
>     r3:do(ct).
>
> To run tests from the interactive shell with a named node, but I have
> never tried that and don't know how it would go.
>
This actually works, though I see an "experimental" warning on top and I
cannot really automate it in a script, as there's no `--eval` option in
`rebar shell`.

So I've tried adding a test.escript file:

%%%%%%%%%%%%%%%%%%%
#!/usr/bin/env escript

main(_) ->
    r3:do(ct),
    init:stop().
%%%%%%%%%%%%%%%%%%%


But:


$ rebar3 shell --sname=mynode --script test.escript
===> Verifying dependencies...
===> Compiling syn
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:8:8] [async-threads:0]
[hipe] [kernel-poll:false] [dtrace]

Eshell V7.3  (abort with ^G)
(mynode@REDACTED)1> ===> Couldn't run shell escript
"/Users/roberto/workspace/syn/test.escript" - exit:{noproc,

                   {gen_server,

                    call,

                    [rebar_agent,

                     {cmd,

                      ct},

                     infinity]}}
Stack: [{gen_server,call,3,[{file,"gen_server.erl"},{line,212}]},
        {test_escript__escript__1458__464329__444078__2,main,1,
            [{file,"/Users/roberto/workspace/syn/test.escript"},{line,5}]},



And I'm stuck.

Any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160320/59d20849/attachment.htm>


More information about the erlang-questions mailing list