1TIME="LONG" 2AUTHOR = "Cleber Rosa <cleber@redhat.com>" 3NAME = 'xfs filesystem test suite' 4TEST_CLASS = 'kernel' 5TEST_CATEGORY = 'Functional' 6TEST_TYPE = 'client' 7DOC = """ 8xfstests in autotest 9-------------------- 10 11This is a simple wrapper for running xfstests inside autotest. The steps to get 12started are really simple: 13 141) Edit the configuration variables on the control file. 15 161.1) The variables 'TEST_DEV' and 'TEST_DIR' are mandatory and should be set to 17 a block device path and mount point path, respectively, that will be used 18 *exclusively* for xfstests. It must have the filesystem of your choice 19 previously created. 20 21 DO NOT USE A BLOCK DEVICE WITH IMPORTANT DATA!!! 22 231.2) Set the range of tests you want to run setting the TEST_RANGE variable. 24 Please notice that python's range() function may not work as you expect, 25 that is, if you want a range from 0-255, use: range(0, 256) 26 272) Run the tests (assuming autotest installed in /usr/local/autotest): 28 29 # cd /usr/local/autotest/client/tests/xfstests 30 # ../../bin/autotest control 31 323) Check the HTML report at 33 34 /usr/local/autotest/client/results/default/job_report.html 35 36General notes 37------------- 38 39* As autotest includes a setup phase for client tests, this step is encapsulated 40in a dummy xfstests number 000. 41 42* XFS utilities, system libraries and header files are checked early, before 43trying to build xfstests. Make sure you resolve those dependencies. 44 45* Some tests are not relevant to filesystems other than XFS, so they will return 46as TEST_NA. 47 48* Be extra careful when using TEST_DEV with device-mapper based block devices. 49For instance, xfstests may not be able to figure out that /dev/<vg>/<lv> is 50actually a link to /dev/mapper/vg-lv. Tests will then fail to check that the 51device is mounted. 52 53* As a convenience the default config file uses a virtual partition, so people 54can try it out the tests without having an actual spare device. However the 55virtual partition depends on the following programs to be available: 56 * sfdisk 57 * losetup 58 * kpartx 59Make sure you have them or a real spare device to test things. 60""" 61# Define the partitions you want to use. 62# 63# Here, by default we use the concept of virtual partition (a partition of 1GB 64# of size), to avoid setup by the user. However, you'll most likely use a real 65# block device for your tests. 66from autotest_lib.client.bin import partition 67file_img = os.path.join(job.tmpdir, 'xfstests.img') 68vp = partition.virtual_partition(file_img=file_img, file_size=1024*1024) 69device = vp.device 70# You can use a real block device, such as /dev/sdc1 71#device=/dev/sdc1 72 73# By default, we create a directory under autotest 74mountpoint = os.path.join(job.tmpdir, 'xfstests') 75if not os.path.isdir(mountpoint): 76 os.makedirs(mountpoint) 77 78p = job.partition(device=device, mountpoint=mountpoint) 79 80# 81# Job configuration, instead of editing xfstests config files, set them 82# right here as environment variables 83# 84 85# TEST_DEV: "device containing TEST PARTITION" 86os.environ['TEST_DEV'] = p.device 87 88# TEST_DIR: "mount point of TEST PARTITION" 89os.environ['TEST_DIR'] = p.mountpoint 90 91# SCRATCH_DEV "device containing SCRATCH PARTITION" 92# os.environ['SCRATCH_DEV'] = '' 93 94# SCRATCH_MNT "mount point for SCRATCH PARTITION" 95# os.environ['SCRATCH_MNT'] = '' 96 97# TAPE_DEV "tape device for testing xfsdump" 98# os.environ['TAPE_DEV'] = '' 99 100# RMT_TAPE_DEV "remote tape device for testing xfsdump" 101# os.environ['RMT_TAPE_DEV'] = '' 102 103# RMT_IRIXTAPE_DEV "remote IRIX tape device for testing xfsdump" 104# os.environ['RMT_IRIXTAPE_DEV'] = '' 105 106# SCRATCH_LOGDEV "device for scratch-fs external log" 107# os.environ['SCRATCH_LOGDEV'] = '' 108 109# SCRATCH_RTDEV "device for scratch-fs realtime data" 110# os.environ['SCRATCH_RTDEV'] = '' 111 112# TEST_LOGDEV "device for test-fs external log" 113# os.environ['TEST_LOGDEV'] = '' 114 115# TEST_RTDEV "device for test-fs realtime data" 116# os.environ['TEST_RTDEV'] = '' 117 118# Whether UDF tests are disable 119# os.environ['DISABLE_UDF_TEST'] = '1' 120 121# 122# Adapt to the list of tests you want to run 123# 124TEST_RANGE = ['%03i' % t for t in range(0, 256)] 125# 126# Choose the filesystem types you want the tests to run on 127# 128FS_TYPES = ['xfs'] 129 130# 131# Finally, run the tests 132# 133 134for fs_type in FS_TYPES: 135 p.mkfs(fs_type) 136 for test in TEST_RANGE: 137 tag = "%s.%s" % (test, fs_type) 138 result = job.run_test_detail('xfstests', test_number=test, tag=tag) 139 140# It is good practice to unmount the partition created 141p.unmount() 142# If you are using the virtual partition, you may destroy it here 143vp.destroy() 144