~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/mnesia/test/README

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
This directory contains the test suite of Mnesia.
 
2
Compile it with "erl -make".
 
3
 
 
4
Test cases are identified with a {Mod, Fun} tuple that maps
 
5
to a function Mod:Fun(Config), where the test case hopefully
 
6
is implemented. The test suite is organized in a hierarchy
 
7
with {mnesia_SUITE, all} as the top.
 
8
 
 
9
The module called mt, implements various convenience functions
 
10
to ease up the execution of test cases. It does also provide
 
11
aliases for some test cases. For example the atom Mod is an
 
12
alias for {Mod, all}, the atom all for {mnesia_SUITE, all},
 
13
evil 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
 
 
41
In order to be able to run the test suite, the Erlang node must
 
42
be started with the distribution enabled and the code path must
 
43
be set to the mnesia/ebin, mnesia/examples, and mnesia/test
 
44
directories. E.g. the following would do:
 
45
 
 
46
    erl -sname a -pa $top/examples -pa $top/src -pa $top/ebin
 
47
 
 
48
where $top is the path to the Mnesia installation. Many test
 
49
cases needs 2 or 3 nodes. The node names may explicitly be
 
50
stated as test suite configuration parameters, but by default
 
51
the extra node names are generated. In this example the names
 
52
will be: a, a1 and a2. It is enough to start the first node
 
53
manually, the extra nodes will automatically be started if
 
54
neccessary.
 
55
 
 
56
The attached UNIX shell script mt, does not work on all
 
57
platforms, but it may be used as a source for inspiration. It
 
58
starts three Erlang nodes in one xterm's each. The main xterm
 
59
(a@localhost) logs all output in the Erlang shell to a
 
60
file. The file is piped thru grep to easily find successful
 
61
test cases (i.e. test cases that encountered an error).
 
62
 
 
63
During development we want to be able to run the test cases
 
64
in the debugger. This demands a little bit of preparations:
 
65
 
 
66
  - Start the neccessary 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 neccessary modules will be
 
77
    loaded on all CONNECTED nodes.
 
78
 
 
79
The test case execution is supervised in order to ensure that no test
 
80
case exceeds its maximum time limit, which by default is 5 minutes.
 
81
When the limit is reached, the running test case gets aborted and the
 
82
test server runs the next test case in line. This behaviour is useful
 
83
when running the entire test suite during the night, but it is really
 
84
annoying during debugging.
 
85
 
 
86
   Use the "erl -mnesia_test_timeout" flag to disable the test case
 
87
   time limit mechanism.
 
88
 
 
89
Some mechanisms in Mnesia are almost impossible to test with a
 
90
white box technique. In order to be able to write predictable
 
91
test cases which tests the same thing every time it is run,
 
92
Mnesia has been instrumented with debug functions. These may be
 
93
controlled from a test program. For example to verify that the
 
94
commit protocols work it is essential that it is possible to
 
95
ensure that we are able to kill Mnesia in the most critical
 
96
situations. Normally Mnesia is compiled with the debug
 
97
functions disabled and this means that test cases which
 
98
requires this functionality will be skipped. The mnesia:ni(),
 
99
mentioned above, functions ensures that the interpreted code is
 
100
instrumented with Mnesia's debug functionality. The mnesia:nc()
 
101
functions compiles Mnesia with the debug setting enabled.
 
102
 
 
103
Happy bug hunting!
 
104
 
 
105
        Hakan Mattsson <hakan@erix.ericsson.se>
 
106
 
 
107