1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1997-2018. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% %CopyrightEnd%
%%
%%
-module(mnesia_SUITE).
-author('[email protected]').
-export([init_per_testcase/2, end_per_testcase/2,
init_per_suite/1, end_per_suite/1,
init_per_group/2, end_per_group/2,
suite/0, all/0, groups/0]).
-export([app/1, appup/1, clean_up_suite/1, silly/0]).
-include_lib("common_test/include/ct.hrl").
-include("mnesia_test_lib.hrl").
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
end_per_testcase(Func, Conf) ->
mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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() ->
[app, appup, {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, index_plugins},
{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}]},
{index_plugins, [], [{mnesia_index_plugin_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, majority},
{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}]},
{majority, [], [{mnesia_majority_test, all}]},
%% The 'heavy' test suite runs some resource consuming tests and
%% benchmarks
{heavy, [], [{group, measure}]},
{measure, [], [{mnesia_measure_test, all}]},
{benchmarks, [],
[{group, mnesia_measure_test, benchmarks}]},
%% 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, 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().
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Test structure of the mnesia application resource file
app(Config) when is_list(Config) ->
ok = ?t:app_test(mnesia).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Test that all required versions have appup directives
appup(Config) when is_list(Config) ->
ok = ?t:appup_test(mnesia).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clean_up_suite(doc) -> ["Not a test case only kills mnesia and nodes, that where"
"started during the tests"];
clean_up_suite(suite) ->
[];
clean_up_suite(Config) when is_list(Config)->
mnesia:kill(),
Slaves = mnesia_test_lib:lookup_config(nodenames, Config),
Nodes = lists:delete(node(), Slaves),
rpc:multicall(Nodes, erlang, halt, []),
ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|