1: %%
    2: %% %CopyrightBegin%
    3: %%
    4: %% Copyright Ericsson AB 1997-2013. All Rights Reserved.
    5: %%
    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/.
   11: %%
   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
   15: %% under the License.
   16: %%
   17: %% %CopyrightEnd%
   18: %%
   19: 
   20: %%
   21: -module(mnesia_SUITE).
   22: -author('hakan@erix.ericsson.se').
   23: -compile([export_all]).
   24: -include("mnesia_test_lib.hrl").
   25: 
   26: init_per_testcase(Func, Conf) ->
   27:     mnesia_test_lib:init_per_testcase(Func, Conf).
   28: 
   29: end_per_testcase(Func, Conf) ->
   30:     mnesia_test_lib:end_per_testcase(Func, Conf).
   31: 
   32: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   33: suite() -> [{ct_hooks,[{ts_install_cth,[{nodenames,2}]}]}].
   34: 
   35: 
   36: %% Verify that Mnesia really is a distributed real-time DBMS.
   37: %% This is the test suite of the Mnesia DBMS. The test suite
   38: %% covers many aspects of usage and is indended to be developed
   39: %% incrementally. The test suite is divided into a hierarchy of test
   40: %% suites where the leafs actually implements the test cases.
   41: %% The intention of each test case and sub test suite can be
   42: %% read in comments where they are implemented or in worst cases
   43: %% from their long mnemonic names. 
   44: %% 
   45: %% The most simple test case of them all is called 'silly'
   46: %% and is useful to run now and then, e.g. when some new fatal
   47: %% bug has been introduced. It may be run even if Mnesia is in
   48: %% such a bad shape that the test machinery cannot be used.
   49: %% NB! Invoke the function directly with mnesia_SUITE:silly()
   50: %% and do not involve the normal test machinery.
   51: 
   52: all() -> 
   53:     [{group, light}, {group, medium}, {group, heavy},
   54:      clean_up_suite].
   55: 
   56: groups() -> 
   57:     %% The 'light' test suite runs a selected set of test suites and is
   58:     %% intended to be the smallest test suite that is meaningful
   59:     %% to run. It starts with an installation test (which in essence is the
   60:     %% 'silly' test case) and then it covers all functions in the API in
   61:     %% various depths. All configuration parameters and examples are also
   62:     %% covered.
   63:     [{light, [],
   64:       [{group, install}, {group, nice}, {group, evil},
   65:        {group, mnesia_frag_test, light}, {group, qlc},
   66:        {group, registry}, {group, config}, {group, examples}]},
   67:      {install, [], [{mnesia_install_test, all}]},
   68:      {nice, [], [{mnesia_nice_coverage_test, all}]},
   69:      {evil, [], [{mnesia_evil_coverage_test, all}]},
   70:      {qlc, [], [{mnesia_qlc_test, all}]},
   71:      {registry, [], [{mnesia_registry_test, all}]},
   72:      {config, [], [{mnesia_config_test, all}]},
   73:      {examples, [], [{mnesia_examples_test, all}]},
   74:      %% The 'medium' test suite verfies the ACID (atomicity, consistency
   75:      %% isolation and durability) properties and various recovery scenarios
   76:      %% These tests may take quite while to run.
   77:      {medium, [],
   78:       [{group, install}, {group, atomicity},
   79:        {group, isolation}, {group, durability},
   80:        {group, recovery}, {group, consistency},
   81:        {group, majority},
   82:        {group, mnesia_frag_test, medium}]},
   83:      {atomicity, [], [{mnesia_atomicity_test, all}]},
   84:      {isolation, [], [{mnesia_isolation_test, all}]},
   85:      {durability, [], [{mnesia_durability_test, all}]},
   86:      {recovery, [], [{mnesia_recovery_test, all}]},
   87:      {consistency, [], [{mnesia_consistency_test, all}]},
   88:      {majority, [], [{mnesia_majority_test, all}]},
   89:      %% The 'heavy' test suite runs some resource consuming tests and
   90:      %% benchmarks
   91:      {heavy, [], [{group, measure}]},
   92:      {measure, [], [{mnesia_measure_test, all}]},
   93:      {prediction, [],
   94:       [{group, mnesia_measure_test, prediction}]},
   95:      {fairness, [],
   96:       [{group, mnesia_measure_test, fairness}]},
   97:      {benchmarks, [],
   98:       [{group, mnesia_measure_test, benchmarks}]},
   99:      {consumption, [],
  100:       [{group, mnesia_measure_test, consumption}]},
  101:      {scalability, [],
  102:       [{group, mnesia_measure_test, scalability}]},
  103:      %% This test suite is an extract of the grand Mnesia suite
  104:      %% it contains OTP R4B specific test cases
  105:      {otp_r4b, [],
  106:       [{mnesia_config_test, access_module},
  107:        {mnesia_config_test, dump_log_load_regulation},
  108:        {mnesia_config_test, ignore_fallback_at_startup},
  109:        {mnesia_config_test, max_wait_for_decision},
  110:        {mnesia_consistency_test, consistency_after_restore},
  111:        {mnesia_evil_backup, restore},
  112:        {mnesia_evil_coverage_test, offline_set_master_nodes},
  113:        {mnesia_evil_coverage_test, record_name},
  114:        {mnesia_evil_coverage_test, user_properties},
  115:        {mnesia_registry_test, all}, {group, otp_2363}]},
  116:      %% Index on disc only tables
  117:      {otp_2363, [],
  118:       [{mnesia_dirty_access_test,
  119: 	dirty_index_match_object_disc_only},
  120:        {mnesia_dirty_access_test, dirty_index_read_disc_only},
  121:        {mnesia_dirty_access_test,
  122: 	dirty_index_update_bag_disc_only},
  123:        {mnesia_dirty_access_test,
  124: 	dirty_index_update_set_disc_only},
  125:        {mnesia_evil_coverage_test,
  126: 	create_live_table_index_disc_only}]}].
  127: 
  128: init_per_group(_GroupName, Config) ->
  129: 	Config.
  130: 
  131: end_per_group(_GroupName, Config) ->
  132: 	Config.
  133: 
  134: init_per_suite(Config) ->
  135:     Config.
  136: 
  137: end_per_suite(Config) ->
  138:     Config.
  139: 
  140: 
  141: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  142: silly() ->
  143:     mnesia_install_test:silly().
  144:     
  145: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  146: 
  147: clean_up_suite(doc) -> ["Not a test case only kills mnesia and nodes, that where" 
  148: 			"started during the tests"];
  149: clean_up_suite(suite) ->
  150:     [];
  151: clean_up_suite(Config) when is_list(Config)->
  152:     mnesia:kill(),
  153:     Slaves = mnesia_test_lib:lookup_config(nodenames, Config),
  154:     Nodes = lists:delete(node(), Slaves),
  155:     rpc:multicall(Nodes, erlang, halt, []),
  156:     ok.
  157: 
  158: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  159: 
  160: 
  161:     
  162: 
  163: