• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..21-Nov-2021-

MakefileH A D21-Nov-20213.3 KiB13268

READMEH A D21-Nov-20214.4 KiB10882

ext_test.erlH A D21-Nov-20216.7 KiB254170

mnesia.coverH A D21-Nov-202128 31

mnesia.specH A D21-Nov-20213.4 KiB7473

mnesia_SUITE.erlH A D21-Nov-20216.4 KiB17691

mnesia_atomicity_test.erlH A D21-Nov-202125.9 KiB824566

mnesia_bench.specH A D21-Nov-202147 11

mnesia_bench_SUITE.erlH A D21-Nov-20211.8 KiB7729

mnesia_config_backup.erlH A D21-Nov-20213.6 KiB10840

mnesia_config_event.erlH A D21-Nov-20211.9 KiB7623

mnesia_config_test.erlH A D21-Nov-202148 KiB1,3971,010

mnesia_consistency_test.erlH A D21-Nov-202159.5 KiB1,6251,195

mnesia_cost.erlH A D21-Nov-20214.5 KiB159101

mnesia_dbn_meters.erlH A D21-Nov-20217.2 KiB241189

mnesia_dirty_access_test.erlH A D21-Nov-202137.3 KiB997741

mnesia_durability_test.erlH A D21-Nov-202167.4 KiB1,5781,123

mnesia_evil_backup.erlH A D21-Nov-202131.1 KiB801656

mnesia_evil_coverage_test.erlH A D21-Nov-2021105.5 KiB2,6152,057

mnesia_examples_test.erlH A D21-Nov-20215.3 KiB168112

mnesia_frag_hash_test.erlH A D21-Nov-20212.2 KiB9575

mnesia_frag_test.erlH A D21-Nov-202132.8 KiB862659

mnesia_inconsistent_database_test.erlH A D21-Nov-20212 KiB7626

mnesia_index_plugin_test.erlH A D21-Nov-20219.4 KiB281224

mnesia_install_test.erlH A D21-Nov-202112 KiB345271

mnesia_isolation_test.erlH A D21-Nov-202192.1 KiB2,5122,027

mnesia_majority_test.erlH A D21-Nov-20216.5 KiB194155

mnesia_measure_test.erlH A D21-Nov-20213.8 KiB13275

mnesia_meter.erlH A D21-Nov-202116.6 KiB467376

mnesia_nice_coverage_test.erlH A D21-Nov-20218.2 KiB242179

mnesia_qlc_test.erlH A D21-Nov-202114.4 KiB489368

mnesia_recovery_test.erlH A D21-Nov-202168.4 KiB1,7301,452

mnesia_registry_test.erlH A D21-Nov-20214.6 KiB149100

mnesia_schema_recovery_test.erlH A D21-Nov-202136.8 KiB854738

mnesia_test_lib.erlH A D21-Nov-202131.5 KiB1,086855

mnesia_test_lib.hrlH A D21-Nov-20214.4 KiB155111

mnesia_tpcb.erlH A D21-Nov-202140.2 KiB1,303997

mnesia_trans_access_test.erlH A D21-Nov-202153.5 KiB1,4111,102

mtH A D21-Nov-20212.1 KiB8450

mt.erlH A D21-Nov-20217.9 KiB275185

README

1This directory contains the test suite of Mnesia.
2Compile it with "erl -make".
3
4Test cases are identified with a {Mod, Fun} tuple that maps
5to a function Mod:Fun(Config), where the test case hopefully
6is implemented. The test suite is organized in a hierarchy
7with {mnesia_SUITE, all} as the top.
8
9The module called mt, implements various convenience functions
10to ease up the execution of test cases. It does also provide
11aliases for some test cases. For example the atom Mod is an
12alias for {Mod, all}, the atom all for {mnesia_SUITE, all},
13evil for mnesia_evil_coverage_test etc.
14
15   mt:struct(TestCase)
16
17      Displays the test case structure from TestCase
18      and downwards the hierarchy. E.g. mt:struct(all)
19      will display the entire test suite.
20
21   mt:t(TestCase), mt:t(TestCase, Config)
22
23      Runs a single test case or a hierarchy of test cases.
24      mt:t(silly) is be a good starter, but you may also
25      try mt:t(all) directly if you feel lucky.
26
27      The identity of the last run test case and the outcome of
28      it is stored on file. mt:t() will re-run the last test case.
29
30      The Config argument contains various configuration
31      parameters for the test cases, such as which nodes that
32      are available for running the test suite. The default
33      settings should be enough for the most. Use mt:read_config()
34      to get the current default setting and change it with
35      mt:write_config(Config).
36
37   mt:doc(TestCase)
38
39      Generates html documentation for the test suite.
40
41In order to be able to run the test suite, the Erlang node must
42be started with the distribution enabled and the code path must
43be set to the mnesia/ebin, mnesia/examples, and mnesia/test
44directories. E.g. the following would do:
45
46    erl -sname a -pa $top/examples -pa $top/src -pa $top/ebin
47
48where $top is the path to the Mnesia installation. Many test
49cases needs 2 or 3 nodes. The node names may explicitly be
50stated as test suite configuration parameters, but by default
51the extra node names are generated. In this example the names
52will be: a, a1 and a2. It is enough to start the first node
53manually, the extra nodes will automatically be started if
54necessary.
55
56The attached UNIX shell script mt, does not work on all
57platforms, but it may be used as a source for inspiration. It
58starts three Erlang nodes in one xterm's each. The main xterm
59(a@localhost) logs all output in the Erlang shell to a
60file. The file is piped thru grep to easily find successful
61test cases (i.e. test cases that encountered an error).
62
63During development we want to be able to run the test cases
64in the debugger. This demands a little bit of preparations:
65
66  - Start the necessary number of nodes (normally 3).
67    This may either be done by running the mt script or
68    by starting the main node and then invoke mt:start_nodes()
69    to start the extra nodes with slave.
70
71  - Ensure that the nodes are connected. The easiest way to do
72    this is by invoking mt:ping().
73
74  - Load all files that needs to be interpreted. This is typically
75    all Mnesia files plus the test case. By invoking mnesia:ni()
76    and mnesia:ni([TestModule]) the necessary modules will be
77    loaded on all CONNECTED nodes.
78
79The test case execution is supervised in order to ensure that no test
80case exceeds its maximum time limit, which by default is 5 minutes.
81When the limit is reached, the running test case gets aborted and the
82test server runs the next test case in line. This behaviour is useful
83when running the entire test suite during the night, but it is really
84annoying during debugging.
85
86   Use the "erl -mnesia_test_timeout" flag to disable the test case
87   time limit mechanism.
88
89Some mechanisms in Mnesia are almost impossible to test with a
90white box technique. In order to be able to write predictable
91test cases which tests the same thing every time it is run,
92Mnesia has been instrumented with debug functions. These may be
93controlled from a test program. For example to verify that the
94commit protocols work it is essential that it is possible to
95ensure that we are able to kill Mnesia in the most critical
96situations. Normally Mnesia is compiled with the debug
97functions disabled and this means that test cases which
98requires this functionality will be skipped. The mnesia:ni(),
99mentioned above, functions ensures that the interpreted code is
100instrumented with Mnesia's debug functionality. The mnesia:nc()
101functions compiles Mnesia with the debug setting enabled.
102
103Happy bug hunting!
104
105        Hakan Mattsson <hakan@erix.ericsson.se>
106
107
108