[erlang-questions] problems with PropEr includes from eunit

Adam Lindberg adam@REDACTED
Thu Jun 30 09:30:06 CEST 2011


This is a combined bug in rebar and PropEr as far as I can see. See my 
entry on the rebar mailing list:

http://lists.basho.com/pipermail/rebar_lists.basho.com/2011-June/000888.html

PropEr relies on the source if the beam file cannot be found (it can't 
when it's cover compiled), and it doesn't seem to know about ERL_LIBS or 
the include paths used. Especially since rebar copies the source file to 
the .eunit folder, it's harder for PropEr to detect linked source files.

You might want to reply on the rebar mailing list to get some traction 
for fixing the problem.

Cheers,
Adam



Martynas Pumputis wrote:
> Hello,
>
> I have problems running PropEr:check_spec/1 from Eunit.
> With this line in module file:
> -include("bp_app/include/log_utils.hrl").
> PropEr stops working. After removing it, PropEr starts working properly.
>
> Error message I get from PropEr:
>
> motiejus:~/mll/gateway_app$ make test_gateway_specs_tests
> ERL_FLAGS="-sname eunit -config ../bp_app/config/default.config
> +P1000000 -env ERL_MAX_ETS_TABLES 20000" ../rebar verbose=2
> skip_deps=true suite=gateway_specs_tests eunit
> ==>  gateway_app (eunit)
> Compiled tests/gateway_specs_tests.erl
> Compiled tests/gateway_app_tests.erl
> ======================== EUnit ========================
> gateway_specs_tests: yadda_test (module 'gateway_specs_tests')...
> =INFO REPORT==== 27-Jun-2011::17:03:39 ===
>     pid:<0.475.0>
>     source: "tests/gateway_specs_tests.erl:29"
>     message: "checkspec says"
>     error: {typeserver,
>                {cant_load_code,gateway_helpers,
>                    {cant_find_object_file,
>                        {cant_compile_source_file,
>
> [{"/home/motiejus/code/mll/gateway_app/.eunit/gateway_helpers.erl",
>                              [{16,epp,
>                                {include,file,
>                                    "bp_app/include/log_utils.hrl"}}]}]}}}}
> [0.029 s] ok
> =======================================================
>   Test passed.
>
> I suspect PropEr recompiles those modules and does not add include paths
> properly.
>
>
> Relevant Code:
> ===== gateway_helpers.erl =====
> -module(gateway_helpers).
> -include("bp_app/include/log_utils.hrl").
> -export([demo/1]).
> -spec demo(integer()) ->  integer().
> demo(Item) ->
>     case Item of
>         1 ->  undefined;
>         R when is_integer(R) ->
>             Item
>     end.
>
> ===== gateway_specs_tests.erl =====
> -module(gateway_specs_tests).
> -include_lib("proper/include/proper.hrl").
> -include_lib("eunit/include/eunit.hrl").
> -include("bp_app/include/log_utils.hrl").
>
> yadda_test() ->
>     ?info("checkspec says", [proper:check_spec({gateway_helpers, demo, 1})]).
>
> bp_app
> ├── include
> │   ├── log_utils.hrl
> gateway_app
> ├── include
> │   ├── consts.hrl
> │   └── types.hrl
> ├── src
> │   └── gateway_helpers.erl
> └── tests
>     └── gateway_specs_tests.erl
>
> Versions:
> Erlang R14A (from Squeeze apt)
> PropEr v1.0-1-g5fe56e9
>
> Please let me know if you need any more information.
>
> Motiejus
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list