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