Exemple #1
0
    def setUp(self):
        '''
        Build Stutter Test
        Source:
        https://github.com/gaowanlong/stutter/archive/master.zip
        '''

        # Check for basic utilities
        smm = SoftwareManager()
        if not smm.check_installed("gcc") and not smm.install("gcc"):
            self.error('Gcc is needed for the test to be run')

        locations = ["https://github.com/gaowanlong/stutter/archive/"
                     "master.zip"]
        tarball = self.fetch_asset("stutter.zip", locations=locations,
                                   expire='7d')
        archive.extract(tarball, self.srcdir)
        self.srcdir = os.path.join(self.srcdir, 'stutter-master')

        mem_byte = str(memory.memtotal())
        print mem_byte
        self._memory = self.params.get('memory', default=mem_byte)
        self._iteration = self.params.get('iteration', default='10')
        self._logdir = self.params.get('logdir', default='/var/tmp/logdir')
        self._rundir = self.params.get('rundir', default='/tmp')

        process.run('mkdir -p  %s' % self._logdir)

        # export env variable, used by test script
        os.environ['MEMTOTAL_BYTES'] = self._memory
        os.environ['ITERATIONS'] = self._iteration
        os.environ['LOGDIR_RESULTS'] = self._logdir
        os.environ['TESTDISK_DIR'] = self._rundir

        build.make(self.srcdir)
    def setUp(self):
        '''
        Install the basic packages to support perf
        '''

        # Check for basic utilities
        smm = SoftwareManager()
        detected_distro = distro.detect()
        self.distro_name = detected_distro.name
        deps = ['gcc', 'make']
        if 'Ubuntu' in self.distro_name:
            deps.extend(['linux-tools-common', 'linux-tools-%s' %
                         platform.uname()[2]])
        elif self.distro_name in ['rhel', 'SuSE', 'fedora', 'centos']:
            deps.extend(['perf'])
        else:
            self.cancel("Install the package for perf supported\
                      by %s" % detected_distro.name)
        for package in deps:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel('%s is needed for the test to be run' % package)

        shutil.copyfile(self.get_data('uprobe.c'),
                        os.path.join(self.teststmpdir, 'uprobe.c'))

        shutil.copyfile(self.get_data('Makefile'),
                        os.path.join(self.teststmpdir, 'Makefile'))

        build.make(self.teststmpdir)
        os.chdir(self.teststmpdir)
        self.temp_file = tempfile.NamedTemporaryFile().name
        self.cmdProbe = "perf probe -x"
        self.recProbe = "perf record -o %s -e probe_uprobe_test:doit" % self.temp_file
        self.report = "perf report --input=%s" % self.temp_file
        self.distro_version = detected_distro.version
    def setUp(self):
        '''
        Build interbench
        Source:
        http://ck.kolivas.org/apps/interbench/interbench-0.31.tar.bz2
        '''
        sm_manager = SoftwareManager()
        for pkg in ['gcc', 'patch']:
            if (not sm_manager.check_installed(pkg) and not
                    sm_manager.install(pkg)):
                self.cancel("%s is needed for the test to be run" % pkg)

        disk_free_mb = (disk.freespace(self.teststmpdir) / 1024) / 1024
        if memory.memtotal()/1024 > disk_free_mb:
            self.cancel('Disk space is less than total memory. Skipping test')

        tarball = self.fetch_asset('http://slackware.cs.utah.edu/pub/kernel'
                                   '.org/pub/linux/kernel/people/ck/apps/'
                                   'interbench/interbench-0.31.tar.gz')
        data_dir = os.path.abspath(self.datadir)
        archive.extract(tarball, self.srcdir)
        version = os.path.basename(tarball.split('.tar.')[0])
        self.sourcedir = os.path.join(self.srcdir, version)

        # Patch for make file
        os.chdir(self.sourcedir)
        makefile_patch = 'patch -p1 < %s ' % (
            os.path.join(data_dir, 'makefile_fix.patch'))
        process.run(makefile_patch, shell=True)

        build.make(self.sourcedir)
Exemple #4
0
    def get_guest_cpuid(self, cpu_model, feature=None, extra_params=None, qom_mode=False):
        if not qom_mode:
            test_kernel_dir = os.path.join(data_dir.get_deps_dir(), "cpuid", "src")
            build.make(test_kernel_dir, extra_args="cpuid_dump_kernel.bin")

        vm_name = params['main_vm']
        params_b = params.copy()
        if not qom_mode:
            params_b["kernel"] = os.path.join(
                test_kernel_dir, "cpuid_dump_kernel.bin")
        params_b["cpu_model"] = cpu_model
        params_b["cpu_model_flags"] = feature
        del params_b["images"]
        del params_b["nics"]
        if extra_params:
            params_b.update(extra_params)
        env_process.preprocess_vm(self, params_b, env, vm_name)
        vm = env.get_vm(vm_name)
        dbg('is dead: %r', vm.is_dead())
        vm.create()
        self.vm = vm
        if qom_mode:
            return get_qom_cpuid(self, vm)
        else:
            return get_test_kernel_cpuid(self, vm)
    def setUp(self):
        '''
        Build VA Test
        '''

        # Check for basic utilities
        smm = SoftwareManager()
        self.scenario_arg = int(self.params.get('scenario_arg', default=1))
        dic = {2: 1024, 3: 1024, 4: 131072, 5: 1, 6: 1, 7: 2}
        if self.scenario_arg not in range(1, 7):
            self.cancel("Test need to skip as scenario will be 1-7")
        if self.scenario_arg in [2, 3, 4]:
            if memory.meminfo.Hugepagesize.mb != 16:
                self.cancel(
                    "Test need to skip as 16MB huge need to configured")
        elif self.scenario_arg in [5, 6, 7]:
            if memory.meminfo.Hugepagesize.gb != 16:
                self.cancel(
                    "Test need to skip as 16GB huge need to configured")
        if self.scenario_arg != 1:
            memory.set_num_huge_pages(dic[self.scenario_arg])

        for packages in ['gcc', 'make']:
            if not smm.check_installed(packages) and not smm.install(packages):
                self.cancle('%s is needed for the test to be run' % packages)

        shutil.copyfile(os.path.join(self.datadir, 'va_test.c'),
                        os.path.join(self.teststmpdir, 'va_test.c'))

        shutil.copyfile(os.path.join(self.datadir, 'Makefile'),
                        os.path.join(self.teststmpdir, 'Makefile'))

        build.make(self.teststmpdir)
    def setUp(self):
        '''
        Build FileBench
        Source:
        https://github.com/filebench/filebench/releases/download/1.5-alpha3/filebench-1.5-alpha3.tar.gz
        '''

        # Check for basic utilities
        smm = SoftwareManager()
        deps = ['libtool', 'automake', 'autoconf', 'bison', 'gcc', 'flex']

        for package in deps:
            if not smm.check_installed(package) and not smm.install(package):
                self.error(package + ' is needed for the test to be run')

        self._testfile = self.params.get('testfile', default='fileserver.f')

        tarball = self.fetch_asset('https://github.com/filebench/'
                                   'filebench/releases/ownload/1.5-alpha3/'
                                   'filebench-1.5-alpha3.tar.gz', expire='7d')

        archive.extract(tarball, self.srcdir)
        version = os.path.basename(tarball.split('.tar.')[0])
        self.srcdir = os.path.join(self.srcdir, version)

        os.chdir(self.srcdir)

        process.run('./configure', shell=True, sudo=True)
        build.make(self.srcdir)
        build.make(self.srcdir, extra_args='install')

        # Setup test file
        t_dir = '/usr/local/share/filebench/workloads/'
        shutil.copyfile(os.path.join(t_dir, self._testfile),
                        os.path.join(self.srcdir, self._testfile))
 def setUp(self):
     """
     Build 'nvme-cli' and setup the device.
     """
     self.device = self.params.get('device', default='/dev/nvme0')
     cmd = 'ls %s' % self.device
     if process.system(cmd, ignore_status=True) is not 0:
         self.skip("%s does not exist" % self.device)
     locations = ["https://github.com/linux-nvme/nvme-cli/archive/"
                  "master.zip"]
     tarball = self.fetch_asset("nvme-cli.zip", locations=locations,
                                expire='15d')
     archive.extract(tarball, self.srcdir)
     os.chdir("%s/nvme-cli-master" % self.srcdir)
     process.system("./NVME-VERSION-GEN", ignore_status=True)
     if process.system_output("cat NVME-VERSION-FILE").strip("\n").\
         split()[-1] != process.system_output("nvme version").\
             strip("\n").split()[-1]:
         build.make(".")
         build.make(".", extra_args='install')
     self.id_ns = self.create_namespace()
     self.log.info(self.id_ns)
     cmd = "nvme id-ns %s | grep 'in use' | awk '{print $5}' | \
         awk -F':' '{print $NF}'" % self.id_ns
     self.format_size = process.system_output(cmd, shell=True).strip('\n')
     self.format_size = pow(2, int(self.format_size))
     cmd = "nvme id-ns %s | grep 'in use' | awk '{print $2}'" % self.id_ns
     self.lba = process.system_output(cmd, shell=True).strip('\n')
    def setUp(self):
        """
        fs_mark
        """

        smm = SoftwareManager()
        tarball = self.fetch_asset('https://github.com/josefbacik/fs_mark/'
                                   'archive/master.zip')
        archive.extract(tarball, self.teststmpdir)
        self.sourcedir = os.path.join(self.teststmpdir, 'fs_mark-master')
        os.chdir(self.sourcedir)
        process.run('make')
        build.make(self.sourcedir)
        self.disk = self.params.get('disk', default=None)
        self.num = self.params.get('num_files', default='1024')
        self.size = self.params.get('size', default='1000')
        self.dir = self.params.get('dir', default=self.srcdir)
        self.fstype = self.params.get('fs', default='ext4')

        if self.fstype == 'btrfs':
            if distro.detect().name == 'Ubuntu':
                if not smm.check_installed("btrfs-tools") and not \
                        smm.install("btrfs-tools"):
                    self.cancel('btrfs-tools is needed for the test to be run')

        if self.disk is not None:
            self.part_obj = Partition(self.disk, mountpoint=self.dir)
            self.log.info("Test will run on %s", self.dir)
            self.log.info("Unmounting the disk before creating file system")
            self.part_obj.unmount()
            self.log.info("creating file system")
            self.part_obj.mkfs(self.fstype)
            self.log.info("Mounting disk %s on dir %s", self.disk, self.dir)
            self.part_obj.mount()
    def setUp(self):

        if not memory.check_hotplug():
            self.cancel("UnSupported : memory hotplug not enabled\n")
        sm = SoftwareManager()
        if not sm.check_installed('stress') and not sm.install('stress'):
            tarball = self.fetch_asset(
                'https://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz')
            archive.extract(tarball, self.teststmpdir)
            self.sourcedir = os.path.join(
                self.teststmpdir, os.path.basename(tarball.split('.tar.')[0]))

            os.chdir(self.sourcedir)
            process.run('[ -x configure ] && ./configure', shell=True)
            build.make(self.sourcedir)
            build.make(self.sourcedir, extra_args='install')
        self.iteration = self.params.get('iteration', default=1)
        self.stresstime = self.params.get('stresstime', default=10)
        self.vmcount = self.params.get('vmcount', default=4)
        self.iocount = self.params.get('iocount', default=4)
        self.memratio = self.params.get('memratio', default=5)
        self.blocks_hotpluggable = get_hotpluggable_blocks(
            (os.path.join('%s', 'memory*') % mem_path), self.memratio)
        if os.path.exists("%s/auto_online_blocks" % mem_path):
            if not self.__is_auto_online():
                self.hotplug_all(self.blocks_hotpluggable)
        clear_dmesg()
Exemple #10
0
 def setUp(self):
     sm = SoftwareManager()
     dist = distro.detect()
     packages = ['gcc', 'dejagnu', 'flex', 'bison', 'texinfo']
     if dist.name == 'Ubuntu':
         packages.extend(['g++', 'binutils-dev'])
     # 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 dist.name in ['SuSE', 'rhel', 'fedora', 'redhat']:
         packages.extend(['gcc-c++', 'binutils-devel', 'texi2html'])
     else:
         self.fail('no packages list for your distro.')
     for package in packages:
         if not sm.check_installed(package) and not sm.install(package):
             self.error("Fail to install %s required for this test." %
                        package)
     test_type = self.params.get('type', default='upstream')
     if test_type == 'upstream':
         gdb_version = self.params.get('gdb_version', default='7.10')
         tarball = self.fetch_asset(
             "http://ftp.gnu.org/gnu/gdb/gdb-%s.tar.gz" % gdb_version)
         archive.extract(tarball, self.workdir)
         sourcedir = os.path.join(
             self.workdir, os.path.basename(tarball.split('.tar')[0]))
     elif test_type == 'distro':
         sourcedir = os.path.join(self.workdir, 'gdb-distro')
         if not os.path.exists(sourcedir):
             os.makedirs(sourcedir)
         sourcedir = sm.get_source("gdb", sourcedir)
     os.chdir(sourcedir)
     process.run('./configure', ignore_status=True, sudo=True)
     build.make(sourcedir)
    def setUp(self):
        '''
        Build numatop Test
        Source:
        https://github.com/01org/numatop.git
        '''

        # Check for basic utilities
        # TODO: Add support for other distributions
        self.numa_pid = None
        detected_distro = distro.detect().name.lower()
        if not detected_distro == "ubuntu":
            self.cancel("Upsupported OS %s" % detected_distro)
        smm = SoftwareManager()
        for package in ['gcc', 'numatop', 'make', 'libnuma-dev']:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel("Failed to install %s, which is needed for"
                            "the test to be run" % package)

        locations = ["https://github.com/01org/numatop/archive/master.zip"]
        tarball = self.fetch_asset("numatop.zip", locations=locations,
                                   expire='7d')
        archive.extract(tarball, self.srcdir)
        self.sourcedir = os.path.join(self.srcdir, 'numatop-master')

        os.chdir(self.sourcedir)

        build.make(self.sourcedir, extra_args='test')
    def setUp(self):
        '''
        Use 85% of memory with/without many process forked
        WARNING: System may go out-of-memory based on the available resource
        '''
        smm = SoftwareManager()
        self.itern = int(self.params.get('iterations', default='10'))
        self.procs = int(self.params.get('procs', default='1'))
        self.minmem = int(self.params.get('minmem', default='10'))
        self.fails = []

        if not (self.itern and self.procs and self.minmem):
            self.cancel(
                'Please use a non-zero value for number'
                ' of iterations, processes and memory to be used')

        self.freemem = int((0.85 * memory.freememtotal()) / 1024)
        # Check for basic utilities
        for packages in ['gcc', 'make']:
            if not smm.check_installed(packages) and not smm.install(packages):
                self.cancel('%s is needed for the test to be run' % packages)

        shutil.copyfile(self.get_data('forkoff.c'),
                        os.path.join(self.teststmpdir, 'forkoff.c'))

        shutil.copyfile(self.get_data('Makefile'),
                        os.path.join(self.teststmpdir, 'Makefile'))

        build.make(self.teststmpdir)
 def setUp(self):
     sm = SoftwareManager()
     detected_distro = distro.detect()
     self.tmpdir = data_dir.get_tmp_dir()
     # Check for basic utilities
     for package in ['gcc', 'make', 'gfortran']:
         if detected_distro.name == "SuSE" and package == "gfortran":
             package = 'gcc-fortran'
         # 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
         if detected_distro.name in ["rhel", "redhat"] and package == "gfortran":
             package = 'gcc-gfortran'
         if not sm.check_installed(package) and not sm.install(package):
             self.error(package + ' is needed for the test to be run')
     atlas_url = 'https://sourceforge.net/projects/'\
                 'math-atlas/files/Stable/3.10.3/atlas3.10.3.tar.bz2'
     lapack_url = 'http://www.netlib.org/lapack/lapack-3.6.1.tgz'
     atlas_url = self.params.get('atlas_url', default=atlas_url)
     lapack_url = self.params.get('lapack_url', default=lapack_url)
     atlas_tarball = self.fetch_asset(atlas_url, expire='7d')
     archive.extract(atlas_tarball, self.workdir)
     self.atlas_dir = os.path.join(self.workdir, 'ATLAS')
     self.atlas_build_dir = os.path.join(self.atlas_dir, 'atlas_build_dir')
     os.makedirs(self.atlas_build_dir)
     lapack_tarball = self.fetch_asset(lapack_url, expire='7d')
     os.chdir(self.atlas_build_dir)
     config_args = '--shared -b 64 '\
                   '--with-netlib-lapack-tarfile=%s '\
                   '--cripple-atlas-performance' % lapack_tarball
     config_args = self.params.get('config_args', default=config_args)
     process.system('../configure %s' % config_args)
     # Tune and compile library
     build.make(self.atlas_build_dir)
    def setUp(self):
        '''
        Build ebizzy
        Source:
        http://liquidtelecom.dl.sourceforge.net/project/ebizzy/ebizzy/0.3
        /ebizzy-0.3.tar.gz
        '''
        sm = SoftwareManager()
        for package in ['gcc', 'make', 'patch']:
            if not sm.check_installed(package) and not sm.install(package):
                self.cancel("%s is needed for the test to be run" % package)
        tarball = self.fetch_asset('http://liquidtelecom.dl.sourceforge.net'
                                   '/project/ebizzy/ebizzy/0.3'
                                   '/ebizzy-0.3.tar.gz')
        archive.extract(tarball, self.workdir)
        version = os.path.basename(tarball.split('.tar.')[0])
        self.sourcedir = os.path.join(self.workdir, version)

        patch = self.params.get(
            'patch', default='Fix-build-issues-with-ebizzy.patch')
        os.chdir(self.sourcedir)
        p1 = 'patch -p0 < %s' % (self.get_data(patch))
        process.run(p1, shell=True)
        process.run('[ -x configure ] && ./configure', shell=True)
        build.make(self.sourcedir)
    def setUp(self):
        self.test_file = self.params.get('tmp_file', default='/tmp/dummy')
        self.duration = self.params.get('duration', default='30')
        self.threads = self.params.get(
            'threads', default=cpu.online_cpus_count())
        self.size = self.params.get(
            'memory_to_test', default=int(0.9 * memory.meminfo.MemFree.m))

        smm = SoftwareManager()
        for package in ['gcc', 'libtool', 'autoconf', 'automake', 'make']:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel("Failed to install %s, which is needed for"
                            "the test to be run" % package)

        if not os.path.exists(self.test_file):
            try:
                os.mknod(self.test_file)
            except OSError:
                self.cancel("Skipping test since test file creation failed")
        loc = ["https://github.com/stressapptest/"
               "stressapptest/archive/master.zip"]
        tarball = self.fetch_asset("stressapp.zip", locations=loc,
                                   expire='7d')
        archive.extract(tarball, self.workdir)
        self.sourcedir = os.path.join(self.workdir, 'stressapptest-master')

        os.chdir(self.sourcedir)
        process.run('./configure', shell=True)

        build.make(self.sourcedir)
    def build_module(self):
        """
        Building of the kretprobe kernel module
        """
        self.log.info("============== Building kretprobe Module =================")
        self.sourcedir = tempfile.mkdtemp()
        os.chdir(self.sourcedir)

        self.location = ('https://raw.githubusercontent.com/torvalds/linux/'
                         'master/samples/kprobes/kretprobe_example.c')
        self.kretprobe_file = self.fetch_asset(self.location, expire='7d')
        self.kretprobe_dst = os.path.join(self.sourcedir, 'kretprobe_example.c')
        shutil.copy(self.kretprobe_file, self.kretprobe_dst)

        """
        Write module make file on the fly
        """
        makefile = open("Makefile", "w")
        makefile.write('obj-m := kretprobe_example.o\nKDIR := /lib/modules/$(shell uname -r)/build'
                       '\nPWD := $(shell pwd)\ndefault:\n\t'
                       '$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules\n')
        makefile.close()

        self.is_fail = 0
        build.make(self.sourcedir)
        if self.is_fail >= 1:
            self.fail("Building kretprobe_example.ko failed")
        if not os.path.isfile('./kretprobe_example.ko'):
            self.fail("No kretprobe_example.ko found, module build failed")
    def setUp(self):
        '''
        Build Ioping  Test
        '''

        # Check for basic utilities
        smm = SoftwareManager()

        self.count = self.params.get('count', default='2')
        self.mode = self.params.get('mode', default='-C')
        self.deadline = self.params.get('deadline', default='10')
        self.period = self.params.get('period', default='10')
        self.interval = self.params.get('interval', default='1s')
        self.size = self.params.get('size', default='4k')
        self.wsize = self.params.get('wsize', default='10m')
        self.disk = self.params.get('disk', default='/home')

        for package in ['gcc', 'make']:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel(
                    "Fail to install %s required for this test." % package)
        tarball = self.fetch_asset('https://storage.googleapis.com/'
                                   'google-code-archive-downloads/v2/'
                                   'code.google.com/ioping/'
                                   'ioping-0.8.tar.gz', expire='0d')
        archive.extract(tarball, self.teststmpdir)
        version = os.path.basename(tarball.split('.tar.')[0])
        self.sourcedir = os.path.join(self.teststmpdir, version)

        build.make(self.sourcedir)
    def setUp(self):
        '''
        Build ebizzy
        '''
        if 'ppc' not in distro.detect().arch:
            self.cancel("Processor is not ppc64")
        smg = SoftwareManager()
        detected_distro = distro.detect()
        deps = ['gcc', 'make', 'patch']
        if 'Ubuntu' in detected_distro.name:
            deps.extend(['linux-tools-common', 'linux-tools-%s'
                         % platform.uname()[2]])
        elif detected_distro.name == "SuSE":
            deps.extend(['cpupower'])
        else:
            deps.extend(['kernel-tools'])
        for package in deps:
            if not smg.check_installed(package) and not smg.install(package):
                self.cancel("%s is needed for the test to be run" % package)
        tarball = self.fetch_asset('http://liquidtelecom.dl.sourceforge.net'
                                   '/project/ebizzy/ebizzy/0.3'
                                   '/ebizzy-0.3.tar.gz')
        archive.extract(tarball, self.workdir)
        version = os.path.basename(tarball.split('.tar.')[0])
        self.sourcedir = os.path.join(self.workdir, version)

        patch = self.params.get(
            'patch', default='Fix-build-issues-with-ebizzy.patch')

        os.chdir(self.sourcedir)
        fix_patch = 'patch -p0 < %s' % (self.get_data(patch))
        process.run(fix_patch, shell=True)
        process.run("./configure")
        build.make(self.sourcedir)
    def setUp(self):
        '''
        Build posixtest
        Source:
            http://ufpr.dl.sourceforge.net/sourceforge/posixtest/posixtestsuite-1.5.2.tar.gz
        '''
        sm = SoftwareManager()
        for package in ['gcc', 'make', 'patch']:
            if not sm.check_installed(package) and not sm.install(package):
                self.cancel("%s is needed for the test to be run" % package)
        tarball = self.fetch_asset('http://ufpr.dl.sourceforge.net'
                                   '/sourceforge/posixtest/posixtestsuite-1.5.2.tar.gz')
        data_dir = os.path.abspath(self.datadir)
        archive.extract(tarball, self.srcdir)
        version = os.path.basename(tarball.split('-1.')[0])
        self.sourcedir = os.path.join(self.srcdir, version)

        patch = self.params.get(
            'patch', default='posix-linux.patch')
        os.chdir(self.sourcedir)
        p1 = 'patch -p1 < %s/%s' % (data_dir, patch)

        process.run(p1, shell=True)

        build.make(self.sourcedir)
    def setUp(self):
        """
        Build 'fio'.
        """
        default_url = "http://brick.kernel.dk/snaps/fio-2.1.10.tar.gz"
        url = self.params.get('fio_tool_url', default=default_url)
        self.disk = self.params.get('disk', default=None)
        self.dir = self.params.get('dir', default=self.srcdir)
        fstype = self.params.get('fs', default='ext4')
        tarball = self.fetch_asset(url)
        archive.extract(tarball, self.teststmpdir)
        fio_version = os.path.basename(tarball.split('.tar.')[0])
        self.sourcedir = os.path.join(self.teststmpdir, fio_version)
        build.make(self.sourcedir)

        smm = SoftwareManager()
        if fstype == 'btrfs':
            if distro.detect().name == 'Ubuntu':
                if not smm.check_installed("btrfs-tools") and not \
                        smm.install("btrfs-tools"):
                    self.cancel('btrfs-tools is needed for the test to be run')

        if self.disk is not None:
            self.part_obj = Partition(self.disk, mountpoint=self.dir)
            self.log.info("Unmounting disk/dir before creating file system")
            self.part_obj.unmount()
            self.log.info("creating file system")
            self.part_obj.mkfs(fstype)
            self.log.info("Mounting disk %s on directory %s",
                          self.disk, self.dir)
            self.part_obj.mount()
    def setUp(self):
        '''
        Build FileBench
        Source:
        https://github.com/filebench/filebench/releases/download/1.5-alpha3/filebench-1.5-alpha3.tar.gz
        '''

        # Check for basic utilities
        smm = SoftwareManager()
        deps = ['libtool', 'automake', 'autoconf', 'bison', 'gcc', 'flex']

        for package in deps:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel(package + ' is needed for the test to be run')

        name_version = 'filebench-1.5-alpha3'
        tarball = self.fetch_asset('https://github.com/filebench/'
                                   'filebench/releases/download/1.5-alpha3/'
                                   '%s.tar.gz' % name_version)

        archive.extract(tarball, self.workdir)
        self.install_prefix = os.path.join(self.workdir, 'install_prefix')
        build_dir = os.path.join(self.workdir, name_version)
        os.chdir(build_dir)
        process.run('./configure --prefix=%s' % self.install_prefix,
                    shell=True)
        build.make(build_dir)
        build.make(build_dir, extra_args='install')
Exemple #22
0
    def setUp(self):
        smm = SoftwareManager()
        self.minthreads = self.params.get(
            'minthrd', default=(500 + cpu.online_cpus_count()))
        self.maxthreads = self.params.get('maxthrd', default=None)
        self.iothreads = self.params.get('iothrd', default=self.minthreads/2)
        self.maxmem = self.params.get('maxmem', default=int(
            memory.meminfo.MemFree.m / self.minthreads))
        self.maxio = self.params.get('maxio', default=None)
        self.longthreads = self.params.get('longthrd', default=False)
        self.shrtthreads = self.params.get('shortthrd', default=False)
        self.time = self.params.get('time', default=100)
        self.iotime = self.params.get('iotime', default=50)

        if self.longthreads and self.shrtthreads:
            self.cancel('Please choose right inputs')

        dist = distro.detect()
        packages = ['gcc']
        if dist.name == 'Ubuntu':
            packages.extend(['g++'])
        elif dist.name in ['SuSE', 'fedora', 'rhel']:
            packages.extend(['gcc-c++'])
        for package in packages:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel('%s is needed for the test to be run' % package)

        for file_name in ['dwh.cpp', 'Makefile']:
            self.copyutil(file_name)
        os.chdir(self.teststmpdir)
        if dist.name in ['fedora', 'rhel']:
            process.system('patch -p0 < %s' %
                           self.get_data('fofd.patch'), shell=True)
        build.make(self.teststmpdir)
    def setUp(self):
        '''
        Check for required packages namely gcc, make, valgrind.
        Transfer the source file and make file.
        Compile
        '''
        smm = SoftwareManager()

        dist = distro.detect()
        if dist.arch != "ppc64le":
            self.cancel("Test is not applicable!!")
        deps = ['gcc', 'make', 'valgrind']
        for package in deps:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel('%s is needed for the test to be run' % package)

        self.log.info("Tranferring the files ...")
        shutil.copyfile(self.get_data('print_power_time_base.c'),
                        os.path.join(self.teststmpdir, 'print_power_time_base.c'))

        self.log.info("About to compile ...")
        shutil.copyfile(self.get_data('Makefile'),
                        os.path.join(self.teststmpdir, 'Makefile'))

        build.make(self.teststmpdir)
    def setUp(self):
        '''
        Build ebizzy
        Source:
        http://liquidtelecom.dl.sourceforge.net/project/ebizzy/ebizzy/0.3
        /ebizzy-0.3.tar.gz
        '''
        sm = SoftwareManager()
        if not sm.check_installed("gcc") and not sm.install("gcc"):
            self.error("Gcc is needed for the test to be run")
        tarball = self.fetch_asset('http://liquidtelecom.dl.sourceforge.net'
                                   '/project/ebizzy/ebizzy/0.3'
                                   '/ebizzy-0.3.tar.gz')
        data_dir = os.path.abspath(self.datadir)
        archive.extract(tarball, self.srcdir)
        version = os.path.basename(tarball.split('.tar.')[0])
        self.srcdir = os.path.join(self.srcdir, version)

        patch = self.params.get(
            'patch', default='Fix-build-issues-with-ebizzy.patch')
        os.chdir(self.srcdir)
        p1 = 'patch -p0 < %s/%s' % (data_dir, patch)
        process.run(p1, shell=True)
        process.run('[ -x configure ] && ./configure', shell=True)
        build.make(self.srcdir)
    def setUp(self):
        '''
        Build linsched  Test
        Source:
        https://github.com/thejinxters/linux-scheduler-testing
        '''

        # Check for basic utilities
        smm = SoftwareManager()
        deps = ['gcc', 'make', 'patch']
        if distro.detect().name == "SuSE":
            deps.append('git-core')
        else:
            deps.append('git')
        for package in deps:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel(
                    "Fail to install %s required for this test." % package)
        self.args = self.params.get('args', default='pi 100')
        git.get_repo('https://github.com/thejinxters/linux-scheduler-testing',
                     destination_dir=self.srcdir)
        os.chdir(self.srcdir)
        fix_patch = 'patch -p1 < %s' % (
            os.path.join(self.datadir, 'fix.patch'))
        process.run(fix_patch, shell=True, ignore_status=True)

        build.make(self.srcdir)
Exemple #26
0
    def setUp(self):
        """
        Build xfstest
        Source: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
        """
        sm = SoftwareManager()
        packages = ['xfslibs-dev', 'uuid-dev', 'libtool-bin', 'e2fsprogs',
                    'automake', 'gcc', 'libuuid1', 'quota', 'attr',
                    'libattr1-dev', 'make', 'libacl1-dev', 'xfsprogs',
                    'libgdbm-dev', 'gawk', 'fio', 'dbench', 'uuid-runtime']
        for package in packages:
            if not sm.check_installed(package) and not sm.install(package):
                self.error("Fail to install %s required for this test." %
                           package)

        self.test_range = self.params.get('test_range', default=None)
        if self.test_range is None:
            self.fail('Please provide a test_range.')

        self.skip_dangerous = self.params.get('skip_dangerous', default=True)

        git.get_repo('git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git',
                     destination_dir=self.srcdir)
        data_dir = os.path.abspath(self.datadir)

        shutil.copyfile(os.path.join(data_dir, 'group'),
                        os.path.join(self.srcdir, 'group'))
        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)
        process.run('useradd 123456-fsgqa', sudo=True)
    def setUp(self):
        '''
        Build Bcc Test
        Source:
        https://github.com/iovisor/bcc
        '''

        # Check for basic utilities
        detected_distro = distro.detect().name.lower()
        smm = SoftwareManager()
        # TODO: Add support for other distributions
        if not detected_distro == "ubuntu":
            self.cancel("Upsupported OS %s" % detected_distro)
        for package in ['bison', 'build-essential', 'cmake', 'flex',
                        'libedit-dev', 'libllvm3.8', 'llvm-3.8-dev',
                        'libclang-3.8-dev', 'python', 'zlib1g-dev',
                        'libelf-dev', 'clang-format-3.8', 'python-netaddr',
                        'python-pyroute2', 'arping', 'iperf', 'netperf',
                        'ethtool']:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel("Failed to install %s, which is needed for"
                            "the test to be run" % package)

        locations = ["https://github.com/iovisor/bcc/archive/master.zip"]
        tarball = self.fetch_asset("bcc.zip", locations=locations,
                                   expire='7d')
        archive.extract(tarball, self.srcdir)
        self.sourcedir = os.path.join(self.srcdir, 'bcc-master')
        os.makedirs('%s/build' % self.sourcedir)
        self.builddir = '%s/build' % self.sourcedir
        os.chdir(self.builddir)
        process.run('cmake .. -DCMAKE_INSTALL_PREFIX=/usr', shell=True)

        build.make(self.builddir)
    def setUp(self):
        '''
        Build Connectathon
        Source:
        git://git.linux-nfs.org/projects/steved/cthon04.git
        '''
        self.nfail = 0
        # Check for root permission
        if os.geteuid() != 0:
            exit("You need to have root privileges to run this script."
                 "\nPlease try again, using 'sudo'. Exiting.")
        # Check for basic utilities
        smm = SoftwareManager()
        detected_distro = distro.detect()
        packages = ['gcc', 'make']

        if detected_distro.name == "SuSE":
            packages.extend(['git-core'])

        else:
            packages.extend(['git'])

        for package in packages:
            if not smm.check_installed(package) and not smm.install(package):
                self.error("Fail to install %s required for this test." %
                           package)

        self.tmpdir = tempfile.mkdtemp(prefix='avocado_' + __name__)
        data_dir = os.path.abspath(self.datadir)
        git.get_repo('git://git.linux-nfs.org/projects/steved/cthon04.git',
                     destination_dir=self.srcdir)
        os.chdir(self.srcdir)

        build.make(self.srcdir)
    def setUp(self):
        softm = SoftwareManager()

        pkgs = ['gcc', 'make']
        if distro.detect().name in ['SuSE', 'Ubuntu']:
            pkgs.extend(['libpfm4'])
        else:
            pkgs.extend(['libpfm'])

        for pkg in pkgs:
            if not softm.check_installed(pkg) and not softm.install(pkg):
                self.cancel("%s is needed for the test to be run" % pkg)
        test_type = self.params.get('type', default='upstream')

        if test_type == 'upstream':
            tarball = self.fetch_asset(
                'https://netix.dl.sourceforge.net/project/perfmon2/'
                'libpfm4/libpfm-4.9.0.tar.gz', expire='1d')
            archive.extract(tarball, self.teststmpdir)
            version = os.path.basename(tarball.split('.tar.')[0])
            self.path = os.path.join(self.teststmpdir, version)
        elif test_type == 'distro':
            sourcedir = os.path.join(self.teststmpdir, 'libpfm-distro')
            if not os.path.exists(sourcedir):
                os.makedirs(sourcedir)
            if distro.detect().name == 'Ubuntu':
                self.path = softm.get_source('libpfm4', sourcedir)
            else:
                self.path = softm.get_source('libpfm', sourcedir)

        os.chdir(self.path)
        build.make(self.path)
    def setUp(self):
        '''
        Build Integrity Test
        '''

        # Check for basic utilities
        smm = SoftwareManager()
        self.scenario_arg = self.params.get('scenario_arg', default='1')
        if self.scenario_arg not in ['1', '2', '3']:
            self.cancel("Test need to skip as scenario needs to be 1-3")
        detected_distro = distro.detect()
        deps = ['gcc', 'make']
        if detected_distro.name == "Ubuntu":
            deps.extend(['libnuma-dev'])
        elif detected_distro.name in ["centos", "rhel", "fedora"]:
            deps.extend(['numactl-devel'])
        else:
            deps.extend(['libnuma-devel'])
        for packages in deps:
            if not smm.check_installed(packages) and not smm.install(packages):
                self.cancel('%s is needed for the test to be run' % packages)

        archive.extract(self.get_data("Integritytests.tar"), self.workdir)
        self.build_dir = os.path.join(self.workdir, 'Integritytests')
        build.make(self.build_dir)
Exemple #31
0
    def setUp(self):
        smm = SoftwareManager()
        dist = distro.detect()
        memsize = int(memory.meminfo.MemFree.b * 0.2)
        self.nr_pages = self.params.get('nr_pages',
                                        default=memsize //
                                        memory.get_page_size())
        self.map_type = self.params.get('map_type', default='private')
        self.hpage = self.params.get('h_page', default=False)

        nodes = memory.numa_nodes_with_memory()
        pkgs = ['gcc', 'make']
        hp_check = 0
        if self.hpage:
            hp_size = memory.get_huge_page_size()
            for node in nodes:
                genio.write_file(
                    '/sys/devices/system/node/node%s/hugepages/hu'
                    'gepages-%skB/nr_hugepages' % (node, str(hp_size)),
                    str(self.nr_pages))
            for node in nodes:
                hp_check += int(
                    genio.read_file(
                        '/sys/devices/system/node/node%s/hugepages/hugepages-%skB'
                        '/nr_hugepages' % (node, str(hp_size))).strip())
            if hp_check < self.nr_pages:
                self.cancel('Not enough pages to be configured on nodes')
        if dist.name in ["Ubuntu", 'debian']:
            pkgs.extend(
                ['libpthread-stubs0-dev', 'libnuma-dev', 'libhugetlbfs-dev'])
        elif dist.name in ["centos", "rhel", "fedora"]:
            pkgs.extend(['numactl-devel', 'libhugetlbfs-devel'])
        elif dist.name == "SuSE":
            pkgs.extend(['libnuma-devel'])
            if dist.version >= 15:
                pkgs.extend(['libhugetlbfs-devel'])
            else:
                pkgs.extend(['libhugetlbfs-libhugetlb-devel'])

        for package in pkgs:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel('%s is needed for the test to be run' % package)

        for file_name in [
                'util.c', 'numa_test.c', 'softoffline.c', 'bench_movepages.c',
                'Makefile'
        ]:
            self.copyutil(file_name)

        build.make(self.teststmpdir)
Exemple #32
0
 def setUp(self):
     """
     Build 'doublefree'.
     """
     source = self.params.get('source', default='doublefree.c')
     c_file = self.get_data(source)
     if c_file is None:
         self.cancel('Test is missing data file %s' % source)
     c_file_name = os.path.basename(c_file)
     dest_c_file = os.path.join(self.workdir, c_file_name)
     shutil.copy(c_file, dest_c_file)
     build.make(self.workdir,
                env={'CFLAGS': '-g -O0'},
                extra_args='doublefree')
    def setUp(self):
        """
        Build 'fio'.
        """
        default_url = "https://brick.kernel.dk/snaps/fio-git-latest.tar.gz"
        url = self.params.get('fio_tool_url', default=default_url)
        self.disk = self.params.get('disk', default=None)
        self.dirs = self.params.get('dir', default=self.workdir)
        fstype = self.params.get('fs', default='ext4')
        tarball = self.fetch_asset(url)
        archive.extract(tarball, self.teststmpdir)
        self.sourcedir = os.path.join(self.teststmpdir, "fio")
        build.make(self.sourcedir)

        smm = SoftwareManager()
        if 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 distro.detect().name in ['Ubuntu', 'debian']:
            pkg_list = ['libaio-dev']
            if fstype == 'btrfs':
                pkg_list.append('btrfs-progs')
        else:
            pkg_list = ['libaio', 'libaio-devel']

        for pkg in pkg_list:
            if pkg and not smm.check_installed(pkg) and not smm.install(pkg):
                self.cancel(
                    "Package %s is missing and could not be installed" % pkg)

        if self.disk is not None:
            self.part_obj = Partition(self.disk, mountpoint=self.dirs)
            self.log.info("Unmounting disk/dir before creating file system")
            self.part_obj.unmount()
            self.log.info("creating file system")
            self.part_obj.mkfs(fstype)
            self.log.info("Mounting disk %s on directory %s", self.disk,
                          self.dirs)
            try:
                self.part_obj.mount()
            except PartitionError:
                self.fail("Mounting disk %s on directory %s failed" %
                          (self.disk, self.dirs))

        self.fio_file = 'fiotest-image'
Exemple #34
0
 def setUp(self):
     """
     Build 'stress'.
     Source:
      http://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz
     """
     tarball = self.fetch_asset(
         'http://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz')
     archive.extract(tarball, self.srcdir)
     stress_version = os.path.basename(tarball.split('.tar.')[0])
     self.srcdir = os.path.join(self.srcdir, stress_version)
     os.chdir(self.srcdir)
     process.run('./configure')
     build.make(self.srcdir)
    def test(self):
        """
        Execute the kernel selftest
        """
        self.error = False
        build.make(self.sourcedir, extra_args='%s run_tests' % self.comp)
        for line in open(os.path.join(self.logdir, 'debug.log')).readlines():
            if self.run_type == 'upstream':
                self.find_match(r'not ok (.*) selftests:(.*)', line)
            elif self.run_type == 'distro':
                self.find_match(r'selftests:(.*)\[FAIL\]', line)

        if self.error:
            self.fail("Testcase failed during selftests")
 def setUp(self):
     sm = SoftwareManager()
     for package in ['gcc', 'make']:
         if not sm.check_installed(package) and not sm.install(package):
             self.cancel('%s is needed for the test to be run' % package)
     tarball = self.fetch_asset(
               "https://www.samba.org/ftp/tridge/dbench/dbench-3.04.tar.gz",
               expire='7d')
     archive.extract(tarball, self.workdir)
     version = os.path.basename(tarball.split('.tar.')[0])
     self.sourcedir = os.path.join(self.workdir, version)
     os.chdir(self.sourcedir)
     process.run('./configure', ignore_status=True, sudo=True)
     build.make(self.sourcedir)
    def test_gpu_burn(self):
        '''
        GPU burn tests
        '''
        self.log.info("test_gpu_burn: GPU Burn tests")

        git.get_repo('https://github.com/wilicc/gpu-burn.git',
                     destination_dir=self.workdir)
        os.chdir(self.workdir)
        build.make(self.workdir)
        output = process.system_output('./gpu_burn',
                                       ignore_status=True,
                                       shell=True)
        self.process_output(output)
Exemple #38
0
    def setUp(self):
        '''
        Build IOZone
        Source:
        http://www.iozone.org/src/current/iozone3_434.tar
        '''

        self.base_dir = os.path.abspath(self.basedir)

        tarball = self.fetch_asset(
            'http://www.iozone.org/src/current/iozone3_434.tar')
        archive.extract(tarball, self.srcdir)
        version = os.path.basename(tarball.split('.tar')[0])
        self.srcdir = os.path.join(self.srcdir, version)

        make_dir = os.path.join(self.srcdir, 'src', 'current')
        os.chdir(make_dir)
        patch = self.params.get('patch', default='makefile.patch')
        patch = os.path.join(self.datadir, patch)
        process.run('patch -p3 < %s' % patch, shell=True)

        d_distro = distro.detect()
        arch = d_distro.arch
        if arch == 'ppc':
            build.make(make_dir, extra_args='linux-powerpc')
        elif arch == 'ppc64' or arch == 'ppc64le':
            build.make(make_dir, extra_args='linux-powerpc64')
        elif arch == 'x86_64':
            build.make(make_dir, extra_args='linux-AMD64')
        else:
            build.make(make_dir, extra_args='linux')
Exemple #39
0
    def setUp(self):
        '''
        Build IOZone
        Source:
        http://www.iozone.org/src/current/iozone3_434.tar
        '''

        self.base_dir = os.path.abspath(self.basedir)
        smm = SoftwareManager()
        for package in ['gcc', 'make', 'patch']:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel("%s is needed for the test to be run" % package)
        tarball = self.fetch_asset(
            'http://www.iozone.org/src/current/iozone3_434.tar')
        archive.extract(tarball, self.srcdir)
        version = os.path.basename(tarball.split('.tar')[0])
        self.srcdir = os.path.join(self.srcdir, version)

        make_dir = os.path.join(self.srcdir, 'src', 'current')
        os.chdir(make_dir)
        patch = self.params.get('patch', default='makefile.patch')
        patch = os.path.join(self.datadir, patch)
        process.run('patch -p3 < %s' % patch, shell=True)

        d_distro = distro.detect()
        arch = d_distro.arch
        if arch == 'ppc':
            build.make(make_dir, extra_args='linux-powerpc')
        elif arch == 'ppc64' or arch == 'ppc64le':
            build.make(make_dir, extra_args='linux-powerpc64')
        elif arch == 'x86_64':
            build.make(make_dir, extra_args='linux-AMD64')
        else:
            build.make(make_dir, extra_args='linux')
 def setUp(self):
     """
     To check and install dependencies for the test
     """
     smm = SoftwareManager()
     detected_distro = distro.detect()
     pkgs = ["gcc", "autoconf", "perl", "m4", "git-core"]
     if detected_distro.name == "Ubuntu":
         pkgs.extend(["libsctp1", "libsctp-dev", "lksctp-tools"])
     else:
         pkgs.extend(["lksctp-tools", "lksctp-tools-devel"])
     for pkg in pkgs:
         if not smm.check_installed(pkg) and not smm.install(pkg):
             self.cancel("%s package is need to test" % pkg)
     interfaces = netifaces.interfaces()
     self.iface = self.params.get("interface", default="")
     self.peer_ip = self.params.get("peer_ip", default="")
     if self.iface not in interfaces:
         self.cancel("%s interface is not available" % self.iface)
     if self.peer_ip == "":
         self.cancel("%s peer machine is not available" % self.peer_ip)
     self.peer_user = self.params.get("peer_user_name", default="root")
     uperf_download = self.params.get("uperf_download", default="https:"
                                      "//github.com/uperf/uperf/"
                                      "archive/master.zip")
     tarball = self.fetch_asset(uperf_download, expire='7d')
     archive.extract(tarball, self.teststmpdir)
     self.uperf_dir = os.path.join(self.teststmpdir, "uperf-master")
     cmd = "scp -r %s %s@%s:/tmp" % (self.uperf_dir, self.peer_user,
                                     self.peer_ip)
     if process.system(cmd, shell=True, ignore_status=True) != 0:
         self.cancel("unable to copy the uperf into peer machine")
     cmd = "ssh %s@%s \"cd /tmp/uperf-master;autoreconf -fi;./configure " \
           "ppc64le;make\"" % (self.peer_user, self.peer_ip)
     if process.system(cmd, ignore_status=True, shell=True, sudo=True):
         self.cancel("Unable to compile Uperf into peer machine")
     self.uperf_run = str(self.params.get("UPERF_SERVER_RUN", default=0))
     if self.uperf_run == '1':
         cmd = "ssh %s@%s \"cd /tmp/uperf-master/src;./uperf -s\""\
               % (self.peer_user, self.peer_ip)
         obj = process.SubProcess(cmd, verbose=False, shell=True)
         obj.start()
     os.chdir(self.uperf_dir)
     process.system('autoreconf -fi', shell=True)
     process.system('./configure ppc64le', shell=True)
     build.make(self.uperf_dir)
     self.expected_tp = self.params.get("EXPECTED_THROUGHPUT", default="85")
     speed = int(read_file("/sys/class/net/%s/speed" % self.iface))
     self.expected_tp = int(self.expected_tp) * speed / 100
Exemple #41
0
 def setUp(self):
     """
     Build 'stress'.
     Source:
      http://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz
     """
     stress_tarball = self.params.get('stress_tarball',
                                      default='stress-1.0.4.tar.gz')
     tarball_path = self.get_data_path(stress_tarball)
     archive.extract(tarball_path, self.srcdir)
     stress_version = stress_tarball.split('.tar.')[0]
     self.srcdir = os.path.join(self.srcdir, stress_version)
     os.chdir(self.srcdir)
     process.run('./configure')
     build.make(self.srcdir)
Exemple #42
0
    def setUp(self):
        '''
        Setup Flail
        '''
        smm = SoftwareManager()
        for package in ['gcc', 'make']:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel(package + ' is needed for the test to be run')
        self.fs_type = self.params.get('fstype', default='xfs')

        tarball = os.path.join(self.datadir, "flail-0.2.0.tar.gz")
        archive.extract(tarball, self.workdir)
        self.build_dir = os.path.join(self.workdir, 'flail-0.2.0')

        build.make(self.build_dir)
Exemple #43
0
 def setUp(self):
     """
     Build bonnie++
     Source:
      http://www.coker.com.au/bonnie++/experimental/bonnie++-1.96.tgz
     """
     bonnie_tarball = self.params.get('bonnie_tarball',
                                      default='bonnie++-1.96.tgz')
     tarball_path = self.get_data_path(bonnie_tarball)
     archive.extract(tarball_path, self.srcdir)
     bonnie_version = bonnie_tarball.split('.tgz')[0]
     self.srcdir = os.path.join(self.srcdir, bonnie_version)
     os.chdir(self.srcdir)
     process.run('./configure')
     build.make(self.srcdir)
Exemple #44
0
 def setUp(self):
     """
     Build the synctest suite.
     """
     self.cwd = os.getcwd()
     tarball_path = self.get_data_path(
         self.params.get('sync_tarball', '*', 'synctest.tar.bz2'))
     archive.extract(tarball_path, self.srcdir)
     self.srcdir = os.path.join(self.srcdir, 'synctest')
     if self.params.get('debug_symbols', default=True):
         build.make(self.srcdir,
                    env={'CFLAGS': '-g -O0'},
                    extra_args='synctest')
     else:
         build.make(self.srcdir)
Exemple #45
0
    def setUp(self):
        """
        fs_mark
        """

        tarball = self.fetch_asset('http://prdownloads.source'
                                   'forge.net/fsmark/fs_mark-3.3.tar.gz')
        archive.extract(tarball, self.srcdir)
        fs_version = os.path.basename(tarball.split('.tar.')[0])
        self.srcdir = os.path.join(self.srcdir, fs_version)
        os.chdir(self.srcdir)
        process.run('make')
        build.make(self.srcdir)
        self.disk = self.params.get('disk', default=None)
        self.fstype = self.params.get('fs', default='ext4')
Exemple #46
0
 def setUp(self):
     """
     Build 'stress'.
     Source:
      https://fossies.org/linux/privat/stress-1.0.4.tar.gz
     """
     tarball = self.fetch_asset(
         'https://fossies.org/linux/privat/stress-1.0.4.tar.gz',
         expire='7d')
     archive.extract(tarball, self.workdir)
     stress_version = os.path.basename(tarball.split('.tar.')[0])
     self.sourcedir = os.path.join(self.workdir, stress_version)
     os.chdir(self.sourcedir)
     process.run('./configure')
     build.make(self.sourcedir)
    def setUp(self):
        smm = SoftwareManager()
        self.memsize = int(
            self.params.get('memory_size',
                            default=(memory.meminfo.MemFree.m * 0.5)) *
            1048576)
        self.induce_err = self.params.get('induce_err', default=0)

        for package in ['gcc', 'make']:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel('%s is needed for the test to be run' % package)
        for file_name in ['memory_api.c', 'mremap.c', 'Makefile']:
            self.copyutil(file_name)

        build.make(self.teststmpdir)
    def setUp(self):
        '''
        Setup Flail
        '''
        smm = SoftwareManager()
        for package in ['gcc', 'make']:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel(package + ' is needed for the test to be run')
        self.fs_type = self.params.get('fstype', default='xfs')

        archive.extract(self.get_data("flail-0.2.0.tar.gz"), self.workdir)
        self.build_dir = os.path.join(self.workdir, 'flail-0.2.0')
        os.chdir(self.build_dir)
        process.system("sed -i 's/.*-lm.*/& -lm' Makefile")
        build.make(self.build_dir)
    def setUp(self):
        '''
        Build fsfuzzer
        Source:
        https://github.com/stevegrubb/fsfuzzer.git
        '''
        detected_distro = distro.detect()
        d_name = detected_distro.name.lower()

        smm = SoftwareManager()
        deps = ['gcc', 'patch', 'libtool', 'autoconf', 'automake', 'make']
        if d_name == 'ubuntu':
            deps.extend(['libattr1-dev'])
        else:
            deps.extend(['libattr-devel'])

        for package in deps:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel("Fail to install/check %s, which is needed for"
                            "fsfuzz to run" % package)

        locations = [
            "https://github.com/stevegrubb/fsfuzzer/archive/"
            "master.zip"
        ]
        tarball = self.fetch_asset("fsfuzzer.zip", locations=locations)
        archive.extract(tarball, self.srcdir)
        os.chdir(os.path.join(self.srcdir, "fsfuzzer-master"))

        if d_name == "ubuntu":
            # Patch for ubuntu
            fuzz_fix_patch = 'patch -p1 < %s' % (os.path.join(
                self.datadir, 'fsfuzz_fix.patch'))
            if process.system(fuzz_fix_patch, shell=True, ignore_status=True):
                self.log.warn("Unable to apply sh->bash patch!")

        process.run('./autogen.sh', shell=True)
        process.run('./configure', shell=True)

        build.make('.')

        self._args = self.params.get('fstype', default='')
        self._fsfuzz = os.path.abspath(os.path.join('.', "fsfuzz"))
        fs_sup = process.system_output('%s %s' % (self._fsfuzz, ' --help'))
        match = re.search(r'%s' % self._args, fs_sup, re.M | re.I)
        if not match:
            self.cancel('File system ' + self._args + ' is unsupported in ' +
                        detected_distro.name)
 def setUp(self):
     smm = SoftwareManager()
     detected_distro = distro.detect()
     # TODO: Add debs for Ubuntu.
     if detected_distro.name == "Ubuntu":
         self.cancel("Skip the test  for ubuntu as debs needs to be"
                     "added in packages")
     packages = [
         'make', 'gcc', 'systemtap', 'systemtap-runtime', 'elfutils',
         'kernel-devel', 'dejagnu'
     ]
     # 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
     if detected_distro.name in ["redhat", "rhel"]:
         packages.extend([
             'git', 'kernel-debug', 'kernel-debuginfo',
             'kernel-debug-debuginfo', 'elfutils-devel'
         ])
     if detected_distro.name == "SuSE":
         packages.extend([
             'git-core', 'kernel-default-devel', 'libebl1',
             'kernel-default-debuginfo', 'kernel-devel', 'kernel-macros',
             'libdw-devel', 'libebl-devel', 'libelf-devel'
         ])
     for package in packages:
         if not smm.check_installed(package) and not smm.install(package):
             self.cancel(' %s is needed for the test to be run' % package)
     git.get_repo('git://sourceware.org/git/systemtap.git',
                  destination_dir=self.workdir)
     os.chdir(self.workdir)
     process.run('./configure', ignore_status=True, sudo=True)
     build.make(self.workdir)
     build.make(self.workdir, extra_args='install')
     self.test_dir = os.path.join(self.workdir, "testsuite")
     os.chdir(self.test_dir)
     # Run a simple systemtap script to make sure systemtap and the
     # kernel debuginfo packages are correctly installed
     script_result = process.system(
         "PATH=%s/bin:$PATH stap -v /bin/true "
         "-e 'probe vfs.read { exit()"
         " }'",
         ignore_status=True,
         sudo=True,
         shell=True)
     if script_result != 0:
         self.cancel("simple systemtap test failed,"
                     "kernel debuginfo package may be missing")
Exemple #51
0
    def setUp(self):
        smm = SoftwareManager()
        detected_distro = distro.detect()
        self.stressors = self.params.get('stressors', default=None)
        self.ttimeout = self.params.get('ttimeout', default='300')
        self.workers = self.params.get(
            'workers', default=multiprocessing.cpu_count())
        self.class_type = self.params.get('class', default='all')
        self.verify = self.params.get('verify', default=True)
        self.syslog = self.params.get('syslog', default=True)
        self.metrics = self.params.get('metrics', default=True)
        self.maximize = self.params.get('maximize', default=True)
        self.times = self.params.get('times', default=True)
        self.aggressive = self.params.get('aggressive', default=True)
        self.exclude = self.params.get('exclude', default=None)
        self.v_stressors = self.params.get('v_stressors', default=None)
        self.parallel = self.params.get('parallel', default=True)

        deps = ['gcc', 'make']
        if 'Ubuntu' in detected_distro.name:
            deps.extend([
                'libaio-dev', 'libapparmor-dev', 'libattr1-dev', 'libbsd-dev',
                'libcap-dev', 'libgcrypt11-dev', 'libkeyutils-dev',
                'libsctp-dev', 'zlib1g-dev'])
        else:
            deps.extend(['libattr-devel', 'libbsd-devel', 'libcap-devel',
                         'libgcrypt-devel', 'keyutils-libs-devel',
                         'zlib-devel', 'libaio-devel'])
        for package in deps:
            if not smm.check_installed(package) and not smm.install(package):
                self.log.info(
                    '%s is needed, get the source and build', package)

        tarball = self.fetch_asset('stressng.zip',
                                   locations=['https://github.com/Colin'
                                              'IanKing/stress-ng/archive'
                                              '/master.zip'], expire='7d')
        archive.extract(tarball, self.workdir)
        sourcedir = os.path.join(self.workdir, 'stress-ng-master')
        os.chdir(sourcedir)
        result = build.run_make(sourcedir,
                                process_kwargs={'ignore_status': True})
        for line in str(result).splitlines():
            if 'error:' in line:
                self.cancel(
                    "Unsupported OS, Please check the build logs !!")
        build.make(sourcedir, extra_args='install')
        clear_dmesg()
    def setUp(self):
        '''
        Install the basic packages to support audit
        '''

        # Check for basic utilities
        smm = SoftwareManager()
        detected_distro = distro.detect()
        deps = ['gcc', 'make']
        if detected_distro.name in [
                'rhel', 'SuSE', 'fedora', 'centos', 'redhat'
        ]:
            deps.extend([
                "glibc", "glibc-devel", "libgcc", "perl", "perl-Test",
                "perl-Test-Harness", "perl-File-Which", "perl-Time-HiRes",
                "nmap-ncat"
            ])
        else:
            self.cancel("Install the package for audit supported\
                      by %s" % detected_distro.name)
        for package in deps:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel('%s is needed for the test to be run' % package)

        url = ("https://github.com/linux-audit/audit-testsuite/archive/"
               "refs/heads/main.zip")

        tarball = self.fetch_asset(url, expire='7d')
        archive.extract(tarball, self.workdir)
        self.sourcedir = os.path.join(self.workdir, 'audit-testsuite-main')
        os.chdir(self.sourcedir)
        if build.make(self.sourcedir) > 0:
            self.cancel("Building audit test suite failed")
 def build_perf_test(self):
     """
     Building the perf event test suite
     """
     self.sourcedir = os.path.join(self.workdir, 'perf_event_tests-master')
     if build.make(self.sourcedir, extra_args="-s -S") > 0:
         self.cancel("Building perf event test suite failed")
Exemple #54
0
 def setUp(self):
     """
     Build the synctest suite.
     """
     self.cwd = os.getcwd()
     sync_tarball = self.params.get("sync_tarball", "*", "synctest.tar.bz2")
     tarball_path = self.get_data(sync_tarball)
     if tarball_path is None:
         self.cancel(f"Test is missing data file {tarball_path}")
     archive.extract(tarball_path, self.workdir)
     srcdir = os.path.join(self.workdir, "synctest")
     os.chdir(srcdir)
     if self.params.get("debug_symbols", default=True):
         build.make(srcdir, env={"CFLAGS": "-g -O0"}, extra_args="synctest")
     else:
         build.make(srcdir)
    def setUp(self):

        # Check for basic utilities
        smm = SoftwareManager()

        for package in ("gcc", "make"):
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel("Fail to install %s required for this test." %
                            package)

        git.get_repo('git://git.code.sf.net/p/perfmon2/libpfm4',
                     destination_dir=self.workdir)

        os.chdir(self.workdir)

        build.make('.')
Exemple #56
0
 def setUp(self):
     sm = SoftwareManager()
     for package in ['gcc', 'make']:
         if not sm.check_installed(package) and not sm.install(package):
             self.cancel("Fail to install %s required for this test." %
                         package)
     gsl_version = self.params.get('gsl_version', default='2.2')
     tarball = self.fetch_asset("ftp://ftp.gnu.org/gnu/gsl/gsl-%s.tar.gz" %
                                gsl_version,
                                expire='10d')
     archive.extract(tarball, self.workdir)
     self.sourcedir = os.path.join(
         self.workdir, os.path.basename(tarball.split('.tar')[0]))
     os.chdir(self.sourcedir)
     process.run('./configure', ignore_status=True, sudo=True)
     build.make(self.sourcedir)
Exemple #57
0
    def build_module(self):
        """
        Building of the livepatching kernel module
        """
        self.log.info(
            "============== Building livepatching Module =================")
        self.sourcedir = tempfile.mkdtemp()
        os.chdir(self.sourcedir)

        self.location = ('https://raw.githubusercontent.com/torvalds/linux/'
                         'master/samples/livepatch/livepatch-sample.c')
        self.livepatch_file = self.fetch_asset(self.location, expire='7d')
        self.livepatch_dst = os.path.join(self.sourcedir, 'livepatch-sample.c')
        shutil.copy(self.livepatch_file, self.livepatch_dst)
        """
        Write module make file on the fly
        """
        makefile = open("Makefile", "w")
        makefile.write('obj-m := livepatch-sample.o\nKDIR '
                       ':= /lib/modules/$(shell uname -r)/build'
                       '\nPWD := $(shell pwd)\ndefault:\n\t'
                       '$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules\n')
        makefile.close()

        if build.make(self.sourcedir) >= 1:
            self.fail("Building livepatch-sample.ko failed")
        if not os.path.isfile('./livepatch-sample.ko'):
            self.fail("No livepatch-sample.ko found, module build failed")
Exemple #58
0
 def setUp(self):
     '''
     Install the basic packages to support libgcrypt
     '''
     # Check for basic utilities
     smm = SoftwareManager()
     detected_distro = distro.detect()
     deps = ['gcc', 'make']
     if detected_distro.name in ['rhel', 'SuSE', 'fedora', 'centos']:
         deps.extend([
             "autoconf", "automake", "libgpg-error-devel", "libgpg-error",
             "transfig"
         ])
     else:
         self.cancel("Unsupported distro %s for libgcrypt package" %
                     detected_distro.name)
     for package in deps:
         if not smm.check_installed(package) and not smm.install(package):
             self.cancel('%s is needed for the test to be run' % package)
     url = "https://dev.gnupg.org/source/libgcrypt.git"
     git.get_repo(url, destination_dir=self.workdir)
     os.chdir(self.workdir)
     process.run("./autogen.sh")
     process.run("./configure --enable-maintainer-mode")
     if build.make(self.workdir):
         # If the make fails then need to run make with -lpthread
         build.run_make(self.workdir,
                        extra_args="CFLAGS+=-lpthread",
                        process_kwargs={"ignore_status": True})
Exemple #59
0
 def test_cuda_uvm(self):
     '''
     GPU Unified tests
     '''
     self.log.info("test_cuda_uvm: GPU Unified tests")
 
     self.ld_path = "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:\
                     /usr/local/cuda/extras/CUPTI/lib64"
     test_dir = "/usr/local/cuda/extras/CUPTI/samples/unified_memory/"
     exp_cmd = "export %s" % self.ld_path
     process.system(exp_cmd, ignore_status=True, shell=True)
     build.make(test_dir)
     os.chdir(test_dir)
     uvm_cmd="/usr/local/cuda/extras/CUPTI/samples/unified_memory/unified_memory"
     output = process.system_output(uvm_cmd, ignore_status=True, shell=True)
     self.process_output(output)
Exemple #60
0
 def setUp(self):
     """
     Build the synctest suite.
     """
     self.cwd = os.getcwd()
     sync_tarball = self.params.get('sync_tarball', '*', 'synctest.tar.bz2')
     tarball_path = self.get_data(sync_tarball)
     if tarball_path is None:
         self.cancel('Test is missing data file %s' % tarball_path)
     archive.extract(tarball_path, self.workdir)
     srcdir = os.path.join(self.workdir, 'synctest')
     os.chdir(srcdir)
     if self.params.get('debug_symbols', default=True):
         build.make(srcdir, env={'CFLAGS': '-g -O0'}, extra_args='synctest')
     else:
         build.make(srcdir)