4
%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
21
-define(log(Format,Args),mnesia_test_lib:log(Format,Args,?FILE,?LINE)).
22
-define(warning(Format,Args),?log("<>WARNING<>~n " ++ Format,Args)).
23
-define(error(Format,Args),
24
mnesia_test_lib:error(Format,Args,?FILE,?LINE)).
25
-define(verbose(Format,Args),mnesia_test_lib:verbose(Format,Args,?FILE,?LINE)).
27
-define(fatal(Format,Args),
29
exit({test_case_fatal, Format, Args, ?FILE, ?LINE})).
31
-define(skip(Format,Args),
32
?warning(Format, Args),
33
exit({skipped, ?flat_format(Format, Args)})).
35
-define(flat_format(Format,Args),
36
lists:flatten(io_lib:format(Format, Args))).
38
-define(sort(What), mnesia_test_lib:sort(What)).
42
AcTuAlReS = (catch (Expr)),
43
?verbose("ok, ~n Result as expected:~p~n",[AcTuAlReS]),
47
-define(match(ExpectedRes,Expr),
49
AcTuAlReS = (catch (Expr)),
52
?verbose("ok, ~n Result as expected:~p~n",[AcTuAlReS]),
55
?error("Not Matching Actual result was:~n ~p~n",
61
-define(match_inverse(NotExpectedRes,Expr),
63
AcTuAlReS = (catch (Expr)),
66
?error("Not matching Actual result was:~n ~p~n",
70
?verbose("ok, ~n Result as expected: ~p~n",[AcTuAlReS]),
75
-define(match_receive(ExpectedMsg),
76
?match(ExpectedMsg,mnesia_test_lib:pick_msg())).
78
%% ExpectedMsgs must be completely bound
79
-define(match_multi_receive(ExpectedMsgs),
81
TmPeXpCtEdMsGs = lists:sort(ExpectedMsgs),
82
?match(TmPeXpCtEdMsGs,
83
lists:sort(lists:map(fun(_) ->
84
mnesia_test_lib:pick_msg()
89
-define(start_activities(Nodes),
90
mnesia_test_lib:start_activities(Nodes)).
92
-define(start_transactions(Pids),
93
mnesia_test_lib:start_transactions(Pids)).
95
-define(acquire_nodes(N, Config),
96
mnesia_test_lib:prepare_test_case([{init_test_case, [mnesia]},
99
{start_appls, [mnesia]}],
100
N, Config, ?FILE, ?LINE)).
102
-define(activate_debug_fun(I, F, C),
103
mnesia_lib:activate_debug_fun(I, F, C, ?FILE, ?LINE)).
105
-define(remote_activate_debug_fun(N, I, F, C),
106
?match(ok, mnesia_test_lib:remote_activate_debug_fun(N, I, F, C,
109
-define(deactivate_debug_fun(I),
110
mnesia_lib:deactivate_debug_fun(I, ?FILE, ?LINE)).
112
-define(remote_deactivate_debug_fun(N, I),
113
rpc:call(N, mnesia_lib, deactivate_debug_fun, [I, ?FILE, ?LINE])).
115
-define(is_debug_compiled,
116
case mnesia_lib:is_debug_compiled() of
118
?skip("Mnesia is not debug compiled, test case ignored.~n", []);
123
-define(needs_disc(Config),
124
case mnesia_test_lib:diskless(Config) of
128
?skip("Must have disc, test case ignored.~n", [])
131
-define(verify_mnesia(Ups, Downs),
132
mnesia_test_lib:verify_mnesia(Ups, Downs, ?FILE, ?LINE)).