5 Preparing system for tests:
7 - compile XFS into your kernel or load XFS modules
8 - install user tools including mkfs.xfs, xfs_db & xfs_bmap
10 - create two partitions to use for testing
12 - format as XFS, mount & optionally populate with
14 - one SCRATCH partition
15 - leave empty and expect this partition to be clobbered
18 (these must be two DIFFERENT partitions)
20 - setup your environment
21 - setenv TEST_DEV "device containing TEST PARTITION"
22 - setenv TEST_DIR "mount point of TEST PARTITION"
23 - setenv SCRATCH_DEV "device containing SCRATCH PARTITION"
24 - setenv SCRATCH_MNT "mount point for SCRATCH PARTITION"
25 - setenv TAPE_DEV "tape device for testing xfsdump"
26 - setenv RMT_TAPE_DEV "remote tape device for testing xfsdump"
27 - setenv RMT_IRIXTAPE_DEV "remote IRIX tape device for testing xfsdump"
29 - setenv SCRATCH_LOGDEV "device for scratch-fs external log"
30 - setenv SCRATCH_RTDEV "device for scratch-fs realtime data"
31 - setenv TEST_LOGDEV "device for test-fs external log"
32 - setenv TEST_RTDEV "device for test-fs realtime data"
33 - if TEST_LOGDEV and/or TEST_RTDEV, these will always be used.
34 - if SCRATCH_LOGDEV and/or SCRATCH_RTDEV, the USE_EXTERNAL
35 environment variable set to "yes" will enable their use.
36 - or add a case to the switch in common.config assigning
37 these variables based on the hostname of your test
40 - if testing xfsdump, make sure the tape devices have a
41 tape which can be overwritten.
43 - make sure $TEST_DEV is a mounted XFS partition
44 - make sure that $SCRATCH_DEV contains nothing useful
49 - ./check 001 002 003 ...
51 The check script tests the return value of each script, and
52 compares the output against the expected output. If the output
53 is not as expected, a diff will be output and an .out.bad file
54 will be produced for the failing test.
56 Unexpected console messages, crashes and hangs may be considered
57 to be failures but are not necesarily detected by the QA system.
59 __________________________
60 ADDING TO THE XFS QA SUITE
61 __________________________
64 Creating new tests scripts:
68 Test script environment:
70 When developing a new test script keep the following things in
71 mind. All of the environment variables and shell procedures are
72 available to the script once the "common.rc" file has been
75 1. The tests are run from an arbitrary directory. If you want to
76 do operations on an XFS filesystem (good idea, eh?), then do
79 (a) Create directories and files at will in the directory
80 $TEST_DIR ... this is within an XFS filesystem and world
81 writeable. You should cleanup when your test is done,
82 e.g. use a _cleanup shell procedure in the trap ... see
83 001 for an example. If you need to know, the $TEST_DIR
84 direcotry is within the filesystem on the block device
87 (b) mkfs a new XFS filesystem on $SCRATCH_DEV, and mount this
88 on $SCRATCH_MNT. Call the the _require_scratch function
89 on startup if you require use of the scratch partition.
90 _require_scratch does some checks on $SCRATCH_DEV &
91 $SCRATCH_MNT and makes sure they're unmounted. You should
92 cleanup when your test is done, and in particular unmount
94 Tests can make use of $SCRATCH_LOGDEV and $SCRATCH_RTDEV
95 for testing external log and realtime volumes - however,
96 these tests need to simply "pass" (e.g. cat $seq.out; exit
97 - or default to an internal log) in the common case where
98 these variables are not set.
100 2. You can safely create temporary files that are not part of the
101 filesystem tests (e.g. to catch output, prepare lists of things
102 to do, etc.) in files named $tmp.<anything>. The standard test
103 script framework created by "new" will initialize $tmp and
106 3. By default, tests are run as the same uid as the person
107 executing the control script "check" that runs the test scripts.
109 If you need to be root, add a call to the shell procedure
110 _need_to_be_root ... this will do nothing or exit with an
111 error message depending on your current uid.
113 4. Some other useful shell procedures:
115 _get_fqdn - echo the host's fully qualified
118 _get_pids_by_name - one argument is a process name, and
119 return all of the matching pids on
122 _within_tolerance - fancy numerical "close enough is good
123 enough" filter for deterministic
124 output ... see comments in
125 common.filter for an explanation
127 _filter_date - turn ctime(3) format dates into the
128 string DATE for deterministic
133 Each test script has a numerical name, e.g. 007, and an associated
134 verified output, e.g. 007.out.
136 It is important that the verified output is deterministic, and
137 part of the job of the test script is to filter the output to
138 make this so. Examples of the sort of things that need filtering:
145 - variable directory contents
146 - imprecise numbers, especially sizes and times
148 Use the "remake" script to recreate the verified output for one
153 The script "check" may be used to run one or more tests.
155 Test number $seq is deemed to "pass" when:
156 (a) no "core" file is created,
157 (b) the file $seq.notrun is not created,
158 (c) the exit status is 0, and
159 (d) the output matches the verified output.
161 In the "not run" case (b), the $seq.notrun file should contain a
162 short one-line summary of why the test was not run. The standard
163 output is not checked, so this can be used for a more verbose
164 explanation and to provide feedback when the QA test is run
168 To force a non-zero exit status use:
174 won't have the desired effect becuase of the way the exit trap
177 The recent pass/fail history is maintained in the file "check.log".
178 The elapsed time for the most recent pass for each test is kept