Using rebar3 eunit
it is able to handle -include("some_file.hrl")
in the tests, but this doesn't work with rebar3 ct
. For some reason when I use rebar3 ct
it tries to compile my eunit tests and fails because it can't find the .hrl files used in the eunit tests. ...can't find include file "some_file.hrl"
What am I doing wrong? Why is it compiling eunit tests when I'm trying to run CT tests?
Quick answer:
Additional compile options for eunit. erl_opts can be used like this with rebar3:
{eunit_compile_opts, [
{i, "custominclude"},
{i, "include"},
{i, "deps/nice/include"},
{i, "/usr/lib64/erlang/lib/some-1.3.0/include"}
]}.
More about this subject
rebar3 change the way eunit tests are performed.
Original rebar2 behavior was to compile your project and anything in the test directory (including subdirectories) to the directory .eunit and then run tests from every file. That's why your include files directive may work under rebar2 simply because all files are included and centralized.
Rebar3 instead, by default, sets Tests to [{application, yourapp}].The eunit command of rebar3 first does some preparation work and after this calls eunit:test(Tests, EUnitOpts).
Notice that:
http://www.rebar3.org/docs/from-rebar-2x-to-rebar3
Since rebar3 ct will take all this in account, being more configurable and less automated (not including all of your applications and deps) this may happen to you.