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