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