mbsheikh
mbsheikh

Reputation: 2521

Eunit error with multiple apps

I have the following directory structure:

myapp
├── apps
│   ├── myapp
│   ├── myotherapp
│   └── myapp_common
├── deps
│   ├── cowboy
......

I run eunit using rebar as follows in the main myapp directory:

./rebar skip_deps=true eunit

It correctly runs eunit for three apps in apps/. After that it tries to run eunit in the parent myapp directory and throws the following error:

......
==> myapp (eunit)
ERROR: eunit failed while processing /home/msheikh/myapp: {'EXIT',{{badmatch,{error,{1,
                           "cp: missing destination file operand after `.eunit'\nTry `cp --help' for more information.\n"}}},
         [{rebar_file_utils,cp_r,2,[]},
          {rebar_eunit,eunit,2,[]},
          {rebar_core,run_modules,4,[]},
          {rebar_core,execute,4,[]},
          {rebar_core,process_dir,4,[]},
          {rebar_core,process_commands,2,[]},
          {rebar,main,1,[]},
          {escript,run,2,[{file,"escript.erl"},{line,727}]}]}}

Question: How can I fix this or prevent eunit from running for the parent myapp directory?

The rebar.config file in the main myapp directory looks like this:

{lib_dirs, ["deps", "apps"]}.

{deps, [
        {lager, ".*", {git, "https://github.com/basho/lager.git", {branch, "master"}}},
        {jsx, ".*", {git, "git://github.com/talentdeficit/jsx.git", {tag, "v0.9.0"}}},
        {cowboy, "", {git, "git://github.com/extend/cowboy.git", {branch, "master"}}},
        ....
       ]}.

{require_otp_vsn, "R15"}.

{escript_incl_apps, [getopt]}.

{erl_opts, [
            debug_info, 
            warn_missing_spec,
            {parse_transform, lager_transform}
           ]}.

{eunit_opts, [verbose]}.

{validate_app_modules, false}.

{sub_dirs, [
            "apps/myapp/",
            "apps/myotherapp/",
            "apps/myapp_common/"]}.

Upvotes: 3

Views: 620

Answers (1)

Motiejus Jakštys
Motiejus Jakštys

Reputation: 2979

I have the same project structure, and it works.

  1. Are you sure you don't have src, test, ebin folders in the top-level directory?
  2. If not, what happens if you mkdir .eunit? (I am not suggesting to keep this, but go looking for a solution from there).

Upvotes: 0

Related Questions