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