I have created a configuration file as described in Erlang -- config for my application that consists of multiple sub-apps of which each has its own Common Test suites directory. For building and testing I use rebar, my directory structure looks like this
.
├── apps
│ ├── app1
│ │ ├── ebin
│ │ └── src
│ ├── app2
│ │ ├── ebin
│ │ ├── logs
│ │ ├── rebar.config
│ │ ├── src
│ │ └── test
│ ├── ...
├── deps
├── rebar.config
├── apps.config
where apps.config
contains the configuration for all apps. When I start my VM with erl -pa deps/*/ebin -pa apps/*/ebin -config apps
everything works fine. I've added {ct_extra_params, "-erl_args -config rpm"}.
to my rebar.config
but when I run rebar ct
an error occurs when application:get_env/1,2
is called.
If it is not possible to do this with rebar, it would also be possible to use make instead if someone could tell me how I can accomplish it there. I know that I can somehow load configs into Common Test as described in Erlang -- External Configuration Date but I thought there would be an easier way if I already have apps.config
.
Update: ct_run -dir apps/app1/test -pa deps/*/ebin -pa apps/*/ebin -erl_args -config rpm
also works as expected. I guess the problem is that rebar changes the cwd when running the tests for each application and therefore the -config rpm
option does not point to a existing file. I was anyway not able to find a workaround.