passing runtime arguments to erlang when running rebar eunit

大憨熊 提交于 2019-12-10 11:13:06

问题


In my startup script, I am starting erlang with:

erl -args_file vm.args

Currently, while trying to run unit tests with rebar eunit is there a way for me to pass custom runtime arguments such as the -args_file option to the erlang process that rebar kicks off? I have searched docs high and low to no avail...

I appreciate the help.


回答1:


I answered my own question. I use the ERL_FLAGS variable to pass command line args. Here is a snippet from my Makefile:

ERL_FLAGS="-args_file test/conf/vm.eunit.args" ./rebar skip_deps=true eunit



回答2:


The first method is satisfied with your restriction: 1. in your eunit test function, to use erlang's "os:cmd("erl -name bar -detached arguments")." to start another erlang node. In the arguments, you can insert whatever you want. But eunit's check will be difficult because the test will cross the nodes.

The second methods is to change your restriction: 1. To use "configuremnt file" to pass arguments, and not to use command parameter to pass parameters.



来源:https://stackoverflow.com/questions/10307575/passing-runtime-arguments-to-erlang-when-running-rebar-eunit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!