279: test mkfs with various sector sizes & alignments
[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 one or 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 (optional)
34             - leave empty and expect this partition to be clobbered
35               by some tests.  If this is not provided, many tests will
36               not be run.
37               (SCRATCH and TEST must be two DIFFERENT partitions)
38               OR
39         - for btrfs only: some btrfs test cases will need 3 or more independent
40               SCRATCH disks which should be set using SCRATCH_DEV_POOL (for eg:
41               SCRATCH_DEV_POOL="/dev/sda /dev/sdb /dev/sdc") with which
42               SCRATCH_DEV should be unused by the tester, and for the legacy
43               support SCRATCH_DEV will be set to the first disk of the
44               SCRATCH_DEV_POOL by xfstests script.
45               
46     - setup your environment
47         - setenv TEST_DEV "device containing TEST PARTITION"
48         - setenv TEST_DIR "mount point of TEST PARTITION"   
49         - optionally:
50              - setenv SCRATCH_DEV "device containing SCRATCH PARTITION" OR
51                (btrfs only) setenv SCRATCH_DEV_POOL "to 3 or more SCRATCH disks for
52                testing btrfs raid concepts"
53              - setenv SCRATCH_MNT "mount point for SCRATCH PARTITION"
54              - setenv TAPE_DEV "tape device for testing xfsdump"
55              - setenv RMT_TAPE_DEV "remote tape device for testing xfsdump"
56              - setenv RMT_IRIXTAPE_DEV "remote IRIX tape device for testing xfsdump"
57              - setenv SCRATCH_LOGDEV "device for scratch-fs external log"
58              - setenv SCRATCH_RTDEV "device for scratch-fs realtime data"
59              - setenv TEST_LOGDEV "device for test-fs external log"
60              - setenv TEST_RTDEV "device for test-fs realtime data"
61              - if TEST_LOGDEV and/or TEST_RTDEV, these will always be used.
62              - if SCRATCH_LOGDEV and/or SCRATCH_RTDEV, the USE_EXTERNAL
63                environment variable set to "yes" will enable their use.
64         - or add a case to the switch in common.config assigning
65           these variables based on the hostname of your test
66           machine
67         - or add these variables to a file called local.config and keep that
68           file in your workarea.
69
70     - if testing xfsdump, make sure the tape devices have a
71       tape which can be overwritten.
72           
73     - make sure $TEST_DEV is a mounted XFS partition
74     - make sure that $SCRATCH_DEV or $SCRATCH_DEV_POOL contains nothing useful
75     
76 Running tests:
77
78     - cd xfstests
79     - By default the tests suite will run xfs tests:
80     - ./check 001 002 003 ... or you can explicitly run a filesystem: 
81       ./check -xfs [test(s)]
82     - You can run a range of tests: ./check 067-078
83     - Groups of tests maybe ran by: ./check -g [group(s)]
84       See the 'group' file for details on groups
85     - for udf tests: ./check -udf [test(s)]
86       Running all the udf tests: ./check -udf -g udf
87     - for running nfs tests: ./check -nfs [test(s)]
88     - To randomize test order: ./check -r [test(s)]
89
90     
91     The check script tests the return value of each script, and
92     compares the output against the expected output. If the output
93     is not as expected, a diff will be output and an .out.bad file
94     will be produced for the failing test.
95     
96     Unexpected console messages, crashes and hangs may be considered
97     to be failures but are not necessarily detected by the QA system.
98
99 __________________________ 
100 ADDING TO THE FSQA SUITE
101 __________________________
102
103
104 Creating new tests scripts:
105
106     Use the "new" script.
107
108 Test script environment:
109
110     When developing a new test script keep the following things in
111     mind.  All of the environment variables and shell procedures are
112     available to the script once the "common.rc" file has been
113     sourced.
114
115      1. The tests are run from an arbitrary directory.  If you want to
116         do operations on an XFS filesystem (good idea, eh?), then do
117         one of the following:
118
119         (a) Create directories and files at will in the directory
120             $TEST_DIR ... this is within an XFS filesystem and world
121             writeable.  You should cleanup when your test is done,
122             e.g. use a _cleanup shell procedure in the trap ... see
123             001 for an example.  If you need to know, the $TEST_DIR
124             directory is within the filesystem on the block device
125             $TEST_DEV.
126
127         (b) mkfs a new XFS filesystem on $SCRATCH_DEV, and mount this
128             on $SCRATCH_MNT. Call the the _require_scratch function 
129             on startup if you require use of the scratch partition.
130             _require_scratch does some checks on $SCRATCH_DEV & 
131             $SCRATCH_MNT and makes sure they're unmounted. You should 
132             cleanup when your test is done, and in particular unmount 
133             $SCRATCH_MNT.
134             Tests can make use of $SCRATCH_LOGDEV and $SCRATCH_RTDEV
135             for testing external log and realtime volumes - however,
136             these tests need to simply "pass" (e.g. cat $seq.out; exit
137             - or default to an internal log) in the common case where
138             these variables are not set.
139
140      2. You can safely create temporary files that are not part of the
141         filesystem tests (e.g. to catch output, prepare lists of things
142         to do, etc.) in files named $tmp.<anything>.  The standard test
143         script framework created by "new" will initialize $tmp and
144         cleanup on exit.
145
146      3. By default, tests are run as the same uid as the person
147         executing the control script "check" that runs the test scripts.
148
149         If you need to be root, add a call to the shell procedure
150         _need_to_be_root ... this will do nothing or exit with an
151         error message depending on your current uid.
152
153      4. Some other useful shell procedures:
154
155         _get_fqdn               - echo the host's fully qualified
156                                   domain name
157
158         _get_pids_by_name       - one argument is a process name, and
159                                   return all of the matching pids on
160                                   standard output
161
162         _within_tolerance       - fancy numerical "close enough is good
163                                   enough" filter for deterministic
164                                   output ... see comments in
165                                   common.filter for an explanation
166
167         _filter_date            - turn ctime(3) format dates into the
168                                   string DATE for deterministic
169                                   output
170
171         _cat_passwd,            - dump the content of the password
172         _cat_group                or group file (both the local file
173                                   and the content of the NIS database
174                                   if it is likely to be present)
175
176      4. General recommendations, usage conventions, etc.:
177         - When the content of the password or group file is
178           required, get it using the _cat_passwd and _cat_group
179           functions, to ensure NIS information is included if NIS
180           is active.
181         - When calling getfacl in a test, pass the "-n" argument so
182           that numeric rather than symbolic identifiers are used in
183           the output.
184
185 Verified output:
186
187     Each test script has a numerical name, e.g. 007, and an associated
188     verified output, e.g. 007.out.
189
190     It is important that the verified output is deterministic, and
191     part of the job of the test script is to filter the output to
192     make this so.  Examples of the sort of things that need filtering:
193
194     - dates
195     - pids
196     - hostnames
197     - filesystem names
198     - timezones
199     - variable directory contents
200     - imprecise numbers, especially sizes and times
201
202     Use the "remake" script to recreate the verified output for one
203     or more tests.
204
205 Pass/failure:
206
207     The script "check" may be used to run one or more tests.
208
209     Test number $seq is deemed to "pass" when:
210     (a) no "core" file is created,
211     (b) the file $seq.notrun is not created,
212     (c) the exit status is 0, and
213     (d) the output matches the verified output.
214
215     In the "not run" case (b), the $seq.notrun file should contain a
216     short one-line summary of why the test was not run.  The standard
217     output is not checked, so this can be used for a more verbose
218     explanation and to provide feedback when the QA test is run
219     interactively.
220
221
222     To force a non-zero exit status use:
223         status=1
224         exit
225
226     Note that:
227         exit 1
228     won't have the desired effect because of the way the exit trap
229     works.
230
231     The recent pass/fail history is maintained in the file "check.log".
232     The elapsed time for the most recent pass for each test is kept
233     in "check.time".