952 |
06 Dec 09 |
peter |
$Id$ |
952 |
06 Dec 09 |
peter |
2 |
|
952 |
06 Dec 09 |
peter |
The svndigest test suite |
952 |
06 Dec 09 |
peter |
4 |
|
952 |
06 Dec 09 |
peter |
5 |
|
952 |
06 Dec 09 |
peter |
Usage: |
952 |
06 Dec 09 |
peter |
7 |
======== |
952 |
06 Dec 09 |
peter |
8 |
|
1050 |
05 Apr 10 |
peter |
Running the tests |
952 |
06 Dec 09 |
peter |
10 |
----------------- |
952 |
06 Dec 09 |
peter |
11 |
|
1050 |
05 Apr 10 |
peter |
To run all tests: |
952 |
06 Dec 09 |
peter |
13 |
|
1050 |
05 Apr 10 |
peter |
make check |
952 |
06 Dec 09 |
peter |
15 |
|
1050 |
05 Apr 10 |
peter |
To rerun only failed tests: |
1050 |
05 Apr 10 |
peter |
17 |
|
1050 |
05 Apr 10 |
peter |
make recheck |
1050 |
05 Apr 10 |
peter |
19 |
|
1050 |
05 Apr 10 |
peter |
To rerun only those tests for there are newer sources |
1050 |
05 Apr 10 |
peter |
21 |
|
1050 |
05 Apr 10 |
peter |
make lazycheck |
1050 |
05 Apr 10 |
peter |
23 |
|
1050 |
05 Apr 10 |
peter |
To run only a subset of tests, use TESTS variable: |
1050 |
05 Apr 10 |
peter |
25 |
|
1050 |
05 Apr 10 |
peter |
make check TESTS="first_test second_test" |
1050 |
05 Apr 10 |
peter |
27 |
|
1050 |
05 Apr 10 |
peter |
To enable test output you can use the VERBOSE variable |
1050 |
05 Apr 10 |
peter |
29 |
|
1050 |
05 Apr 10 |
peter |
make check VERBOSE=1 |
1050 |
05 Apr 10 |
peter |
31 |
|
952 |
06 Dec 09 |
peter |
Interpretation |
952 |
06 Dec 09 |
peter |
33 |
-------------- |
952 |
06 Dec 09 |
peter |
34 |
|
952 |
06 Dec 09 |
peter |
Successes: |
952 |
06 Dec 09 |
peter |
PASS - success |
952 |
06 Dec 09 |
peter |
XFAIL - expected failure |
952 |
06 Dec 09 |
peter |
38 |
|
952 |
06 Dec 09 |
peter |
Failures: |
952 |
06 Dec 09 |
peter |
FAIL - failure |
952 |
06 Dec 09 |
peter |
XPASS - unexpected success |
952 |
06 Dec 09 |
peter |
42 |
|
952 |
06 Dec 09 |
peter |
Other: |
952 |
06 Dec 09 |
peter |
SKIP - skipped test |
952 |
06 Dec 09 |
peter |
45 |
|
952 |
06 Dec 09 |
peter |
46 |
|
952 |
06 Dec 09 |
peter |
Getting details from failures |
952 |
06 Dec 09 |
peter |
48 |
----------------------------- |
952 |
06 Dec 09 |
peter |
49 |
|
1050 |
05 Apr 10 |
peter |
You can run the test directly, `./foo_test'; it will be verbose. The |
1050 |
05 Apr 10 |
peter |
verbose output is also available in `foo_test.log'. A summary log is |
1050 |
05 Apr 10 |
peter |
created in the file `test-suite.log'. |
952 |
06 Dec 09 |
peter |
53 |
|
952 |
06 Dec 09 |
peter |
54 |
|
952 |
06 Dec 09 |
peter |
Reporting failures |
952 |
06 Dec 09 |
peter |
56 |
------------------ |
952 |
06 Dec 09 |
peter |
57 |
|
952 |
06 Dec 09 |
peter |
Open a 'New Ticket' in the issue tracking system |
952 |
06 Dec 09 |
peter |
(http://dev.thep.lu.se/svndigest) with verbose output of failing |
952 |
06 Dec 09 |
peter |
tests along with which version of svndigest and which operating |
952 |
06 Dec 09 |
peter |
system etc. Alternatively, you can send a bug report to the address |
952 |
06 Dec 09 |
peter |
given in the failed `make check' or in `configure --help'. |
952 |
06 Dec 09 |
peter |
63 |
|
952 |
06 Dec 09 |
peter |
64 |
|
952 |
06 Dec 09 |
peter |
65 |
|
952 |
06 Dec 09 |
peter |
Writing tests |
952 |
06 Dec 09 |
peter |
67 |
============= |
952 |
06 Dec 09 |
peter |
68 |
|
952 |
06 Dec 09 |
peter |
If you plan to fix a bug, write the test first. This way you will |
952 |
06 Dec 09 |
peter |
make sure the test catches the bug, and that it succeeds once you |
952 |
06 Dec 09 |
peter |
have fixed the bug. |
952 |
06 Dec 09 |
peter |
72 |
|
974 |
11 Dec 09 |
peter |
Add a copyright and license followed by one or two lines describing |
974 |
11 Dec 09 |
peter |
what the test does. |
974 |
11 Dec 09 |
peter |
75 |
|
974 |
11 Dec 09 |
peter |
Tests shall returns 0 at success, 77 if it should be skipped, and |
974 |
11 Dec 09 |
peter |
something else at failure. Tests should be silent also at failure |
974 |
11 Dec 09 |
peter |
unless option `-v` is passed or env variable VERBOSE is set. |
974 |
11 Dec 09 |
peter |
79 |
|
974 |
11 Dec 09 |
peter |
Add the test to XFAIL_TESTS in Makefile.am, if it tests a bug still |
974 |
11 Dec 09 |
peter |
present, i.e., the test is expected to fail. |
974 |
11 Dec 09 |
peter |
82 |
|
1092 |
12 Jun 10 |
peter |
Note that that if tests are initialized correctly using either Suite |
1092 |
12 Jun 10 |
peter |
class (see section C++ tests) or via init.sh (see shell tests) a |
1092 |
12 Jun 10 |
peter |
sub-dir testSubDir/foo is created from which the test is run. |
1092 |
12 Jun 10 |
peter |
86 |
|
974 |
11 Dec 09 |
peter |
C++ tests |
974 |
11 Dec 09 |
peter |
88 |
--------- |
974 |
11 Dec 09 |
peter |
89 |
|
1164 |
13 Aug 10 |
peter |
Tests written in C++ have suffix `.test', for example, `foo.test' |
1164 |
13 Aug 10 |
peter |
and corresponding source is called `foo.cc'. To add a new test |
1164 |
13 Aug 10 |
peter |
append `foo.test' to variable EXTRA_PROGRAMS in `Makefile.am' and |
1164 |
13 Aug 10 |
peter |
edit `foo.cc'. |
1164 |
13 Aug 10 |
peter |
94 |
|
952 |
06 Dec 09 |
peter |
Use the test::Suite class liberally. See other tests for examples of |
952 |
06 Dec 09 |
peter |
typical usage. |
952 |
06 Dec 09 |
peter |
97 |
|
1050 |
05 Apr 10 |
peter |
Set `need_test_repo` to true in Suite constructor if the test uses |
974 |
11 Dec 09 |
peter |
the test repository. That will result in the test being skipped if |
974 |
11 Dec 09 |
peter |
test repo is not available, or if it is available the wc will |
974 |
11 Dec 09 |
peter |
checked out (if needed) and updated. |
952 |
06 Dec 09 |
peter |
102 |
|
952 |
06 Dec 09 |
peter |
If a test needs a data file, place the data in directory |
952 |
06 Dec 09 |
peter |
'test/data'. However, you should feel free to re-use the data files |
952 |
06 Dec 09 |
peter |
already there. It should be possible to run the test suite also in a |
952 |
06 Dec 09 |
peter |
VPATH build in which builddir and srcdir are not the same. To avoid |
952 |
06 Dec 09 |
peter |
problems with files not found in VPATH builds, use the function |
974 |
11 Dec 09 |
peter |
test::src_filename() which gives you the absolute path to the |
974 |
11 Dec 09 |
peter |
file. If the data file is generated during build, e.g., checked out |
974 |
11 Dec 09 |
peter |
in a wc and residing in builddir, use test:filename instead. |
952 |
06 Dec 09 |
peter |
111 |
|
974 |
11 Dec 09 |
peter |
Shell tests |
974 |
11 Dec 09 |
peter |
113 |
----------- |
974 |
11 Dec 09 |
peter |
114 |
|
974 |
11 Dec 09 |
peter |
Use `required=...` for setting a space delimited list of required |
974 |
11 Dec 09 |
peter |
tools (see other tests and init.sh). If `repo` is included in |
974 |
11 Dec 09 |
peter |
`required`, a toy_project wc will be checked out and updated if test |
974 |
11 Dec 09 |
peter |
repo is available, otherwise test is skipped. |
974 |
11 Dec 09 |
peter |
119 |
|
974 |
11 Dec 09 |
peter |
Include init.sh, with `. ./init.sh`. |
974 |
11 Dec 09 |
peter |
121 |
|
1092 |
12 Jun 10 |
peter |
Use variables set in init.sh such as $srcdir and $abs_top_builddir, and $SVN. |
974 |
11 Dec 09 |
peter |
123 |
|
1092 |
12 Jun 10 |
peter |
Do not run svndigest and svncopyright directly, but use functions |
1092 |
12 Jun 10 |
peter |
SVNDIGEST_run and SVNCOPYRIGHT_run. |
1092 |
12 Jun 10 |
peter |
126 |
|
974 |
11 Dec 09 |
peter |
Do not use `exit`, but use functions `exit_fail()`, `exit_skip()`, |
974 |
11 Dec 09 |
peter |
or `exit_success()`. |
974 |
11 Dec 09 |
peter |
129 |
|
974 |
11 Dec 09 |
peter |
Make sure to set svn property `svn:executable` on test. |
974 |
11 Dec 09 |
peter |
131 |
|
1050 |
05 Apr 10 |
peter |
Add test to `distributed_TESTS` in Makefile.am. In order to get the |
1050 |
05 Apr 10 |
peter |
lazycheck to behave as expected, declare accurate dependencies. If |
1050 |
05 Apr 10 |
peter |
test 'foo.sh', for example, depends on file 'bar.txt', create a make |
1050 |
05 Apr 10 |
peter |
rule: 'foo.log: bar.txt'. |
974 |
11 Dec 09 |
peter |
136 |
|
952 |
06 Dec 09 |
peter |
137 |
====================================================================== |
1050 |
05 Apr 10 |
peter |
Copyright (C) 2009, 2010 Peter Johansson |
952 |
06 Dec 09 |
peter |
139 |
|
952 |
06 Dec 09 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
952 |
06 Dec 09 |
peter |
141 |
|
952 |
06 Dec 09 |
peter |
The svndigest is free software; you can redistribute it and/or modify |
952 |
06 Dec 09 |
peter |
it under the terms of the GNU General Public License as published by |
952 |
06 Dec 09 |
peter |
the Free Software Foundation; either version 3 of the License, or (at |
952 |
06 Dec 09 |
peter |
your option) any later version. |
952 |
06 Dec 09 |
peter |
146 |
|
952 |
06 Dec 09 |
peter |
The svndigest is distributed in the hope that it will be useful, but |
952 |
06 Dec 09 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
952 |
06 Dec 09 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
952 |
06 Dec 09 |
peter |
General Public License for more details. |
952 |
06 Dec 09 |
peter |
151 |
|
952 |
06 Dec 09 |
peter |
You should have received a copy of the GNU General Public License |
952 |
06 Dec 09 |
peter |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
952 |
06 Dec 09 |
peter |
154 |
====================================================================== |
952 |
06 Dec 09 |
peter |
155 |
|
952 |
06 Dec 09 |
peter |
156 |
|