oops...checked in some temporary changes from testing on ia64 box.
[xfstests-dev.git] / README
1 ______________________
2 USING THE XFS QA SUITE
3 ______________________
4
5 Preparing system for tests:
6
7     - compile XFS into your kernel or load XFS modules
8     - install user tools including mkfs.xfs, xfs_db & xfs_bmap
9     
10     - create two partitions to use for testing
11         - one TEST partition
12             - format as XFS, mount & optionally populate with 
13               NON-IMPORTANT stuff
14         - one SCRATCH partition
15             - leave empty and expect this partition to be clobbered
16               by some tests.
17               
18         (these must be two DIFFERENT partitions)
19               
20     - setup your environment
21         - setenv TEST_DEV "device containing TEST PARTITION"
22         - setenv TEST_DIR "mount point of TEST PARTITION"   
23         - setenv SCRATCH_DEV "device containing SCRATCH PARTITION"
24         - setenv SCRATCH_MNT "mount point for SCRATCH PARTITION"
25         - setenv TAPE_DEV "tape device for testing xfsdump"
26         - setenv RMT_TAPE_DEV "remote tape device for testing xfsdump"
27         - setenv RMT_IRIXTAPE_DEV "remote IRIX tape device for testing xfsdump"
28         - optionally:
29              - setenv SCRATCH_LOGDEV "device for external log"
30              - setenv SCRATCH_RTDEV "device for realtime data"
31         - or add a case to the switch in common.config assigning
32           these variables based on the hostname of your test
33           machine
34
35     - if testing xfsdump, make sure the tape devices have a
36       tape which can be overwritten.
37           
38     - make sure $TEST_DEV is a mounted XFS partition
39     - make sure that $SCRATCH_DEV contains nothing useful
40     
41 Running tests:
42
43     - cd cmd/xfs/stress
44     - ./check 001 002 003 ... 
45     
46     The check script tests the return value of each script, and
47     compares the output against the expected output. If the output
48     is not as expected, a diff will be output and an .out.bad file
49     will be produced for the failing test.
50     
51     Unexpected console messages, crashes and hangs may be considered
52     to be failures but are not necesarily detected by the QA system.
53
54 __________________________ 
55 ADDING TO THE XFS QA SUITE
56 __________________________
57
58
59 Creating new tests scripts:
60
61     Use the "new" script.
62
63 Test script environment:
64
65     When developing a new test script keep the following things in
66     mind.  All of the environment variables and shell procedures are
67     available to the script once the "common.rc" file has been
68     sourced.
69
70      1. The tests are run from an arbitrary directory.  If you want to
71         do operations on an XFS filesystem (good idea, eh?), then do
72         one of the following:
73
74         (a) Create directories and files at will in the directory
75             $TEST_DIR ... this is within an XFS filesystem and world
76             writeable.  You should cleanup when your test is done,
77             e.g. use a _cleanup shell procedure in the trap ... see
78             001 for an example.  If you need to know, the $TEST_DIR
79             direcotry is within the filesystem on the block device
80             $TEST_DEV.
81
82         (b) mkfs a new XFS filesystem on $SCRATCH_DEV, and mount this
83             on $SCRATCH_MNT. Call the the _require_scratch function 
84             on startup if you require use of the scratch partition.
85             _require_scratch does some checks on $SCRATCH_DEV & 
86             $SCRATCH_MNT and makes sure they're unmounted. You should 
87             cleanup when your test is done, and in particular unmount 
88             $SCRATCH_MNT.
89             Tests can make use of $SCRATCH_LOGDEV and $SCRATCH_RTDEV
90             for testing external log and realtime volumes - however,
91             these tests need to simply "pass" (e.g. cat $seq.out; exit
92             - or default to an internal log) in the common case where
93             these variables are not set.
94
95      2. You can safely create temporary files that are not part of the
96         filesystem tests (e.g. to catch output, prepare lists of things
97         to do, etc.) in files named $tmp.<anything>.  The standard test
98         script framework created by "new" will initialize $tmp and
99         cleanup on exit.
100
101      3. By default, tests are run as the same uid as the person
102         executing the control script "check" that runs the test scripts.
103
104         If you need to be root, add a call to the shell procedure
105         _need_to_be_root ... this will do nothing or exit with an
106         error message depending on your current uid.
107
108      4. Some other useful shell procedures:
109
110         _get_fqdn               - echo the host's fully qualified
111                                   domain name
112
113         _get_pids_by_name       - one argument is a process name, and
114                                   return all of the matching pids on
115                                   standard output
116
117         _within_tolerance       - fancy numerical "close enough is good
118                                   enough" filter for deterministic
119                                   output ... see comments in
120                                   common.filter for an explanation
121
122         _filter_date            - turn ctime(3) format dates into the
123                                   string DATE for deterministic
124                                   output
125
126 Verified output:
127
128     Each test script has a numerical name, e.g. 007, and an associated
129     verified output, e.g. 007.out.
130
131     It is important that the verified output is deterministic, and
132     part of the job of the test script is to filter the output to
133     make this so.  Examples of the sort of things that need filtering:
134
135     - dates
136     - pids
137     - hostnames
138     - filesystem names
139     - timezones
140     - variable directory contents
141     - imprecise numbers, especially sizes and times
142
143     Use the "remake" script to recreate the verified output for one
144     or more tests.
145
146 Pass/failure:
147
148     The script "check" may be used to run one or more tests.
149
150     Test number $seq is deemed to "pass" when:
151     (a) no "core" file is created,
152     (b) the file $seq.notrun is not created,
153     (c) the exit status is 0, and
154     (d) the output matches the verified output.
155
156     In the "not run" case (b), the $seq.notrun file should contain a
157     short one-line summary of why the test was not run.  The standard
158     output is not checked, so this can be used for a more verbose
159     explanation and to provide feedback when the QA test is run
160     interactively.
161
162
163     To force a non-zero exit status use:
164         status=1
165         exit
166
167     Note that:
168         exit 1
169     won't have the desired effect becuase of the way the exit trap
170     works.
171
172     The recent pass/fail history is maintained in the file "check.log".
173     The elapsed time for the most recent pass for each test is kept
174     in "check.time".