Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run rebar eunit configuration #562

Closed
myles-mcdonnell opened this issue Feb 3, 2015 · 10 comments
Closed

Unable to run rebar eunit configuration #562

myles-mcdonnell opened this issue Feb 3, 2015 · 10 comments
Assignees

Comments

@myles-mcdonnell
Copy link

When running rebar eunit config (skip deps = true, run in module = [none], command = eunit) it runs the following:

rebar eunit -C /private/var/folders/g6/snhc0p9n2ygdrxdrr07yj4k40000gp/T/eunit_teamcity9.tmp/rebar.config

which fails as this dir does not exist. Smells like an accidental commit from a dev.(or CI) env. to me, although maybe I'm doing something wrong as new to this party.

(Yosemite, IDJ 14.02, ErlangPlugin 0.5.9)

@deadok22
Copy link
Collaborator

deadok22 commented Feb 4, 2015

Hi @myles-mcdonnell!

Nothing accidental here. The plugin creates a temporary directory where it puts a copy of rebar.config from your project modified in order to attach eunit_teamcity reporter. It's weird if the temp directory isn't there as it's created each time you attempt to run the configuration.

Please re-check if the directory is there after you run the configuration, and if you still face the problem, share rebar's output.

@myles-mcdonnell
Copy link
Author

Sorry, I'm not sure what you mean by "run the configuration"? I can run all rebar commands from a standalone terminal ok, including eunit.

My run config in IDJ as follows:

screenshot 2015-02-03 21 04 43

My rebar.config is as follows

{cover_enabled, true}.

{deps, [
{jiffy, ".*", {git, "https://github.com/davisp/jiffy.git"}}
]}.

Output from within IDJ is:

/Users/mylesmcdonnell/JsonErl/rebar eunit -C /private/var/folders/g6/snhc0p9n2ygdrxdrr07yj4k40000gp/T/eunit_teamcity10.tmp/rebar.config
Testing started at 11:36 ...
ERROR: Failed to load /private/var/folders/g6/snhc0p9n2ygdrxdrr07yj4k40000gp/T/eunit_teamcity10.tmp/rebar.config: {error,
{5,
erl_parse,
["syntax error before: ",
"'.'"]}}

Thanks

@deadok22
Copy link
Collaborator

deadok22 commented Feb 4, 2015

I meant running rebar eunit configuration by "running the configuration", so you got me right.

Well, the output suggests we've done something wrong with the rebar.config (presumably, we've somehow output an incorrect configuration file there) - could you paste the content of /private/var/folders/g6/snhc0p9n2ygdrxdrr07yj4k40000gp/T/eunit_teamcity10.tmp/rebar.config here, please?

@myles-mcdonnell
Copy link
Author

{cover_enabled, true}.

{deps, [
{jiffy, ".*", {git, "https://github.com/davisp/jiffy.git"}}
]}.{eunit_opts,[{report,{eunit_teamcity, []}},{no_tty, true}]}.

@myles-mcdonnell
Copy link
Author

Got it, wants a line break after the '.' on line 5..

@deadok22
Copy link
Collaborator

deadok22 commented Feb 4, 2015

Thank you, @myles-mcdonnell, I'll add a line break to the code which generates this file.

This is somewhat unexpected, though, as the issue hasn't been discovered before. What is your Erlang version?

@myles-mcdonnell
Copy link
Author

R17.4.0 installed from here http://rudix.org/packages/erlang.html (yosemite)

If I add the line

{eunit_opts,[{report,{eunit_teamcity, []}},{no_tty, true}]}.

manually to the top of my rebar.config the config runs but reports empty test suite? This maybe unrelated.

If you want me to run a test on my system before you merge LMK, thanks @deadok22 .

@deadok22
Copy link
Collaborator

deadok22 commented Feb 4, 2015

@myles-mcdonnell and does it work if you only add an extra newline at the end of your rebar.config?

If it still reports an empty suite and you're sure it's not empty, share more details on how your tests are written.

@myles-mcdonnell
Copy link
Author

I've got the standard rebar template app with the eunit test code from https://github.com/rebar/rebar/wiki/Getting-started

-module(jsonErl_app).

-behaviour(application).

%% Application callbacks
-export([start/2, stop/1]).

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.

%% ===================================================================
%% Application callbacks
%% ===================================================================

start(_StartType, _StartArgs) ->
    jsonErl_sup:start_link().

stop(_State) ->
    ok.

-ifdef(TEST).

simple_test() ->
    ok = application:start(jsonErl),
    ?assertNot(undefined == whereis(jsonErl_sup)).

-endif.

this runs ok from the terminal with the following config:

{cover_enabled, false}.

{deps, [{jiffy, ".*", {git, "https://github.com/davisp/jiffy.git"}}]}.

but as reported previously from IDJ. If I add a new line empty to the top of the config, no change in either IDJ or Teminal results. If I add the team city config line, e.g.

{eunit_opts,[{report,{eunit_teamcity, []}},{no_tty, true}]}.

{cover_enabled, false}.

{deps, [{jiffy, ".*", {git, "https://github.com/davisp/jiffy.git"}}]}.

Then the output in IDJ is

/Users/mylesmcdonnell/JsonErl/rebar eunit -C /private/var/folders/g6/snhc0p9n2ygdrxdrr07yj4k40000gp/T/eunit_teamcity19.tmp/rebar.config
Testing started at 12:11 ...
==> JsonErl (eunit)Empty test suite.
Empty test suite.

=INFO REPORT==== 4-Feb-2015::12:12:00 ===
    application: jsonErl
    exited: killed
    type: temporary

@deadok22
Copy link
Collaborator

I've pushed a fix for this issue.

As to "Empty test suite." messages - ignore them. They're reported for modules which do not contain any eunit tests - try selecting different tests in the panel to the left of your console output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants