Commit graph

111 commits

Author SHA1 Message Date
Dave Smith
d3c125de27 Merge pull request #47 from uwiger/master
rebar_eunit:reset_after_eunit/1 mustn't remove 'included_applications'
2013-06-17 15:21:11 -07:00
Dave Smith
76405da6d7 Merge pull request #24 from legoscia/master
Allow specifying eunit suite run order in 'suites'
2013-06-16 06:07:55 -07:00
Tuncer Ayaz
4b8c81fb53 Implement 'rebar help CMD1 CMD2' and extend common 'rebar help' msg
* allow plugins to print help message for implemented commands
* append core rebar.config options to common 'rebar help' message
2012-12-31 20:45:11 +01:00
Tuncer Ayaz
2716d83a18 Fix basho/rebar/issues/286 2012-12-17 12:53:48 +01:00
Ulf Wiger
209ca73b91 rebar_eunit:reset_after_eunit/1 mustn't remove 'included_applications'
One could argue that rebar_eunit does some pretty dangerous stuff when
trying to clean up after a test run, but specifically, it tells the
Application Controller to delete everything returned by
application:get_all_env(App). Unfortunately, included_applications
also goes, which can lead to a crash in application_controller, if
the application is subsequently unloaded.

This patch attempts the smallest possible fix: remove all env
variables except included_applications.
2012-12-16 21:30:15 +01:00
Magnus Henoch
e4083cacee Run eunit suites in the order specified in the 'suites' command line parameter
Normally, Rebar runs eunit tests in the order the beam files are
stored in the file system (see rebar_utils:beams).  However, sometimes
it is desirable to run the tests in a different order (e.g. to
reproduce an error found on a build server).  For that case, it would
make sense to use the 'suites' parameter not just for selecting which
modules to consider, but also for choosing the order.
2012-11-20 15:50:00 +00:00
Shunichi Shinohara
22b703efa8 eunit: analyze coverage only for cover compiled modules
This change fixes #310.
2012-09-13 22:30:30 +02:00
Tuncer Ayaz
e0bc55db33 Use R15B02 EUnit {test,M,F} primitive as suggested by Richard Carlsson 2012-09-06 00:50:46 +02:00
Tuncer Ayaz
f22337b68f Comment eunit_test:function_wrapper/2 TODO 2012-09-01 11:11:24 +02:00
Tuncer Ayaz
8aadd65a34 rebar_eunit: adapt to R15B02 changes 2012-08-31 22:07:42 +02:00
Markus Näsman
2d139ea6c2 Stop cover server between eunit runs for speed
Cover gets slower and slower for each application. This is due to the
cover_server internal state. Stopping the cover server between
eunit+cover runs, emptying the cover_server state, gives a ~5-6x speed
improvement when analyzing many Erlang modules. Stopping the cover
server replaces the earlier practice of doing a cover:reset before each
run. On a project consisting of 62 dependencies with a total of 1866
Erlang modules the running time of rebar eunit decreased from ~20
minutes to ~3 minutes.
2012-08-30 17:27:43 +02:00
Tuncer Ayaz
ff8337f9b0 Fix whitespace error in rebar_eunit 2012-08-22 19:17:17 +02:00
Tuncer Ayaz
f528c397f8 Fix whitespace errors in rebar_ct and rebar_eunit 2012-08-22 19:14:35 +02:00
Tuncer Ayaz
3c0d97bf2c Cleanup and comment 2012-08-20 13:55:55 +02:00
Roberto Ostinelli
60516dc406 Fix tests= option not running generator tests 2012-08-20 12:58:34 +02:00
Roberto Ostinelli
fa6618f2b4 Add experimental tests= filter without eunit suites 2012-08-20 12:58:31 +02:00
Tuncer Ayaz
fc7df16e31 Clarify comments 2012-08-12 14:03:44 +02:00
Tuncer Ayaz
bdee72fae8 rebar_eunit: add tests= TODO item 2012-08-11 23:10:06 +02:00
Roberto Ostinelli
69dc9ec933 Add experimental tests= filter for eunit suites 2012-08-11 23:08:21 +02:00
Tuncer Ayaz
5d6b82390f rebar_eunit: fix typo 2012-08-10 16:05:00 +02:00
Tuncer Ayaz
e47d643ea3 Use separate dirs for eunit and qc 2012-08-09 18:37:26 +02:00
Tuncer Ayaz
99b645e4a3 Separate eunit and qc compile options 2012-08-09 14:04:53 +02:00
Tuncer Ayaz
803f6e8ecd Replace test-compile with compile_only=true option 2012-08-09 14:04:53 +02:00
Tuncer Ayaz
888bbc8ee2 Fix whitespace error 2012-08-07 14:03:58 +02:00
Tuncer Ayaz
fdc1425a3b Use rebar_utils:test_dir/0 for coverdata export file 2012-08-07 14:02:13 +02:00
David Åberg
43d5b6257e Enable export of cover data from eunit testrun 2012-08-07 13:44:40 +02:00
Tuncer Ayaz
c9ddb8325a Quote EUnit User's guide about _tests.beam handling 2012-07-31 16:39:25 +02:00
Tuncer Ayaz
ad2e94b96b Add experimental notice to test-compile and shell 2012-07-31 15:39:36 +02:00
Tuncer Ayaz
636c02f0be Fix R13B03 build (Reported-by: Sergey Nartimov) 2012-07-28 19:51:57 +02:00
Tuncer Ayaz
228f39efa1 Rename old eunit compile options for consistency with test-compile 2012-07-26 17:15:01 +02:00
Tuncer Ayaz
c0644dc195 Finalize app=, skip_app=, suite= deprecations 2012-07-23 16:48:15 +02:00
Tuncer Ayaz
e75a97ad33 Add 'qc' cmd and rename eunit-compile to test-compile 2012-07-23 16:22:06 +02:00
Tuncer Ayaz
902dcdf3ff Add 'eunit-compile' cmd (Suggested-by: Joe Norton) 2012-07-23 13:28:38 +02:00
Tuncer Ayaz
252757c753 Do not use application:set_env 2012-07-23 13:17:11 +02:00
Tuncer Ayaz
5a4ddd5524 Do not keep eunit config 2012-07-13 22:48:20 +02:00
Tuncer Ayaz
e185e86bff Remove shared state 2012-07-13 15:21:56 +02:00
Tuncer Ayaz
e4fb80799b Remove debug log 2012-07-11 23:40:28 +02:00
Tuncer Ayaz
015858b2d3 Simplify eunit 2012-07-11 20:36:41 +02:00
Tuncer Ayaz
990e60f120 Use filename:join 2012-07-11 18:44:48 +02:00
Tuncer Ayaz
f5af9d6c21 Fix rebar_eunit whitespace issues 2012-07-02 19:23:25 +02:00
Motiejus Jakštys
ad2f30ccb9 Fix cover crash if src_dirs is not default
Make sure files from erl_opts->src_dirs are copied to .eunit for cover
inspection.

Without this patch cover failed to find source files which were in
src_dirs, and threw the following exception:

ERROR: eunit failed while processing
/path/to/project:
{'EXIT',{{badmatch,{error,no_source_code_found}},
         [{rebar_eunit,'-cover_analyze/3-fun-0-',1,
                       [{file,"src/rebar_eunit.erl"},{line,280}]},
          {lists,foreach,2,[{file,"lists.erl"},{line,1262}]},
          {rebar_eunit,cover_analyze,3,
                       [{file,"src/rebar_eunit.erl"},{line,279}]},
          {rebar_eunit,eunit,2,[{file,"src/rebar_eunit.erl"},{line,140}]},
          {rebar_core,run_modules,4,[{file,"src/rebar_core.erl"},{line,425}]},
          {rebar_core,execute,5,[{file,"src/rebar_core.erl"},{line,359}]},
          {rebar_core,process_dir0,6,[{file,"src/rebar_core.erl"},{line,223}]},
          {rebar_core,process_dir,4,
                      [{file,"src/rebar_core.erl"},{line,130}]}]}}

Now all source files are copied to .eunit.
2012-07-02 18:46:00 +02:00
Tuncer Ayaz
e6165c7146 Fix #252 (Reported-by: Maxim-Vladimirsky) 2012-06-21 00:08:51 +02:00
Tuncer Ayaz
3dce05314b Fix rebar_eunit comments 2012-06-18 00:55:51 +02:00
Dave Smith
c86c99940d Remove ?FAIL in favor of ?ABORT 2012-06-08 07:06:15 -06:00
Jeremy Raymond
7e84634b8f Fix for destruction of config app vars on reset 2012-02-15 21:11:57 +01:00
Tuncer Ayaz
ee44d8554a Fix whitespace errors 2012-01-17 17:04:07 +01:00
Francis Joanis
b498e86ef7 Delete existing erl files in ?EUNIT_DIR
Before copying the .erl files to the .eunit directory ensure that they
are deleted if they already exist. This prevents EACCES errors to happen
when trying to re-copy .erl files that are read-only.
2012-01-17 16:54:27 +01:00
Tomas Abrahamsson
c8f56c7cb2 Don't kill any inet_gethost_native after eunit
Avoid error reports like this one:

  prompt$ rebar eunit
  ==> dummy (eunit)
    Test passed.

  =ERROR REPORT==== 29-Dec-2011::23:22:11 ===
  ** Generic server inet_gethost_native_sup terminating
  ** Last message in was {'EXIT',<0.62.0>,killed}
  ** When Server state == {state,inet_gethost_native,undefined,<0.62.0>,
                                 {local,inet_gethost_native_sup}}
  ** Reason for termination ==
  ** killed

Previously, it could happen if an eunit test did something that
required a name lookup, like in this example:

  -module(dummy_tests).
  -include_lib("eunit/include/eunit.hrl").

  x_test() ->
      {ok, _Hostent} = inet:gethostbyname(localhost).

The inet_gethost_native is a process, started on demand, under a
supervisor_bridge under the kernel_sup, but it is not a gen_server
process or the like, so it has nothing in '$ancestors' in its process
dictionary to indicate it is part of kernel.
2011-12-29 23:38:03 +01:00
Tuncer Ayaz
8c89a388bf Universally support apps=/skip_apps= 2011-12-12 21:20:34 +01:00
Klas Johansson
896e8505b2 Stop applications before killing extra processes
This means that applications get a chance to shut down themselves,
before rebar will start killing their processes.  This avoids ERROR
REPORTS from application supervisors.
2011-11-02 20:08:24 +01:00