Merge branch 'selftest' of git://git.samba.org/jelmer/samba
[ira/wip.git] / selftest / README
1 # vim: ft=rst
2
3 This directory contains test scripts that are useful for running a
4 bunch of tests all at once. 
5
6 Available testsuites
7 ====================
8 The available testsuites are obtained from a script, usually 
9 selftest/samba{3,4}_tests.sh. This script should for each testsuite output 
10 the name of the test, the command to run and the environment that should be 
11 provided. Use the included "plantest" function to generate the required output.
12
13 Testsuite behaviour
14 ================================
15
16 Exit code
17 ------------
18 The testsuites should exit with a non-zero exit code if at least one 
19 test failed. Skipped tests should not influence the exit code.
20
21 Output format
22 -------------
23 Testsuites can simply use the exit code to indicate whether all of their 
24 tests have succeeded or one or more have failed. It is also possible to 
25 provide more granular information using the Subunit protocol. 
26
27 This protocol works by writing simple messages to standard output. Any 
28 messages that can not be interpreted by this protocol are considered comments 
29 for the last announced test.
30
31 Accepted commands are:
32
33 test
34 ~~~~~~~~~~~~
35 test: <NAME>
36
37 Announce that a new test with the specified name is starting
38
39 success
40 ~~~~~~~~~~~~~~~
41 success: <NAME> 
42
43 Announce that the test with the specified name is done and ran successfully.
44
45 failure
46 ~~~~~~~~~~~~~~~
47 failure: <NAME> 
48 failure: <NAME> [ REASON ]
49
50 Announce that the test with the specified name failed. Optionally, it is 
51 possible to specify a reason it failed.
52
53 skip
54 ~~~~~~~~~~~~
55 skip: <NAME>
56 skip: <NAME> [ REASON ]
57
58 Announce that the test with the specified name was skipped. Optionally a 
59 reason can be specified.
60
61 knownfail
62 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63 knownfail: <NAME>
64 knownfail: <NAME> [ REASON ]
65
66 Announce that the test with the specified name was run and failed as expected.
67 Alternatively it is also possible to simply return "failure:" here but 
68 specify in the samba4-knownfailures file that it is failing.
69
70 Environments
71 ============
72 Tests often need to run against a server with particular things set up, 
73 a "environment". This environment is provided by the test "target": Samba 3, 
74 Samba 4 or Windows.
75
76 The following environments are currently available:
77
78  - none: No server set up, no variables set.
79  - dc: Domain controller set up. The following environment variables will 
80    be set:
81
82      * USERNAME: Administrator user name
83          * PASSWORD: Administrator password
84          * DOMAIN: Domain name
85          * REALM: Realm name
86          * SERVER: DC host name 
87          * SERVER_IP: DC IPv4 address
88          * NETBIOSNAME: DC NetBIOS name
89          * NETIOSALIAS: DC NetBIOS alias
90
91  - member: Domain controller and member server that is joined to it set up. The
92    following environment variables will be set:
93
94      * USERNAME: Domain administrator user name
95          * PASSWORD: Domain administrator password
96          * DOMAIN: Domain name
97          * REALM: Realm name
98          * SERVER: Name of the member server
99
100
101 Running tests
102 =============
103
104 To run all the tests use::
105
106    make test
107
108 To run a quick subset (aiming for about 1 minute of testing) run::
109
110    make quicktest
111
112 To run a specific test, use this syntax::
113
114    make test TESTS=testname
115
116 for example::
117
118    make test TESTS=samba4.BASE-DELETE
119