diff options
Diffstat (limited to 'lib/mnesia')
52 files changed, 1131 insertions, 1590 deletions
diff --git a/lib/mnesia/doc/src/Mnesia_chap2.xmlsrc b/lib/mnesia/doc/src/Mnesia_chap2.xmlsrc index 0714c7b645..473b35b806 100644 --- a/lib/mnesia/doc/src/Mnesia_chap2.xmlsrc +++ b/lib/mnesia/doc/src/Mnesia_chap2.xmlsrc @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -235,9 +235,7 @@ <seealso marker="Mnesia_chap3#start_mnesia">Starting Mnesia</seealso>. </item> </list> - <p>Continuing the dialogue with the Erlang shell will produce the following - the following: - </p> + <p>Continuing the dialogue with the Erlang shell will produce the following:</p> <pre><![CDATA[ 3> company:init(). {atomic,ok} @@ -418,7 +416,7 @@ In_proj</tcaption> interchangeably throughout this book. </p> <p>A Mnesia table is populated by Mnesia records. For example, - the tuple <c>{boss, klacke, bjarne}</c> is an record. The + the tuple <c>{boss, klacke, bjarne}</c> is a record. The second element in this tuple is the key. In order to uniquely identify a table row both the key and the table name is needed. The term <em>object identifier</em>, @@ -553,7 +551,7 @@ In_proj</tcaption> stored in the database: </p> <pre> -\011 mnesia:select(employee, [{#employee{sex = female, name = '$1', _ = '_'},[], ['$1']}]). +mnesia:select(employee, [{#employee{sex = female, name = '$1', _ = '_'},[], ['$1']}]). </pre> <p>Select must always run within an activity such as a transaction. To be able to call from the shell we might @@ -587,8 +585,8 @@ In_proj</tcaption> </p> <pre> Q = qlc:q([E#employee.name || E <![CDATA[<-]]> mnesia:table(employee), -\011 E#employee.sex == female]), -\011 qlc:e(Q), + E#employee.sex == female]), + qlc:e(Q), </pre> <p>Accessing mnesia tables from a QLC list comprehension must always be done within a transaction. Consider the following diff --git a/lib/mnesia/doc/src/Mnesia_chap3.xml b/lib/mnesia/doc/src/Mnesia_chap3.xml index 9a382bcb5a..5733aedbfd 100644 --- a/lib/mnesia/doc/src/Mnesia_chap3.xml +++ b/lib/mnesia/doc/src/Mnesia_chap3.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -132,7 +132,7 @@ function changes the format on all records in table <c>Tab</c>. It applies the argument <c>Fun</c> to all records in the table. <c>Fun</c> shall be a function which - takes an record of the old type, and returns the record of the new + takes a record of the old type, and returns the record of the new type. The table key may not be changed.</p> <code type="none"> -record(old, {key, val}). @@ -418,8 +418,8 @@ skeppet %<input>erl -sname b -mnesia dir '"/ldisc/scratch/Mnesia.company"'</inpu type <c>set</c> and <c>bag</c>: </p> <pre> f() -> F = fun() -> -\011 mnesia:write({foo, 1, 2}), mnesia:write({foo, 1, 3}), -\011 mnesia:read({foo, 1}) end, mnesia:transaction(F). </pre> + mnesia:write({foo, 1, 2}), mnesia:write({foo, 1, 3}), + mnesia:read({foo, 1}) end, mnesia:transaction(F). </pre> <p>This transaction will return the list <c>[{foo,1,3}]</c> if the <c>foo</c> table is of type <c>set</c>. However, list <c>[{foo,1,2}, {foo,1,3}]</c> will return if the table is diff --git a/lib/mnesia/doc/src/Mnesia_chap4.xmlsrc b/lib/mnesia/doc/src/Mnesia_chap4.xmlsrc index 7d89c1b0dd..7e57c7ac02 100644 --- a/lib/mnesia/doc/src/Mnesia_chap4.xmlsrc +++ b/lib/mnesia/doc/src/Mnesia_chap4.xmlsrc @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -514,13 +514,13 @@ The behavior is undefined if any process perform a write of the table itself. This is an implementation detail, but remember the dirty functions are low level functions. </item> - <item><c>mnesia:dirty_last(Tab)</c> This function works exactly as + <item><c>mnesia:dirty_last(Tab)</c> This function works exactly like <c>mnesia:dirty_first/1</c> but returns the last object in Erlang term order for the <c>ordered_set</c> table type. For all other table types, <c>mnesia:dirty_first/1</c> and <c>mnesia:dirty_last/1</c> are synonyms. </item> - <item><c>mnesia:dirty_prev(Tab, Key)</c> This function works exactly as + <item><c>mnesia:dirty_prev(Tab, Key)</c> This function works exactly like <c>mnesia:dirty_next/2</c> but returns the previous object in Erlang term order for the ordered_set table type. For all other table types, <c>mnesia:dirty_next/2</c> and diff --git a/lib/mnesia/doc/src/Mnesia_chap5.xmlsrc b/lib/mnesia/doc/src/Mnesia_chap5.xmlsrc index 1c7e3662e1..30a8991465 100644 --- a/lib/mnesia/doc/src/Mnesia_chap5.xmlsrc +++ b/lib/mnesia/doc/src/Mnesia_chap5.xmlsrc @@ -335,7 +335,7 @@ ok explicitly be set at table creation. The default is <c>0</c>, but if <c>n_disc_copies</c> and <c>n_disc_only_copies</c> also are <c>0</c>, - <c>n_ram_copies</c>\011will default be set to <c>1</c>. + <c>n_ram_copies</c> will default be set to <c>1</c>. </p> </item> <tag><c>{n_disc_copies, Int}</c></tag> @@ -408,7 +408,7 @@ ok (a@sam)4> SecProps = [{foreign_key, {prim_dict, sec_val}}]. [{foreign_key,{prim_dict,sec_val}}] (a@sam)5> mnesia:create_table(sec_dict, -\011 [{frag_properties, SecProps}, + [{frag_properties, SecProps}, (a@sam)5> {attributes, [sec_key, sec_val]}]). {atomic,ok} (a@sam)6> Write = fun(Rec) -> mnesia:write(Rec) end. @@ -418,23 +418,23 @@ ok (a@sam)8> SecKey = 42. 42 (a@sam)9> mnesia:activity(sync_dirty, Write, -\011\011 [{prim_dict, PrimKey, -11}], mnesia_frag). + [{prim_dict, PrimKey, -11}], mnesia_frag). ok (a@sam)10> mnesia:activity(sync_dirty, Write, -\011\011 [{sec_dict, SecKey, PrimKey}], mnesia_frag). + [{sec_dict, SecKey, PrimKey}], mnesia_frag). ok (a@sam)11> mnesia:change_table_frag(prim_dict, {add_frag, [node()]}). {atomic,ok} (a@sam)12> SecRead = fun(PrimKey, SecKey) -> -\011\011 mnesia:read({sec_dict, PrimKey}, SecKey, read) end. + mnesia:read({sec_dict, PrimKey}, SecKey, read) end. #Fun<erl_eval> (a@sam)13> mnesia:activity(transaction, SecRead, -\011\011 [PrimKey, SecKey], mnesia_frag). + [PrimKey, SecKey], mnesia_frag). [{sec_dict,42,11}] (a@sam)14> Info = fun(Tab, Item) -> mnesia:table_info(Tab, Item) end. #Fun<erl_eval> (a@sam)15> mnesia:activity(sync_dirty, Info, -\011\011 [prim_dict, frag_size], mnesia_frag). + [prim_dict, frag_size], mnesia_frag). [{prim_dict,0}, {prim_dict_frag2,0}, {prim_dict_frag3,0}, @@ -444,7 +444,7 @@ ok {prim_dict_frag7,0}, {prim_dict_frag8,0}] (a@sam)16> mnesia:activity(sync_dirty, Info, -\011\011 [sec_dict, frag_size], mnesia_frag). + [sec_dict, frag_size], mnesia_frag). [{sec_dict,0}, {sec_dict_frag2,0}, {sec_dict_frag3,0}, @@ -1051,7 +1051,7 @@ ok ActivityID will be received. Note that this event may still be received even if no table events with a corresponding ActivityID were received, depending on the tables to which the receiving process is subscribed.</p> - <p>Dirty operations always only contain one update and thus no activity event is sent.</p> + <p>Dirty operations always only contain one update and thus no activity event is sent.</p> </item> </taglist> </section> diff --git a/lib/mnesia/doc/src/mnesia.xml b/lib/mnesia/doc/src/mnesia.xml index 5d3bcf830e..16e78ea0af 100644 --- a/lib/mnesia/doc/src/mnesia.xml +++ b/lib/mnesia/doc/src/mnesia.xml @@ -799,7 +799,7 @@ mnesia:change_table_copy_type(person, node(), disc_copies) </item> <item> <p><c>{local_content, Bool}</c>, where <c>Bool</c> must be - either <c>true</c> or <c>false</c>. The default value is <c>false</c>.\011 </p> + either <c>true</c> or <c>false</c>. The default value is <c>false</c>.</p> </item> </list> <p>For example, the following call creates the <c>person</c> table @@ -1022,7 +1022,7 @@ mnesia:create_table(person, <name>dirty_last(Tab) -> Key | exit({aborted, Reason}) </name> <fsummary>Return the key for the last record in a table.</fsummary> <desc> - <p>This function works exactly + <p>This function works exactly like <c>mnesia:dirty_first/1</c> but returns the last object in Erlang term order for the <c>ordered_set</c> table type. For all other table types, <c>mnesia:dirty_first/1</c> and @@ -1063,11 +1063,11 @@ mnesia:create_table(person, <name>dirty_prev(Tab, Key) -> Key | exit({aborted, Reason}) </name> <fsummary>Return the previous key in a table. </fsummary> <desc> - <p>This function works exactly + <p>This function works exactly like <c>mnesia:dirty_next/2</c> but returns the previous object in Erlang term order for the ordered_set table type. For all other table types, <c>mnesia:dirty_next/2</c> and - <c>mnesia:dirty_prev/2</c> are synonyms.\011 </p> + <c>mnesia:dirty_prev/2</c> are synonyms.</p> </desc> </func> <func> @@ -1334,7 +1334,7 @@ mnesia:create_table(person, <name>foldr(Function, Acc, Table) -> NewAcc | transaction abort </name> <fsummary>Call Function for each record in Table </fsummary> <desc> - <p>This function works exactly as + <p>This function works exactly like <c>foldl/3</c> but iterates the table in the opposite order for the <c>ordered_set</c> table type. For all other table types, <c>foldr/3</c> and @@ -1512,14 +1512,14 @@ mnesia:create_table(person, <fsummary>Check if code is running in a transaction.</fsummary> <desc> <p>When this function is executed inside a transaction context - it returns <c>true</c>, otherwise <c>false</c>.</p> + it returns <c>true</c>, otherwise <c>false</c>.</p> </desc> </func> <func> <name>last(Tab) -> Key | transaction abort </name> <fsummary>Return the key for the last record in a table.</fsummary> <desc> - <p>This function works exactly + <p>This function works exactly like <c>mnesia:first/1</c> but returns the last object in Erlang term order for the <c>ordered_set</c> table type. For all other table types, <c>mnesia:first/1</c> and @@ -1698,11 +1698,11 @@ mnesia:create_table(person, <name>prev(Tab, Key) -> Key | transaction abort </name> <fsummary>Return the previous key in a table. </fsummary> <desc> - <p>This function works exactly + <p>This function works exactly like <c>mnesia:next/2</c> but returns the previous object in Erlang term order for the ordered_set table type. For all other table types, <c>mnesia:next/2</c> and - <c>mnesia:prev/2</c> are synonyms.\011 </p> + <c>mnesia:prev/2</c> are synonyms.</p> </desc> </func> <func> @@ -1891,10 +1891,10 @@ mnesia:create_table(person, <p>For example to find the names of all male persons with an age over 30 in table Tab do:</p> <code type="none"> -\011 MatchHead = #person{name='$1', sex=male, age='$2', _='_'}, -\011 Guard = {'>', '$2', 30}, -\011 Result = '$1', -\011 mnesia:select(Tab,[{MatchHead, [Guard], [Result]}]), +MatchHead = #person{name='$1', sex=male, age='$2', _='_'}, +Guard = {'>', '$2', 30}, +Result = '$1', +mnesia:select(Tab,[{MatchHead, [Guard], [Result]}]), </code> </desc> </func> @@ -2835,7 +2835,7 @@ raise(Name, Amount) -> </func> <func> <name>write(Tab, Record, LockKind) -> transaction abort | ok </name> - <fsummary>Write an record into the database.</fsummary> + <fsummary>Write a record into the database.</fsummary> <desc> <p>Writes the record <c>Record</c> to the table <c>Tab</c>. </p> diff --git a/lib/mnesia/doc/src/mnesia_frag_hash.xml b/lib/mnesia/doc/src/mnesia_frag_hash.xml index ca03327994..73162c3974 100644 --- a/lib/mnesia/doc/src/mnesia_frag_hash.xml +++ b/lib/mnesia/doc/src/mnesia_frag_hash.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2002</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/mnesia/doc/src/mnesia_registry.xml b/lib/mnesia/doc/src/mnesia_registry.xml index 966134d508..e08f3a42fc 100644 --- a/lib/mnesia/doc/src/mnesia_registry.xml +++ b/lib/mnesia/doc/src/mnesia_registry.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1998</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/mnesia/doc/src/notes.xml b/lib/mnesia/doc/src/notes.xml index 2352f11b93..ccf70b8373 100644 --- a/lib/mnesia/doc/src/notes.xml +++ b/lib/mnesia/doc/src/notes.xml @@ -38,7 +38,72 @@ thus constitutes one section in this document. The title of each section is the version number of Mnesia.</p> - <section><title>Mnesia 4.4.15</title> + <section><title>Mnesia 4.4.17</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Calling mnesia:first/1 on empty fragmented table works. + Thanks Magnus Henoch.</p> + <p> + Own Id: OTP-9108</p> + </item> + <item> + <p> + If Mnesia detects that the network is not fully connected + during start, Mnesia will not start until all nodes are + reachable.</p> + <p> + Own Id: OTP-9115 Aux Id: seq-11728 </p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Fix issues reported by dialyzer.</p> + <p> + Own Id: OTP-9107</p> + </item> + </list> + </section> + +</section> + +<section><title>Mnesia 4.4.16</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Sometimes a 'log_header' record was added to tables when + invoking mnesia:restore/2 with the option + 'recreate_tables'. Thanks Vance Shipley.</p> + <p> + Own Id: OTP-8960</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Compiler warnings were eliminated.</p> + <p> + Own Id: OTP-8855</p> + </item> + </list> + </section> + +</section> + +<section><title>Mnesia 4.4.15</title> <section><title>Improvements and New Features</title> <list> diff --git a/lib/mnesia/doc/src/part_notes_history.xml b/lib/mnesia/doc/src/part_notes_history.xml index 177738623c..e4621dbbf7 100644 --- a/lib/mnesia/doc/src/part_notes_history.xml +++ b/lib/mnesia/doc/src/part_notes_history.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2004</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/mnesia/src/mnesia.appup.src b/lib/mnesia/src/mnesia.appup.src index 47c9bf9979..0eff761b61 100644 --- a/lib/mnesia/src/mnesia.appup.src +++ b/lib/mnesia/src/mnesia.appup.src @@ -1,7 +1,25 @@ %% -*- erlang -*- {"%VSN%", - [ + [ + {"4.4.16",[ + {update, mnesia_frag, soft, soft_purge, soft_purge, []}, + {update, mnesia_schema, soft, soft_purge, soft_purge, []} + ]}, + {"4.4.15",[ + {update, mnesia_frag, soft, soft_purge, soft_purge, []}, + {update, mnesia, soft, soft_purge, soft_purge, []}, + {update, mnesia_dumper, soft, soft_purge, soft_purge, []} + ]} ], [ + {"4.4.16",[ + {update, mnesia_frag, soft, soft_purge, soft_purge, []}, + {update, mnesia_schema, soft, soft_purge, soft_purge, []} + ]}, + {"4.4.15",[ + {update, mnesia_frag, soft, soft_purge, soft_purge, []}, + {update, mnesia, soft, soft_purge, soft_purge, []}, + {update, mnesia_dumper, soft, soft_purge, soft_purge, []} + ]} ] }. diff --git a/lib/mnesia/src/mnesia.erl b/lib/mnesia/src/mnesia.erl index fb29007780..025b32f506 100644 --- a/lib/mnesia/src/mnesia.erl +++ b/lib/mnesia/src/mnesia.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -302,7 +302,7 @@ ms() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Activity mgt --spec(abort/1 :: (_) -> no_return()). +-spec abort(_) -> no_return(). abort(Reason) -> exit({aborted, Reason}). @@ -1835,6 +1835,7 @@ do_dirty_rpc(Tab, Node, M, F, Args) -> %% Info %% Info about one table +-spec table_info(atom(), any()) -> any(). table_info(Tab, Item) -> case get(mnesia_activity_state) of undefined -> @@ -1868,7 +1869,7 @@ any_table_info(Tab, Item) when is_atom(Tab) -> type -> case ?catch_val({Tab, setorbag}) of {'EXIT', _} -> - bad_info_reply(Tab, Item); + abort({no_exists, Tab, Item}); Val -> Val end; @@ -1886,7 +1887,7 @@ any_table_info(Tab, Item) when is_atom(Tab) -> _ -> case ?catch_val({Tab, Item}) of {'EXIT', _} -> - bad_info_reply(Tab, Item); + abort({no_exists, Tab, Item}); Val -> Val end diff --git a/lib/mnesia/src/mnesia_bup.erl b/lib/mnesia/src/mnesia_bup.erl index 37a8258d74..47dcdad7ac 100644 --- a/lib/mnesia/src/mnesia_bup.erl +++ b/lib/mnesia/src/mnesia_bup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -65,6 +65,8 @@ default_op = keep_tables }). +-type fallback_args() :: #fallback_args{}. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Backup iterator @@ -108,6 +110,7 @@ iter(R, Header, Schema, Fun, Acc, BupItems) -> Acc2 = Fun(BupItems, Header, Schema, Acc), iter(R, Header, Schema, Fun, Acc2, []). +-spec safe_apply(#restore{}, atom(), list()) -> tuple(). safe_apply(R, write, [_, Items]) when Items =:= [] -> R; safe_apply(R, What, Args) -> @@ -570,6 +573,7 @@ fallback_bup() -> mnesia_lib:dir(fallback_name()). fallback_tmp_name() -> "FALLBACK.TMP". %% fallback_full_tmp_name() -> mnesia_lib:dir(fallback_tmp_name()). +-spec fallback_receiver(pid(), fallback_args()) -> no_return(). fallback_receiver(Master, FA) -> process_flag(trap_exit, true), @@ -981,6 +985,7 @@ do_uninstall_fallback(FA) -> {error, Reason} end. +-spec uninstall_fallback_master(pid(), fallback_args()) -> no_return(). uninstall_fallback_master(ClientPid, FA) -> process_flag(trap_exit, true), diff --git a/lib/mnesia/src/mnesia_dumper.erl b/lib/mnesia/src/mnesia_dumper.erl index f669d009c6..644133cf5d 100644 --- a/lib/mnesia/src/mnesia_dumper.erl +++ b/lib/mnesia/src/mnesia_dumper.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. 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 @@ -643,7 +643,7 @@ insert_op(Tid, _, {op, create_table, TabDef}, InPlace, InitBy) -> true -> ignore; false -> mnesia_log:open_log(temp, - mnesia_log:dcl_log_header(), + mnesia_log:dcd_log_header(), Dcd, false, false, diff --git a/lib/mnesia/src/mnesia_frag.erl b/lib/mnesia/src/mnesia_frag.erl index a2958ab461..9e77fe0b9f 100644 --- a/lib/mnesia/src/mnesia_frag.erl +++ b/lib/mnesia/src/mnesia_frag.erl @@ -1,7 +1,7 @@ %%% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -209,7 +209,7 @@ first(ActivityId, Opaque, Tab) -> end end. -search_first(ActivityId, Opaque, Tab, N, FH) when N =< FH#frag_state.n_fragments -> +search_first(ActivityId, Opaque, Tab, N, FH) when N < FH#frag_state.n_fragments -> NextN = N + 1, NextFrag = n_to_frag_name(Tab, NextN), case mnesia:first(ActivityId, Opaque, NextFrag) of @@ -448,13 +448,15 @@ do_remote_select(_ReplyTo, _Ref, [], _MatchSpec) -> local_collect(Ref, Pid, Type, LocalMatch, OldSelectFun) -> receive - {local_select, Ref, LocalRes} -> - remote_collect(Ref, Type, LocalRes, LocalMatch, OldSelectFun); + {local_select, Ref, ok} -> + remote_collect_ok(Ref, Type, LocalMatch, OldSelectFun); + {local_select, Ref, {error, Reason}} -> + remote_collect_error(Ref, Type, Reason, OldSelectFun); {'EXIT', Pid, Reason} -> - remote_collect(Ref, Type, {error, Reason}, [], OldSelectFun) + remote_collect_error(Ref, Type, Reason, OldSelectFun) end. -remote_collect(Ref, Type, LocalRes = ok, Acc, OldSelectFun) -> +remote_collect_ok(Ref, Type, Acc, OldSelectFun) -> receive {remote_select, Ref, Node, RemoteRes} -> case RemoteRes of @@ -463,19 +465,21 @@ remote_collect(Ref, Type, LocalRes = ok, Acc, OldSelectFun) -> ordered_set -> lists:merge(RemoteMatch, Acc); _ -> RemoteMatch ++ Acc end, - remote_collect(Ref, Type, LocalRes, Matches, OldSelectFun); + remote_collect_ok(Ref, Type, Matches, OldSelectFun); _ -> - remote_collect(Ref, Type, {error, {node_not_running, Node}}, [], OldSelectFun) + Reason = {node_not_running, Node}, + remote_collect_error(Ref, Type, Reason, OldSelectFun) end after 0 -> Acc - end; -remote_collect(Ref, Type, LocalRes = {error, Reason}, _Acc, OldSelectFun) -> + end. + +remote_collect_error(Ref, Type, Reason, OldSelectFun) -> receive {remote_select, Ref, _Node, _RemoteRes} -> - remote_collect(Ref, Type, LocalRes, [], OldSelectFun) + remote_collect_error(Ref, Type, Reason, OldSelectFun) after 0 -> - mnesia:abort(Reason) + mnesia:abort({error, Reason}) end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/mnesia/src/mnesia_index.erl b/lib/mnesia/src/mnesia_index.erl index 4e6e8a997c..61210d7e55 100644 --- a/lib/mnesia/src/mnesia_index.erl +++ b/lib/mnesia/src/mnesia_index.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/mnesia/src/mnesia_lib.erl b/lib/mnesia/src/mnesia_lib.erl index 3da3dd2f5c..36bcfe8de9 100644 --- a/lib/mnesia/src/mnesia_lib.erl +++ b/lib/mnesia/src/mnesia_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -399,7 +399,7 @@ other_val(Var, Other) -> pr_other(Var, Other) end. --spec(pr_other/2 :: (_,_) -> no_return()). +-spec pr_other(_,_) -> no_return(). pr_other(Var, Other) -> Why = diff --git a/lib/mnesia/src/mnesia_locker.erl b/lib/mnesia/src/mnesia_locker.erl index 6b5770d91e..ca0cc79c45 100644 --- a/lib/mnesia/src/mnesia_locker.erl +++ b/lib/mnesia/src/mnesia_locker.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -1104,6 +1104,7 @@ do_stop() -> system_continue(_Parent, _Debug, State) -> loop(State). +-spec system_terminate(_, _, _, _) -> no_return(). system_terminate(_Reason, _Parent, _Debug, _State) -> do_stop(). diff --git a/lib/mnesia/src/mnesia_log.erl b/lib/mnesia/src/mnesia_log.erl index 11b792026e..9e804cc4c2 100644 --- a/lib/mnesia/src/mnesia_log.erl +++ b/lib/mnesia/src/mnesia_log.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/mnesia/src/mnesia_recover.erl b/lib/mnesia/src/mnesia_recover.erl index 7435b6896a..b3eed1de6e 100644 --- a/lib/mnesia/src/mnesia_recover.erl +++ b/lib/mnesia/src/mnesia_recover.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 diff --git a/lib/mnesia/src/mnesia_schema.erl b/lib/mnesia/src/mnesia_schema.erl index 17e570b881..d1d892a387 100644 --- a/lib/mnesia/src/mnesia_schema.erl +++ b/lib/mnesia/src/mnesia_schema.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -2686,7 +2686,8 @@ do_merge_schema(LockTabs0) -> if RemoteRunning /= RemoteRunning1 -> mnesia_lib:error("Mnesia on ~p could not connect to node(s) ~p~n", - [node(), RemoteRunning1 -- RemoteRunning]); + [node(), RemoteRunning1 -- RemoteRunning]), + mnesia:abort({node_not_running, RemoteRunning1 -- RemoteRunning}); true -> ok end, NeedsLock = RemoteRunning -- LockedAlready, @@ -3029,7 +3030,9 @@ announce_im_running([N | Ns], SchemaCs) -> mnesia_lib:add({current, db_nodes}, N), mnesia_controller:add_active_replica(schema, N, SchemaCs); false -> - ignore + mnesia_lib:error("Mnesia on ~p could not connect to node ~p~n", + [node(), N]), + mnesia:abort({node_not_running, N}) end, announce_im_running(Ns, SchemaCs); announce_im_running([], _) -> diff --git a/lib/mnesia/src/mnesia_snmp_hook.erl b/lib/mnesia/src/mnesia_snmp_hook.erl index 8b4b5231e1..893b39f3c0 100644 --- a/lib/mnesia/src/mnesia_snmp_hook.erl +++ b/lib/mnesia/src/mnesia_snmp_hook.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/mnesia/src/mnesia_tm.erl b/lib/mnesia/src/mnesia_tm.erl index f3ffac5493..bb8e788b40 100644 --- a/lib/mnesia/src/mnesia_tm.erl +++ b/lib/mnesia/src/mnesia_tm.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -1604,6 +1604,7 @@ tell_participants([Pid | Pids], Msg) -> tell_participants([], _Msg) -> ok. +-spec commit_participant(_, _, _, _, _) -> no_return(). %% Trap exit because we can get a shutdown from application manager commit_participant(Coord, Tid, Bin, DiscNs, RamNs) when is_binary(Bin) -> process_flag(trap_exit, true), @@ -2279,6 +2280,7 @@ fixtable(Tab, Lock, Me) -> system_continue(_Parent, _Debug, State) -> doit_loop(State). +-spec system_terminate(_, _, _, _) -> no_return(). system_terminate(_Reason, _Parent, _Debug, State) -> do_stop(State). diff --git a/lib/mnesia/test/Makefile b/lib/mnesia/test/Makefile index 58632d6970..b165924ef2 100644 --- a/lib/mnesia/test/Makefile +++ b/lib/mnesia/test/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1996-2009. All Rights Reserved. +# Copyright Ericsson AB 1996-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 @@ -108,7 +108,7 @@ release_spec: opt release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) mnesia.spec mnesia.spec.vxworks $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) mnesia.spec mnesia.cover $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) $(INSTALL_SCRIPT) mt $(INSTALL_PROGS) $(RELSYSDIR) # chmod -R u+w $(RELSYSDIR) # @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/mnesia/test/mnesia.cover b/lib/mnesia/test/mnesia.cover new file mode 100644 index 0000000000..66ffc06e89 --- /dev/null +++ b/lib/mnesia/test/mnesia.cover @@ -0,0 +1,2 @@ +{incl_app,mnesia,details}. + diff --git a/lib/mnesia/test/mnesia.spec b/lib/mnesia/test/mnesia.spec index 596f8b917d..204d1519cb 100644 --- a/lib/mnesia/test/mnesia.spec +++ b/lib/mnesia/test/mnesia.spec @@ -1,23 +1,76 @@ -{topcase, {dir, "../mnesia_test"}}. -{require_nodenames, 2}. -{skip, {mnesia_measure_test, ram_meter, "Takes to long time"}}. -{skip, {mnesia_measure_test, disc_meter, "Takes to long time"}}. -{skip, {mnesia_measure_test, disc_only_meter, "Takes to long time"}}. -{skip, {mnesia_measure_test, cost, "Takes to long time"}}. -{skip, {mnesia_measure_test, dbn_meters, "Takes to long time"}}. -{skip, {mnesia_measure_test, tpcb, "Takes to long time"}}. -{skip, {mnesia_measure_test, prediction, "Not yet implemented"}}. -{skip, {mnesia_measure_test, consumption, "Not yet implemented"}}. -{skip, {mnesia_measure_test, scalability, "Not yet implemented"}}. -{skip, {mnesia_measure_test, tpcb, "Takes too much time and memory"}}. -{skip, {mnesia_measure_test, measure_all_api_functions, "Not yet implemented"}}. -{skip, {mnesia_measure_test, mnemosyne_vs_mnesia_kernel, "Not yet implemented"}}. -{skip, {mnesia_examples_test, company, "Not yet implemented"}}. -{skip, {mnesia_config_test, ignore_fallback_at_startup, "Not yet implemented"}}. -{skip, {mnesia_evil_backup, local_backup_checkpoint, "Not yet implemented"}}. -{skip, {mnesia_config_test, max_wait_for_decision, "Not yet implemented"}}. -{skip, {mnesia_recovery_test, after_full_disc_partition, "Not yet implemented"}}. -{skip, {mnesia_recovery_test, system_upgrade, "Not yet implemented"}}. -{skip, {mnesia_consistency_test, consistency_after_change_table_copy_type, "Not yet implemented"}}. -{skip, {mnesia_consistency_test, consistency_after_transform_table, "Not yet implemented"}}. -{skip, {mnesia_consistency_test, consistency_after_rename_of_node, "Not yet implemented"}}. +{suites,"../mnesia_test",all}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [ram_meter], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [disc_meter], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [disc_only_meter], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test,[cost],"Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [dbn_meters], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [ram_tpcb,disc_tpcb,disc_only_tpcb], + "Takes to long time"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [reader_disturbed_by_node_down,writer_disturbed_by_node_down, + reader_disturbed_by_node_up,writer_disturbed_by_node_up, + reader_disturbed_by_schema_ops,writer_disturbed_by_schema_ops, + reader_disturbed_by_checkpoint,writer_disturbed_by_checkpoint, + reader_disturbed_by_dump_log,writer_disturbed_by_dump_log, + reader_disturbed_by_backup,writer_disturbed_by_backup, + reader_disturbed_by_restore,writer_disturbed_by_restore, + reader_competing_with_reader,reader_competing_with_writer, + writer_competing_with_reader,writer_competing_with_writer], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [measure_resource_consumption,determine_resource_leakage], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [determine_system_limits,performance_at_min_config, + performance_at_max_config,performance_at_full_load, + resource_consumption_at_min_config, + resource_consumption_at_max_config, + resource_consumption_at_full_load], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [ram_tpcb,disc_tpcb,disc_only_tpcb], + "Takes too much time and memory"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [measure_all_api_functions], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_measure_test, + [mnemosyne_vs_mnesia_kernel], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_examples_test, + [company], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_config_test, + [ignore_fallback_at_startup], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_evil_backup, + [local_backup_checkpoint], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_config_test, + [max_wait_for_decision], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_recovery_test, + [after_full_disc_partition], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_recovery_test, + [system_upgrade], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_consistency_test, + [consistency_after_change_table_copy_type], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_consistency_test, + [consistency_after_transform_table_ram, + consistency_after_transform_table_disc, + consistency_after_transform_table_disc_only], + "Not yet implemented"}. +{skip_cases,"../mnesia_test",mnesia_consistency_test, + [consistency_after_rename_of_node], + "Not yet implemented"}. diff --git a/lib/mnesia/test/mnesia_SUITE.erl b/lib/mnesia/test/mnesia_SUITE.erl index b28deaf330..8ba8427213 100644 --- a/lib/mnesia/test/mnesia_SUITE.erl +++ b/lib/mnesia/test/mnesia_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 @@ -26,135 +26,122 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify that Mnesia really is a distributed real-time DBMS", - "This is the test suite of the Mnesia DBMS. The test suite", - "covers many aspects of usage and is indended to be developed", - "incrementally. The test suite is divided into a hierarchy of test", - "suites where the leafs actually implements the test cases.", - "The intention of each test case and sub test suite can be", - "read in comments where they are implemented or in worst cases", - "from their long mnemonic names. ", - "", - "The most simple test case of them all is called 'silly'", - "and is useful to run now and then, e.g. when some new fatal", - "bug has been introduced. It may be run even if Mnesia is in", - "such a bad shape that the test machinery cannot be used.", - "NB! Invoke the function directly with mnesia_SUITE:silly()", - "and do not involve the normal test machinery."]; -all(suite) -> - [ - light, - medium, - heavy, - clean_up_suite - ]. +suite() -> [{ct_hooks,[{ts_install_cth,[{nodenames,2}]}]}]. + + +%% Verify that Mnesia really is a distributed real-time DBMS. +%% This is the test suite of the Mnesia DBMS. The test suite +%% covers many aspects of usage and is indended to be developed +%% incrementally. The test suite is divided into a hierarchy of test +%% suites where the leafs actually implements the test cases. +%% The intention of each test case and sub test suite can be +%% read in comments where they are implemented or in worst cases +%% from their long mnemonic names. +%% +%% The most simple test case of them all is called 'silly' +%% and is useful to run now and then, e.g. when some new fatal +%% bug has been introduced. It may be run even if Mnesia is in +%% such a bad shape that the test machinery cannot be used. +%% NB! Invoke the function directly with mnesia_SUITE:silly() +%% and do not involve the normal test machinery. + +all() -> + [{group, light}, {group, medium}, {group, heavy}, + clean_up_suite]. + +groups() -> + %% The 'light' test suite runs a selected set of test suites and is + %% intended to be the smallest test suite that is meaningful + %% to run. It starts with an installation test (which in essence is the + %% 'silly' test case) and then it covers all functions in the API in + %% various depths. All configuration parameters and examples are also + %% covered. + [{light, [], + [{group, install}, {group, nice}, {group, evil}, + {group, mnesia_frag_test, light}, {group, qlc}, + {group, registry}, {group, config}, {group, examples}]}, + {install, [], [{mnesia_install_test, all}]}, + {nice, [], [{mnesia_nice_coverage_test, all}]}, + {evil, [], [{mnesia_evil_coverage_test, all}]}, + {qlc, [], [{mnesia_qlc_test, all}]}, + {registry, [], [{mnesia_registry_test, all}]}, + {config, [], [{mnesia_config_test, all}]}, + {examples, [], [{mnesia_examples_test, all}]}, + %% The 'medium' test suite verfies the ACID (atomicity, consistency + %% isolation and durability) properties and various recovery scenarios + %% These tests may take quite while to run. + {medium, [], + [{group, install}, {group, atomicity}, + {group, isolation}, {group, durability}, + {group, recovery}, {group, consistency}, + {group, mnesia_frag_test, medium}]}, + {atomicity, [], [{mnesia_atomicity_test, all}]}, + {isolation, [], [{mnesia_isolation_test, all}]}, + {durability, [], [{mnesia_durability_test, all}]}, + {recovery, [], [{mnesia_recovery_test, all}]}, + {consistency, [], [{mnesia_consistency_test, all}]}, + %% The 'heavy' test suite runs some resource consuming tests and + %% benchmarks + {heavy, [], [{group, measure}]}, + {measure, [], [{mnesia_measure_test, all}]}, + {prediction, [], + [{group, mnesia_measure_test, prediction}]}, + {fairness, [], + [{group, mnesia_measure_test, fairness}]}, + {benchmarks, [], + [{group, mnesia_measure_test, benchmarks}]}, + {consumption, [], + [{group, mnesia_measure_test, consumption}]}, + {scalability, [], + [{group, mnesia_measure_test, scalability}]}, + %% This test suite is an extract of the grand Mnesia suite + %% it contains OTP R4B specific test cases + {otp_r4b, [], + [{mnesia_config_test, access_module}, + {mnesia_config_test, dump_log_load_regulation}, + {mnesia_config_test, embedded_mnemosyne}, + {mnesia_config_test, ignore_fallback_at_startup}, + {mnesia_config_test, max_wait_for_decision}, + {mnesia_consistency_test, consistency_after_restore}, + {mnesia_evil_backup, restore}, + {mnesia_evil_coverage_test, offline_set_master_nodes}, + {mnesia_evil_coverage_test, record_name}, + {mnesia_evil_coverage_test, user_properties}, + {mnesia_registry_test, all}, {group, otp_2363}]}, + %% Index on disc only tables + {otp_2363, [], + [{mnesia_dirty_access_test, + dirty_index_match_object_disc_only}, + {mnesia_dirty_access_test, dirty_index_read_disc_only}, + {mnesia_dirty_access_test, + dirty_index_update_bag_disc_only}, + {mnesia_dirty_access_test, + dirty_index_update_set_disc_only}, + {mnesia_evil_coverage_test, + create_live_table_index_disc_only}]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +init_per_suite(Config) -> + Config. + +end_per_suite(Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% silly() -> mnesia_install_test:silly(). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -light(doc) -> - ["The 'light' test suite runs a selected set of test suites and is", - "intended to be the smallest test suite that is meaningful", - "to run. It starts with an installation test (which in essence is the", - "'silly' test case) and then it covers all functions in the API in", - "various depths. All configuration parameters and examples are also", - "covered."]; -light(suite) -> - [ - install, - nice, - evil, - {mnesia_frag_test, light}, - qlc, - registry, - config, - examples - ]. - -install(suite) -> - [{mnesia_install_test, all}]. - -nice(suite) -> - [{mnesia_nice_coverage_test, all}]. - -evil(suite) -> - [{mnesia_evil_coverage_test, all}]. - -qlc(suite) -> - [{mnesia_qlc_test, all}]. - -registry(suite) -> - [{mnesia_registry_test, all}]. - -config(suite) -> - [{mnesia_config_test, all}]. - -examples(suite) -> - [{mnesia_examples_test, all}]. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -medium(doc) -> - ["The 'medium' test suite verfies the ACID (atomicity, consistency", - "isolation and durability) properties and various recovery scenarios", - "These tests may take quite while to run."]; -medium(suite) -> - [ - install, - atomicity, - isolation, - durability, - recovery, - consistency, - {mnesia_frag_test, medium} - ]. - -atomicity(suite) -> - [{mnesia_atomicity_test, all}]. - -isolation(suite) -> - [{mnesia_isolation_test, all}]. - -durability(suite) -> - [{mnesia_durability_test, all}]. - -recovery(suite) -> - [{mnesia_recovery_test, all}]. - -consistency(suite) -> - [{mnesia_consistency_test, all}]. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -heavy(doc) -> - ["The 'heavy' test suite runs some resource consuming tests and", - "benchmarks"]; -heavy(suite) -> - [measure]. - -measure(suite) -> - [{mnesia_measure_test, all}]. - -prediction(suite) -> - [{mnesia_measure_test, prediction}]. - -fairness(suite) -> - [{mnesia_measure_test, fairness}]. - -benchmarks(suite) -> - [{mnesia_measure_test, benchmarks}]. - -consumption(suite) -> - [{mnesia_measure_test, consumption}]. - -scalability(suite) -> - [{mnesia_measure_test, scalability}]. - clean_up_suite(doc) -> ["Not a test case only kills mnesia and nodes, that where" "started during the tests"]; @@ -169,35 +156,7 @@ clean_up_suite(Config) when is_list(Config)-> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -otp_r4b(doc) -> - ["This test suite is an extract of the grand Mnesia suite", - "it contains OTP R4B specific test cases"]; -otp_r4b(suite) -> - [ - {mnesia_config_test, access_module}, - {mnesia_config_test, dump_log_load_regulation}, - {mnesia_config_test, embedded_mnemosyne}, - {mnesia_config_test, ignore_fallback_at_startup}, - {mnesia_config_test, max_wait_for_decision}, - {mnesia_consistency_test, consistency_after_restore}, - {mnesia_evil_backup, restore}, - {mnesia_evil_coverage_test, offline_set_master_nodes}, - {mnesia_evil_coverage_test, record_name}, - {mnesia_evil_coverage_test, user_properties}, - {mnesia_registry_test, all}, - otp_2363 - ]. - -otp_2363(doc) -> - ["Index on disc only tables"]; -otp_2363(suite) -> - [ - {mnesia_dirty_access_test, dirty_index_match_object_disc_only}, - {mnesia_dirty_access_test,dirty_index_read_disc_only}, - {mnesia_dirty_access_test,dirty_index_update_bag_disc_only}, - {mnesia_dirty_access_test,dirty_index_update_set_disc_only}, - {mnesia_evil_coverage_test, create_live_table_index_disc_only} - ]. + diff --git a/lib/mnesia/test/mnesia_atomicity_test.erl b/lib/mnesia/test/mnesia_atomicity_test.erl index 645c203a91..cf878fc820 100644 --- a/lib/mnesia/test/mnesia_atomicity_test.erl +++ b/lib/mnesia/test/mnesia_atomicity_test.erl @@ -27,24 +27,46 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify atomicity of transactions", - "Verify that transactions are atomic, i.e. either all operations", - "in a transaction will be performed or none of them. It must be", - "assured that no partitially completed operations leaves any", - "effects in the database."]; -all(suite) -> - [ - explicit_abort_in_middle_of_trans, +all() -> + [explicit_abort_in_middle_of_trans, runtime_error_in_middle_of_trans, - kill_self_in_middle_of_trans, - throw_in_middle_of_trans, - mnesia_down_in_middle_of_trans - ]. + kill_self_in_middle_of_trans, throw_in_middle_of_trans, + {group, mnesia_down_in_middle_of_trans}]. + +groups() -> + [{mnesia_down_in_middle_of_trans, [], + [mnesia_down_during_infinite_trans, + {group, lock_waiter}, {group, restart_check}]}, + {lock_waiter, [], + [lock_waiter_sw_r, lock_waiter_sw_rt, lock_waiter_sw_wt, + lock_waiter_wr_r, lock_waiter_srw_r, lock_waiter_sw_sw, + lock_waiter_sw_w, lock_waiter_sw_wr, lock_waiter_sw_srw, + lock_waiter_wr_wt, lock_waiter_srw_wt, + lock_waiter_wr_sw, lock_waiter_srw_sw, lock_waiter_wr_w, + lock_waiter_srw_w, lock_waiter_r_sw, lock_waiter_r_w, + lock_waiter_r_wt, lock_waiter_rt_sw, lock_waiter_rt_w, + lock_waiter_rt_wt, lock_waiter_wr_wr, + lock_waiter_srw_srw, lock_waiter_wt_r, lock_waiter_wt_w, + lock_waiter_wt_rt, lock_waiter_wt_wt, lock_waiter_wt_wr, + lock_waiter_wt_srw, lock_waiter_wt_sw, lock_waiter_w_wr, + lock_waiter_w_srw, lock_waiter_w_sw, lock_waiter_w_r, + lock_waiter_w_w, lock_waiter_w_rt, lock_waiter_w_wt]}, + {restart_check, [], + [restart_r_one, restart_w_one, restart_rt_one, + restart_wt_one, restart_wr_one, restart_sw_one, + restart_r_two, restart_w_two, restart_rt_two, + restart_wt_two, restart_wr_two, restart_sw_two]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% explicit_abort_in_middle_of_trans(suite) -> []; @@ -259,12 +281,6 @@ throw_in_middle_of_trans(Config) when is_list(Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -mnesia_down_in_middle_of_trans(suite) -> - [ - mnesia_down_during_infinite_trans, - lock_waiter, - restart_check - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% mnesia_down_during_infinite_trans(suite) -> []; @@ -304,56 +320,6 @@ mnesia_down_during_infinite_trans(Config) when is_list(Config) -> ?verify_mnesia([Node2], [Node1]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -lock_waiter(doc) -> - ["The purpose of this test case is to test the following situation:", - "process B locks an object, process A accesses that object as", - "well, but A has to wait for the lock to be released. Then", - "mnesia of B goes down. Question: will A get the lock ?", - "important: the transaction of A is the oldest one !!! (= a little tricky)", - "", - "several different access operations shall be tested", - "rt = read_lock_table, wt = write_lock_table, r = read,", - "sw = s_write, w = write, wr = wread"]; -lock_waiter(suite) -> - [ - lock_waiter_sw_r, - lock_waiter_sw_rt, - lock_waiter_sw_wt, - lock_waiter_wr_r, - lock_waiter_srw_r, - lock_waiter_sw_sw, - lock_waiter_sw_w, - lock_waiter_sw_wr, - lock_waiter_sw_srw, - lock_waiter_wr_wt, - lock_waiter_srw_wt, - lock_waiter_wr_sw, - lock_waiter_srw_sw, - lock_waiter_wr_w, - lock_waiter_srw_w, - lock_waiter_r_sw, - lock_waiter_r_w, - lock_waiter_r_wt, - lock_waiter_rt_sw, - lock_waiter_rt_w, - lock_waiter_rt_wt, - lock_waiter_wr_wr, - lock_waiter_srw_srw, - lock_waiter_wt_r, - lock_waiter_wt_w, - lock_waiter_wt_rt, - lock_waiter_wt_wt, - lock_waiter_wt_wr, - lock_waiter_wt_srw, - lock_waiter_wt_sw, - lock_waiter_w_wr, - lock_waiter_w_srw, - lock_waiter_w_sw, - lock_waiter_w_r, - lock_waiter_w_w, - lock_waiter_w_rt, - lock_waiter_w_wt - ]. lock_waiter_sw_r(suite) -> []; lock_waiter_sw_r(Config) when is_list(Config) -> @@ -649,29 +615,6 @@ wait(Mseconds) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -restart_check (doc) -> - [ - "test case:'A' performs a transaction on a table which", - "is only replicated on node B. During that transaction", - "mnesia on node B is killed. The transaction of A should", - "be stopped, since there is no further replica", - "rt = read_lock_table, wt = write_lock_table, r = read,", - "sw = s_write, w = write, wr = wread,"]; -restart_check(suite) -> - [ - restart_r_one, - restart_w_one, - restart_rt_one, - restart_wt_one, - restart_wr_one, - restart_sw_one, - restart_r_two, - restart_w_two, - restart_rt_two, - restart_wt_two, - restart_wr_two, - restart_sw_two - ]. restart_r_one(suite) -> []; restart_r_one(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_config_backup.erl b/lib/mnesia/test/mnesia_config_backup.erl index a33ec6ac5c..0916e255e2 100644 --- a/lib/mnesia/test/mnesia_config_backup.erl +++ b/lib/mnesia/test/mnesia_config_backup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2010. 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 diff --git a/lib/mnesia/test/mnesia_config_event.erl b/lib/mnesia/test/mnesia_config_event.erl index 6c1dea7ed5..832bf94eb9 100644 --- a/lib/mnesia/test/mnesia_config_event.erl +++ b/lib/mnesia/test/mnesia_config_event.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2010. 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 diff --git a/lib/mnesia/test/mnesia_config_test.erl b/lib/mnesia/test/mnesia_config_test.erl index 7b62c63a62..93510d539c 100644 --- a/lib/mnesia/test/mnesia_config_test.erl +++ b/lib/mnesia/test/mnesia_config_test.erl @@ -27,14 +27,14 @@ -record(test_table2,{i, b}). -export([ - all/1, + all/0,groups/0,init_per_group/2,end_per_group/2, access_module/1, auto_repair/1, backup_module/1, debug/1, dir/1, dump_log_load_regulation/1, - dump_log_thresholds/1, + dump_log_update_in_place/1, embedded_mnemosyne/1, event_module/1, @@ -44,7 +44,7 @@ send_compressed/1, app_test/1, - schema_config/1, + schema_merge/1, unknown_config/1, @@ -56,13 +56,13 @@ start_first_one_disc_less_then_two_more_disc_less/1, schema_location_and_extra_db_nodes_combinations/1, table_load_to_disc_less_nodes/1, - dynamic_connect/1, + dynamic_basic/1, dynamic_ext/1, dynamic_bad/1, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, c_nodes/0 ]). @@ -95,46 +95,40 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - [ - "Test all configuration parameters", - "Perform an exhaustive test of all the various parameters that", - "may be used to configure the Mnesia application.", - "", - "Hint: Check out the unofficial function mnesia:start/1.", - " But be careful to cleanup all configuration parameters", - " afterwards since the rest of the test suite may rely on", - " these default configurations. Perhaps it is best to run", - " these tests in a separate node which is dropped afterwards.", - "Are really all configuration parameters covered?"]; - -all(suite) -> - [ - access_module, - auto_repair, - backup_module, - debug, - dir, - dump_log_load_regulation, - dump_log_thresholds, - dump_log_update_in_place, - embedded_mnemosyne, - event_module, - ignore_fallback_at_startup, - inconsistent_database, - max_wait_for_decision, - send_compressed, - - app_test, - schema_config, - unknown_config - ]. +all() -> + [access_module, auto_repair, backup_module, debug, dir, + dump_log_load_regulation, {group, dump_log_thresholds}, + dump_log_update_in_place, embedded_mnemosyne, + event_module, ignore_fallback_at_startup, + inconsistent_database, max_wait_for_decision, + send_compressed, app_test, {group, schema_config}, + unknown_config]. + +groups() -> + [{dump_log_thresholds, [], + [dump_log_time_threshold, dump_log_write_threshold]}, + {schema_config, [], + [start_one_disc_full_then_one_disc_less, + start_first_one_disc_less_then_one_disc_full, + start_first_one_disc_less_then_two_more_disc_less, + schema_location_and_extra_db_nodes_combinations, + table_load_to_disc_less_nodes, schema_merge, + {group, dynamic_connect}]}, + {dynamic_connect, [], + [dynamic_basic, dynamic_ext, dynamic_bad]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -445,21 +439,6 @@ dump_log_update_in_place(Config) when is_list(Config) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dump_log_thresholds(doc) -> - ["Elaborate with various values of the dump log thresholds and how", - "they affects each others. Both the dump_log_time_threshold and the", - "dump_log_write_threshold must be covered. Do also check that both", - "kinds of overload events are generated as expected.", - "", - "Logs are checked by first doing whatever has to be done to trigger ", - "a dump, and then stopping Mnesia and then look in the ", - "data files and see that the correct amount of transactions ", - "have been done."]; -dump_log_thresholds(suite) -> - [ - dump_log_time_threshold, - dump_log_write_threshold - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dump_log_write_threshold(doc)-> @@ -783,22 +762,6 @@ event_module(Config) when is_list(Config) -> ok. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -schema_config(doc) -> - ["Try many configurations with various schema_location's with and", - "without explicit extra_db_nodes. Do also provoke various schema merge", - "situations. Most of the other test suites focusses on tests where the", - "schema is residing on disc. Now it is time to perform an exhaustive", - "elaboration with various disc less configurations."]; -schema_config(suite) -> - [ - start_one_disc_full_then_one_disc_less, - start_first_one_disc_less_then_one_disc_full, - start_first_one_disc_less_then_two_more_disc_less, - schema_location_and_extra_db_nodes_combinations, - table_load_to_disc_less_nodes, - schema_merge, - dynamic_connect - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% start_one_disc_full_then_one_disc_less(doc)-> ["Start a disk node and then a disk less one. Distribute some", @@ -1160,15 +1123,6 @@ sort(NS) when is_list(NS) -> lists:sort(NS). -dynamic_connect(doc) -> - ["Test the new functionality where we start mnesia first and then " - "connect to the other mnesia nodes"]; -dynamic_connect(suite) -> - [ - dynamic_basic, - dynamic_ext, - dynamic_bad - ]. dynamic_basic(suite) -> []; diff --git a/lib/mnesia/test/mnesia_consistency_test.erl b/lib/mnesia/test/mnesia_consistency_test.erl index ffe8ab7ac3..f38e13f3a2 100644 --- a/lib/mnesia/test/mnesia_consistency_test.erl +++ b/lib/mnesia/test/mnesia_consistency_test.erl @@ -27,33 +27,121 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify transaction consistency", - "Consistency is the property of the application that requires any", - "execution of the transaction to take the database from one", - "consistent state to another. Verify that the database is", - "consistent at any point in time.", - "Verify for various configurations.", - " Verify for both set and bag"]; -all(suite) -> - [ - consistency_after_restart, - consistency_after_dump_tables, - consistency_after_add_replica, - consistency_after_del_replica, - consistency_after_move_replica, - consistency_after_transform_table, +all() -> + [{group, consistency_after_restart}, + {group, consistency_after_dump_tables}, + {group, consistency_after_add_replica}, + {group, consistency_after_del_replica}, + {group, consistency_after_move_replica}, + {group, consistency_after_transform_table}, consistency_after_change_table_copy_type, - consistency_after_fallback, - consistency_after_restore, + {group, consistency_after_fallback}, + {group, consistency_after_restore}, consistency_after_rename_of_node, - checkpoint_retainer_consistency, - backup_consistency - ]. + {group, checkpoint_retainer_consistency}, + {group, backup_consistency}]. + +groups() -> + [{consistency_after_restart, [], + [consistency_after_restart_1_ram, + consistency_after_restart_1_disc, + consistency_after_restart_1_disc_only, + consistency_after_restart_2_ram, + consistency_after_restart_2_disc, + consistency_after_restart_2_disc_only]}, + {consistency_after_dump_tables, [], + [consistency_after_dump_tables_1_ram, + consistency_after_dump_tables_2_ram]}, + {consistency_after_add_replica, [], + [consistency_after_add_replica_2_ram, + consistency_after_add_replica_2_disc, + consistency_after_add_replica_2_disc_only, + consistency_after_add_replica_3_ram, + consistency_after_add_replica_3_disc, + consistency_after_add_replica_3_disc_only]}, + {consistency_after_del_replica, [], + [consistency_after_del_replica_2_ram, + consistency_after_del_replica_2_disc, + consistency_after_del_replica_2_disc_only, + consistency_after_del_replica_3_ram, + consistency_after_del_replica_3_disc, + consistency_after_del_replica_3_disc_only]}, + {consistency_after_move_replica, [], + [consistency_after_move_replica_2_ram, + consistency_after_move_replica_2_disc, + consistency_after_move_replica_2_disc_only, + consistency_after_move_replica_3_ram, + consistency_after_move_replica_3_disc, + consistency_after_move_replica_3_disc_only]}, + {consistency_after_transform_table, [], + [consistency_after_transform_table_ram, + consistency_after_transform_table_disc, + consistency_after_transform_table_disc_only]}, + {consistency_after_fallback, [], + [consistency_after_fallback_2_ram, + consistency_after_fallback_2_disc, + consistency_after_fallback_2_disc_only, + consistency_after_fallback_3_ram, + consistency_after_fallback_3_disc, + consistency_after_fallback_3_disc_only]}, + {consistency_after_restore, [], + [consistency_after_restore_clear_ram, + consistency_after_restore_clear_disc, + consistency_after_restore_clear_disc_only, + consistency_after_restore_recreate_ram, + consistency_after_restore_recreate_disc, + consistency_after_restore_recreate_disc_only]}, + {checkpoint_retainer_consistency, [], + [{group, updates_during_checkpoint_activation}, + {group, updates_during_checkpoint_iteration}, + {group, load_table_with_activated_checkpoint}, + {group, + add_table_copy_to_table_with_activated_checkpoint}]}, + {updates_during_checkpoint_activation, [], + [updates_during_checkpoint_activation_2_ram, + updates_during_checkpoint_activation_2_disc, + updates_during_checkpoint_activation_2_disc_only, + updates_during_checkpoint_activation_3_ram, + updates_during_checkpoint_activation_3_disc, + updates_during_checkpoint_activation_3_disc_only]}, + {updates_during_checkpoint_iteration, [], + [updates_during_checkpoint_iteration_2_ram, + updates_during_checkpoint_iteration_2_disc, + updates_during_checkpoint_iteration_2_disc_only]}, + {load_table_with_activated_checkpoint, [], + [load_table_with_activated_checkpoint_ram, + load_table_with_activated_checkpoint_disc, + load_table_with_activated_checkpoint_disc_only]}, + {add_table_copy_to_table_with_activated_checkpoint, [], + [add_table_copy_to_table_with_activated_checkpoint_ram, + add_table_copy_to_table_with_activated_checkpoint_disc, + add_table_copy_to_table_with_activated_checkpoint_disc_only]}, + {backup_consistency, [], + [{group, interupted_install_fallback}, + {group, interupted_uninstall_fallback}, + {group, mnesia_down_during_backup_causes_switch}, + {group, mnesia_down_during_backup_causes_abort}, + {group, schema_transactions_during_backup}]}, + {interupted_install_fallback, [], + [inst_fallback_process_dies, fatal_when_inconsistency]}, + {interupted_uninstall_fallback, [], [after_delete]}, + {mnesia_down_during_backup_causes_switch, [], + [cause_switch_before, cause_switch_after]}, + {mnesia_down_during_backup_causes_abort, [], + [cause_abort_before, cause_abort_after]}, + {schema_transactions_during_backup, [], + [change_schema_before, change_schema_after]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -185,15 +273,6 @@ receive_messages(ListOfMsgs) -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_restart(suite) -> - [ - consistency_after_restart_1_ram, - consistency_after_restart_1_disc, - consistency_after_restart_1_disc_only, - consistency_after_restart_2_ram, - consistency_after_restart_2_disc, - consistency_after_restart_2_disc_only - ]. consistency_after_restart_1_ram(suite) -> []; consistency_after_restart_1_ram(Config) when is_list(Config) -> @@ -237,11 +316,6 @@ consistency_after_restart(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_dump_tables(suite) -> - [ - consistency_after_dump_tables_1_ram, - consistency_after_dump_tables_2_ram - ]. consistency_after_dump_tables_1_ram(suite) -> []; consistency_after_dump_tables_1_ram(Config) when is_list(Config) -> @@ -274,15 +348,6 @@ consistency_after_dump_tables(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_add_replica(suite) -> - [ - consistency_after_add_replica_2_ram, - consistency_after_add_replica_2_disc, - consistency_after_add_replica_2_disc_only, - consistency_after_add_replica_3_ram, - consistency_after_add_replica_3_disc, - consistency_after_add_replica_3_disc_only - ]. consistency_after_add_replica_2_ram(suite) -> []; consistency_after_add_replica_2_ram(Config) when is_list(Config) -> @@ -326,15 +391,6 @@ consistency_after_add_replica(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes0, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_del_replica(suite) -> - [ - consistency_after_del_replica_2_ram, - consistency_after_del_replica_2_disc, - consistency_after_del_replica_2_disc_only, - consistency_after_del_replica_3_ram, - consistency_after_del_replica_3_disc, - consistency_after_del_replica_3_disc_only - ]. consistency_after_del_replica_2_ram(suite) -> []; consistency_after_del_replica_2_ram(Config) when is_list(Config) -> @@ -377,15 +433,6 @@ consistency_after_del_replica(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_move_replica(suite) -> - [ - consistency_after_move_replica_2_ram, - consistency_after_move_replica_2_disc, - consistency_after_move_replica_2_disc_only, - consistency_after_move_replica_3_ram, - consistency_after_move_replica_3_disc, - consistency_after_move_replica_3_disc_only - ]. consistency_after_move_replica_2_ram(suite) -> []; consistency_after_move_replica_2_ram(Config) when is_list(Config) -> @@ -430,16 +477,6 @@ consistency_after_move_replica(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_transform_table(doc) -> - ["Check that the database is consistent after transform_table.", - " While applications are updating the involved tables. "]; - -consistency_after_transform_table(suite) -> - [ - consistency_after_transform_table_ram, - consistency_after_transform_table_disc, - consistency_after_transform_table_disc_only - ]. consistency_after_transform_table_ram(suite) -> []; @@ -498,20 +535,6 @@ consistency_after_change_table_copy_type(doc) -> " While applications are updating the involved tables. "]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_fallback(doc) -> - ["Check that installed fallbacks are consistent. Check this by starting ", - "some nodes, run tpcb on them, take a backup at any time, install it ", - "as a fallback, kill all nodes, start mnesia again and check for ", - "any inconsistencies"]; -consistency_after_fallback(suite) -> - [ - consistency_after_fallback_2_ram, - consistency_after_fallback_2_disc, - consistency_after_fallback_2_disc_only, - consistency_after_fallback_3_ram, - consistency_after_fallback_3_disc - , consistency_after_fallback_3_disc_only - ]. consistency_after_fallback_2_ram(suite) -> []; consistency_after_fallback_2_ram(Config) when is_list(Config) -> @@ -583,18 +606,6 @@ consistency_after_fallback(ReplicaType, NodeConfig, Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consistency_after_restore(doc) -> - ["Verify consistency after restore operations."]; - -consistency_after_restore(suite) -> - [ - consistency_after_restore_clear_ram, - consistency_after_restore_clear_disc, - consistency_after_restore_clear_disc_only, - consistency_after_restore_recreate_ram, - consistency_after_restore_recreate_disc, - consistency_after_restore_recreate_disc_only - ]. consistency_after_restore_clear_ram(suite) -> []; consistency_after_restore_clear_ram(Config) when is_list(Config) -> @@ -716,32 +727,8 @@ consistency_after_rename_of_node(doc) -> ["Skipped because it is an unimportant case."]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -checkpoint_retainer_consistency(doc) -> - ["Verify that the contents of a checkpoint retainer has the expected", - "contents in various situations."]; -checkpoint_retainer_consistency(suite) -> - [ - updates_during_checkpoint_activation, - updates_during_checkpoint_iteration, - load_table_with_activated_checkpoint, - add_table_copy_to_table_with_activated_checkpoint - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -updates_during_checkpoint_activation(doc) -> - ["Perform updates while the checkpoint getting activated", - "and verify that all checkpoint retainers associated with", - "different replicas of the same table really has the same", - "contents."]; -updates_during_checkpoint_activation(suite) -> - [ - updates_during_checkpoint_activation_2_ram, - updates_during_checkpoint_activation_2_disc, - updates_during_checkpoint_activation_2_disc_only, - updates_during_checkpoint_activation_3_ram, - updates_during_checkpoint_activation_3_disc - , updates_during_checkpoint_activation_3_disc_only - ]. updates_during_checkpoint_activation_2_ram(suite) -> []; updates_during_checkpoint_activation_2_ram(Config) when is_list(Config) -> @@ -808,17 +795,6 @@ updates_during_checkpoint_activation(ReplicaType,NodeConfig,Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -updates_during_checkpoint_iteration(doc) -> - ["Perform updates while someone is iterating over a checkpoint", - "and verify that the iterator really finds the expected data", - "regardless of ongoing upates."]; - -updates_during_checkpoint_iteration(suite) -> - [ - updates_during_checkpoint_iteration_2_ram, - updates_during_checkpoint_iteration_2_disc - , updates_during_checkpoint_iteration_2_disc_only - ]. updates_during_checkpoint_iteration_2_ram(suite) -> []; updates_during_checkpoint_iteration_2_ram(Config) when is_list(Config) -> @@ -890,17 +866,6 @@ loop_accounts(N_br, N_acc) when N_acc >= 1 -> loop_accounts(_,_) -> done. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -load_table_with_activated_checkpoint(doc) -> - ["Load a table with a checkpoint attached to it and verify that the", - "newly loaded replica also gets a checkpoint retainer attached to it", - "and that it is consistent with the original retainer."]; - -load_table_with_activated_checkpoint(suite) -> - [ - load_table_with_activated_checkpoint_ram, - load_table_with_activated_checkpoint_disc, - load_table_with_activated_checkpoint_disc_only - ]. load_table_with_activated_checkpoint_ram(suite) -> []; load_table_with_activated_checkpoint_ram(Config) when is_list(Config) -> @@ -986,18 +951,6 @@ view(Source, Mod) -> lists:sort(TabList). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -add_table_copy_to_table_with_activated_checkpoint(doc) -> - ["Add a replica to a table with a checkpoint attached to it", - "and verify that the new replica also gets a checkpoint", - "retainer attached to it and that it is consistent with the", - "original retainer."]; - -add_table_copy_to_table_with_activated_checkpoint(suite) -> - [ - add_table_copy_to_table_with_activated_checkpoint_ram, - add_table_copy_to_table_with_activated_checkpoint_disc, - add_table_copy_to_table_with_activated_checkpoint_disc_only - ]. add_table_copy_to_table_with_activated_checkpoint_ram(suite) -> []; add_table_copy_to_table_with_activated_checkpoint_ram(Config) when is_list(Config) -> @@ -1070,25 +1023,8 @@ add_table_copy_to_table_with_activated_checkpoint(Type,Config) -> ?verify_mnesia(Nodes, []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -backup_consistency(suite) -> - [ - interupted_install_fallback, - interupted_uninstall_fallback, - mnesia_down_during_backup_causes_switch, - mnesia_down_during_backup_causes_abort, - schema_transactions_during_backup - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -interupted_install_fallback(doc) -> - ["Verify that a interrupted install_fallback really", - "is performed on all nodes or none"]; - -interupted_install_fallback(suite) -> - [ - inst_fallback_process_dies, - fatal_when_inconsistency - ]. inst_fallback_process_dies(suite) -> []; @@ -1232,13 +1168,6 @@ is_running(Node, Shouldbe) -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -interupted_uninstall_fallback(doc) -> - ["Verify that a interrupted uninstall_fallback really", - "is performed on all nodes or none"]; -interupted_uninstall_fallback(suite) -> - [ - after_delete - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1371,17 +1300,6 @@ do_uninstall(Config,DebugPoint) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -mnesia_down_during_backup_causes_switch(doc) -> - ["Verify that an ongoing backup is not disturbed", - "even if the node hosting the replica that currently", - "is being backup'ed is stopped. The backup utility", - "is expected to switch over to another replica and", - "fulfill the backup."]; -mnesia_down_during_backup_causes_switch(suite) -> - [ - cause_switch_before, - cause_switch_after - ]. %%%%%%%%%%%%%%% @@ -1401,16 +1319,6 @@ cause_switch_after(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -mnesia_down_during_backup_causes_abort(doc) -> - ["Verify that an ongoing backup is aborted nicely", - "without leaving any backup file if the last replica", - "of a table becomes unavailable due to a node down", - "or some crash."]; -mnesia_down_during_backup_causes_abort(suite) -> - [ - cause_abort_before, - cause_abort_after - ]. %%%%%%%%%%%%%%%%%% @@ -1432,14 +1340,6 @@ cause_abort_after(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -schema_transactions_during_backup(doc) -> - ["Verify that an schema transactions does not", - "affect an ongoing backup."]; -schema_transactions_during_backup(suite) -> - [ - change_schema_before, - change_schema_after - ]. %%%%%%%%%%%%% diff --git a/lib/mnesia/test/mnesia_cost.erl b/lib/mnesia/test/mnesia_cost.erl index 54cb2b3064..3221f46f61 100644 --- a/lib/mnesia/test/mnesia_cost.erl +++ b/lib/mnesia/test/mnesia_cost.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. 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 diff --git a/lib/mnesia/test/mnesia_dirty_access_test.erl b/lib/mnesia/test/mnesia_dirty_access_test.erl index 5f9f2a9733..abbdab48c0 100644 --- a/lib/mnesia/test/mnesia_dirty_access_test.erl +++ b/lib/mnesia/test/mnesia_dirty_access_test.erl @@ -26,37 +26,72 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Evil dirty access, regardless of transaction scope.", - "Invoke all functions in the API and try to cover all legal uses", - "cases as well the illegal dito. This is a complement to the", - "other more explicit test cases."]; -all(suite) -> - [ - dirty_write, - dirty_read, - dirty_update_counter, - dirty_delete, - dirty_delete_object, - dirty_match_object, - dirty_index, - dirty_iter, - admin_tests - ]. +all() -> + [{group, dirty_write}, {group, dirty_read}, + {group, dirty_update_counter}, {group, dirty_delete}, + {group, dirty_delete_object}, + {group, dirty_match_object}, {group, dirty_index}, + {group, dirty_iter}, {group, admin_tests}]. + +groups() -> + [{dirty_write, [], + [dirty_write_ram, dirty_write_disc, + dirty_write_disc_only]}, + {dirty_read, [], + [dirty_read_ram, dirty_read_disc, + dirty_read_disc_only]}, + {dirty_update_counter, [], + [dirty_update_counter_ram, dirty_update_counter_disc, + dirty_update_counter_disc_only]}, + {dirty_delete, [], + [dirty_delete_ram, dirty_delete_disc, + dirty_delete_disc_only]}, + {dirty_delete_object, [], + [dirty_delete_object_ram, dirty_delete_object_disc, + dirty_delete_object_disc_only]}, + {dirty_match_object, [], + [dirty_match_object_ram, dirty_match_object_disc, + dirty_match_object_disc_only]}, + {dirty_index, [], + [{group, dirty_index_match_object}, + {group, dirty_index_read}, + {group, dirty_index_update}]}, + {dirty_index_match_object, [], + [dirty_index_match_object_ram, + dirty_index_match_object_disc, + dirty_index_match_object_disc_only]}, + {dirty_index_read, [], + [dirty_index_read_ram, dirty_index_read_disc, + dirty_index_read_disc_only]}, + {dirty_index_update, [], + [dirty_index_update_set_ram, + dirty_index_update_set_disc, + dirty_index_update_set_disc_only, + dirty_index_update_bag_ram, dirty_index_update_bag_disc, + dirty_index_update_bag_disc_only]}, + {dirty_iter, [], + [dirty_iter_ram, dirty_iter_disc, + dirty_iter_disc_only]}, + {admin_tests, [], + [del_table_copy_1, del_table_copy_2, del_table_copy_3, + add_table_copy_1, add_table_copy_2, add_table_copy_3, + add_table_copy_4, move_table_copy_1, move_table_copy_2, + move_table_copy_3, move_table_copy_4]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Write records dirty -dirty_write(suite) -> - [ - dirty_write_ram, - dirty_write_disc, - dirty_write_disc_only - ]. dirty_write_ram(suite) -> []; dirty_write_ram(Config) when is_list(Config) -> @@ -88,12 +123,6 @@ dirty_write(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Read records dirty -dirty_read(suite) -> - [ - dirty_read_ram, - dirty_read_disc, - dirty_read_disc_only - ]. dirty_read_ram(suite) -> []; dirty_read_ram(Config) when is_list(Config) -> @@ -137,12 +166,6 @@ dirty_read(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Update counter record dirty -dirty_update_counter(suite) -> - [ - dirty_update_counter_ram, - dirty_update_counter_disc, - dirty_update_counter_disc_only - ]. dirty_update_counter_ram(suite) -> []; dirty_update_counter_ram(Config) when is_list(Config) -> @@ -180,12 +203,6 @@ dirty_update_counter(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Delete record dirty -dirty_delete(suite) -> - [ - dirty_delete_ram, - dirty_delete_disc, - dirty_delete_disc_only - ]. dirty_delete_ram(suite) -> []; dirty_delete_ram(Config) when is_list(Config) -> @@ -223,12 +240,6 @@ dirty_delete(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Delete matching record dirty -dirty_delete_object(suite) -> - [ - dirty_delete_object_ram, - dirty_delete_object_disc, - dirty_delete_object_disc_only - ]. dirty_delete_object_ram(suite) -> []; dirty_delete_object_ram(Config) when is_list(Config) -> @@ -272,12 +283,6 @@ dirty_delete_object(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Read matching records dirty -dirty_match_object(suite) -> - [ - dirty_match_object_ram, - dirty_match_object_disc, - dirty_match_object_disc_only - ]. dirty_match_object_ram(suite) -> []; dirty_match_object_ram(Config) when is_list(Config) -> @@ -311,22 +316,10 @@ dirty_match_object(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dirty_index(suite) -> - [ - dirty_index_match_object, - dirty_index_read, - dirty_index_update - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Dirty read matching records by using an index -dirty_index_match_object(suite) -> - [ - dirty_index_match_object_ram, - dirty_index_match_object_disc, - dirty_index_match_object_disc_only - ]. dirty_index_match_object_ram(suite) -> []; dirty_index_match_object_ram(Config) when is_list(Config) -> @@ -364,12 +357,6 @@ dirty_index_match_object(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Read records by using an index -dirty_index_read(suite) -> - [ - dirty_index_read_ram, - dirty_index_read_disc, - dirty_index_read_disc_only - ]. dirty_index_read_ram(suite) -> []; dirty_index_read_ram(Config) when is_list(Config) -> @@ -413,19 +400,6 @@ dirty_index_read(Config, Storage) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dirty_index_update(suite) -> - [ - dirty_index_update_set_ram, - dirty_index_update_set_disc, - dirty_index_update_set_disc_only, - dirty_index_update_bag_ram, - dirty_index_update_bag_disc, - dirty_index_update_bag_disc_only - ]; -dirty_index_update(doc) -> - ["See Ticket OTP-2083, verifies that a table with a index is " - "update in the correct way i.e. the index finds the correct " - "records after a update"]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dirty_index_update_set_ram(suite) -> []; @@ -631,12 +605,6 @@ dirty_index_update_bag(Config, Storage) -> %% Dirty iteration %% dirty_slot, dirty_first, dirty_next -dirty_iter(suite) -> - [ - dirty_iter_ram, - dirty_iter_disc, - dirty_iter_disc_only - ]. dirty_iter_ram(suite) -> []; dirty_iter_ram(Config) when is_list(Config) -> @@ -700,21 +668,6 @@ all_nexts(Tab, PrevKey) -> [PrevKey] ++ all_nexts(Tab, Key). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -admin_tests(doc) -> - ["Verifies that dirty operations work during schema operations"]; - -admin_tests(suite) -> - [del_table_copy_1, - del_table_copy_2, - del_table_copy_3, - add_table_copy_1, - add_table_copy_2, - add_table_copy_3, - add_table_copy_4, - move_table_copy_1, - move_table_copy_2, - move_table_copy_3, - move_table_copy_4]. update_trans(Tab, Key, Acc) -> Update = diff --git a/lib/mnesia/test/mnesia_durability_test.erl b/lib/mnesia/test/mnesia_durability_test.erl index b917b0ca40..55205d1222 100644 --- a/lib/mnesia/test/mnesia_durability_test.erl +++ b/lib/mnesia/test/mnesia_durability_test.erl @@ -28,47 +28,54 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -record(test_rec,{key,val}). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify durability", - "Verify that the effects of committed transactions are durable.", - "The content of the tables tables must be restored at startup."]; -all(suite) -> - [ - load_tables, - durability_of_dump_tables, +all() -> + [{group, load_tables}, + {group, durability_of_dump_tables}, durability_of_disc_copies, - durability_of_disc_only_copies - ]. + durability_of_disc_only_copies]. + +groups() -> + [{load_tables, [], + [load_latest_data, load_local_contents_directly, + load_directly_when_all_are_ram_copiesA, + load_directly_when_all_are_ram_copiesB, + {group, late_load_when_all_are_ram_copies_on_ram_nodes}, + load_when_last_replica_becomes_available, + load_when_we_have_down_from_all_other_replica_nodes, + late_load_transforms_into_disc_load, + late_load_leads_to_hanging, + force_load_when_nobody_intents_to_load, + force_load_when_someone_has_decided_to_load, + force_load_when_someone_else_already_has_loaded, + force_load_when_we_has_loaded, + force_load_on_a_non_local_table, + force_load_when_the_table_does_not_exist, + {group, load_tables_with_master_tables}]}, + {late_load_when_all_are_ram_copies_on_ram_nodes, [], + [late_load_when_all_are_ram_copies_on_ram_nodes1, + late_load_when_all_are_ram_copies_on_ram_nodes2]}, + {load_tables_with_master_tables, [], + [master_nodes, starting_master_nodes, + master_on_non_local_tables, + remote_force_load_with_local_master_node]}, + {durability_of_dump_tables, [], + [dump_ram_copies, dump_disc_copies, dump_disc_only]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -load_tables(doc) -> - ["Try to provoke all kinds of table load scenarios."]; -load_tables(suite) -> - [ - load_latest_data, - load_local_contents_directly, - load_directly_when_all_are_ram_copiesA, - load_directly_when_all_are_ram_copiesB, - late_load_when_all_are_ram_copies_on_ram_nodes, - load_when_last_replica_becomes_available, - load_when_we_have_down_from_all_other_replica_nodes, - late_load_transforms_into_disc_load, - late_load_leads_to_hanging, - force_load_when_nobody_intents_to_load, - force_load_when_someone_has_decided_to_load, - force_load_when_someone_else_already_has_loaded, - force_load_when_we_has_loaded, - force_load_on_a_non_local_table, - force_load_when_the_table_does_not_exist, - load_tables_with_master_tables - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load_latest_data(doc) -> @@ -284,13 +291,6 @@ load_directly_when_all_are_ram_copiesB(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -late_load_when_all_are_ram_copies_on_ram_nodes(doc) -> - ["Load of ram_copies tables when all replicas resides on disc less nodes"]; -late_load_when_all_are_ram_copies_on_ram_nodes(suite) -> - [ - late_load_when_all_are_ram_copies_on_ram_nodes1, - late_load_when_all_are_ram_copies_on_ram_nodes2 - ]. late_load_when_all_are_ram_copies_on_ram_nodes1(suite) -> []; late_load_when_all_are_ram_copies_on_ram_nodes1(Config) when is_list(Config) -> @@ -916,22 +916,6 @@ force_load_when_the_table_does_not_exist(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -load_tables_with_master_tables(doc) -> - ["Verifies the semantics of different master nodes settings", - "The semantics should be:", - "1. Mnesia downs, Normally decides from where mnesia should load tables", - "2. Master tables (overrides mnesia downs) ", - "3. Force load (overrides Master tables) ", - "--- 1st from active master nodes", - "--- 2nd from active nodes", - "--- 3rd get local copy (if ram create new one)" - ]; - -load_tables_with_master_tables(suite) -> - [master_nodes, - starting_master_nodes, - master_on_non_local_tables, - remote_force_load_with_local_master_node]. -define(SDwrite(Tup), fun() -> mnesia:write(Tup) end). @@ -1156,13 +1140,6 @@ remote_force_load_with_local_master_node(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -durability_of_dump_tables(doc) -> - [ "Verify that all tables contain the correct data when Mnesia", - "is restarted and tables are loaded from disc to recover", - " their previous contents. " ]; -durability_of_dump_tables(suite) -> [dump_ram_copies, - dump_disc_copies, - dump_disc_only]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/mnesia/test/mnesia_evil_backup.erl b/lib/mnesia/test/mnesia_evil_backup.erl index bbbebeb02c..63f4146d98 100644 --- a/lib/mnesia/test/mnesia_evil_backup.erl +++ b/lib/mnesia/test/mnesia_evil_backup.erl @@ -35,31 +35,30 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Checking all the functionality regarding ", - "to the backup and different ", - "kinds of restore and fallback interface"]; - -all(suite) -> - [ - backup, - bad_backup, - global_backup_checkpoint, - restore_tables, - traverse_backup, +all() -> + [backup, bad_backup, global_backup_checkpoint, + {group, restore_tables}, traverse_backup, selective_backup_checkpoint, - incremental_backup_checkpoint, -%% local_backup_checkpoint, - install_fallback, - uninstall_fallback, - local_fallback, - sops_with_checkpoint - ]. + incremental_backup_checkpoint, install_fallback, + uninstall_fallback, local_fallback, + sops_with_checkpoint]. + +groups() -> + [{restore_tables, [], + [restore_errors, restore_clear, restore_keep, + restore_recreate, restore_clear_ram]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + backup(doc) -> ["Checking the interface to the function backup", "We don't check that the backups can be used here", @@ -132,17 +131,6 @@ global_backup_checkpoint(Config) when is_list(Config) -> ?match(ok, file:delete(File2)), ?verify_mnesia(Nodes, []). -restore_tables(doc) -> - ["Tests the interface of restore"]; - -restore_tables(suite) -> - [ - restore_errors, - restore_clear, - restore_keep, - restore_recreate, - restore_clear_ram - ]. restore_errors(suite) -> []; restore_errors(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_evil_coverage_test.erl b/lib/mnesia/test/mnesia_evil_coverage_test.erl index 4fbf1b4003..668eba176f 100644 --- a/lib/mnesia/test/mnesia_evil_coverage_test.erl +++ b/lib/mnesia/test/mnesia_evil_coverage_test.erl @@ -30,45 +30,54 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Evil usage of the API.", - "Invoke all functions in the API and try to cover all legal uses", - "cases as well the illegal dito. This is a complement to the", - "other more explicit test cases."]; -all(suite) -> - [ - system_info, - table_info, - error_description, - db_node_lifecycle, - evil_delete_db_node, - start_and_stop, - checkpoint, - table_lifecycle, - add_copy_conflict, - add_copy_when_going_down, - replica_management, - schema_availability, - local_content, - table_access_modifications, - replica_location, - table_sync, - user_properties, - unsupp_user_props, - record_name, - snmp_access, - subscriptions, - iteration, - debug_support, - sorted_ets, +all() -> + [system_info, table_info, error_description, + db_node_lifecycle, evil_delete_db_node, start_and_stop, + checkpoint, table_lifecycle, add_copy_conflict, + add_copy_when_going_down, replica_management, + schema_availability, local_content, + {group, table_access_modifications}, replica_location, + {group, table_sync}, user_properties, unsupp_user_props, + {group, record_name}, {group, snmp_access}, + {group, subscriptions}, {group, iteration}, + {group, debug_support}, sorted_ets, {mnesia_dirty_access_test, all}, {mnesia_trans_access_test, all}, - {mnesia_evil_backup, all} - ]. + {mnesia_evil_backup, all}]. + +groups() -> + [{table_access_modifications, [], + [change_table_access_mode, change_table_load_order, + set_master_nodes, offline_set_master_nodes]}, + {table_sync, [], + [dump_tables, dump_log, wait_for_tables, + force_load_table]}, + {snmp_access, [], + [snmp_open_table, snmp_close_table, snmp_get_next_index, + snmp_get_row, snmp_get_mnesia_key, snmp_update_counter, + snmp_order]}, + {subscriptions, [], + [subscribe_standard, subscribe_extended]}, + {iteration, [], [foldl]}, + {debug_support, [], + [info, schema_0, schema_1, view_0, view_1, view_2, + lkill, kill]}, + {record_name, [], [{group, record_name_dirty_access}]}, + {record_name_dirty_access, [], + [record_name_dirty_access_ram, + record_name_dirty_access_disc, + record_name_dirty_access_disc_only]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -910,13 +919,6 @@ local_content(Config) when is_list(Config) -> ?verify_mnesia(Nodes, []). -table_access_modifications(suite) -> - [ - change_table_access_mode, - change_table_load_order, - set_master_nodes, - offline_set_master_nodes - ]. change_table_access_mode(suite) -> []; change_table_access_mode(Config) when is_list(Config) -> @@ -1103,13 +1105,6 @@ offline_set_master_nodes(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Syncronize table with log or disc %% -table_sync(suite) -> - [ - dump_tables, - dump_log, - wait_for_tables, - force_load_table - ]. %% Dump ram tables on disc dump_tables(suite) -> []; @@ -1359,19 +1354,6 @@ unsupp_user_props(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -snmp_access(doc) -> - ["Make Mnesia table accessible via SNMP"]; - -snmp_access(suite) -> - [ - snmp_open_table, - snmp_close_table, - snmp_get_next_index, - snmp_get_row, - snmp_get_mnesia_key, - snmp_update_counter, - snmp_order - ]. snmp_open_table(suite) -> []; snmp_open_table(Config) when is_list(Config) -> @@ -1779,11 +1761,6 @@ get_keys(Tab, Key) -> -record(tab, {i, e1, e2}). % Simple test table -subscriptions(doc) -> - ["Test the event subscription mechanism"]; -subscriptions(suite) -> - [subscribe_standard, - subscribe_extended]. subscribe_extended(doc) -> ["Test the extended set of events, test with and without checkpoints. "]; @@ -2009,10 +1986,6 @@ recv_event() -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -iteration(doc) -> - ["Verify that the iteration functions works as expected"]; -iteration(suite) -> - [foldl]. foldl(suite) -> @@ -2074,19 +2047,6 @@ sort_res(Else) -> Else. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -debug_support(doc) -> - ["Check that the debug support has not decayed."]; -debug_support(suite) -> - [ - info, - schema_0, - schema_1, - view_0, - view_1, - view_2, - lkill, - kill - ]. info(suite) -> []; info(Config) when is_list(Config) -> @@ -2173,21 +2133,7 @@ kill(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -record_name(doc) -> - ["Verify that record names may be differ from the name of ", - "the hosting table. Check at least access, restore, " - "registry, subscriptions and traveres_backup"]; -record_name(suite) -> - [ - record_name_dirty_access - ]. - -record_name_dirty_access(suite) -> - [ - record_name_dirty_access_ram, - record_name_dirty_access_disc, - record_name_dirty_access_disc_only - ]. + record_name_dirty_access_ram(suite) -> []; diff --git a/lib/mnesia/test/mnesia_examples_test.erl b/lib/mnesia/test/mnesia_examples_test.erl index d1b1409c9d..373d47a05a 100644 --- a/lib/mnesia/test/mnesia_examples_test.erl +++ b/lib/mnesia/test/mnesia_examples_test.erl @@ -26,8 +26,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(init(N, Config), mnesia_test_lib:prepare_test_case([{init_test_case, [mnesia]}, @@ -61,16 +61,21 @@ opt_load(Mod) -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Run all examples mentioned in the documentation", - "Are really all examples covered?"]; -all(suite) -> - [ - bup, - company, - meter, - tpcb - ]. +all() -> + [bup, company, meter, {group, tpcb}]. + +groups() -> + [{tpcb, [], + [replica_test, sticky_replica_test, dist_test, + conflict_test, frag_test, frag2_test, remote_test, + remote_frag2_test]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% bup(doc) -> ["Run the backup examples in bup.erl"]; @@ -85,19 +90,6 @@ company(doc) -> ["Run the company examples in company.erl and company_o.erl"]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -tpcb(doc) -> - ["Run the sample configurations of the stress tests in mnesia_tpcb.erl"]; -tpcb(suite) -> - [ - replica_test, - sticky_replica_test, - dist_test, - conflict_test, - frag_test, - frag2_test, - remote_test, - remote_frag2_test - ]. replica_test(suite) -> []; replica_test(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_frag_test.erl b/lib/mnesia/test/mnesia_frag_test.erl index 4add340254..d3f6762af7 100644 --- a/lib/mnesia/test/mnesia_frag_test.erl +++ b/lib/mnesia/test/mnesia_frag_test.erl @@ -27,8 +27,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(match_dist(ExpectedRes, Expr), case ?match(ExpectedRes, Expr) of @@ -37,34 +37,29 @@ fin_per_testcase(Func, Conf) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify the functionality of fragmented tables"]; -all(suite) -> - [ - light, - medium - ]. - -light(suite) -> - [ - nice, - evil - ]. - -medium(suite) -> - [ - consistency - ]. +all() -> + [{group, light}, {group, medium}]. + +groups() -> + [{light, [], [{group, nice}, {group, evil}]}, + {medium, [], [consistency]}, + {nice, [], + [nice_single, nice_multi, nice_access, iter_access]}, + {evil, [], + [evil_create, evil_delete, evil_change, evil_combine, + evil_loop, evil_delete_db_node]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -nice(suite) -> - [ - nice_single, - nice_multi, - nice_access, - iter_access - ]. nice_single(suite) -> []; nice_single(Config) when is_list(Config) -> @@ -503,17 +498,6 @@ consistency(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -evil(doc) -> - ["Evil coverage of fragmentation API."]; -evil(suite) -> - [ - evil_create, - evil_delete, - evil_change, - evil_combine, - evil_loop, - evil_delete_db_node - ]. evil_create(suite) -> []; evil_create(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_inconsistent_database_test.erl b/lib/mnesia/test/mnesia_inconsistent_database_test.erl index b19cd8e01b..c4b6257d5b 100644 --- a/lib/mnesia/test/mnesia_inconsistent_database_test.erl +++ b/lib/mnesia/test/mnesia_inconsistent_database_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. 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 diff --git a/lib/mnesia/test/mnesia_install_test.erl b/lib/mnesia/test/mnesia_install_test.erl index 42a2a19f37..5d55fcac0e 100644 --- a/lib/mnesia/test/mnesia_install_test.erl +++ b/lib/mnesia/test/mnesia_install_test.erl @@ -27,29 +27,22 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Run some small but demanding test cases in order to verify", - "that the basic functionality in Mnesia still works.", - "", - "Try some very simple things to begin with and increase the", - "difficulty stepwise. This test suite should be run before", - "all the others if you expect to find bugs.", - "", - "The function mnesia_install_test:silly() does not use the whole", - "infra structure of the test suite. Invoke it on a single node to", - "begin with. If that works, proceed with pong = net_adm:ping(SomeOtherNode)", - "and rerun silly() in order to perform some distributed tests."]; -all(suite) -> - [ - silly_durability, - silly_move, - silly_upgrade - %,stress - ]. +all() -> + [silly_durability, silly_move, silly_upgrade]. + +groups() -> + [{stress, [], stress_cases()}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Stepwise of more and more advanced features @@ -86,11 +79,11 @@ silly2(Config) when is_list(Config) -> [schema])), MoveRes = silly_move(Config), UpgradeRes = silly_upgrade(Config), - StressRes = [StressFun(F) || F <- stress(suite)], + StressRes = [StressFun(F) || F <- stress_cases()], ?verify_mnesia([Node2], []), [Res, MoveRes, UpgradeRes] ++ StressRes; _ -> - StressRes = [StressFun(F) || F <- stress(suite)], + StressRes = [StressFun(F) || F <- stress_cases()], ?warning("Too few nodes. Perform net_adm:ping(OtherNode) " "and rerun!!!~n", []), [Res | StressRes] @@ -286,13 +279,9 @@ transform_some_records(Tab1, _Tab2, Old) -> lists:sort(lists:zf(Filter, Old)). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -stress(doc) -> - ["Stress the system a little"]; -stress(suite) -> - [ - conflict, - dist - ]. + +stress_cases() -> +[conflict, dist]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dist(doc) -> diff --git a/lib/mnesia/test/mnesia_isolation_test.erl b/lib/mnesia/test/mnesia_isolation_test.erl index 4fc6e8fe58..3273bc4d40 100644 --- a/lib/mnesia/test/mnesia_isolation_test.erl +++ b/lib/mnesia/test/mnesia_isolation_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2010. 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 @@ -27,46 +27,53 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify the isolation property.", - "Operations of concurrent transactions must yield results which", - "are indistinguishable from the results which would be obtained by", - "forcing each transaction to be serially executed to completion in", - "some order. This means that repeated reads of the same records", - "within any committed transaction must have returned identical", - "data when run concurrently with any mix of arbitary transactions.", - "Updates in one transaction must not be visible in any other", - "transaction before the transaction has been committed."]; -all(suite) -> - [ - locking, - visibility - ]. +all() -> + [{group, locking}, {group, visibility}]. + +groups() -> + [{locking, [], + [no_conflict, simple_queue_conflict, + advanced_queue_conflict, simple_deadlock_conflict, + advanced_deadlock_conflict, lock_burst, + {group, sticky_locks}, {group, unbound_locking}, + {group, admin_conflict}, nasty]}, + {sticky_locks, [], [basic_sticky_functionality]}, + {unbound_locking, [], [unbound1, unbound2]}, + {admin_conflict, [], + [create_table, delete_table, move_table_copy, + add_table_index, del_table_index, transform_table, + snmp_open_table, snmp_close_table, + change_table_copy_type, change_table_access, + add_table_copy, del_table_copy, dump_tables, + {group, extra_admin_tests}]}, + {extra_admin_tests, [], + [del_table_copy_1, del_table_copy_2, del_table_copy_3, + add_table_copy_1, add_table_copy_2, add_table_copy_3, + add_table_copy_4, move_table_copy_1, move_table_copy_2, + move_table_copy_3, move_table_copy_4]}, + {visibility, [], + [dirty_updates_visible_direct, + dirty_reads_regardless_of_trans, + trans_update_invisibible_outside_trans, + trans_update_visible_inside_trans, write_shadows, + delete_shadows, write_delete_shadows_bag, + write_delete_shadows_bag2, {group, iteration}, + shadow_search, snmp_shadows]}, + {removed_resources, [], [rr_kill_copy]}, + {iteration, [], [foldl, first_next]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -locking(doc) -> - ["Verify locking semantics for various configurations", - " NoLock = lock_funs(no_lock, any_granularity)", - " SharedLock = lock_funs(shared_lock, any_granularity)", - " ExclusiveLock = lock_funs(exclusive_lock, any_granularity)", - " AnyLock = lock_funs(any_lock, any_granularity)"]; -locking(suite) -> - [no_conflict, - simple_queue_conflict, - advanced_queue_conflict, - simple_deadlock_conflict, - advanced_deadlock_conflict, - lock_burst, - sticky_locks, - unbound_locking, - admin_conflict, -%% removed_resources, - nasty - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -431,14 +438,6 @@ burst_incr(Tab, Father) -> Father ! burst_incr_done. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -sticky_locks(doc) -> - ["Simple Tests of sticky locks"]; - -sticky_locks(suite) -> - [ - basic_sticky_functionality - %% Needs to be expandand a little bit further - ]. basic_sticky_functionality(suite) -> []; basic_sticky_functionality(Config) when is_list(Config) -> @@ -519,12 +518,6 @@ get_held() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -unbound_locking(suite) -> - [unbound1, unbound2]; - -unbound_locking(doc) -> - ["Check that mnesia handles unbound key variables, GPRS bug." - "Ticket id: OTP-3342"]. unbound1(suite) -> []; unbound1(Config) when is_list(Config) -> @@ -637,25 +630,6 @@ receiver() -> end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -admin_conflict(doc) -> - ["Provoke lock conflicts with schema transactions and checkpoints."]; -admin_conflict(suite) -> - [ - create_table, - delete_table, - move_table_copy, - add_table_index, - del_table_index, - transform_table, - snmp_open_table, - snmp_close_table, - change_table_copy_type, - change_table_access, - add_table_copy, - del_table_copy, - dump_tables, - extra_admin_tests - ]. create_table(suite) -> []; create_table(Config) when is_list(Config) -> @@ -1088,18 +1062,6 @@ insert(Tab, N) when N > 0 -> ok = mnesia:sync_dirty(fun() -> mnesia:write({Tab, N, N, 0}) end), insert(Tab, N-1). -extra_admin_tests(suite) -> - [del_table_copy_1, - del_table_copy_2, - del_table_copy_3, - add_table_copy_1, - add_table_copy_2, - add_table_copy_3, - add_table_copy_4, - move_table_copy_1, - move_table_copy_2, - move_table_copy_3, - move_table_copy_4]. update_own(Tab, Key, Acc) -> Update = @@ -1347,23 +1309,6 @@ move_table(CallFrom, FromNode, ToNode, [Node1, Node2, Node3], Def) -> ?verify_mnesia([Node1, Node2, Node3], []). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -visibility(doc) -> - ["Verify the visibility semantics for various configurations"]; -visibility(suite) -> - [ - dirty_updates_visible_direct, - dirty_reads_regardless_of_trans, - trans_update_invisibible_outside_trans, - trans_update_visible_inside_trans, - write_shadows, - delete_shadows, -%% delete_shadows2, - write_delete_shadows_bag, - write_delete_shadows_bag2, - iteration, - shadow_search, - snmp_shadows - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dirty_updates_visible_direct(doc) -> @@ -1969,10 +1914,6 @@ shadow_search(Config) when is_list(Config) -> ?verify_mnesia([Node1], []). -removed_resources(suite) -> - [rr_kill_copy]; -removed_resources(doc) -> - ["Verify that the locking behave when resources are removed"]. rr_kill_copy(suite) -> []; rr_kill_copy(Config) when is_list(Config) -> @@ -2138,11 +2079,6 @@ get_exit(Pid) -> ?error("Timeout EXIT ~p~n", [Pid]) end. -iteration(doc) -> - ["Verify that the updates before/during iteration are visable " - "and that the order is preserved for ordered_set tables"]; -iteration(suite) -> - [foldl,first_next]. foldl(doc) -> [""]; diff --git a/lib/mnesia/test/mnesia_measure_test.erl b/lib/mnesia/test/mnesia_measure_test.erl index fbf804dbec..e63689d83a 100644 --- a/lib/mnesia/test/mnesia_measure_test.erl +++ b/lib/mnesia/test/mnesia_measure_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. 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 @@ -27,8 +27,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(init(N, Config), mnesia_test_lib:prepare_test_case([{init_test_case, [mnesia]}, @@ -37,101 +37,62 @@ fin_per_testcase(Func, Conf) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Measure various aspects of Mnesia", - "Verify that Mnesia has predictable response times,", - "that the transaction system has fair algoritms,", - "resource consumption, scalabilitym system limits etc.", - "Perform some benchmarks."]; -all(suite) -> - [ - prediction, - consumption, - scalability, - benchmarks - ]. +all() -> + [{group, prediction}, {group, consumption}, + {group, scalability}, {group, benchmarks}]. + +groups() -> + [{prediction, [], + [reader_disturbed_by_node_down, + writer_disturbed_by_node_down, + reader_disturbed_by_node_up, + writer_disturbed_by_node_up, + reader_disturbed_by_schema_ops, + writer_disturbed_by_schema_ops, + reader_disturbed_by_checkpoint, + writer_disturbed_by_checkpoint, + reader_disturbed_by_dump_log, + writer_disturbed_by_dump_log, + reader_disturbed_by_backup, writer_disturbed_by_backup, + reader_disturbed_by_restore, + writer_disturbed_by_restore, {group, fairness}]}, + {fairness, [], + [reader_competing_with_reader, + reader_competing_with_writer, + writer_competing_with_reader, + writer_competing_with_writer]}, + {consumption, [], + [measure_resource_consumption, + determine_resource_leakage]}, + {scalability, [], + [determine_system_limits, performance_at_min_config, + performance_at_max_config, performance_at_full_load, + resource_consumption_at_min_config, + resource_consumption_at_max_config, + resource_consumption_at_full_load]}, + {benchmarks, [], + [{group, meter}, cost, dbn_meters, + measure_all_api_functions, {group, tpcb}, + mnemosyne_vs_mnesia_kernel]}, + {tpcb, [], [ram_tpcb, disc_tpcb, disc_only_tpcb]}, + {meter, [], [ram_meter, disc_meter, disc_only_meter]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -prediction(doc) -> - ["The system must have predictable response times.", - "The maintenance of the system should not impact on the", - "availability. Make sure that the response times does not vary too", - "much from the undisturbed normal usage.", - "Verify that deadlocks never occurs."]; -prediction(suite) -> - [ - reader_disturbed_by_node_down, - writer_disturbed_by_node_down, - reader_disturbed_by_node_up, - writer_disturbed_by_node_up, - reader_disturbed_by_schema_ops, - writer_disturbed_by_schema_ops, - reader_disturbed_by_checkpoint, - writer_disturbed_by_checkpoint, - reader_disturbed_by_dump_log, - writer_disturbed_by_dump_log, - reader_disturbed_by_backup, - writer_disturbed_by_backup, - reader_disturbed_by_restore, - writer_disturbed_by_restore, - fairness - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -fairness(doc) -> - ["Verify that the transaction system behaves fair, even under intense", - "stress. Combine different access patterns (transaction profiles)", - "in order to verify that concurrent applications gets a fair share", - "of the database resource. Verify that starvation never may occur."]; -fairness(suite) -> - [ - reader_competing_with_reader, - reader_competing_with_writer, - writer_competing_with_reader, - writer_competing_with_writer - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -consumption(doc) -> - ["Measure the resource consumption and publish the outcome. Make", - "sure that resources are released after failures."]; -consumption(suite) -> - [ - measure_resource_consumption, - determine_resource_leakage - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -scalability(doc) -> - ["Try out where the system limits are. We must at least meet the", - "documented system limits.", - "Redo the performance meters for various configurations and load,", - "especially near system limits."]; -scalability(suite) -> - [ - determine_system_limits, - performance_at_min_config, - performance_at_max_config, - performance_at_full_load, - resource_consumption_at_min_config, - resource_consumption_at_max_config, - resource_consumption_at_full_load - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -benchmarks(doc) -> - ["Measure typical database operations and publish them. Try to", - "verify that new releases of Mnesia always outperforms old", - "releases, or at least that the meters does not get worse."]; -benchmarks(suite) -> - [ - meter, - cost, - dbn_meters, - measure_all_api_functions, - tpcb, - mnemosyne_vs_mnesia_kernel - ]. dbn_meters(suite) -> []; dbn_meters(Config) when is_list(Config) -> @@ -139,12 +100,6 @@ dbn_meters(Config) when is_list(Config) -> ?match(ok, mnesia_dbn_meters:start()), ok. -tpcb(suite) -> - [ - ram_tpcb, - disc_tpcb, - disc_only_tpcb - ]. tpcb(ReplicaType, Config) -> HarakiriDelay = {tc_timeout, timer:minutes(20)}, @@ -171,12 +126,6 @@ disc_only_tpcb(suite) -> []; disc_only_tpcb(Config) when is_list(Config) -> tpcb(disc_only_copies, Config). -meter(suite) -> - [ - ram_meter, - disc_meter, - disc_only_meter - ]. ram_meter(suite) -> []; ram_meter(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_nice_coverage_test.erl b/lib/mnesia/test/mnesia_nice_coverage_test.erl index aa9339f6b9..78eab67b11 100644 --- a/lib/mnesia/test/mnesia_nice_coverage_test.erl +++ b/lib/mnesia/test/mnesia_nice_coverage_test.erl @@ -28,16 +28,22 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Test nice usage of the entire API", - "Invoke all functions in the API, at least once.", - "Try to verify that all functions exists and that they perform", - "reasonable things when used in the most simple way."]; -all(suite) -> [nice]. +all() -> + [nice]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + nice(doc) -> [""]; nice(suite) -> []; diff --git a/lib/mnesia/test/mnesia_qlc_test.erl b/lib/mnesia/test/mnesia_qlc_test.erl index 1e4f776c7d..141de71d01 100644 --- a/lib/mnesia/test/mnesia_qlc_test.erl +++ b/lib/mnesia/test/mnesia_qlc_test.erl @@ -22,7 +22,7 @@ -compile(export_all). --export([all/1]). +-export([all/0,groups/0,init_per_group/2,end_per_group/2]). -include("mnesia_test_lib.hrl"). -include_lib("stdlib/include/qlc.hrl"). @@ -31,20 +31,34 @@ init_per_testcase(Func, Conf) -> setup(Conf), mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -all(doc) -> - ["Test that the qlc mnesia interface works as expected."]; -all(suite) -> +all() -> case code:which(qlc) of non_existing -> []; - _ -> - all_qlc() + _ -> all_qlc() end. -all_qlc() -> - [dirty, trans, frag, info, mnesia_down]. +groups() -> + [{dirty, [], + [dirty_nice_ram_copies, dirty_nice_disc_copies, + dirty_nice_disc_only_copies]}, + {trans, [], + [trans_nice_ram_copies, trans_nice_disc_copies, + trans_nice_disc_only_copies, {group, atomic}]}, + {atomic, [], [atomic_eval]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +all_qlc() -> + [{group, dirty}, {group, trans}, frag, info, + mnesia_down]. init_testcases(Type,Config) -> Nodes = [N1,N2] = ?acquire_nodes(2, Config), @@ -59,10 +73,6 @@ init_testcases(Type,Config) -> Nodes. %% Test cases -dirty(suite) -> - [dirty_nice_ram_copies, - dirty_nice_disc_copies, - dirty_nice_disc_only_copies]. dirty_nice_ram_copies(Setup) -> dirty_nice(Setup,ram_copies). dirty_nice_disc_copies(Setup) -> dirty_nice(Setup,disc_copies). @@ -109,12 +119,6 @@ dirty_nice(Config, Type) when is_list(Config) -> end, ?verify_mnesia(Ns, []). -trans(suite) -> - [trans_nice_ram_copies, - trans_nice_disc_copies, - trans_nice_disc_only_copies, - atomic - ]. trans_nice_ram_copies(Setup) -> trans_nice(Setup,ram_copies). trans_nice_disc_copies(Setup) -> trans_nice(Setup,disc_copies). @@ -182,9 +186,7 @@ recs() -> "-record(b, {k,v}). " "-record(k, {t,v}). " >>. - -atomic(suite) -> [atomic_eval]; -atomic(doc) -> []. + atomic_eval(suite) -> []; atomic_eval(doc) -> []; diff --git a/lib/mnesia/test/mnesia_recovery_test.erl b/lib/mnesia/test/mnesia_recovery_test.erl index f6ecf2ce2e..625e6e824c 100644 --- a/lib/mnesia/test/mnesia_recovery_test.erl +++ b/lib/mnesia/test/mnesia_recovery_test.erl @@ -28,8 +28,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(receive_messages(Msgs), receive_messages(Msgs, ?FILE, ?LINE)). @@ -42,34 +42,93 @@ fin_per_testcase(Func, Conf) -> -endif. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify recoverability", - "Verify that the effects of committed transactions are preserved", - "after recovery from system failures. It must be possible to", - "restore the tables to a consistent state on a node, from (any kind", - "of) replica on other nodes as well as from local disk on the failed", - "node. The system must also recover from instantaneous", - "interruption causing disk files to not be completely synchronized."]; - -all(suite) -> - [ - mnesia_down, - explicit_stop, - coord_dies, - schema_trans, - async_dirty, - sync_dirty, - sym_trans, - asym_trans, - after_full_disc_partition, - after_corrupt_files, - disc_less, - garb_decision, - system_upgrade - ]. - -schema_trans(suite) -> - [{mnesia_schema_recovery_test, all}]. +all() -> + [{group, mnesia_down}, {group, explicit_stop}, + coord_dies, {group, schema_trans}, {group, async_dirty}, + {group, sync_dirty}, {group, sym_trans}, + {group, asym_trans}, after_full_disc_partition, + {group, after_corrupt_files}, disc_less, garb_decision, + system_upgrade]. + +groups() -> + [{schema_trans, [], + [{mnesia_schema_recovery_test, all}]}, + {mnesia_down, [], + [{group, mnesia_down_during_startup}, + {group, master_node_tests}, {group, read_during_down}, + {group, with_checkpoint}, delete_during_start]}, + {master_node_tests, [], + [no_master_2, no_master_3, one_master_2, one_master_3, + two_master_2, two_master_3, all_master_2, + all_master_3]}, + {read_during_down, [], + [dirty_read_during_down, trans_read_during_down]}, + {mnesia_down_during_startup, [], + [mnesia_down_during_startup_disk_ram, + mnesia_down_during_startup_init_ram, + mnesia_down_during_startup_init_disc, + mnesia_down_during_startup_init_disc_only, + mnesia_down_during_startup_tm_ram, + mnesia_down_during_startup_tm_disc, + mnesia_down_during_startup_tm_disc_only]}, + {with_checkpoint, [], + [with_checkpoint_same, with_checkpoint_other]}, + {explicit_stop, [], [explicit_stop_during_snmp]}, + {sym_trans, [], + [sym_trans_before_commit_kill_coord_node, + sym_trans_before_commit_kill_coord_pid, + sym_trans_before_commit_kill_part_after_ask, + sym_trans_before_commit_kill_part_before_ask, + sym_trans_after_commit_kill_coord_node, + sym_trans_after_commit_kill_coord_pid, + sym_trans_after_commit_kill_part_after_ask, + sym_trans_after_commit_kill_part_do_commit_pre, + sym_trans_after_commit_kill_part_do_commit_post]}, + {sync_dirty, [], + [sync_dirty_pre_kill_part, + sync_dirty_pre_kill_coord_node, + sync_dirty_pre_kill_coord_pid, + sync_dirty_post_kill_part, + sync_dirty_post_kill_coord_node, + sync_dirty_post_kill_coord_pid]}, + {async_dirty, [], + [async_dirty_pre_kill_part, + async_dirty_pre_kill_coord_node, + async_dirty_pre_kill_coord_pid, + async_dirty_post_kill_part, + async_dirty_post_kill_coord_node, + async_dirty_post_kill_coord_pid]}, + {asym_trans, [], + [asym_trans_kill_part_ask, + asym_trans_kill_part_commit_vote, + asym_trans_kill_part_pre_commit, + asym_trans_kill_part_log_commit, + asym_trans_kill_part_do_commit, + asym_trans_kill_coord_got_votes, + asym_trans_kill_coord_pid_got_votes, + asym_trans_kill_coord_log_commit_rec, + asym_trans_kill_coord_pid_log_commit_rec, + asym_trans_kill_coord_log_commit_dec, + asym_trans_kill_coord_pid_log_commit_dec, + asym_trans_kill_coord_rec_acc_pre_commit_log_commit, + asym_trans_kill_coord_pid_rec_acc_pre_commit_log_commit, + asym_trans_kill_coord_rec_acc_pre_commit_done_commit, + asym_trans_kill_coord_pid_rec_acc_pre_commit_done_commit]}, + {after_corrupt_files, [], + [after_corrupt_files_decision_log_head, + after_corrupt_files_decision_log_tail, + after_corrupt_files_latest_log_head, + after_corrupt_files_latest_log_tail, + after_corrupt_files_table_dat_head, + after_corrupt_files_table_dat_tail, + after_corrupt_files_schema_dat_head, + after_corrupt_files_schema_dat_tail]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. tpcb_config(ReplicaType, _NodeConfig, Nodes) -> [{n_branches, 5}, @@ -83,30 +142,7 @@ tpcb_config(ReplicaType, _NodeConfig, Nodes) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -mnesia_down(doc) -> - [" Various tests about recovery when mnesia goes down on one or several nodes."]; -mnesia_down(suite) -> - [ - mnesia_down_during_startup, - master_node_tests, - read_during_down, - with_checkpoint, - delete_during_start - ]. - -master_node_tests(doc) -> - ["Verify that mnesia loads the correct data after it has been down, regarding master node settings."]; -master_node_tests(suite) -> - [ - no_master_2, - no_master_3, - one_master_2, - one_master_3, - two_master_2, - two_master_3, - all_master_2, - all_master_3 - ]. + no_master_2(suite) -> []; no_master_2(Config) when is_list(Config) -> mnesia_down_2(no, Config). @@ -251,13 +287,6 @@ mnesia_down_3(Masters, Config) -> ?verify_mnesia(Nodes, []). -read_during_down(doc) -> - ["Verify that read operation can continue to read when mnesia goes down"]; -read_during_down(suite) -> - [ - dirty_read_during_down, - trans_read_during_down - ]. dirty_read_during_down(suite) -> []; @@ -325,20 +354,6 @@ loop_and_kill_mnesia(N, Node, Tabs) -> timer:sleep(100), loop_and_kill_mnesia(N-1, KN, Tabs). -mnesia_down_during_startup(doc) -> - ["Verify that mnesia can come back up again in a consistent state", - "after it has gone down during startup (with different store and", - "when it goes down in different situations"]; -mnesia_down_during_startup(suite) -> - [ - mnesia_down_during_startup_disk_ram, - mnesia_down_during_startup_init_ram, - mnesia_down_during_startup_init_disc, - mnesia_down_during_startup_init_disc_only, - mnesia_down_during_startup_tm_ram, - mnesia_down_during_startup_tm_disc, - mnesia_down_during_startup_tm_disc_only - ]. mnesia_down_during_startup_disk_ram(suite) -> []; mnesia_down_during_startup_disk_ram(Config) when is_list(Config)-> @@ -433,10 +448,6 @@ mnesia_down_during_startup2(Config, ReplicaType, Debug_Point, _Father) -> ?verify_mnesia(Nodes, []). -with_checkpoint(doc) -> - ["Restart mnesia with checkpoint"]; -with_checkpoint(suite) -> - [with_checkpoint_same, with_checkpoint_other]. with_checkpoint_same(suite) -> []; with_checkpoint_same(Config) when is_list(Config) -> @@ -581,10 +592,6 @@ verify_where2read([]) -> ok. %%------------------------------------------------------------------------------------------- -explicit_stop(doc) -> - ["Stop Mnesia in different situations"]; -explicit_stop(suite) -> - [explicit_stop_during_snmp]. %% This is a bad implementation, but at least gives a indication if something is wrong explicit_stop_during_snmp(suite) -> []; explicit_stop_during_snmp(Config) when is_list(Config) -> @@ -700,21 +707,7 @@ coord_dies(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -sym_trans(doc) -> - ["Recovery of symmetrical transactions in a couple of different", - "situations; when coordinator or participant or node dies"]; - -sym_trans(suite) -> - [sym_trans_before_commit_kill_coord_node, %% coordinator node dies - sym_trans_before_commit_kill_coord_pid, %% coordinator process dies - sym_trans_before_commit_kill_part_after_ask, %% participating node dies - sym_trans_before_commit_kill_part_before_ask, - sym_trans_after_commit_kill_coord_node, - sym_trans_after_commit_kill_coord_pid, - sym_trans_after_commit_kill_part_after_ask, - sym_trans_after_commit_kill_part_do_commit_pre, - sym_trans_after_commit_kill_part_do_commit_post]. + %kill_after_debug_point(Config, TestCase, {Debug_node, Debug_Point}, TransFun, Tab) @@ -828,17 +821,6 @@ do_sym_trans([Tab], _Fahter) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -sync_dirty(doc) -> - ["Verify recovery of synchronously operations in a couple of different", - "situations"]; -sync_dirty(suite) -> - [sync_dirty_pre_kill_part, - sync_dirty_pre_kill_coord_node, - sync_dirty_pre_kill_coord_pid, - sync_dirty_post_kill_part, - sync_dirty_post_kill_coord_node, - sync_dirty_post_kill_coord_pid - ]. sync_dirty_pre_kill_part(suite) -> []; sync_dirty_pre_kill_part(Config) when is_list(Config) -> @@ -916,16 +898,6 @@ do_sync_dirty([Tab], _Father) -> ?dl("SYNC_DIRTY done: ~p ", [Res]), ok. -async_dirty(doc) -> - ["Verify recovery of asynchronously dirty operations in a couple of different", - "situations"]; -async_dirty(suite) -> - [async_dirty_pre_kill_part, - async_dirty_pre_kill_coord_node, - async_dirty_pre_kill_coord_pid, - async_dirty_post_kill_part, - async_dirty_post_kill_coord_node, - async_dirty_post_kill_coord_pid]. async_dirty_pre_kill_part(suite) -> []; async_dirty_pre_kill_part(Config) when is_list(Config) -> @@ -1005,29 +977,6 @@ do_async_dirty([Tab], _Fahter) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -asym_trans(doc) -> - ["Recovery of asymmetrical transactions in a couple of different", - "situations, currently the error cases are not covered, i.e. ", - "not tested are the situations when we kill mnesia or a process", - "during a recovery"]; -asym_trans(suite) -> - [ - asym_trans_kill_part_ask, - asym_trans_kill_part_commit_vote, - asym_trans_kill_part_pre_commit, - asym_trans_kill_part_log_commit, - asym_trans_kill_part_do_commit, - asym_trans_kill_coord_got_votes, - asym_trans_kill_coord_pid_got_votes, - asym_trans_kill_coord_log_commit_rec, - asym_trans_kill_coord_pid_log_commit_rec, - asym_trans_kill_coord_log_commit_dec, - asym_trans_kill_coord_pid_log_commit_dec, - asym_trans_kill_coord_rec_acc_pre_commit_log_commit, - asym_trans_kill_coord_pid_rec_acc_pre_commit_log_commit, - asym_trans_kill_coord_rec_acc_pre_commit_done_commit, - asym_trans_kill_coord_pid_rec_acc_pre_commit_done_commit - ]. asym_trans_kill_part_ask(suite) -> []; asym_trans_kill_part_ask(Config) when is_list(Config) -> @@ -1435,18 +1384,6 @@ after_full_disc_partition(doc) -> %% interrupted_fallback_start %% is implemented in consistency interupted_install_fallback! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -after_corrupt_files(doc) -> - ["Verify that mnesia (and dets) can handle corrupt files"]; -after_corrupt_files(suite) -> % cope with unsynced disks - [after_corrupt_files_decision_log_head, - after_corrupt_files_decision_log_tail, - after_corrupt_files_latest_log_head, - after_corrupt_files_latest_log_tail, - after_corrupt_files_table_dat_head, - after_corrupt_files_table_dat_tail, - after_corrupt_files_schema_dat_head, - after_corrupt_files_schema_dat_tail - ]. after_corrupt_files_decision_log_head(suite) -> []; after_corrupt_files_decision_log_head(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_registry_test.erl b/lib/mnesia/test/mnesia_registry_test.erl index 2305ef93b7..cf8da38632 100644 --- a/lib/mnesia/test/mnesia_registry_test.erl +++ b/lib/mnesia/test/mnesia_registry_test.erl @@ -26,17 +26,22 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Test the mnesia_registry module"]; -all(suite) -> - [ - good_dump, - bad_dump - ]. +all() -> + [good_dump, bad_dump]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% good_dump(doc) -> diff --git a/lib/mnesia/test/mnesia_schema_recovery_test.erl b/lib/mnesia/test/mnesia_schema_recovery_test.erl index 387238ae6b..0fe26efd0b 100644 --- a/lib/mnesia/test/mnesia_schema_recovery_test.erl +++ b/lib/mnesia/test/mnesia_schema_recovery_test.erl @@ -26,8 +26,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(receive_messages(Msgs), receive_messages(Msgs, ?FILE, ?LINE)). @@ -41,92 +41,82 @@ fin_per_testcase(Func, Conf) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Verify recoverabiliy of schema transactions.", - " Verify that a schema transaction", - " can be completed when it has been logged correctly and Mnesia", - " crashed before the log has been dumped. Then the transaction ", - " should be handled during the log dump at startup" - ]; -all(suite) -> - [interrupted_before_log_dump, - interrupted_after_log_dump]. - -interrupted_before_log_dump(suite) -> - [interrupted_before_create_ram, - interrupted_before_create_disc, - interrupted_before_create_disc_only, - interrupted_before_create_nostore, - interrupted_before_delete_ram, - interrupted_before_delete_disc, - interrupted_before_delete_disc_only, - interrupted_before_add_ram, - interrupted_before_add_disc, - interrupted_before_add_disc_only, - interrupted_before_add_kill_copier, - interrupted_before_move_ram, - interrupted_before_move_disc, - interrupted_before_move_disc_only, - interrupted_before_move_kill_copier, - interrupted_before_delcopy_ram, - interrupted_before_delcopy_disc, - interrupted_before_delcopy_disc_only, - interrupted_before_delcopy_kill_copier, - interrupted_before_addindex_ram, - interrupted_before_addindex_disc, - interrupted_before_addindex_disc_only, - interrupted_before_delindex_ram, - interrupted_before_delindex_disc, - interrupted_before_delindex_disc_only, - interrupted_before_change_type_ram2disc, - interrupted_before_change_type_ram2disc_only, - interrupted_before_change_type_disc2ram, - interrupted_before_change_type_disc2disc_only, - interrupted_before_change_type_disc_only2ram, - interrupted_before_change_type_disc_only2disc, - interrupted_before_change_type_other_node, - interrupted_before_change_schema_type %% Change schema table copy type!! - ]. - -interrupted_after_log_dump(suite) -> - [interrupted_after_create_ram, - interrupted_after_create_disc, - interrupted_after_create_disc_only, - interrupted_after_create_nostore, - interrupted_after_delete_ram, - interrupted_after_delete_disc, - interrupted_after_delete_disc_only, - interrupted_after_add_ram, - interrupted_after_add_disc, - interrupted_after_add_disc_only, - interrupted_after_add_kill_copier, - interrupted_after_move_ram, - interrupted_after_move_disc, - interrupted_after_move_disc_only, - interrupted_after_move_kill_copier, - interrupted_after_delcopy_ram, - interrupted_after_delcopy_disc, - interrupted_after_delcopy_disc_only, - interrupted_after_delcopy_kill_copier, - interrupted_after_addindex_ram, - interrupted_after_addindex_disc, - interrupted_after_addindex_disc_only, - interrupted_after_delindex_ram, - interrupted_after_delindex_disc, - interrupted_after_delindex_disc_only, - interrupted_after_change_type_ram2disc, - interrupted_after_change_type_ram2disc_only, - interrupted_after_change_type_disc2ram, - interrupted_after_change_type_disc2disc_only, - interrupted_after_change_type_disc_only2ram, - interrupted_after_change_type_disc_only2disc, - interrupted_after_change_type_other_node, - interrupted_after_change_schema_type %% Change schema table copy type!! - -% interrupted_before_change_access_mode, -% interrupted_before_transform, -% interrupted_before_restore, - ]. +all() -> + [{group, interrupted_before_log_dump}, + {group, interrupted_after_log_dump}]. + +groups() -> + [{interrupted_before_log_dump, [], + [interrupted_before_create_ram, + interrupted_before_create_disc, + interrupted_before_create_disc_only, + interrupted_before_create_nostore, + interrupted_before_delete_ram, + interrupted_before_delete_disc, + interrupted_before_delete_disc_only, + interrupted_before_add_ram, interrupted_before_add_disc, + interrupted_before_add_disc_only, + interrupted_before_add_kill_copier, + interrupted_before_move_ram, + interrupted_before_move_disc, + interrupted_before_move_disc_only, + interrupted_before_move_kill_copier, + interrupted_before_delcopy_ram, + interrupted_before_delcopy_disc, + interrupted_before_delcopy_disc_only, + interrupted_before_delcopy_kill_copier, + interrupted_before_addindex_ram, + interrupted_before_addindex_disc, + interrupted_before_addindex_disc_only, + interrupted_before_delindex_ram, + interrupted_before_delindex_disc, + interrupted_before_delindex_disc_only, + interrupted_before_change_type_ram2disc, + interrupted_before_change_type_ram2disc_only, + interrupted_before_change_type_disc2ram, + interrupted_before_change_type_disc2disc_only, + interrupted_before_change_type_disc_only2ram, + interrupted_before_change_type_disc_only2disc, + interrupted_before_change_type_other_node, + interrupted_before_change_schema_type]}, + {interrupted_after_log_dump, [], + [interrupted_after_create_ram, + interrupted_after_create_disc, + interrupted_after_create_disc_only, + interrupted_after_create_nostore, + interrupted_after_delete_ram, + interrupted_after_delete_disc, + interrupted_after_delete_disc_only, + interrupted_after_add_ram, interrupted_after_add_disc, + interrupted_after_add_disc_only, + interrupted_after_add_kill_copier, + interrupted_after_move_ram, interrupted_after_move_disc, + interrupted_after_move_disc_only, + interrupted_after_move_kill_copier, + interrupted_after_delcopy_ram, + interrupted_after_delcopy_disc, + interrupted_after_delcopy_disc_only, + interrupted_after_delcopy_kill_copier, + interrupted_after_addindex_ram, + interrupted_after_addindex_disc, + interrupted_after_addindex_disc_only, + interrupted_after_delindex_ram, + interrupted_after_delindex_disc, + interrupted_after_delindex_disc_only, + interrupted_after_change_type_ram2disc, + interrupted_after_change_type_ram2disc_only, + interrupted_after_change_type_disc2ram, + interrupted_after_change_type_disc2disc_only, + interrupted_after_change_type_disc_only2ram, + interrupted_after_change_type_disc_only2disc, + interrupted_after_change_type_other_node, + interrupted_after_change_schema_type]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. interrupted_before_create_ram(suite) -> []; interrupted_before_create_ram(Config) when is_list(Config) -> diff --git a/lib/mnesia/test/mnesia_test_lib.erl b/lib/mnesia/test/mnesia_test_lib.erl index 1e98f017f7..182c240084 100644 --- a/lib/mnesia/test/mnesia_test_lib.erl +++ b/lib/mnesia/test/mnesia_test_lib.erl @@ -130,7 +130,7 @@ doc/1, struct/1, init_per_testcase/2, - fin_per_testcase/2, + end_per_testcase/2, kill_tc/2 ]). @@ -144,7 +144,7 @@ init_per_testcase(_Func, Config) -> global:register_name(mnesia_global_logger, group_leader()), Config. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> global:unregister_name(mnesia_global_logger), %% Nodes = select_nodes(all, Config, ?FILE, ?LINE), %% rpc:multicall(Nodes, mnesia, lkill, []), @@ -492,19 +492,19 @@ wait_for_evaluator(Pid, Mod, Fun, Config) -> {'EXIT', Pid, {skipped, Reason}} -> log("<WARNING> Test case ~w skipped, because ~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {skip, {Mod, Fun}, Reason}; {'EXIT', Pid, Reason} -> log("<>ERROR<> Eval process ~w exited, because ~p~n", [{Mod, Fun}, Reason]), - Mod:fin_per_testcase(Fun, Config), + Mod:end_per_testcase(Fun, Config), {crash, {Mod, Fun}, Reason} end. test_case_evaluator(Mod, Fun, [Config]) -> NewConfig = Mod:init_per_testcase(Fun, Config), R = apply(Mod, Fun, [NewConfig]), - Mod:fin_per_testcase(Fun, NewConfig), + Mod:end_per_testcase(Fun, NewConfig), exit({test_case_ok, R}). activity_evaluator(Coordinator) -> diff --git a/lib/mnesia/test/mnesia_test_lib.hrl b/lib/mnesia/test/mnesia_test_lib.hrl index 85f12200d4..fc377dbd2c 100644 --- a/lib/mnesia/test/mnesia_test_lib.hrl +++ b/lib/mnesia/test/mnesia_test_lib.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 diff --git a/lib/mnesia/test/mnesia_tpcb.erl b/lib/mnesia/test/mnesia_tpcb.erl index 903c53a21c..595412ff24 100644 --- a/lib/mnesia/test/mnesia_tpcb.erl +++ b/lib/mnesia/test/mnesia_tpcb.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. 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 diff --git a/lib/mnesia/test/mnesia_trans_access_test.erl b/lib/mnesia/test/mnesia_trans_access_test.erl index c67382e694..55ba4dd761 100644 --- a/lib/mnesia/test/mnesia_trans_access_test.erl +++ b/lib/mnesia/test/mnesia_trans_access_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. 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 @@ -26,8 +26,8 @@ init_per_testcase(Func, Conf) -> mnesia_test_lib:init_per_testcase(Func, Conf). -fin_per_testcase(Func, Conf) -> - mnesia_test_lib:fin_per_testcase(Func, Conf). +end_per_testcase(Func, Conf) -> + mnesia_test_lib:end_per_testcase(Func, Conf). -define(receive_messages(Msgs), mnesia_recovery_test:receive_messages(Msgs, ?FILE, ?LINE)). @@ -40,18 +40,41 @@ fin_per_testcase(Func, Conf) -> -endif. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(doc) -> - ["Evil access of records in the scope of transactions", - "Invoke all functions in the API and try to cover all legal uses", - "cases as well the illegal dito. This is a complement to the", - "other more explicit test cases."]; -all(suite) -> - [ - write, read, wread, delete, delete_object, - match_object, select, select14, all_keys, - transaction, nested_activities, - index_tabs, index_lifecycle - ]. +all() -> + [write, read, wread, delete, delete_object, + match_object, select, select14, all_keys, transaction, + {group, nested_activities}, {group, index_tabs}, + {group, index_lifecycle}]. + +groups() -> + [{nested_activities, [], + [basic_nested, {group, nested_transactions}, + mix_of_nested_activities]}, + {nested_transactions, [], + [nested_trans_both_ok, nested_trans_child_dies, + nested_trans_parent_dies, nested_trans_both_dies]}, + {index_tabs, [], + [index_match_object, index_read, {group, index_update}, + index_write]}, + {index_update, [], + [index_update_set, index_update_bag]}, + {index_lifecycle, [], + [add_table_index_ram, add_table_index_disc, + add_table_index_disc_only, create_live_table_index_ram, + create_live_table_index_disc, + create_live_table_index_disc_only, del_table_index_ram, + del_table_index_disc, del_table_index_disc_only, + {group, idx_schema_changes}]}, + {idx_schema_changes, [], + [idx_schema_changes_ram, idx_schema_changes_disc, + idx_schema_changes_disc_only]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Write records @@ -404,12 +427,6 @@ transaction(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -nested_activities(suite) -> - [ - basic_nested, - nested_transactions, - mix_of_nested_activities - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -520,13 +537,6 @@ n_f4() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -nested_transactions(doc) -> - ["Verify that nested_transactions are handled as expected"]; -nested_transactions(suite) -> - [nested_trans_both_ok, - nested_trans_child_dies, - nested_trans_parent_dies, - nested_trans_both_dies]. nested_trans_both_ok(suite) -> []; nested_trans_both_ok(Config) when is_list(Config) -> @@ -671,13 +681,6 @@ read_op(Oid) -> Ops end. -index_tabs(suite) -> - [ - index_match_object, - index_read, - index_update, - index_write - ]. %% Read matching records by using an index @@ -767,10 +770,6 @@ index_read(Config) when is_list(Config) -> ?match({'EXIT', {aborted, no_transaction}}, mnesia:index_read(Tab, 2, ValPos)), ?verify_mnesia(Nodes, []). -index_update(suite) -> [index_update_set, index_update_bag]; -index_update(doc) -> ["See Ticket OTP-2083, verifies that a table with a index is " - "update in the correct way i.e. the index finds the correct " - "records after a update"]. index_update_set(suite) -> []; index_update_set(Config)when is_list(Config) -> [Node1] = Nodes = ?acquire_nodes(1, Config), @@ -1046,19 +1045,6 @@ index_write(Config)when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Add and drop indecies -index_lifecycle(suite) -> - [ - add_table_index_ram, - add_table_index_disc, - add_table_index_disc_only, - create_live_table_index_ram, - create_live_table_index_disc, - create_live_table_index_disc_only, - del_table_index_ram, - del_table_index_disc, - del_table_index_disc_only, - idx_schema_changes - ]. add_table_index_ram(suite) -> []; add_table_index_ram(Config) when is_list(Config) -> @@ -1171,13 +1157,6 @@ del_table_index(Config, Storage) -> ?match({atomic, ok}, mnesia:transaction(NestedFun)), ?verify_mnesia(Nodes, []). -idx_schema_changes(suite) -> [idx_schema_changes_ram, - idx_schema_changes_disc, - idx_schema_changes_disc_only]; -idx_schema_changes(doc) -> - ["Tests that index tables are handled correctly when schema changes.", - "For example when a replica is deleted or inserted", - "TICKET OTP-2XXX (ELVIRA)"]. idx_schema_changes_ram(suite) -> []; idx_schema_changes_ram(Config) when is_list(Config) -> diff --git a/lib/mnesia/vsn.mk b/lib/mnesia/vsn.mk index bce0f7b739..5247657b68 100644 --- a/lib/mnesia/vsn.mk +++ b/lib/mnesia/vsn.mk @@ -1 +1 @@ -MNESIA_VSN = 4.4.15 +MNESIA_VSN = 4.4.17 |