[erlang-questions] problems with PropEr includes from eunit

Martynas Pumputis <>
Mon Jun 27 17:01:17 CEST 2011


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



More information about the erlang-questions mailing list