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