Home | History | Annotate | Download | only in xfstests
      1 TIME="LONG"
      2 AUTHOR = "Cleber Rosa <cleber (a] redhat.com>"
      3 NAME = 'xfs filesystem test suite'
      4 TEST_CLASS = 'kernel'
      5 TEST_CATEGORY = 'Functional'
      6 TEST_TYPE = 'client'
      7 DOC = """
      8 xfstests in autotest
      9 --------------------
     10 
     11 This is a simple wrapper for running xfstests inside autotest. The steps to get
     12 started are really simple:
     13 
     14 1) Edit the configuration variables on the control file.
     15 
     16 1.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 
     23 1.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 
     27 2) Run the tests (assuming autotest installed in /usr/local/autotest):
     28 
     29    # cd /usr/local/autotest/client/tests/xfstests
     30    # ../../bin/autotest control
     31 
     32 3) Check the HTML report at
     33 
     34    /usr/local/autotest/client/results/default/job_report.html
     35 
     36 General notes
     37 -------------
     38 
     39 * As autotest includes a setup phase for client tests, this step is encapsulated
     40 in a dummy xfstests number 000.
     41 
     42 * XFS utilities, system libraries and header files are checked early, before
     43 trying 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
     46 as TEST_NA.
     47 
     48 * Be extra careful when using TEST_DEV with device-mapper based block devices.
     49 For instance, xfstests may not be able to figure out that /dev/<vg>/<lv> is
     50 actually a link to /dev/mapper/vg-lv. Tests will then fail to check that the
     51 device is mounted.
     52 
     53 * As a convenience the default config file uses a virtual partition, so people
     54 can try it out the tests without having an actual spare device. However the
     55 virtual partition depends on the following programs to be available:
     56      * sfdisk
     57      * losetup
     58      * kpartx
     59 Make 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.
     66 from autotest_lib.client.bin import partition
     67 file_img = os.path.join(job.tmpdir, 'xfstests.img')
     68 vp = partition.virtual_partition(file_img=file_img, file_size=1024*1024)
     69 device = 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
     74 mountpoint = os.path.join(job.tmpdir, 'xfstests')
     75 if not os.path.isdir(mountpoint):
     76     os.makedirs(mountpoint)
     77 
     78 p = 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"
     86 os.environ['TEST_DEV'] = p.device
     87 
     88 # TEST_DIR: "mount point of TEST PARTITION"
     89 os.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 #
    124 TEST_RANGE = ['%03i' % t for t in range(0, 256)]
    125 #
    126 # Choose the filesystem types you want the tests to run on
    127 #
    128 FS_TYPES = ['xfs']
    129 
    130 #
    131 # Finally, run the tests
    132 #
    133 
    134 for 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
    141 p.unmount()
    142 # If you are using the virtual partition, you may destroy it here
    143 vp.destroy()
    144