diff options
Diffstat (limited to 'lib/eunit')
-rw-r--r-- | lib/eunit/doc/overview.edoc | 2 | ||||
-rw-r--r-- | lib/eunit/doc/src/Makefile | 2 | ||||
-rw-r--r-- | lib/eunit/doc/src/book.xml | 2 | ||||
-rw-r--r-- | lib/eunit/doc/src/notes.xml | 57 | ||||
-rw-r--r-- | lib/eunit/doc/src/part.xml | 2 | ||||
-rw-r--r-- | lib/eunit/doc/src/part_notes.xml | 2 | ||||
-rw-r--r-- | lib/eunit/doc/src/ref_man.xml | 2 | ||||
-rw-r--r-- | lib/eunit/src/eunit.erl | 12 | ||||
-rw-r--r-- | lib/eunit/src/eunit_lib.erl | 18 | ||||
-rw-r--r-- | lib/eunit/src/eunit_surefire.erl | 20 | ||||
-rw-r--r-- | lib/eunit/test/Makefile | 2 | ||||
-rw-r--r-- | lib/eunit/test/eunit.cover | 4 | ||||
-rw-r--r-- | lib/eunit/test/eunit.dynspec | 6 | ||||
-rw-r--r-- | lib/eunit/test/eunit.spec | 3 | ||||
-rw-r--r-- | lib/eunit/test/eunit_SUITE.erl | 27 | ||||
-rw-r--r-- | lib/eunit/vsn.mk | 2 |
16 files changed, 121 insertions, 42 deletions
diff --git a/lib/eunit/doc/overview.edoc b/lib/eunit/doc/overview.edoc index 2583f0be25..be05a13fba 100644 --- a/lib/eunit/doc/overview.edoc +++ b/lib/eunit/doc/overview.edoc @@ -913,7 +913,7 @@ To make the descriptions simpler, we first list some definitions: <td>`CleanupX'</td><td>`(X::any(), R::any()) -> any()'</td> </tr> <tr> -<td>`Instantiator'</td><td>`((R::any()) -> Tests) | {with, [AbstractTestFun::((any()) -> any())]}'</td> +<td>`Instantiator'</td><td>`((R::any()) -> Tests | {with, [AbstractTestFun::((any()) -> any())]}'</td> </tr> <tr> <td>`Where'</td><td>`local | spawn | {spawn, Node::atom()}'</td> diff --git a/lib/eunit/doc/src/Makefile b/lib/eunit/doc/src/Makefile index 19be96d763..2cdc579275 100644 --- a/lib/eunit/doc/src/Makefile +++ b/lib/eunit/doc/src/Makefile @@ -146,7 +146,7 @@ debug opt: clean clean_docs: rm -rf $(HTMLDIR)/* rm -f $(MAN3DIR)/* - rm -f $(XML_CHAPTER_FILES) *.html + rm -f $(XML_REF3_FILES) $(XML_CHAPTER_FILES) *.html rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) rm -f errs core *~ diff --git a/lib/eunit/doc/src/book.xml b/lib/eunit/doc/src/book.xml index 4444b1dd7a..eb044c1a66 100644 --- a/lib/eunit/doc/src/book.xml +++ b/lib/eunit/doc/src/book.xml @@ -5,7 +5,7 @@ <header titlestyle="normal"> <copyright> <year>2008</year> - <year>2008</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/eunit/doc/src/notes.xml b/lib/eunit/doc/src/notes.xml index 974ba1db4e..a02d76c5b9 100644 --- a/lib/eunit/doc/src/notes.xml +++ b/lib/eunit/doc/src/notes.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2008</year> - <year>2008</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> @@ -32,6 +32,61 @@ </header> <p>This document describes the changes made to the EUnit application.</p> +<section><title>Eunit 2.1.7</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Increase depth of error messages in Eunit Surefire + reports</p> + <p> + Currently, error messages in Eunit Surefire reports are + shortened just like when written to a terminal. However, + the space limitations that constrain terminal output do + not apply here, so it's more useful to include more of + the error message. The new depth of 100 should be enough + for most cases, while protecting against runaway errors. + (Thanks to Magnus Henoch)</p> + <p> + Own Id: OTP-9220</p> + </item> + <item> + <p> + Don't let eunit_surefire report back to eunit when + stopping</p> + <p> + When eunit is terminating, a stop message is sent to all + listeners and eunit then waits for *one* result message + but previously both eunit_tty and eunit_surefire sent a + response on error. Don't send a result message from + eunit_surefire; let eunit_tty take care of all result + reporting, both positive and negative to avoid race + conditions and inconsistencies. (Thanks to Klas + Johansson)</p> + <p> + Own Id: OTP-9269</p> + </item> + </list> + </section> + +</section> + +<section><title>Eunit 2.1.6</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> Fix format_man_pages so it handles all man sections + and remove warnings/errors in various man pages. </p> + <p> + Own Id: OTP-8600</p> + </item> + </list> + </section> + +</section> + <section><title>Eunit 2.1.5</title> <section><title>Improvements and New Features</title> diff --git a/lib/eunit/doc/src/part.xml b/lib/eunit/doc/src/part.xml index e31a8d1b78..84e5aec039 100644 --- a/lib/eunit/doc/src/part.xml +++ b/lib/eunit/doc/src/part.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2008</year> - <year>2008</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/eunit/doc/src/part_notes.xml b/lib/eunit/doc/src/part_notes.xml index 28644f961b..191d69b915 100644 --- a/lib/eunit/doc/src/part_notes.xml +++ b/lib/eunit/doc/src/part_notes.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2008</year> - <year>2008</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/eunit/doc/src/ref_man.xml b/lib/eunit/doc/src/ref_man.xml index 02feef5e97..eb46ceda1e 100644 --- a/lib/eunit/doc/src/ref_man.xml +++ b/lib/eunit/doc/src/ref_man.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2008</year> - <year>2008</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/eunit/src/eunit.erl b/lib/eunit/src/eunit.erl index 59084a52fb..da35c5c2ec 100644 --- a/lib/eunit/src/eunit.erl +++ b/lib/eunit/src/eunit.erl @@ -16,7 +16,7 @@ %% $Id: eunit.erl 339 2009-04-05 14:10:47Z rcarlsson $ %% %% @copyright 2004-2009 Micka�l R�mond, Richard Carlsson -%% @author Micka�l R�mond <[email protected]> +%% @author Mickaël Rémond <[email protected]> %% [http://www.process-one.net/] %% @author Richard Carlsson <[email protected]> %% [http://user.it.uu.se/~richardc/] @@ -157,6 +157,7 @@ test_run(Reference, Listeners) -> receive {done, Reference} -> cast(Listeners, {stop, Reference, self()}), + wait_until_listeners_have_terminated(Listeners), receive {result, Reference, Result} -> Result @@ -169,6 +170,15 @@ cast([P | Ps], Msg) -> cast([], _Msg) -> ok. +wait_until_listeners_have_terminated([P | Ps]) -> + MRef = erlang:monitor(process, P), + receive + {'DOWN', MRef, process, P, _} -> + wait_until_listeners_have_terminated(Ps) + end; +wait_until_listeners_have_terminated([]) -> + ok. + %% TODO: functions that run tests on a given node, not a given server %% TODO: maybe some functions could check for a globally registered server? %% TODO: some synchronous but completely quiet interface function diff --git a/lib/eunit/src/eunit_lib.erl b/lib/eunit/src/eunit_lib.erl index 4751f1094a..45d2387e7b 100644 --- a/lib/eunit/src/eunit_lib.erl +++ b/lib/eunit/src/eunit_lib.erl @@ -33,7 +33,7 @@ -export([dlist_next/1, uniq/1, fun_parent/1, is_string/1, command/1, command/2, command/3, trie_new/0, trie_store/2, trie_match/2, split_node/1, consult_file/1, list_dir/1, format_exit_term/1, - format_exception/1, format_error/1]). + format_exception/1, format_exception/2, format_error/1]). %% Type definitions for describing exceptions @@ -55,21 +55,23 @@ %% --------------------------------------------------------------------- %% Formatting of error descriptors +format_exception(Exception) -> + format_exception(Exception, 20). -format_exception({Class,Term,Trace}) +format_exception({Class,Term,Trace}, Depth) when is_atom(Class), is_list(Trace) -> case is_stacktrace(Trace) of true -> io_lib:format("~w:~P\n~s", - [Class, Term, 20, format_stacktrace(Trace)]); + [Class, Term, Depth, format_stacktrace(Trace)]); false -> - format_term(Term) + format_term(Term, Depth) end; -format_exception(Term) -> - format_term(Term). +format_exception(Term, Depth) -> + format_term(Term, Depth). -format_term(Term) -> - io_lib:format("~P\n", [Term, 15]). +format_term(Term, Depth) -> + io_lib:format("~P\n", [Term, Depth]). format_exit_term(Term) -> {Reason, Trace} = analyze_exit_term(Term), diff --git a/lib/eunit/src/eunit_surefire.erl b/lib/eunit/src/eunit_surefire.erl index aeda31d251..dfb08c90b2 100644 --- a/lib/eunit/src/eunit_surefire.erl +++ b/lib/eunit/src/eunit_surefire.erl @@ -15,7 +15,7 @@ %% %% $Id: $ %% -%% @author Micka�l R�mond <[email protected]> +%% @author Mickaël Rémond <[email protected]> %% @copyright 2009 Micka�l R�mond, Paul Guyot %% @see eunit %% @doc Surefire reports for EUnit (Format used by Maven and Atlassian @@ -100,16 +100,10 @@ terminate({ok, _Data}, St) -> XmlDir = St#state.xmldir, write_report(TestSuite, XmlDir), ok; -terminate({error, Reason}, _St) -> - io:fwrite("Internal error: ~P.\n", [Reason, 25]), - sync_end(error). - -sync_end(Result) -> - receive - {stop, Reference, ReplyTo} -> - ReplyTo ! {result, Reference, Result}, - ok - end. +terminate({error, _Reason}, _St) -> + %% Don't report any errors here, since eunit_tty takes care of that. + %% Just terminate. + ok. handle_begin(group, Data, St) -> NewId = proplists:get_value(id, Data), @@ -323,7 +317,7 @@ write_testcase( format_testcase_result(ok) -> [<<>>]; format_testcase_result({failed, {error, {Type, _}, _} = Exception}) when is_atom(Type) -> [?INDENT, ?INDENT, <<"<failure type=\"">>, escape_attr(atom_to_list(Type)), <<"\">">>, ?NEWLINE, - <<"::">>, escape_text(eunit_lib:format_exception(Exception)), + <<"::">>, escape_text(eunit_lib:format_exception(Exception, 100)), ?INDENT, ?INDENT, <<"</failure>">>, ?NEWLINE]; format_testcase_result({failed, Term}) -> [?INDENT, ?INDENT, <<"<failure type=\"unknown\">">>, ?NEWLINE, @@ -331,7 +325,7 @@ format_testcase_result({failed, Term}) -> ?INDENT, ?INDENT, <<"</failure>">>, ?NEWLINE]; format_testcase_result({aborted, {Class, _Term, _Trace} = Exception}) when is_atom(Class) -> [?INDENT, ?INDENT, <<"<error type=\"">>, escape_attr(atom_to_list(Class)), <<"\">">>, ?NEWLINE, - <<"::">>, escape_text(eunit_lib:format_exception(Exception)), + <<"::">>, escape_text(eunit_lib:format_exception(Exception, 100)), ?INDENT, ?INDENT, <<"</error>">>, ?NEWLINE]; format_testcase_result({aborted, Term}) -> [?INDENT, ?INDENT, <<"<error type=\"unknown\">">>, ?NEWLINE, diff --git a/lib/eunit/test/Makefile b/lib/eunit/test/Makefile index 74d485d1cc..a2d276f619 100644 --- a/lib/eunit/test/Makefile +++ b/lib/eunit/test/Makefile @@ -75,7 +75,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) eunit.dynspec $(EMAKEFILE) \ + $(INSTALL_DATA) eunit.spec $(EMAKEFILE) \ $(COVERFILE) $(ERL_FILES) \ $(RELSYSDIR) diff --git a/lib/eunit/test/eunit.cover b/lib/eunit/test/eunit.cover index d1eaf770b6..00c09127a8 100644 --- a/lib/eunit/test/eunit.cover +++ b/lib/eunit/test/eunit.cover @@ -1,3 +1,5 @@ +{incl_app,eunit,details}. + %% -*- erlang -*- -{exclude,[eunit_test]}. +{excl_mods,eunit,[eunit_test]}. diff --git a/lib/eunit/test/eunit.dynspec b/lib/eunit/test/eunit.dynspec deleted file mode 100644 index c1d345ac14..0000000000 --- a/lib/eunit/test/eunit.dynspec +++ /dev/null @@ -1,6 +0,0 @@ -%% -*- erlang -*- -%% You can test this file using this command. -%% file:script("eunit.dynspec", [{'Os',"Unix"}]). - -[]. - diff --git a/lib/eunit/test/eunit.spec b/lib/eunit/test/eunit.spec new file mode 100644 index 0000000000..2db7731a7e --- /dev/null +++ b/lib/eunit/test/eunit.spec @@ -0,0 +1,3 @@ +%% -*- erlang -*- +{suites,"../eunit_test",all}. + diff --git a/lib/eunit/test/eunit_SUITE.erl b/lib/eunit/test/eunit_SUITE.erl index 4ebcec6f5d..47c2435d63 100644 --- a/lib/eunit/test/eunit_SUITE.erl +++ b/lib/eunit/test/eunit_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,13 +18,32 @@ %% -module(eunit_SUITE). --export([all/1,eunit_test/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2,eunit_test/1]). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [eunit_test]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + eunit_test(Config) when is_list(Config) -> ok = file:set_cwd(code:lib_dir(eunit)), ok = eunit:test(eunit). diff --git a/lib/eunit/vsn.mk b/lib/eunit/vsn.mk index 3bfa9c8000..d7edd7977b 100644 --- a/lib/eunit/vsn.mk +++ b/lib/eunit/vsn.mk @@ -1 +1 @@ -EUNIT_VSN = 2.1.5 +EUNIT_VSN = 2.1.7 |