1 |
578 |
markom |
Tcl Test Suite
|
2 |
|
|
--------------
|
3 |
|
|
|
4 |
|
|
RCS: @(#) $Id: README,v 1.1.1.1 2002-01-16 10:25:35 markom Exp $
|
5 |
|
|
|
6 |
|
|
This directory contains a set of validation tests for the Tcl
|
7 |
|
|
commands. Each of the files whose name ends in ".test" is
|
8 |
|
|
intended to fully exercise one or a few Tcl commands. The
|
9 |
|
|
commands tested by a given file are listed in the first line
|
10 |
|
|
of the file.
|
11 |
|
|
|
12 |
|
|
You can run the tests in two ways:
|
13 |
|
|
(a) type "make test" in ../unix; this will run all of the tests.
|
14 |
|
|
(b) start up tcltest in this directory, then "source" the test
|
15 |
|
|
file (for example, type "source parse.test"). To run all
|
16 |
|
|
of the tests, type "source all".
|
17 |
|
|
In either case no output will be generated if all goes well, except
|
18 |
|
|
for a listing of the tests.. If there are errors then additional
|
19 |
|
|
messages will appear in the format described below. Note: don't
|
20 |
|
|
run the tests as superuser, since this will cause several of the tests
|
21 |
|
|
to fail.
|
22 |
|
|
|
23 |
|
|
The rest of this file provides additional information on the
|
24 |
|
|
features of the testing environment.
|
25 |
|
|
|
26 |
|
|
This approach to testing was designed and initially implemented
|
27 |
|
|
by Mary Ann May-Pumphrey of Sun Microsystems. Many thanks to
|
28 |
|
|
her for donating her work back to the public Tcl release.
|
29 |
|
|
|
30 |
|
|
Definitions file:
|
31 |
|
|
-----------------
|
32 |
|
|
|
33 |
|
|
The file "defs" defines a collection of procedures and variables
|
34 |
|
|
used to run the tests. It is read in automatically by each of the
|
35 |
|
|
.test files if needed, but once it has been read once it will not
|
36 |
|
|
be read again by the .test files. If you change defs while running
|
37 |
|
|
tests you'll have to "source" it by hand to load its new contents.
|
38 |
|
|
|
39 |
|
|
Test output:
|
40 |
|
|
------------
|
41 |
|
|
|
42 |
|
|
Normally, output only appears when there are errors. However, if
|
43 |
|
|
the variable VERBOSE is set to 1 then tests will be run in "verbose"
|
44 |
|
|
mode and output will be generated for each test regardless of
|
45 |
|
|
whether it succeeded or failed. Test output consists of the
|
46 |
|
|
following information:
|
47 |
|
|
|
48 |
|
|
- the test identifier (which can be used to locate the test code
|
49 |
|
|
in the .test file)
|
50 |
|
|
- a brief description of the test
|
51 |
|
|
- the contents of the test code
|
52 |
|
|
- the actual results produced by the tests
|
53 |
|
|
- a "PASSED" or "FAILED" message
|
54 |
|
|
- the expected results (if the test failed)
|
55 |
|
|
|
56 |
|
|
You can set VERBOSE either interactively (after the defs file has been
|
57 |
|
|
read in), or you can change the default value in "defs".
|
58 |
|
|
|
59 |
|
|
Selecting tests for execution:
|
60 |
|
|
------------------------------
|
61 |
|
|
|
62 |
|
|
Normally, all the tests in a file are run whenever the file is
|
63 |
|
|
"source"d. However, you can select a specific set of tests using
|
64 |
|
|
the global variable TESTS. This variable contains a pattern; any
|
65 |
|
|
test whose identifier matches TESTS will be run. For example,
|
66 |
|
|
the following interactive command causes all of the "for" tests in
|
67 |
|
|
groups 2 and 4 to be executed:
|
68 |
|
|
|
69 |
|
|
set TESTS {for-[24]*}
|
70 |
|
|
|
71 |
|
|
TESTS defaults to *, but you can change the default in "defs" if
|
72 |
|
|
you wish.
|
73 |
|
|
|
74 |
|
|
Saving keystrokes:
|
75 |
|
|
------------------
|
76 |
|
|
|
77 |
|
|
A convenience procedure named "dotests" is included in file
|
78 |
|
|
"defs". It takes two arguments--the name of the test file (such
|
79 |
|
|
as "parse.test"), and a pattern selecting the tests you want to
|
80 |
|
|
execute. It sets TESTS to the second argument, calls "source" on
|
81 |
|
|
the file specified in the first argument, and restores TESTS to
|
82 |
|
|
its pre-call value at the end.
|
83 |
|
|
|
84 |
|
|
Batch vs. interactive execution:
|
85 |
|
|
--------------------------------
|
86 |
|
|
|
87 |
|
|
The tests can be run in either batch or interactive mode. Batch
|
88 |
|
|
mode refers to using I/O redirection from a UNIX shell. For example,
|
89 |
|
|
the following command causes the tests in the file named "parse.test"
|
90 |
|
|
to be executed:
|
91 |
|
|
|
92 |
|
|
tclTest < parse.test > parse.test.results
|
93 |
|
|
|
94 |
|
|
Users who want to execute the tests in this fashion need to first
|
95 |
|
|
ensure that the file "defs" has proper values for the global
|
96 |
|
|
variables that control the testing environment (VERBOSE and TESTS).
|