def setUp(self): prefix = temp_dir_prefix(__name__, self, 'setUp') self.tmpdir = tempfile.TemporaryDirectory(prefix=prefix) self.mountpoint = os.path.join(self.tmpdir.name, "disk") os.mkdir(self.mountpoint) self.disk = partition.Partition( os.path.join(self.tmpdir.name, "block"), 1, self.mountpoint)
def test_sector_write(self): """ Test write on a sector mode device """ region = self.get_default_region() self.plib.disable_namespace(region=region) self.plib.destroy_namespace(region=region) self.plib.create_namespace(region=region, mode='sector', sector_size='512') self.disk = '/dev/%s' % self.plib.run_ndctl_list_val( self.plib.run_ndctl_list("-N -r %s" % region)[0], 'blockdev') size = self.plib.run_ndctl_list_val( self.plib.run_ndctl_list("-N -r %s" % region)[0], 'size') self.part = partition.Partition(self.disk) self.part.mkfs(fstype='xfs', args='-b size=%s -s size=512' % memory.get_page_size()) mnt_path = self.params.get('mnt_point', default='/pmemS') if not os.path.exists(mnt_path): os.makedirs(mnt_path) self.part.mount(mountpoint=mnt_path) self.log.info("Test will run on %s", mnt_path) fio_job = self.params.get('fio_job', default='sector-fio.job') cmd = '%s --directory %s --filename mmap-pmem --size %s %s' % ( self.build_fio(), mnt_path, size // 2, self.get_data(fio_job)) if process.system(cmd, ignore_status=True): self.fail("FIO mmap workload on fsdax failed")
def test_map_sync(self): """ Test MAP_SYNC flag with sample mmap write """ region = self.get_default_region() self.plib.create_namespace(region=region, mode='fsdax') self.disk = '/dev/%s' % self.plib.run_ndctl_list_val( self.plib.run_ndctl_list("-N -r %s" % region)[0], 'blockdev') mnt_path = self.params.get('mnt_point', default='/pmem_map') self.part = partition.Partition(self.disk, mountpoint=mnt_path, mount_options='dax') self.part.mkfs(fstype='xfs', args='-b size=%s -s size=512 %s' % (memory.get_page_size(), self.reflink)) if not os.path.exists(mnt_path): os.makedirs(mnt_path) self.part.mount() self.log.info("Testing MAP_SYNC on %s", mnt_path) src_file = os.path.join(self.teststmpdir, 'map_sync.c') shutil.copyfile(self.get_data('map_sync.c'), src_file) process.system('gcc %s -o map_sync' % src_file) process.system('fallocate -l 64k %s/new_file' % mnt_path) if process.system('./map_sync %s/new_file' % mnt_path, ignore_status=True): self.fail('Write with MAP_SYNC flag failed')
def setup_nvdimm(self): """ Setup pmem devices """ self.plib = pmem.PMem() regions = sorted(self.plib.run_ndctl_list('-R'), key=lambda i: i['size'], reverse=True) if not regions: self.plib.enable_region() regions = sorted(self.plib.run_ndctl_list('-R'), key=lambda i: i['size'], reverse=True) self.region = self.plib.run_ndctl_list_val(regions[0], 'dev') if self.plib.run_ndctl_list('-N -r %s' % self.region): self.plib.destroy_namespace(region=self.region, force=True) self.plib.create_namespace(region=self.region) disk_id = "/dev/%s" % self.plib.run_ndctl_list_val( self.plib.run_ndctl_list('-N -r %s' % self.region)[0], 'blockdev') self.mnt_dir = '/pmem' self.part_obj = partition.Partition(disk_id, mountpoint=self.mnt_dir) self.log.info("Creating file system") self.part_obj.mkfs(fstype='ext4', args='-b 64k -F') self.log.info("Mounting disk %s", disk_id) if not os.path.exists(self.mnt_dir): os.makedirs(self.mnt_dir) try: self.part_obj.mount(args='-o dax') except partition.PartitionError: self.cancel("Mounting disk %s on directory failed" % disk_id) return os.path.join(self.mnt_dir, "file")
def setUp(self): """ :params disk: The disk on which the operations are to be performed. :params fsys: A L{utils.partition} instance. :params megabytes: The amount of data to read/write. :params blocks: The blocksize in bytes to use. :params streams: Number of streams. Defaults to 2. :params blocks_per_file: The number of blocks per file. :params fs: The file system type of the disk. :params seq_read: Perform sequential operations. Defaults to true. :params dd_woptions: dd write options. :params dd_roptions: dd read options. :params fs_dd_woptions: dd write in streams. :params fs_dd_roptions: dd read in streams. """ self.disk = self.params.get('disk') if not self.disk: self.cancel('Test requires disk parameter,Please check README') self.fsys = partition_lib.Partition(self.disk, mountpoint=self.workdir) self.megabytes = self.params.get('megabytes', default=100) self.blocks = self.params.get('blocks', default=None) self.streams = self.params.get('streams', default=2) self.blocks_per_file = self.params.get('blocks_per_file', default=None) self.fstype = self.params.get('fs', default=None) self.seq_read = self.params.get('seq_read', default=True) self.dd_woptions = self.params.get('dd_woptions', default='') self.dd_roptions = self.params.get('dd_roptions', default='') self.fs_dd_woptions = self.params.get('fs_dd_woptions', default='') self.fs_dd_roptions = self.params.get('fs_dd_roptions', default='') if self.fstype == 'btrfs': ver = int(distro.detect().version) rel = int(distro.detect().release) if distro.detect().name == 'rhel': if (ver == 7 and rel >= 4) or ver > 7: self.cancel("btrfs is not supported with RHEL 7.4 onwards") if not self.blocks: self.blocks = self.megabytes * 256 if not self.blocks_per_file: self.blocks_per_file = self.blocks / self.streams root_fs_device = process.system_output( "df | egrep /$ | awk " "'{print $1}'", shell=True) self.root_fstype = self._device_to_fstype('/etc/fstab', root_fs_device) if not self.fstype and self.root_fstype: self.fstype = self.root_fstype self.old_fstype = self._device_to_fstype('/etc/mtab') if not self.old_fstype: self.old_fstpye = self._device_to_fstype('/etc/fstab') if not self.old_fstype: self.old_fstype = self.fstype self.log.info('Dumping %d megabytes across %d streams', self.megabytes, self.streams)
def _create_loop_device(self, base_disk, loop_size, mount=True): if mount: self.part = partition.Partition(base_disk, mountpoint=self.disk_mnt) self.part.mount() # Creating two loop devices for i in range(2): process.run('fallocate -o 0 -l %s %s/file-%s.img' % (loop_size, self.disk_mnt, i), shell=True, sudo=True) dev = process.system_output('losetup -f').strip() self.devices.append(dev) process.run('losetup %s %s/file-%s.img' % (dev, self.disk_mnt, i), shell=True, sudo=True)
def _create_loop_device(self, base_disk, loop_size, mount=True): if mount: self.part = partition.Partition( base_disk, mountpoint=self.disk_mnt) self.part.mount() # Creating two loop devices for i in range(2): if self.use_dd: dd_count = int(loop_size.split('GiB')[0]) process.run('dd if=/dev/zero of=%s/file-%s.img bs=1G count=%s' % (self.disk_mnt, i, dd_count), shell=True, sudo=True) else: process.run('fallocate -o 0 -l %s %s/file-%s.img' % (loop_size, self.disk_mnt, i), shell=True, sudo=True) dev = process.system_output('losetup -f').strip() self.devices.append(dev) process.run('losetup %s %s/file-%s.img' % (dev, self.disk_mnt, i), shell=True, sudo=True)
def run(test, params, env): """ Creating a raw image with large size on different file systems. 1. Create a raw image with large size on XFS and check the output info. 2. Setup EXT4 filesystem. 3. Create a raw image with large size on the EXT4 file system and check the output info. :param test: VT test object. :param params: Dictionary with the test parameters. :param env: Dictionary with test environment. """ large_img = params["images"] root_dir = data_dir.get_data_dir() loop_img = os.path.join(root_dir, "loop.img") loop_size = int(params["loop_file_size"]) file_sys = params["file_sys"] err_info = params["err_info"].split(";") mnt_dir = os.path.join(root_dir, "tmp") large = QemuImg(params.object_params(large_img), mnt_dir, large_img) # Setup file system env part = p.Partition(loop_img, loop_size=loop_size, mountpoint=mnt_dir) part.mkfs(file_sys) part.mount() logging.info("Test creating an image with large size over %s.", file_sys) try: large.create(large.params) except TestError as err: for info in err_info: if info in six.text_type(err): break else: test.fail("CML failed with unexpected output: %s" % err) else: test.fail("There is no error when creating an image with large size.") finally: part.unmount() os.rmdir(mnt_dir) os.remove(loop_img)
def setUp(self): """ Build xfstest Source: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git """ self.use_dd = False root_fs = process.system_output("df -T / | awk 'END {print $2}'", shell=True).decode("utf-8") if root_fs in ['ext3', 'ext4']: self.use_dd = True self.dev_type = self.params.get('type', default='loop') sm = SoftwareManager() self.detected_distro = distro.detect() packages = [ 'e2fsprogs', 'automake', 'gcc', 'quota', 'attr', 'make', 'xfsprogs', 'gawk' ] if self.detected_distro.name in ['Ubuntu', 'debian']: packages.extend([ 'xfslibs-dev', 'uuid-dev', 'libuuid1', 'libattr1-dev', 'libacl1-dev', 'libgdbm-dev', 'uuid-runtime', 'libaio-dev', 'fio', 'dbench' ]) if self.detected_distro.version in ['14']: packages.extend(['libtool']) elif self.detected_distro.version in ['18', '20']: packages.extend(['libtool-bin', 'libgdbm-compat-dev']) else: packages.extend(['libtool-bin']) elif self.detected_distro.name in ['centos', 'fedora', 'rhel', 'SuSE']: if self.dev_type == 'nvdimm': packages.extend(['ndctl', 'parted']) if self.detected_distro.name == 'rhel': packages.extend(['daxctl']) packages.extend([ 'acl', 'bc', 'dump', 'indent', 'libtool', 'lvm2', 'xfsdump', 'psmisc', 'sed', 'libacl-devel', 'libattr-devel', 'libaio-devel', 'libuuid-devel', 'openssl-devel', 'xfsprogs-devel' ]) if self.detected_distro.name == 'SuSE': packages.extend(['libbtrfs-devel', 'libcap-progs']) else: packages.extend(['btrfs-progs-devel']) packages_remove = ['indent', 'btrfs-progs-devel'] if self.detected_distro.name == 'rhel' and\ self.detected_distro.version.startswith('8'): packages = list(set(packages) - set(packages_remove)) elif self.detected_distro.name == 'rhel' and\ self.detected_distro.version.startswith('9'): packages_remove.extend(['dump']) packages = list(set(packages) - set(packages_remove)) if self.detected_distro.name in ['centos', 'fedora']: packages.extend(['fio', 'dbench']) else: self.cancel("test not supported in %s" % self.detected_distro.name) for package in packages: if not sm.check_installed(package) and not sm.install(package): self.cancel("Fail to install %s required for this test." % package) self.skip_dangerous = self.params.get('skip_dangerous', default=True) self.test_range = self.params.get('test_range', default=None) self.scratch_mnt = self.params.get('scratch_mnt', default='/mnt/scratch') self.test_mnt = self.params.get('test_mnt', default='/mnt/test') self.disk_mnt = self.params.get('disk_mnt', default='/mnt/loop_device') self.fs_to_test = self.params.get('fs', default='ext4') if process.system('which mkfs.%s' % self.fs_to_test, ignore_status=True): self.cancel('Unknown filesystem %s' % self.fs_to_test) mount = True self.devices = [] self.log_devices = [] shutil.copyfile(self.get_data('local.config'), os.path.join(self.teststmpdir, 'local.config')) shutil.copyfile(self.get_data('group'), os.path.join(self.teststmpdir, 'group')) self.log_test = self.params.get('log_test', default='') self.log_scratch = self.params.get('log_scratch', default='') if self.dev_type == 'loop': base_disk = self.params.get('disk', default=None) loop_size = self.params.get('loop_size', default='7GiB') if not base_disk: # Using root for file creation by default check = (int(loop_size.split('GiB')[0]) * 2) + 1 if disk.freespace('/') / 1073741824 > check: self.disk_mnt = '' mount = False else: self.cancel('Need %s GB to create loop devices' % check) self._create_loop_device(base_disk, loop_size, mount) elif self.dev_type == 'nvdimm': self.setup_nvdimm() else: self.test_dev = self.params.get('disk_test', default=None) self.scratch_dev = self.params.get('disk_scratch', default=None) self.devices.extend([self.test_dev, self.scratch_dev]) # mkfs for devices if self.devices: cfg_file = os.path.join(self.teststmpdir, 'local.config') self.mkfs_opt = self.params.get('mkfs_opt', default='') self.mount_opt = self.params.get('mount_opt', default='') with open(cfg_file, "r") as sources: lines = sources.readlines() with open(cfg_file, "w") as sources: for line in lines: if line.startswith('export TEST_DEV'): sources.write( re.sub(r'export TEST_DEV=.*', 'export TEST_DEV=%s' % self.devices[0], line)) elif line.startswith('export TEST_DIR'): sources.write( re.sub(r'export TEST_DIR=.*', 'export TEST_DIR=%s' % self.test_mnt, line)) elif line.startswith('export SCRATCH_DEV'): sources.write( re.sub(r'export SCRATCH_DEV=.*', 'export SCRATCH_DEV=%s' % self.devices[1], line)) elif line.startswith('export SCRATCH_MNT'): sources.write( re.sub(r'export SCRATCH_MNT=.*', 'export SCRATCH_MNT=%s' % self.scratch_mnt, line)) break with open(cfg_file, "a") as sources: if self.log_test: sources.write('export USE_EXTERNAL=yes\n') sources.write('export TEST_LOGDEV="%s"\n' % self.log_test) self.log_devices.append(self.log_test) if self.log_scratch: sources.write('export SCRATCH_LOGDEV="%s"\n' % self.log_scratch) self.log_devices.append(self.log_scratch) if self.mkfs_opt: sources.write('MKFS_OPTIONS="%s"\n' % self.mkfs_opt) if self.mount_opt: sources.write('MOUNT_OPTIONS="%s"\n' % self.mount_opt) self.logdev_opt = self.params.get('logdev_opt', default='') for dev in self.log_devices: dev_obj = partition.Partition(dev) dev_obj.mkfs(fstype=self.fs_to_test, args=self.mkfs_opt) for ite, dev in enumerate(self.devices): dev_obj = partition.Partition(dev) if self.logdev_opt: dev_obj.mkfs(fstype=self.fs_to_test, args='%s %s=%s' % (self.mkfs_opt, self.logdev_opt, self.log_devices[ite])) else: dev_obj.mkfs(fstype=self.fs_to_test, args=self.mkfs_opt) git.get_repo('git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git', destination_dir=self.teststmpdir) build.make(self.teststmpdir) self.available_tests = self._get_available_tests() self.test_list = self._create_test_list(self.test_range) self.log.info("Tests available in srcdir: %s", ", ".join(self.available_tests)) if not self.test_range: self.exclude = self.params.get('exclude', default=None) self.gen_exclude = self.params.get('gen_exclude', default=None) self.share_exclude = self.params.get('share_exclude', default=None) if self.exclude or self.gen_exclude or self.share_exclude: self.exclude_file = os.path.join(self.teststmpdir, 'exclude') if self.exclude: self._create_test_list(self.exclude, self.fs_to_test, dangerous=False) if self.gen_exclude: self._create_test_list(self.gen_exclude, "generic", dangerous=False) if self.share_exclude: self._create_test_list(self.share_exclude, "shared", dangerous=False) if self.detected_distro.name is not 'SuSE': if process.system('useradd 123456-fsgqa', sudo=True, ignore_status=True): self.log.warn('useradd 123456-fsgqa failed') if process.system('useradd fsgqa', sudo=True, ignore_status=True): self.log.warn('useradd fsgqa failed') else: if process.system('useradd -m -U fsgqa', sudo=True, ignore_status=True): self.log.warn('useradd fsgqa failed') if process.system('groupadd sys', sudo=True, ignore_status=True): self.log.warn('groupadd sys failed') if not os.path.exists(self.scratch_mnt): os.makedirs(self.scratch_mnt) if not os.path.exists(self.test_mnt): os.makedirs(self.test_mnt)
def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix="avocado_" + __name__) self.mountpoint = os.path.join(self.tmpdir, "disk") os.mkdir(self.mountpoint) self.disk = partition.Partition(os.path.join(self.tmpdir, "block"), 1, self.mountpoint)
def test(self): self.plib.enable_region() regions = self.plib.run_ndctl_list('-R') self.plib.destroy_namespace(force=True) region = self.plib.run_ndctl_list_val(regions[0], 'dev') split = self.params.get('split_ns', default=False) if len(regions) == 1: if self.plib.is_region_legacy(region): self.cancel("Cannot create DM with single pmem device") if not split: self.cancel("Cannot run test without split option enabled") if split: if self.plib.is_region_legacy(region): self.cancel("Cannot split pmem device on legacy hardware") size_align = self.get_size_alignval() self.log.info("Creating namespace with existing regions") for reg_json in regions: region = self.plib.run_ndctl_list_val(reg_json, 'dev') slot_count = self.plib.get_slot_count(region) reg_size = self.plib.run_ndctl_list_val( self.plib.run_ndctl_list('-r %s' % region)[0], 'size') namespace_size = reg_size // slot_count # Now align the namespace size namespace_size = (namespace_size // size_align) * size_align if namespace_size <= size_align: self.log.warn("Skipping namespace size less than pagesize") continue for _ in range(0, slot_count): self.plib.create_namespace( region=region, size=namespace_size) else: self.log.info("Creating namespace with full size") for reg_json in regions: region = self.plib.run_ndctl_list_val(reg_json, 'dev') self.plib.create_namespace(region=region) devices = self.plib.run_ndctl_list('-N') blk_cmd = "" bdev = None blk_size1 = 0 for cnt, dev in enumerate(devices): bdev = self.plib.run_ndctl_list_val(dev, 'blockdev') bdev = "/dev/%s" % bdev blk_size2 = process.system_output( "blockdev --getsz %s" % bdev).decode() blk_cmd += ' %s %s linear %s 0 "\\\\n"' % ( blk_size1, blk_size2, bdev) blk_size1 += int(blk_size2) if cnt == len(devices) - 1: break dm_cmd = 'echo -e "%s" | dmsetup create linear-pmem' % blk_cmd if process.system(dm_cmd, shell=True, sudo=True, ignore_status=True): self.fail("Creating DM failed") self.log.info("Running FIO on device-mapper") dm_disk = "/dev/mapper/linear-pmem" self.part = partition.Partition(dm_disk) self.part.mkfs(fstype='xfs', args='-b size=%s -s size=512 -m reflink=0' % memory.get_page_size()) mnt_path = self.params.get('mnt_point', default='/pmem') if not os.path.exists(mnt_path): os.makedirs(mnt_path) self.part.mount(mountpoint=mnt_path, args='-o dax') self.log.info("Test will run on %s", mnt_path) fio_job = self.params.get('fio_job', default='ndctl-fio.job') size = disk.freespace(mnt_path) * 0.9 cmd = '%s --directory %s --filename mmap-pmem --size %s %s' % ( self.build_fio(), mnt_path, size, self.get_data(fio_job)) if process.system(cmd, ignore_status=True): self.fail("FIO mmap workload on fsdax failed")
def setUp(self): """ Build xfstest Source: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git """ self.use_dd = False root_fs = process.system_output( "df -T / | awk 'END {print $2}'", shell=True).decode("utf-8") if root_fs in ['ext3', 'ext4']: self.use_dd = True self.dev_type = self.params.get('type', default='loop') sm = SoftwareManager() self.detected_distro = distro.detect() packages = ['e2fsprogs', 'automake', 'gcc', 'quota', 'attr', 'make', 'xfsprogs', 'gawk'] if self.detected_distro.name in ['Ubuntu', 'debian']: packages.extend( ['xfslibs-dev', 'uuid-dev', 'libuuid1', 'libattr1-dev', 'libacl1-dev', 'libgdbm-dev', 'uuid-runtime', 'libaio-dev', 'fio', 'dbench', 'gettext', 'libinih-dev', 'liburcu-dev', 'libblkid-dev', 'liblzo2-dev', 'zlib1g-dev', 'e2fslibs-dev', 'asciidoc', 'xmlto', 'libzstd-dev', 'libudev-dev']) if self.detected_distro.version in ['14']: packages.extend(['libtool']) elif self.detected_distro.version in ['18', '20']: packages.extend(['libtool-bin', 'libgdbm-compat-dev']) else: packages.extend(['libtool-bin']) elif self.detected_distro.name in ['centos', 'fedora', 'rhel', 'SuSE']: if self.dev_type == 'nvdimm': packages.extend(['ndctl', 'parted']) if self.detected_distro.name == 'rhel': packages.extend(['daxctl']) packages.extend(['acl', 'bc', 'dump', 'indent', 'libtool', 'lvm2', 'xfsdump', 'psmisc', 'sed', 'libacl-devel', 'libattr-devel', 'libaio-devel', 'libuuid-devel', 'openssl-devel', 'xfsprogs-devel', 'gettext', 'libblkid-devel', 'lzo-devel', 'zlib-devel', 'e2fsprogs-devel', 'asciidoc', 'xmlto', 'libzstd-devel', 'systemd-devel', 'meson', 'gcc-c++']) if self.detected_distro.name == 'SuSE': packages.extend(['libbtrfs-devel', 'libcap-progs', 'liburcu-devel', 'libinih-devel']) else: packages.extend(['btrfs-progs-devel', 'userspace-rcu-devel']) packages_remove = ['indent', 'btrfs-progs-devel'] if self.detected_distro.name == 'rhel' and\ self.detected_distro.version.startswith('8'): packages = list(set(packages)-set(packages_remove)) elif self.detected_distro.name == 'rhel' and\ self.detected_distro.version.startswith('9'): packages_remove.extend(['dump']) packages = list(set(packages)-set(packages_remove)) if self.detected_distro.name in ['centos', 'fedora']: packages.extend(['fio', 'dbench']) else: self.cancel("test not supported in %s" % self.detected_distro.name) for package in packages: if not sm.check_installed(package) and not sm.install(package): self.cancel("Fail to install %s required for this test." % package) self.skip_dangerous = self.params.get('skip_dangerous', default=True) self.test_range = self.params.get('test_range', default=None) self.scratch_mnt = self.params.get( 'scratch_mnt', default='/mnt/scratch') self.test_mnt = self.params.get('test_mnt', default='/mnt/test') self.disk_mnt = self.params.get('disk_mnt', default='/mnt/loop_device') self.fs_to_test = self.params.get('fs', default='ext4') self.run_type = self.params.get('run_type', default='distro') if self.run_type == 'upstream': prefix = "/usr/local" bin_prefix = "/usr/local/bin" if self.detected_distro.name == 'SuSE': # SuSE has /sbin at a higher priority than /usr/local/bin # in $PATH, so install all the binaries in /sbin to make # sure they are picked up correctly by xfstests. # # We still install in /usr/local but binaries are kept in # /sbin bin_prefix = "/sbin" if self.fs_to_test == "ext4": # Build e2fs progs e2fsprogs_dir = os.path.join(self.teststmpdir, 'e2fsprogs') if not os.path.exists(e2fsprogs_dir): os.makedirs(e2fsprogs_dir) e2fsprogs_url = self.params.get('e2fsprogs_url') git.get_repo(e2fsprogs_url, destination_dir=e2fsprogs_dir) e2fsprogs_build_dir = os.path.join(e2fsprogs_dir, 'build') if not os.path.exists(e2fsprogs_build_dir): os.makedirs(e2fsprogs_build_dir) os.chdir(e2fsprogs_build_dir) process.run("../configure --prefix=%s --bindir=%s --sbindir=%s" % (prefix, bin_prefix, bin_prefix), verbose=True) build.make(e2fsprogs_build_dir) build.make(e2fsprogs_build_dir, extra_args='install') if self.fs_to_test == "xfs": if self.detected_distro.name in ['centos', 'fedora', 'rhel']: libini_path = process.run("ldconfig -p | grep libini", verbose=True, ignore_status=True) if not libini_path: # Build libini.h as it is needed for xfsprogs libini_dir = os.path.join(self.teststmpdir, 'libini') if not os.path.exists(libini_dir): os.makedirs(libini_dir) git.get_repo('https://github.com/benhoyt/inih', destination_dir=libini_dir) os.chdir(libini_dir) process.run("meson build", verbose=True) libini_build_dir = os.path.join(libini_dir, 'build') if os.path.exists(libini_build_dir): os.chdir(libini_build_dir) process.run("meson install", verbose=True) else: self.fail('Something went wrong while building \ libini. Please check the logs.') # Build xfs progs xfsprogs_dir = os.path.join(self.teststmpdir, 'xfsprogs') if not os.path.exists(xfsprogs_dir): os.makedirs(xfsprogs_dir) xfsprogs_url = self.params.get('xfsprogs_url') git.get_repo(xfsprogs_url, destination_dir=xfsprogs_dir) os.chdir(xfsprogs_dir) build.make(xfsprogs_dir) process.run("./configure --prefix=%s --bindir=%s --sbindir=%s" % (prefix, bin_prefix, bin_prefix), verbose=True) build.make(xfsprogs_dir, extra_args='install') if self.fs_to_test == "btrfs": # Build btrfs progs btrfsprogs_dir = os.path.join(self.teststmpdir, 'btrfsprogs') if not os.path.exists(btrfsprogs_dir): os.makedirs(btrfsprogs_dir) btrfsprogs_url = self.params.get('btrfsprogs_url') git.get_repo(btrfsprogs_url, destination_dir=btrfsprogs_dir) os.chdir(btrfsprogs_dir) process.run("./autogen.sh", verbose=True) process.run("./configure --prefix=%s --bindir=%s --sbindir=%s --disable-documentation" % (prefix, bin_prefix, bin_prefix), verbose=True) build.make(btrfsprogs_dir) build.make(btrfsprogs_dir, extra_args='install') # Check versions of fsprogs fsprogs_ver = process.system_output("mkfs.%s -V" % self.fs_to_test, ignore_status=True, shell=True).decode("utf-8") self.log.info(fsprogs_ver) if process.system('which mkfs.%s' % self.fs_to_test, ignore_status=True): self.cancel('Unknown filesystem %s' % self.fs_to_test) mount = True self.devices = [] self.log_devices = [] shutil.copyfile(self.get_data('local.config'), os.path.join(self.teststmpdir, 'local.config')) shutil.copyfile(self.get_data('group'), os.path.join(self.teststmpdir, 'group')) self.log_test = self.params.get('log_test', default='') self.log_scratch = self.params.get('log_scratch', default='') if self.dev_type == 'loop': base_disk = self.params.get('disk', default=None) loop_size = self.params.get('loop_size', default='7GiB') if not base_disk: # Using root for file creation by default check = (int(loop_size.split('GiB')[0]) * 2) + 1 if disk.freespace('/') / 1073741824 > check: self.disk_mnt = '' mount = False else: self.cancel('Need %s GB to create loop devices' % check) self._create_loop_device(base_disk, loop_size, mount) elif self.dev_type == 'nvdimm': self.setup_nvdimm() else: self.test_dev = self.params.get('disk_test', default=None) self.scratch_dev = self.params.get('disk_scratch', default=None) self.devices.extend([self.test_dev, self.scratch_dev]) # mkfs for devices if self.devices: cfg_file = os.path.join(self.teststmpdir, 'local.config') self.mkfs_opt = self.params.get('mkfs_opt', default='') self.mount_opt = self.params.get('mount_opt', default='') with open(cfg_file, "r") as sources: lines = sources.readlines() with open(cfg_file, "w") as sources: for line in lines: if line.startswith('export TEST_DEV'): sources.write( re.sub(r'export TEST_DEV=.*', 'export TEST_DEV=%s' % self.devices[0], line)) elif line.startswith('export TEST_DIR'): sources.write( re.sub(r'export TEST_DIR=.*', 'export TEST_DIR=%s' % self.test_mnt, line)) elif line.startswith('export SCRATCH_DEV'): sources.write(re.sub( r'export SCRATCH_DEV=.*', 'export SCRATCH_DEV=%s' % self.devices[1], line)) elif line.startswith('export SCRATCH_MNT'): sources.write( re.sub( r'export SCRATCH_MNT=.*', 'export SCRATCH_MNT=%s' % self.scratch_mnt, line)) break with open(cfg_file, "a") as sources: if self.log_test: sources.write('export USE_EXTERNAL=yes\n') sources.write('export TEST_LOGDEV="%s"\n' % self.log_test) self.log_devices.append(self.log_test) if self.log_scratch: sources.write('export SCRATCH_LOGDEV="%s"\n' % self.log_scratch) self.log_devices.append(self.log_scratch) if self.mkfs_opt: sources.write('MKFS_OPTIONS="%s"\n' % self.mkfs_opt) if self.mount_opt: sources.write('MOUNT_OPTIONS="%s"\n' % self.mount_opt) self.logdev_opt = self.params.get('logdev_opt', default='') for dev in self.log_devices: dev_obj = partition.Partition(dev) dev_obj.mkfs(fstype=self.fs_to_test, args=self.mkfs_opt) for ite, dev in enumerate(self.devices): dev_obj = partition.Partition(dev) if self.logdev_opt: dev_obj.mkfs(fstype=self.fs_to_test, args='%s %s=%s' % ( self.mkfs_opt, self.logdev_opt, self.log_devices[ite])) else: dev_obj.mkfs(fstype=self.fs_to_test, args=self.mkfs_opt) git.get_repo('git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git', destination_dir=self.teststmpdir) build.make(self.teststmpdir) self.available_tests = self._get_available_tests() self.test_list = self._create_test_list(self.test_range) self.log.info("Tests available in srcdir: %s", ", ".join(self.available_tests)) if not self.test_range: self.exclude = self.params.get('exclude', default=None) self.gen_exclude = self.params.get('gen_exclude', default=None) self.share_exclude = self.params.get('share_exclude', default=None) if self.exclude or self.gen_exclude or self.share_exclude: self.exclude_file = os.path.join(self.teststmpdir, 'exclude') if self.exclude: self._create_test_list(self.exclude, self.fs_to_test, dangerous=False) if self.gen_exclude: self._create_test_list(self.gen_exclude, "generic", dangerous=False) if self.share_exclude: self._create_test_list(self.share_exclude, "shared", dangerous=False) if self.detected_distro.name is not 'SuSE': if process.system('useradd 123456-fsgqa', sudo=True, ignore_status=True): self.log.warn('useradd 123456-fsgqa failed') if process.system('useradd fsgqa', sudo=True, ignore_status=True): self.log.warn('useradd fsgqa failed') else: if process.system('useradd -m -U fsgqa', sudo=True, ignore_status=True): self.log.warn('useradd fsgqa failed') if process.system('groupadd sys', sudo=True, ignore_status=True): self.log.warn('groupadd sys failed') if not os.path.exists(self.scratch_mnt): os.makedirs(self.scratch_mnt) if not os.path.exists(self.test_mnt): os.makedirs(self.test_mnt)
def setUp(self): """ Build xfstest Source: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git """ if process.system_output("df -T / | awk 'END {print $2}'", shell=True) == 'ext3': self.skip('Test does not support ext3 root file system') sm = SoftwareManager() self.detected_distro = distro.detect() packages = [ 'e2fsprogs', 'automake', 'gcc', 'quota', 'attr', 'make', 'xfsprogs', 'gawk' ] if 'Ubuntu' in self.detected_distro.name: packages.extend([ 'xfslibs-dev', 'uuid-dev', 'libtool-bin', 'libuuid1', 'libattr1-dev', 'libacl1-dev', 'libgdbm-dev', 'uuid-runtime', 'libaio-dev', 'fio', 'dbench' ]) # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif self.detected_distro.name in [ 'centos', 'fedora', 'rhel', 'redhat', 'SuSE' ]: packages.extend([ 'acl', 'bc', 'dump', 'indent', 'libtool', 'lvm2', 'xfsdump', 'psmisc', 'sed', 'libacl-devel', 'libattr-devel', 'libaio-devel', 'libuuid-devel', 'openssl-devel', 'xfsprogs-devel' ]) if self.detected_distro.name == 'SuSE': packages.extend(['libbtrfs-devel']) else: packages.extend(['btrfs-progs-devel']) if self.detected_distro.name in ['centos', 'fedora']: packages.extend(['fio', 'dbench']) else: self.skip("test not supported in %s" % self.detected_distro.name) for package in packages: if not sm.check_installed(package) and not sm.install(package): self.skip("Fail to install %s required for this test." % package) self.skip_dangerous = self.params.get('skip_dangerous', default=True) self.test_range = self.params.get('test_range', default=None) self.scratch_mnt = self.params.get('scratch_mnt', default='/mnt/scratch') self.test_mnt = self.params.get('test_mnt', default='/mnt/test') self.disk_mnt = self.params.get('disk_mnt', default='/mnt/loop_device') self.dev_type = self.params.get('type', default='loop') self.fs_to_test = self.params.get('fs', default='ext4') if process.system('which mkfs.%s' % self.fs_to_test, ignore_status=True): self.skip('Unknown filesystem %s' % self.fs_to_test) mount = True self.devices = [] shutil.copyfile(os.path.join(self.datadir, 'local.config'), os.path.join(self.srcdir, 'local.config')) shutil.copyfile(os.path.join(self.datadir, 'group'), os.path.join(self.srcdir, 'group')) if self.dev_type == 'loop': base_disk = self.params.get('disk', default=None) loop_size = self.params.get('loop_size', default='9GiB') if not base_disk: # Using root for file creation by default if disk.freespace('/') / 1073741824 > 15: self.disk_mnt = '' mount = False else: self.skip('Need 15 GB to create loop devices') self._create_loop_device(base_disk, loop_size, mount) else: self.test_dev = self.params.get('disk_test', default=None) self.scratch_dev = self.params.get('disk_scratch', default=None) self.devices.extend([self.test_dev, self.scratch_dev]) # mkfs for devices if self.devices: line = ('export TEST_DEV=%s' % self.devices[0]).replace('/', '\/') process.system('sed -i "s/export TEST_DEV=.*/%s/g" %s' % (line, os.path.join(self.srcdir, 'local.config')), shell=True) line = ('export SCRATCH_DEV=%s' % self.devices[1]).replace( '/', '\/') process.system('sed -i "s/export SCRATCH_DEV=.*/%s/g" %s' % (line, os.path.join(self.srcdir, 'local.config')), shell=True) for dev in self.devices: dev_obj = partition.Partition(dev) dev_obj.mkfs(fstype=self.fs_to_test) git.get_repo('git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git', destination_dir=self.srcdir) build.make(self.srcdir) self.available_tests = self._get_available_tests() self.test_list = self._create_test_list() self.log.info("Tests available in srcdir: %s", ", ".join(self.available_tests)) process.run('useradd fsgqa', sudo=True) if self.detected_distro.name is not 'SuSE': process.run('useradd 123456-fsgqa', sudo=True) if not os.path.exists(self.scratch_mnt): os.makedirs(self.scratch_mnt) if not os.path.exists(self.test_mnt): os.makedirs(self.test_mnt)
def setUp(self): """ Build xfstest Source: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git """ self.use_dd = False root_fs = process.system_output("df -T / | awk 'END {print $2}'", shell=True) if root_fs in ['ext3', 'ext4']: self.use_dd = True sm = SoftwareManager() self.detected_distro = distro.detect() packages = [ 'e2fsprogs', 'automake', 'gcc', 'quota', 'attr', 'make', 'xfsprogs', 'gawk' ] if 'Ubuntu' in self.detected_distro.name: packages.extend([ 'xfslibs-dev', 'uuid-dev', 'libuuid1', 'libattr1-dev', 'libacl1-dev', 'libgdbm-dev', 'uuid-runtime', 'libaio-dev', 'fio', 'dbench', 'btrfs-tools' ]) if '14' in self.detected_distro.version: packages.extend(['libtool']) elif '18' in self.detected_distro.version: packages.extend(['libtool-bin', 'libgdbm-compat-dev']) else: packages.extend(['libtool-bin']) # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif self.detected_distro.name in [ 'centos', 'fedora', 'rhel', 'redhat', 'SuSE' ]: packages.extend([ 'acl', 'bc', 'dump', 'indent', 'libtool', 'lvm2', 'xfsdump', 'psmisc', 'sed', 'libacl-devel', 'libattr-devel', 'libaio-devel', 'libuuid-devel', 'openssl-devel', 'xfsprogs-devel' ]) if self.detected_distro.name == 'SuSE': packages.extend(['libbtrfs-devel', 'libcap-progs']) else: packages.extend(['btrfs-progs-devel']) if self.detected_distro.name in ['centos', 'fedora']: packages.extend(['fio', 'dbench']) else: self.cancel("test not supported in %s" % self.detected_distro.name) for package in packages: if not sm.check_installed(package) and not sm.install(package): self.cancel("Fail to install %s required for this test." % package) self.skip_dangerous = self.params.get('skip_dangerous', default=True) self.test_range = self.params.get('test_range', default=None) self.scratch_mnt = self.params.get('scratch_mnt', default='/mnt/scratch') self.test_mnt = self.params.get('test_mnt', default='/mnt/test') self.disk_mnt = self.params.get('disk_mnt', default='/mnt/loop_device') self.dev_type = self.params.get('type', default='loop') self.fs_to_test = self.params.get('fs', default='ext4') if process.system('which mkfs.%s' % self.fs_to_test, ignore_status=True): self.cancel('Unknown filesystem %s' % self.fs_to_test) mount = True self.devices = [] shutil.copyfile(self.get_data('local.config'), os.path.join(self.teststmpdir, 'local.config')) shutil.copyfile(self.get_data('group'), os.path.join(self.teststmpdir, 'group')) if self.dev_type == 'loop': base_disk = self.params.get('disk', default=None) loop_size = self.params.get('loop_size', default='7GiB') if not base_disk: # Using root for file creation by default check = (int(loop_size.split('GiB')[0]) * 2) + 1 if disk.freespace('/') / 1073741824 > check: self.disk_mnt = '' mount = False else: self.cancel('Need %s GB to create loop devices' % check) self._create_loop_device(base_disk, loop_size, mount) else: self.test_dev = self.params.get('disk_test', default=None) self.scratch_dev = self.params.get('disk_scratch', default=None) self.devices.extend([self.test_dev, self.scratch_dev]) # mkfs for devices if self.devices: cfg_file = os.path.join(self.teststmpdir, 'local.config') with open(cfg_file, "r") as sources: lines = sources.readlines() with open(cfg_file, "w") as sources: for line in lines: if line.startswith('export TEST_DEV'): sources.write( re.sub(r'export TEST_DEV=.*', 'export TEST_DEV=%s' % self.devices[0], line)) elif line.startswith('export TEST_DIR'): sources.write( re.sub(r'export TEST_DIR=.*', 'export TEST_DIR=%s' % self.test_mnt, line)) elif line.startswith('export SCRATCH_DEV'): sources.write( re.sub(r'export SCRATCH_DEV=.*', 'export SCRATCH_DEV=%s' % self.devices[1], line)) elif line.startswith('export SCRATCH_MNT'): sources.write( re.sub(r'export SCRATCH_MNT=.*', 'export SCRATCH_MNT=%s' % self.scratch_mnt, line)) break for dev in self.devices: dev_obj = partition.Partition(dev) dev_obj.mkfs(fstype=self.fs_to_test) git.get_repo('git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git', destination_dir=self.teststmpdir) build.make(self.teststmpdir) self.available_tests = self._get_available_tests() self.test_list = self._create_test_list(self.test_range) self.log.info("Tests available in srcdir: %s", ", ".join(self.available_tests)) if not self.test_range: self.exclude = self.params.get('exclude', default=None) self.gen_exclude = self.params.get('gen_exclude', default=None) self.share_exclude = self.params.get('share_exclude', default=None) if self.exclude or self.gen_exclude or self.share_exclude: self.exclude_file = os.path.join(self.teststmpdir, 'exclude') if self.exclude: self._create_test_list(self.exclude, self.fs_to_test, dangerous=False) if self.gen_exclude: self._create_test_list(self.gen_exclude, "generic", dangerous=False) if self.share_exclude: self._create_test_list(self.share_exclude, "shared", dangerous=False) if self.detected_distro.name is not 'SuSE': process.run('useradd 123456-fsgqa', sudo=True) process.run('useradd fsgqa', sudo=True) else: process.run('useradd -m -U fsgqa', sudo=True) process.run('groupadd sys', sudo=True) if not os.path.exists(self.scratch_mnt): os.makedirs(self.scratch_mnt) if not os.path.exists(self.test_mnt): os.makedirs(self.test_mnt)
def setUp(self): """ Build xfstest Source: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git """ self.use_dd = False root_fs = process.system_output("df -T / | awk 'END {print $2}'", shell=True).decode("utf-8") if root_fs in ['ext3', 'ext4']: self.use_dd = True self.dev_type = self.params.get('type', default='loop') sm = SoftwareManager() self.detected_distro = distro.detect() packages = [ 'e2fsprogs', 'automake', 'gcc', 'quota', 'attr', 'make', 'xfsprogs', 'gawk' ] if self.detected_distro.name in ['Ubuntu', 'debian']: packages.extend([ 'xfslibs-dev', 'uuid-dev', 'libuuid1', 'libattr1-dev', 'libacl1-dev', 'libgdbm-dev', 'uuid-runtime', 'libaio-dev', 'fio', 'dbench', 'libbtrfs-dev' ]) if self.detected_distro.version in ['14']: packages.extend(['libtool']) elif self.detected_distro.version in ['18', '20']: packages.extend(['libtool-bin', 'libgdbm-compat-dev']) else: packages.extend(['libtool-bin']) # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif self.detected_distro.name in ['centos', 'fedora', 'rhel', 'SuSE']: if self.dev_type == 'nvdimm': packages.extend(['ndctl', 'parted']) if self.detected_distro.name == 'rhel': packages.extend(['daxctl']) packages.extend([ 'acl', 'bc', 'dump', 'indent', 'libtool', 'lvm2', 'xfsdump', 'psmisc', 'sed', 'libacl-devel', 'libattr-devel', 'libaio-devel', 'libuuid-devel', 'openssl-devel', 'xfsprogs-devel' ]) if self.detected_distro.name == 'SuSE': packages.extend(['libbtrfs-devel', 'libcap-progs']) else: packages.extend(['btrfs-progs-devel']) if self.detected_distro.name == 'rhel' and\ self.detected_distro.version.startswith('8'): packages.remove('indent') packages.remove('btrfs-progs-devel') if self.detected_distro.name in ['centos', 'fedora']: packages.extend(['fio', 'dbench']) else: self.cancel("test not supported in %s" % self.detected_distro.name) for package in packages: if not sm.check_installed(package) and not sm.install(package): self.cancel("Fail to install %s required for this test." % package) self.skip_dangerous = self.params.get('skip_dangerous', default=True) self.test_range = self.params.get('test_range', default=None) self.scratch_mnt = self.params.get('scratch_mnt', default='/mnt/scratch') self.test_mnt = self.params.get('test_mnt', default='/mnt/test') self.disk_mnt = self.params.get('disk_mnt', default='/mnt/loop_device') self.fs_to_test = self.params.get('fs', default='ext4') if process.system('which mkfs.%s' % self.fs_to_test, ignore_status=True): self.cancel('Unknown filesystem %s' % self.fs_to_test) mount = True self.devices = [] self.log_devices = [] shutil.copyfile(self.get_data('local.config'), os.path.join(self.teststmpdir, 'local.config')) shutil.copyfile(self.get_data('group'), os.path.join(self.teststmpdir, 'group')) if self.dev_type == 'loop': base_disk = self.params.get('disk', default=None) loop_size = self.params.get('loop_size', default='7GiB') if not base_disk: # Using root for file creation by default check = (int(loop_size.split('GiB')[0]) * 2) + 1 if disk.freespace('/') / 1073741824 > check: self.disk_mnt = '' mount = False else: self.cancel('Need %s GB to create loop devices' % check) self._create_loop_device(base_disk, loop_size, mount) elif self.dev_type == 'nvdimm': self.test_dev = self.params.get('disk_test', default=None) self.scratch_dev = self.params.get('disk_scratch', default=None) self.log_test = self.params.get('log_test', default='') self.log_scratch = self.params.get('log_scratch', default='') logflag = self.params.get('logdev', default=False) self.plib = pmem.PMem() regions = sorted(self.plib.run_ndctl_list('-R'), key=lambda i: i['size'], reverse=True) if not (self.test_dev and self.scratch_dev): if not regions: self.plib.enable_region() regions = sorted(self.plib.run_ndctl_list('-R'), key=lambda i: i['size'], reverse=True) region = self.plib.run_ndctl_list_val(regions[0], 'dev') if not self.plib.is_region_legacy(region): self.plib.destroy_namespace(region=region, force=True) self.plib.create_namespace(region=region, size='21G', sector_size='512') pmem_dev = self.plib.run_ndctl_list_val( self.plib.run_ndctl_list('-N -r %s' % region)[0], 'blockdev') if logflag: if not (self.log_test and self.log_scratch): self.plib.create_namespace(region=region, size='3G', mode='sector', sector_size='512') log_dev = self.plib.run_ndctl_list_val( self.plib.run_ndctl_list('-N -r %s -m sector' % region)[0], 'blockdev') else: self.plib.enable_region() if not len(regions) > 1 and logflag: self.cancel("Cannot use logdev with one region") else: reg_2 = self.plib.run_ndctl_list_val(regions[1], 'dev') self.plib.create_namespace(region=reg_2, size='3G', mode='sector', sector_size='512') log_dev = self.plib.run_ndctl_list_val( self.plib.run_ndctl_list(' -N -r %s -m sector' % reg_2)[0], 'blockdev') pmem_dev = self.plib.run_ndctl_list_val( self.plib.run_ndctl_list('-N -r %s' % region)[0], 'blockdev') if process.system('parted -s -a optimal /dev/%s mklabel gpt --' ' mkpart primary xfs 1MiB 10GiB mkpart ' 'primary xfs 10GiB 20GiB' % pmem_dev, shell=True): self.cancel("Failed to setup PMEM partitions") self.test_dev = "/dev/%sp1" % pmem_dev self.scratch_dev = "/dev/%sp2" % pmem_dev self.devices.extend([self.test_dev, self.scratch_dev]) if logflag and not (self.log_test and self.log_scratch): if process.system('parted -s -a optimal /dev/%s mklabel gpt --' ' mkpart primary xfs 1MiB 1GiB mkpart ' 'primary xfs 1GiB 2GiB' % log_dev, shell=True): self.cancel("Failed to setup logdev partitions") self.log_test = "/dev/%s1" % log_dev self.log_scratch = "/dev/%s2" % log_dev else: self.test_dev = self.params.get('disk_test', default=None) self.scratch_dev = self.params.get('disk_scratch', default=None) self.devices.extend([self.test_dev, self.scratch_dev]) # mkfs for devices if self.devices: cfg_file = os.path.join(self.teststmpdir, 'local.config') self.mkfs_opt = self.params.get('mkfs_opt', default='') self.mount_opt = self.params.get('mount_opt', default='') with open(cfg_file, "r") as sources: lines = sources.readlines() with open(cfg_file, "w") as sources: for line in lines: if line.startswith('export TEST_DEV'): sources.write( re.sub(r'export TEST_DEV=.*', 'export TEST_DEV=%s' % self.devices[0], line)) elif line.startswith('export TEST_DIR'): sources.write( re.sub(r'export TEST_DIR=.*', 'export TEST_DIR=%s' % self.test_mnt, line)) elif line.startswith('export SCRATCH_DEV'): sources.write( re.sub(r'export SCRATCH_DEV=.*', 'export SCRATCH_DEV=%s' % self.devices[1], line)) elif line.startswith('export SCRATCH_MNT'): sources.write( re.sub(r'export SCRATCH_MNT=.*', 'export SCRATCH_MNT=%s' % self.scratch_mnt, line)) break with open(cfg_file, "a") as sources: if self.log_test: sources.write('export USE_EXTERNAL=yes\n') sources.write('export TEST_LOGDEV="%s"\n' % self.log_test) self.log_devices.append(self.log_test) if self.log_scratch: sources.write('export SCRATCH_LOGDEV="%s"\n' % self.log_scratch) self.log_devices.append(self.log_scratch) if self.mkfs_opt: sources.write('MKFS_OPTIONS="%s"\n' % self.mkfs_opt) if self.mount_opt: sources.write('MOUNT_OPTIONS="%s"\n' % self.mount_opt) self.logdev_opt = self.params.get('logdev_opt', default='') for dev in self.log_devices: dev_obj = partition.Partition(dev) dev_obj.mkfs(fstype=self.fs_to_test, args=self.mkfs_opt) for ite, dev in enumerate(self.devices): dev_obj = partition.Partition(dev) if self.logdev_opt: dev_obj.mkfs(fstype=self.fs_to_test, args='%s %s=%s' % (self.mkfs_opt, self.logdev_opt, self.log_devices[ite])) else: dev_obj.mkfs(fstype=self.fs_to_test, args=self.mkfs_opt) git.get_repo('git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git', destination_dir=self.teststmpdir) build.make(self.teststmpdir) self.available_tests = self._get_available_tests() self.test_list = self._create_test_list(self.test_range) self.log.info("Tests available in srcdir: %s", ", ".join(self.available_tests)) if not self.test_range: self.exclude = self.params.get('exclude', default=None) self.gen_exclude = self.params.get('gen_exclude', default=None) self.share_exclude = self.params.get('share_exclude', default=None) if self.exclude or self.gen_exclude or self.share_exclude: self.exclude_file = os.path.join(self.teststmpdir, 'exclude') if self.exclude: self._create_test_list(self.exclude, self.fs_to_test, dangerous=False) if self.gen_exclude: self._create_test_list(self.gen_exclude, "generic", dangerous=False) if self.share_exclude: self._create_test_list(self.share_exclude, "shared", dangerous=False) if self.detected_distro.name is not 'SuSE': if process.system('useradd 123456-fsgqa', sudo=True, ignore_status=True): self.log.warn('useradd 123456-fsgqa failed') if process.system('useradd fsgqa', sudo=True, ignore_status=True): self.log.warn('useradd fsgqa failed') else: if process.system('useradd -m -U fsgqa', sudo=True, ignore_status=True): self.log.warn('useradd fsgqa failed') if process.system('groupadd sys', sudo=True, ignore_status=True): self.log.warn('groupadd sys failed') if not os.path.exists(self.scratch_mnt): os.makedirs(self.scratch_mnt) if not os.path.exists(self.test_mnt): os.makedirs(self.test_mnt)