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 external log"
30 - setenv SCRATCH_RTDEV "device for realtime data"
31 - or add a case to the switch in common.config assigning
32 these variables based on the hostname of your test
35 - if testing xfsdump, make sure the tape devices have a
36 tape which can be overwritten.
38 - make sure $TEST_DEV is a mounted XFS partition
39 - make sure that $SCRATCH_DEV contains nothing useful
44 - ./check 001 002 003 ...
46 The check script tests the return value of each script, and
47 compares the output against the expected output. If the output
48 is not as expected, a diff will be output and an .out.bad file
49 will be produced for the failing test.
51 Unexpected console messages, crashes and hangs may be considered
52 to be failures but are not necesarily detected by the QA system.
54 __________________________
55 ADDING TO THE XFS QA SUITE
56 __________________________
59 Creating new tests scripts:
63 Test script environment:
65 When developing a new test script keep the following things in
66 mind. All of the environment variables and shell procedures are
67 available to the script once the "common.rc" file has been
70 1. The tests are run from an arbitrary directory. If you want to
71 do operations on an XFS filesystem (good idea, eh?), then do
74 (a) Create directories and files at will in the directory
75 $TEST_DIR ... this is within an XFS filesystem and world
76 writeable. You should cleanup when your test is done,
77 e.g. use a _cleanup shell procedure in the trap ... see
78 001 for an example. If you need to know, the $TEST_DIR
79 direcotry is within the filesystem on the block device
82 (b) mkfs a new XFS filesystem on $SCRATCH_DEV, and mount this
83 on $SCRATCH_MNT. Call the the _require_scratch function
84 on startup if you require use of the scratch partition.
85 _require_scratch does some checks on $SCRATCH_DEV &
86 $SCRATCH_MNT and makes sure they're unmounted. You should
87 cleanup when your test is done, and in particular unmount
89 Tests can make use of $SCRATCH_LOGDEV and $SCRATCH_RTDEV
90 for testing external log and realtime volumes - however,
91 these tests need to simply "pass" (e.g. cat $seq.out; exit
92 - or default to an internal log) in the common case where
93 these variables are not set.
95 2. You can safely create temporary files that are not part of the
96 filesystem tests (e.g. to catch output, prepare lists of things
97 to do, etc.) in files named $tmp.<anything>. The standard test
98 script framework created by "new" will initialize $tmp and
101 3. By default, tests are run as the same uid as the person
102 executing the control script "check" that runs the test scripts.
104 If you need to be root, add a call to the shell procedure
105 _need_to_be_root ... this will do nothing or exit with an
106 error message depending on your current uid.
108 4. Some other useful shell procedures:
110 _get_fqdn - echo the host's fully qualified
113 _get_pids_by_name - one argument is a process name, and
114 return all of the matching pids on
117 _within_tolerance - fancy numerical "close enough is good
118 enough" filter for deterministic
119 output ... see comments in
120 common.filter for an explanation
122 _filter_date - turn ctime(3) format dates into the
123 string DATE for deterministic
128 Each test script has a numerical name, e.g. 007, and an associated
129 verified output, e.g. 007.out.
131 It is important that the verified output is deterministic, and
132 part of the job of the test script is to filter the output to
133 make this so. Examples of the sort of things that need filtering:
140 - variable directory contents
141 - imprecise numbers, especially sizes and times
143 Use the "remake" script to recreate the verified output for one
148 The script "check" may be used to run one or more tests.
150 Test number $seq is deemed to "pass" when:
151 (a) no "core" file is created,
152 (b) the file $seq.notrun is not created,
153 (c) the exit status is 0, and
154 (d) the output matches the verified output.
156 In the "not run" case (b), the $seq.notrun file should contain a
157 short one-line summary of why the test was not run. The standard
158 output is not checked, so this can be used for a more verbose
159 explanation and to provide feedback when the QA test is run
163 To force a non-zero exit status use:
169 won't have the desired effect becuase of the way the exit trap
172 The recent pass/fail history is maintained in the file "check.log".
173 The elapsed time for the most recent pass for each test is kept