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