1 | $Id: README 1092 2010-06-12 23:50:18Z peter $ |
---|
2 | |
---|
3 | The svndigest test suite |
---|
4 | |
---|
5 | |
---|
6 | Usage: |
---|
7 | ======== |
---|
8 | |
---|
9 | Running the tests |
---|
10 | ----------------- |
---|
11 | |
---|
12 | To run all tests: |
---|
13 | |
---|
14 | make check |
---|
15 | |
---|
16 | To rerun only failed tests: |
---|
17 | |
---|
18 | make recheck |
---|
19 | |
---|
20 | To rerun only those tests for there are newer sources |
---|
21 | |
---|
22 | make lazycheck |
---|
23 | |
---|
24 | To run only a subset of tests, use TESTS variable: |
---|
25 | |
---|
26 | make check TESTS="first_test second_test" |
---|
27 | |
---|
28 | To enable test output you can use the VERBOSE variable |
---|
29 | |
---|
30 | make check VERBOSE=1 |
---|
31 | |
---|
32 | Interpretation |
---|
33 | -------------- |
---|
34 | |
---|
35 | Successes: |
---|
36 | PASS - success |
---|
37 | XFAIL - expected failure |
---|
38 | |
---|
39 | Failures: |
---|
40 | FAIL - failure |
---|
41 | XPASS - unexpected success |
---|
42 | |
---|
43 | Other: |
---|
44 | SKIP - skipped test |
---|
45 | |
---|
46 | |
---|
47 | Getting details from failures |
---|
48 | ----------------------------- |
---|
49 | |
---|
50 | You can run the test directly, `./foo_test'; it will be verbose. The |
---|
51 | verbose output is also available in `foo_test.log'. A summary log is |
---|
52 | created in the file `test-suite.log'. |
---|
53 | |
---|
54 | |
---|
55 | Reporting failures |
---|
56 | ------------------ |
---|
57 | |
---|
58 | Open a 'New Ticket' in the issue tracking system |
---|
59 | (http://dev.thep.lu.se/svndigest) with verbose output of failing |
---|
60 | tests along with which version of svndigest and which operating |
---|
61 | system etc. Alternatively, you can send a bug report to the address |
---|
62 | given in the failed `make check' or in `configure --help'. |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | Writing tests |
---|
67 | ============= |
---|
68 | |
---|
69 | If you plan to fix a bug, write the test first. This way you will |
---|
70 | make sure the test catches the bug, and that it succeeds once you |
---|
71 | have fixed the bug. |
---|
72 | |
---|
73 | Add a copyright and license followed by one or two lines describing |
---|
74 | what the test does. |
---|
75 | |
---|
76 | Tests shall returns 0 at success, 77 if it should be skipped, and |
---|
77 | something else at failure. Tests should be silent also at failure |
---|
78 | unless option `-v` is passed or env variable VERBOSE is set. |
---|
79 | |
---|
80 | Add the test to XFAIL_TESTS in Makefile.am, if it tests a bug still |
---|
81 | present, i.e., the test is expected to fail. |
---|
82 | |
---|
83 | Note that that if tests are initialized correctly using either Suite |
---|
84 | class (see section C++ tests) or via init.sh (see shell tests) a |
---|
85 | sub-dir testSubDir/foo is created from which the test is run. |
---|
86 | |
---|
87 | C++ tests |
---|
88 | --------- |
---|
89 | |
---|
90 | Use the test::Suite class liberally. See other tests for examples of |
---|
91 | typical usage. |
---|
92 | |
---|
93 | Set `need_test_repo` to true in Suite constructor if the test uses |
---|
94 | the test repository. That will result in the test being skipped if |
---|
95 | test repo is not available, or if it is available the wc will |
---|
96 | checked out (if needed) and updated. |
---|
97 | |
---|
98 | If a test needs a data file, place the data in directory |
---|
99 | 'test/data'. However, you should feel free to re-use the data files |
---|
100 | already there. It should be possible to run the test suite also in a |
---|
101 | VPATH build in which builddir and srcdir are not the same. To avoid |
---|
102 | problems with files not found in VPATH builds, use the function |
---|
103 | test::src_filename() which gives you the absolute path to the |
---|
104 | file. If the data file is generated during build, e.g., checked out |
---|
105 | in a wc and residing in builddir, use test:filename instead. |
---|
106 | |
---|
107 | Add the test to check_PROGRAMS in Makefile.am. |
---|
108 | |
---|
109 | Shell tests |
---|
110 | ----------- |
---|
111 | |
---|
112 | Use `required=...` for setting a space delimited list of required |
---|
113 | tools (see other tests and init.sh). If `repo` is included in |
---|
114 | `required`, a toy_project wc will be checked out and updated if test |
---|
115 | repo is available, otherwise test is skipped. |
---|
116 | |
---|
117 | Include init.sh, with `. ./init.sh`. |
---|
118 | |
---|
119 | Use variables set in init.sh such as $srcdir and $abs_top_builddir, and $SVN. |
---|
120 | |
---|
121 | Do not run svndigest and svncopyright directly, but use functions |
---|
122 | SVNDIGEST_run and SVNCOPYRIGHT_run. |
---|
123 | |
---|
124 | Do not use `exit`, but use functions `exit_fail()`, `exit_skip()`, |
---|
125 | or `exit_success()`. |
---|
126 | |
---|
127 | Make sure to set svn property `svn:executable` on test. |
---|
128 | |
---|
129 | Add test to `distributed_TESTS` in Makefile.am. In order to get the |
---|
130 | lazycheck to behave as expected, declare accurate dependencies. If |
---|
131 | test 'foo.sh', for example, depends on file 'bar.txt', create a make |
---|
132 | rule: 'foo.log: bar.txt'. |
---|
133 | |
---|
134 | ====================================================================== |
---|
135 | Copyright (C) 2009, 2010 Peter Johansson |
---|
136 | |
---|
137 | This file is part of svndigest, http://dev.thep.lu.se/svndigest |
---|
138 | |
---|
139 | The svndigest is free software; you can redistribute it and/or modify |
---|
140 | it under the terms of the GNU General Public License as published by |
---|
141 | the Free Software Foundation; either version 3 of the License, or (at |
---|
142 | your option) any later version. |
---|
143 | |
---|
144 | The svndigest is distributed in the hope that it will be useful, but |
---|
145 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
146 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
147 | General Public License for more details. |
---|
148 | |
---|
149 | You should have received a copy of the GNU General Public License |
---|
150 | along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
---|
151 | ====================================================================== |
---|
152 | |
---|
153 | |
---|