OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [expect/] [tests/] [README] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.