675 |
10 Oct 06 |
jari |
$Id$ |
675 |
10 Oct 06 |
jari |
2 |
|
1640 |
12 Dec 08 |
peter |
The yat test suite |
1640 |
12 Dec 08 |
peter |
4 |
|
1640 |
12 Dec 08 |
peter |
5 |
|
1640 |
12 Dec 08 |
peter |
Usage: |
1640 |
12 Dec 08 |
peter |
7 |
======== |
1640 |
12 Dec 08 |
peter |
8 |
|
2228 |
25 Mar 10 |
peter |
Running the tests |
1640 |
12 Dec 08 |
peter |
10 |
----------------- |
1640 |
12 Dec 08 |
peter |
11 |
|
2228 |
25 Mar 10 |
peter |
To run all tests: |
1640 |
12 Dec 08 |
peter |
13 |
|
2228 |
25 Mar 10 |
peter |
make check |
1640 |
12 Dec 08 |
peter |
15 |
|
2754 |
28 Jun 12 |
peter |
You can use '-j N' for faster completion on multiprocessor systems. |
2261 |
26 May 10 |
peter |
17 |
|
2232 |
26 Mar 10 |
peter |
To rerun only failed tests: |
2228 |
25 Mar 10 |
peter |
19 |
|
2228 |
25 Mar 10 |
peter |
make recheck |
2228 |
25 Mar 10 |
peter |
21 |
|
2475 |
13 Apr 11 |
peter |
To rerun only those tests for which there are newer sources |
2232 |
26 Mar 10 |
peter |
23 |
|
2232 |
26 Mar 10 |
peter |
make lazycheck |
2232 |
26 Mar 10 |
peter |
25 |
|
2228 |
25 Mar 10 |
peter |
To run only a subset of tests, use TESTS variable: |
2228 |
25 Mar 10 |
peter |
27 |
|
2228 |
25 Mar 10 |
peter |
make check TESTS="first_test second_test" |
2228 |
25 Mar 10 |
peter |
29 |
|
2228 |
25 Mar 10 |
peter |
To enable test output you can use the VERBOSE variable |
2228 |
25 Mar 10 |
peter |
31 |
|
2228 |
25 Mar 10 |
peter |
make check VERBOSE=1 |
2228 |
25 Mar 10 |
peter |
33 |
|
1640 |
12 Dec 08 |
peter |
Interpretation |
1640 |
12 Dec 08 |
peter |
35 |
-------------- |
1640 |
12 Dec 08 |
peter |
36 |
|
1640 |
12 Dec 08 |
peter |
Successes: |
1640 |
12 Dec 08 |
peter |
PASS - success |
1640 |
12 Dec 08 |
peter |
XFAIL - expected failure |
1640 |
12 Dec 08 |
peter |
40 |
|
1640 |
12 Dec 08 |
peter |
Failures: |
1640 |
12 Dec 08 |
peter |
FAIL - failure |
1640 |
12 Dec 08 |
peter |
XPASS - unexpected success |
1640 |
12 Dec 08 |
peter |
44 |
|
1640 |
12 Dec 08 |
peter |
Other: |
1640 |
12 Dec 08 |
peter |
SKIP - skipped test |
1640 |
12 Dec 08 |
peter |
47 |
|
1640 |
12 Dec 08 |
peter |
48 |
|
1640 |
12 Dec 08 |
peter |
Getting details from failures |
1640 |
12 Dec 08 |
peter |
50 |
----------------------------- |
1640 |
12 Dec 08 |
peter |
51 |
|
2754 |
28 Jun 12 |
peter |
You can run the test directly, 'test/foo_test'; it will be verbose. The |
2754 |
28 Jun 12 |
peter |
verbose output is also available in 'test/foo_test.log'. A summary log is |
2754 |
28 Jun 12 |
peter |
created in the file 'test-suite.log'. |
1640 |
12 Dec 08 |
peter |
55 |
|
1640 |
12 Dec 08 |
peter |
56 |
|
1640 |
12 Dec 08 |
peter |
Reporting failures |
1640 |
12 Dec 08 |
peter |
58 |
------------------ |
1640 |
12 Dec 08 |
peter |
59 |
|
2754 |
28 Jun 12 |
peter |
If a test fails, please send file 'test-suite.log' to the address |
2754 |
28 Jun 12 |
peter |
given in the failed 'make check' or in './configure --help', |
2754 |
28 Jun 12 |
peter |
together with other relevant info such as version numbers, operating |
2754 |
28 Jun 12 |
peter |
system, etc. |
1640 |
12 Dec 08 |
peter |
64 |
|
1640 |
12 Dec 08 |
peter |
65 |
|
1640 |
12 Dec 08 |
peter |
Writing tests |
1640 |
12 Dec 08 |
peter |
67 |
============= |
1640 |
12 Dec 08 |
peter |
68 |
|
1641 |
12 Dec 08 |
peter |
If you plan to fix a bug, write the test first. This way you will |
1640 |
12 Dec 08 |
peter |
make sure the test catches the bug, and that it succeeds once you |
1640 |
12 Dec 08 |
peter |
have fixed the bug. |
1640 |
12 Dec 08 |
peter |
72 |
|
1640 |
12 Dec 08 |
peter |
Use the test::Suite class liberally. See other tests for examples of |
1640 |
12 Dec 08 |
peter |
typical usage. |
1640 |
12 Dec 08 |
peter |
75 |
|
1642 |
12 Dec 08 |
peter |
Tests shall return 0 at success and -1 otherwise (see |
1642 |
12 Dec 08 |
peter |
test::Suite::return_value()). If the test should be skipped for some |
1642 |
12 Dec 08 |
peter |
reason it shall return 77. |
1640 |
12 Dec 08 |
peter |
79 |
|
1675 |
22 Dec 08 |
peter |
When writing numerical tests, it is typically desired to allow for |
1675 |
22 Dec 08 |
peter |
some small errors in the comparisons. When comparing two doubles |
1675 |
22 Dec 08 |
peter |
computed within the same program, the error bound should scale with |
1675 |
22 Dec 08 |
peter |
the machine precision. See test::Suite::equal(3). In other case, for |
1675 |
22 Dec 08 |
peter |
example, when the comparison includes a double distributed in |
1675 |
22 Dec 08 |
peter |
'test/data' the error bound should be fixed and reflect the |
1675 |
22 Dec 08 |
peter |
precision in the distributed file. See test::Suite::equal_fix(3). |
1675 |
22 Dec 08 |
peter |
87 |
|
1642 |
12 Dec 08 |
peter |
If a test needs a data file, place the data in directory |
1642 |
12 Dec 08 |
peter |
'test/data'. However, you should feel free to re-use the data files |
1933 |
30 Apr 09 |
peter |
already there. It should be possible to run the test suite also in a |
1933 |
30 Apr 09 |
peter |
VPATH build in which builddir and srcdir are not the same. To avoid |
1933 |
30 Apr 09 |
peter |
problems with files not found in VPATH builds, use the function |
1933 |
30 Apr 09 |
peter |
test::filename() which gives you the absolute path to the file. |
1640 |
12 Dec 08 |
peter |
94 |
|
1642 |
12 Dec 08 |
peter |
If a test grows large, avoid having several tests in one long |
1642 |
12 Dec 08 |
peter |
main. It creates long correlations and complicates debugging and |
1642 |
12 Dec 08 |
peter |
extending the test. If you don't want to split the test into several |
1642 |
12 Dec 08 |
peter |
files, split the test into several independent sub-functions. |
1640 |
12 Dec 08 |
peter |
99 |
|
2233 |
27 Mar 10 |
peter |
C++ tests |
2233 |
27 Mar 10 |
peter |
101 |
--------- |
1642 |
12 Dec 08 |
peter |
102 |
|
2233 |
27 Mar 10 |
peter |
Use the test::Suite class liberally. See other tests for examples of |
2370 |
11 Dec 10 |
peter |
typical usage. Add the test to EXTRA_PROGRAMS in Makefile.am. Tests |
2754 |
28 Jun 12 |
peter |
should have the extension '.test' as in 'foo.test' and corresponding |
2754 |
28 Jun 12 |
peter |
source file should be named 'foo.cc'. |
2233 |
27 Mar 10 |
peter |
107 |
|
2233 |
27 Mar 10 |
peter |
Shell tests |
2233 |
27 Mar 10 |
peter |
109 |
----------- |
2233 |
27 Mar 10 |
peter |
110 |
|
2233 |
27 Mar 10 |
peter |
Use 'required=...' for setting a space delimited list of required |
2233 |
27 Mar 10 |
peter |
tools (see other tests and common_defs.sh). Include common_defs.sh, |
2521 |
11 Jul 11 |
peter |
with '. ./common_defs.sh || exit 99'. |
2233 |
27 Mar 10 |
peter |
114 |
|
2233 |
27 Mar 10 |
peter |
Add test to 'DISTRIBUTED_TESTS' in Makefile.am. In order to get the |
2233 |
27 Mar 10 |
peter |
lazycheck to behave as expected, declare accurate dependencies. If |
2233 |
27 Mar 10 |
peter |
test 'foo.sh', for example, depends on file 'bar.txt', create a make |
2238 |
04 Apr 10 |
peter |
rule: 'foo.log: bar.txt'. |
2233 |
27 Mar 10 |
peter |
119 |
|
2754 |
28 Jun 12 |
peter |
Do not use 'exit' directly, but use functions 'exit_fail', 'exit_skip', |
2754 |
28 Jun 12 |
peter |
'exit_fatal', or 'exit_success'. |
2521 |
11 Jul 11 |
peter |
122 |
|
2233 |
27 Mar 10 |
peter |
Make sure to set svn property 'svn:executable' on test. |
2233 |
27 Mar 10 |
peter |
124 |
|
675 |
10 Oct 06 |
jari |
125 |
====================================================================== |
831 |
27 Mar 07 |
peter |
Copyright (C) 2005 Peter Johansson |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2006 Jari Häkkinen |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2007 Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
2754 |
28 Jun 12 |
peter |
Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson |
675 |
10 Oct 06 |
jari |
131 |
|
1437 |
25 Aug 08 |
peter |
This file is part of yat library, http://dev.thep.lu.se/yat |
675 |
10 Oct 06 |
jari |
133 |
|
675 |
10 Oct 06 |
jari |
The yat library is free software; you can redistribute it and/or |
675 |
10 Oct 06 |
jari |
modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
published by the Free Software Foundation; either version 3 of the |
675 |
10 Oct 06 |
jari |
License, or (at your option) any later version. |
675 |
10 Oct 06 |
jari |
138 |
|
675 |
10 Oct 06 |
jari |
The yat library is distributed in the hope that it will be useful, but |
675 |
10 Oct 06 |
jari |
WITHOUT ANY WARRANTY; without even the implied warranty of |
675 |
10 Oct 06 |
jari |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
675 |
10 Oct 06 |
jari |
General Public License for more details. |
675 |
10 Oct 06 |
jari |
143 |
|
675 |
10 Oct 06 |
jari |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
675 |
10 Oct 06 |
jari |
146 |
====================================================================== |