Lager fails during normal test runs

I decided to configure lager in the Erlang project. I use erlang.mk, so added

ERLC_OPTS = +'{parse_transform, lager_transform}' 

into my makefile. I can run make alland compile modules without errors. I can also start the console erland run the application containing the modules using lager. No errors are generated and lager writes messages during a console session. Everything seems to be in order (this is the first time I've used lager). But, when I run the Common Test, the lager calls fail:

10:11:17.174 [error] CRASH REPORT Process <0.238.0> with 2 neighbours exited with reason: call to undefined function lager:info("Params: ~p", [[]]) in gen_server:init_it/6 line 328

Since it seems that the modules I'm testing were compiled correctly, I assume this is a problem with the missing lager module. However, if I add this:

erlang:display(lager:module_info()),

over the first lager call, this succeeds by printing module information for lager. I assume that the logging calls that I make use a parsing transformation manner to work, and this is not the case during normal test runs.

Any suggestions are welcome!

+4
source share
2 answers

Turns out I had a mishandling in my Makefile, but I learned a lot about it in erlang.mk. erlang.mk was looking for a variable with a different name.

I originally had this in my Makefile:

ERLC_OPTS = +'{parse_transform, lager_transform}'

erlang.mk ERLC_OPTS . Common Test. , :

# Compile flags
ERLC_COMPILE_OPTS= +'{parse_transform, lager_transform}'

# Use the same settings for compiling releases as well as for testing
ERLC_OPTS= $(ERLC_COMPILE_OPTS)
TEST_ERLC_OPTS= $(ERLC_COMPILE_OPTS)

, .

+3

Stratus3D, erlang.mk ERLC_OPTS TEST_ERLC_OPTS, :

# this must be first
include erlang.mk

# Compile flags
ERLC_COMPILE_OPTS= +'{parse_transform, lager_transform}'

# Append these settings
ERLC_OPTS += $(ERLC_COMPILE_OPTS)
TEST_ERLC_OPTS += $(ERLC_COMPILE_OPTS)
+3

All Articles