Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make Rebar run Common Test in a release directory?

I have a Rebar project with a top-level release directory that just includes the component applications as dependencies and contains the reltool configuration.

Some of my applications have Common Test suites in test subdirectories, and I can run those tests with rebar ct.

Now I want to create a Common Test suite for the entire release. However, when I run rebar ct skip_deps=true in the top-level directory, I just get:

Command 'ct' not understood or not applicable

How can I make Rebar run my tests?

like image 504
legoscia Avatar asked Jun 29 '12 15:06

legoscia


1 Answers

Rebar has three sets of modules (see rebar.app):

  • any_dir_modules, which apply to any directory in your project;
  • app_dir modules, which apply only to directories containing files matching src/*.app.src or ebin/*.app (see rebar_app_utils:is_app_dir/1); and
  • rel_dir modules, which apply only to directories containing reltool.config or reltool.config.script (see rebar_rel_utils:is_rel_dir/1).

The rebar_ct module, which is responsible for running Common Test, is in the app_dir category, and your top-level release directory is thus not eligible.

You can work around this by specifying that rebar_ct is a plugin, since plugins bypass the module category mechanism. Put the following line in your rebar.config:

{plugins, [rebar_ct]}.

And you'll get:

$ rebar ct skip_deps=true
==> foo (ct)
==> bar (ct)
==> my_rel (ct)
DONE.
Testing src.my_rel: TEST COMPLETE, 0 ok, 0 failed of 0 test cases
like image 183
legoscia Avatar answered Oct 27 '22 00:10

legoscia