def setUp(self):
        """
        Setup checks :
        0. Processor should be ppc64.
        1. Perf package
        2. 24x7 is present
        3. Performance measurement is enabled in lpar through BMC
        """
        smm = SoftwareManager()
        detected_distro = distro.detect()
        if 'ppc' not in process.system_output("uname -p", ignore_status=True):
            self.cancel("Processor is not ppc64")
        deps = ['gcc', 'make']
        if 'Ubuntu' in detected_distro.name:
            deps.extend(['linux-tools-common', 'linux-tools-%s'
                         % platform.uname()[2]])
        elif detected_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)

        self.cpu_arch = cpu.get_cpu_arch().lower()
        self.perf_args = "perf stat -v -C 0 -e"
        if self.cpu_arch == 'power8':
            self.perf_stat = "%s hv_24x7/HPM_0THRD_NON_IDLE_CCYC" % self.perf_args
        if self.cpu_arch == 'power9':
            self.perf_stat = "%s hv_24x7/CPM_TLBIE" % self.perf_args
        self.event_sysfs = "/sys/bus/event_source/devices/hv_24x7"

        # Check if 24x7 is present
        if os.path.exists("%s" % self.event_sysfs):
            self.log.info('hv_24x7 present')
        else:
            self.cancel("%s doesn't exist.This feature is supported"
                        " only on LPAR" % self.event_sysfs)

        # Performance measurement has to be enabled in lpar through BMC
        # Check if its enabled
        result_perf = process.run("%s,domain=2,core=1/ sleep 1"
                                  % self.perf_stat, ignore_status=True)
        if "not supported" in result_perf.stderr:
            self.cancel("Please enable lpar to allow collecting"
                        " the 24x7 counters info")
Ejemplo n.º 2
0
    def setUp(self):
        """
        Setup and install dependencies for the test.
        """
        self.test_name = "udaddy"
        self.basic = self.params.get("basic_option", default="None")
        self.ext = self.params.get("ext_option", default="None")
        self.flag = self.params.get("ext_flag", default="0")
        if self.basic == "None" and self.ext == "None":
            self.skip("No option given")
        if self.flag == "1" and self.ext != "None":
            self.option = self.ext
        else:
            self.option = self.basic
        if process.system("ibstat", shell=True, ignore_status=True) != 0:
            self.skip("MOFED is not installed. Skipping")
        depends = ["openssh-clients", "iputils*"]
        smm = SoftwareManager()
        for package in depends:
            if not smm.check_installed(package):
                if not smm.install(package):
                    self.skip("Not able to install %s" % package)
        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.skip("%s interface is not available" % self.iface)
        if self.peer_ip == "":
            self.skip("%s peer machine is not available" % self.peer_ip)
        self.timeout = "2m"
        self.local_ip = netifaces.ifaddresses(self.iface)[AF_INET][0]['addr']

        detected_distro = distro.detect()
        if detected_distro.name == "Ubuntu":
            cmd = "service ufw stop"
        elif detected_distro.name in ['redhat', 'fedora']:
            cmd = "systemctl stop firewalld"
        elif detected_distro.name == "SuSE":
            cmd = "rcSuSEfirewall2 stop"
        elif detected_distro.name == "centos":
            cmd = "service iptables stop"
        else:
            self.skip("Distro not supported")
        if process.system("%s && ssh %s %s" % (cmd, self.peer_ip, cmd),
                          ignore_status=True,
                          shell=True) != 0:
            self.skip("Unable to disable firewall")
Ejemplo n.º 3
0
    def setUp(self):
        """
        Verify :
        1. It is Power system and platform is Power NV.
        2. Cpupower tool is installed.
        """

        if 'ppc' not in distro.detect().arch:
            self.cancel("Processor is not ppc64")
        if not os.path.exists('/sys/devices/system/cpu/cpu0/cpufreq'):
            self.cancel('CPUFREQ is supported only on Power NV')

        smm = SoftwareManager()
        detected_distro = distro.detect()
        if 'Ubuntu' in detected_distro.name:
            deps = [
                'linux-tools-common',
                'linux-tools-%s' % platform.uname()[2]
            ]
        elif detected_distro.name == "SuSE":
            deps = ['cpupower']
        else:
            deps = ['kernel-tools']
        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)

        fre_min = 0
        fre_max = 0
        freq_info = process.system_output("cpupower frequency-info",
                                          shell=True).decode("utf-8")
        for line in str(freq_info).splitlines():
            if re.search('hardware limits:', line, re.IGNORECASE):
                frq = line.split(":")[1]
                frq_init = frq.split('-')[0]
                frq_last = frq.split('-')[1]
                fre_min = float(frq_init.split('GHz')[0])
                fre_max = float(frq_last.split('GHz')[0])
                break
        threshold = (fre_max - fre_min) * (10**6)
        self.threshold = int(self.params.get("threshold", default=threshold))
        self.cpus = cpu.online_cpus_count()
        self.cpu_num = 0
        self.max_freq = 0
        self.quad_dict = {}
        self.max_freq_dict = {}
        self.quad_to_cpu_mapping()
Ejemplo n.º 4
0
 def setUp(self):
     """
     To check and install dependencies for the test
     """
     smm = SoftwareManager()
     detected_distro = distro.detect()
     pkgs = ['gcc']
     if detected_distro.name == "Ubuntu":
         pkgs.append('openssh-client')
     elif detected_distro.name == "SuSE":
         pkgs.append('openssh')
     else:
         pkgs.append('openssh-clients')
     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")
     self.timeout = self.params.get("timeout", default="600")
     self.netperf_run = self.params.get("NETSERVER_RUN", default="0")
     self.netperf = os.path.join(self.teststmpdir, 'netperf')
     netperf_download = self.params.get("netperf_download", default="ftp:"
                                        "//ftp.netperf.org/"
                                        "netperf/netperf-2.7.0.tar.bz2")
     tarball = self.fetch_asset(netperf_download, expire='7d')
     archive.extract(tarball, self.netperf)
     self.version = os.path.basename(tarball.split('.tar.')[0])
     self.neperf = os.path.join(self.netperf, self.version)
     cmd = "scp -r %s %s@%s:/tmp/" % (self.neperf, self.peer_user,
                                      self.peer_ip)
     if process.system(cmd, shell=True, ignore_status=True) != 0:
         self.cancel("unable to copy the netperf into peer machine")
     tmp = "cd /tmp/%s;./configure ppc64le;make" % self.version
     cmd = "ssh %s@%s \"%s\"" % (self.peer_user, self.peer_ip, tmp)
     if process.system(cmd, shell=True, ignore_status=True) != 0:
         self.fail("test failed because command failed in peer machine")
     os.chdir(self.neperf)
     process.system('./configure ppc64le', shell=True)
     build.make(self.neperf)
     self.perf = os.path.join(self.neperf, 'src', 'netperf')
     self.expected_tp = self.params.get("EXPECTED_THROUGHPUT", default="90")
Ejemplo n.º 5
0
    def setUp(self):
        """
        Sets up the args required to run the test.
        """

        smm = SoftwareManager()
        detected_distro = distro.detect()

        if detected_distro.name not in [
                'Ubuntu', 'rhel', 'SuSE', 'fedora', 'debian', 'centos'
        ]:
            self.cancel('Test Not applicable')

        if detected_distro.name in ["Ubuntu", 'debian']:
            deps = ['memcached', 'libmemcached-tools']
            stress_tool = 'memcslap'

        if detected_distro.name in ["rhel", "SuSE", "fedora", 'centos']:
            deps = ['memcached', 'libmemcached']
            stress_tool = 'memslap'

        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)

        # Memcached Required Args
        memory_to_use = self.params.get("memory_to_use",
                                        default=memory.meminfo.MemFree.m)
        port_no = self.params.get("port_no", default='12111')
        memcached_args = self.params.get('memcached_args', default='')
        self.memcached_cmd = 'memcached -u %s -p %s -m %d  %s &'\
                             % (getpass.getuser(), port_no, memory_to_use,
                                memcached_args)

        # Memcached stress tool required Args
        # For more options : memcslap --help
        system_ip = self.params.get('system_ip', default='127.0.0.1')
        test_to_run = self.params.get('test_to_run', default='get')
        concurrency = self.params.get('concurrency', default='100')
        stress_tool_args = self.params.get('stress_tool_args', default='')

        self.stress_tool_cmd = '%s -s %s:%s --test %s --verbose '\
                               '--concurrency %s %s' % (stress_tool,
                                                        system_ip, port_no,
                                                        test_to_run,
                                                        concurrency,
                                                        stress_tool_args)
Ejemplo n.º 6
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)

        if 'Ubuntu' in detected_distro.name:
            deps = [
                'libaio-dev', 'libapparmor-dev', 'libattr1-dev', 'libbsd-dev',
                'libcap-dev', 'libgcrypt11-dev', 'libkeyutils-dev',
                'libsctp-dev', 'zlib1g-dev']
        else:
            deps = ['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.srcdir)
        sourcedir = os.path.join(self.srcdir, '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()
Ejemplo n.º 7
0
    def setUp(self):
        """
        Resolve the packages dependencies and download the source.
        """
        smg = SoftwareManager()
        self.comp = self.params.get('comp', default='')
        if self.comp:
            self.comp = '-C %s' % self.comp
        detected_distro = distro.detect()
        deps = ['gcc', 'make', 'automake', 'autoconf']

        if 'Ubuntu' in detected_distro.name:
            deps.extend([
                'libpopt0', 'libc6', 'libc6-dev', 'libcap-dev', 'libpopt-dev',
                'libcap-ng0', 'libcap-ng-dev', 'libnuma-dev', 'libfuse-dev',
                'elfutils', 'libelf1'
            ])
        elif 'SuSE' in detected_distro.name:
            deps.extend([
                'popt', 'glibc', 'glibc-devel', 'popt-devel', 'libcap2',
                'libcap-devel', 'libcap-ng-devel'
            ])
        # 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 detected_distro.name in ['centos', 'fedora', 'rhel', 'redhat']:
            deps.extend([
                'popt', 'glibc', 'glibc-devel', 'glibc-static', 'libcap-ng',
                'libcap', 'libcap-devel', 'fuse-devel', 'libcap-ng-devel'
            ])

        for package in deps:
            if not smg.check_installed(package) and not smg.install(package):
                self.cancel("Fail to install %s required for this test." %
                            (package))

        location = ["https://github.com/torvalds/linux/archive/master.zip"]
        tarball = self.fetch_asset("kselftest.zip",
                                   locations=location,
                                   expire='1d')
        archive.extract(tarball, self.srcdir)
        self.buldir = os.path.join(self.srcdir, 'linux-master')
        self.sourcedir = os.path.join(self.buldir, self.testdir)
        result = build.run_make(self.sourcedir)
        for line in str(result).splitlines():
            if 'ERROR' in line:
                self.fail("Compilation failed, Please check the build logs !!")
Ejemplo n.º 8
0
 def setUp(self):
     sm = SoftwareManager()
     deps = ['gcc', 'make', 'gawk']
     self.build_dir = self.params.get('build_dir',
                                      default=data_dir.get_tmp_dir())
     for package in deps:
         if not sm.check_installed(package) and not sm.install(package):
             self.error(package + ' is needed for the test to be run')
     url = 'https://github.com/bminor/glibc/archive/master.zip'
     tarball = self.fetch_asset("glibc.zip", locations=[url], expire='7d')
     archive.extract(tarball, self.srcdir)
     glibc_dir = os.path.join(self.srcdir, "glibc-master")
     os.chdir(self.build_dir)
     process.run(glibc_dir + '/configure --prefix=%s' % self.build_dir,
                 ignore_status=True,
                 sudo=True)
     build.make(self.build_dir)
Ejemplo n.º 9
0
    def setUp(self):
        sm = SoftwareManager()

        dist = distro.detect()
        packages = ['lshw', 'net-tools', 'pciutils']
        if dist.name == "SuSE" and dist.version < 15:
            self.cancel("lshw not supported on SUES-%s. Please run " +
                        "on SLES15 or higher versions only " % dist.version)
        if dist.name == 'Ubuntu' and dist.version.version >= 18:
            packages.extend(['iproute2'])
        else:
            packages.extend(['iproute'])

        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)
Ejemplo n.º 10
0
    def setUp(self):
        smg = SoftwareManager()
        dist = distro.detect()
        if dist.name in ['Ubuntu', 'debian']:
            linux_tools = "linux-tools-" + os.uname()[2][3]
            pkgs = [linux_tools]
            if dist.name in ['Ubuntu']:
                pkgs.extend(['linux-tools-common'])
        elif dist.name in ['centos', 'fedora', 'rhel', 'SuSE']:
            pkgs = ['perf']
        else:
            self.cancel("perf is not supported on %s" % dist.name)

        for pkg in pkgs:
            if not smg.check_installed(pkg) and not smg.install(pkg):
                self.cancel("Package %s is missing/could not be installed" %
                            pkg)
Ejemplo n.º 11
0
 def setUp(self):
     # 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 distro.detect().name in ['rhel', 'redhat']:
         self.cancel('Hwinfo not supported on RHEL')
     sm = SoftwareManager()
     if not sm.check_installed("hwinfo") and not sm.install("hwinfo"):
         self.cancel("Fail to install hwinfo required for this test.")
     self.clear_dmesg()
     self.disk_name = process.system_output("df -h | egrep '(s|v)d[a-z][1-8]' | "
                                            "tail -1 | cut -d' ' -f1",
                                            shell=True).decode("utf-8").strip("12345")
     self.Unique_Id = process.system_output("hwinfo --disk --only %s | "
                                            "grep 'Unique' | head -1 | "
                                            "cut -d':' -f2" % self.disk_name,
                                            shell=True).decode("utf-8")
Ejemplo n.º 12
0
    def setUp(self):
        """
        Install all the dependency packages required for building
        source tarball specific to os,if not tests will stop.
        """
        smm = SoftwareManager()
        dist = distro.detect()
        packages = ['gcc', 'dejagnu', 'flex', 'bison', 'sharutils']

        if dist.name == 'Ubuntu':
            packages.extend([
                'libmpfr-dev', 'libgmp-dev', 'libmpc-dev', 'texinfo', 'zip',
                'libc6-dev', 'libelf1', 'elfutils', 'gnat', 'autogen'
            ])
        elif dist.name == 'SuSE':
            packages.extend([
                'glibc-devel-static', 'zlib-devel', 'elfutils', 'libelf-devel',
                'gcc-c++', 'isl-devel', 'gmp-devel', 'glibc-devel',
                'mpfr-devel', 'makeinfo', 'texinfo', 'mpc-devel'
            ])
        else:
            packages.extend([
                'glibc-static', 'autogen', 'guile', 'guile-devel', 'libgo',
                'libgo-devel', 'libgo-static', 'elfutils-devel', 'texinfo-tex',
                'texinfo', 'elfutils-libelf-devel', 'gmp-devel', 'mpfr-devel',
                'libmpc-devel', 'gcc-gnat', 'libgnat', 'zlib-devel', 'gettext',
                'libgcc', 'libgomp'
            ])

        for package in packages:
            if not smm.check_installed(package) and not smm.install(package):
                self.skip("Failed to install %s required for this test." %
                          package)
        tarball = self.fetch_asset(
            'gcc.zip',
            locations=[
                'https://github.com/gcc-mirror/gcc/archive'
                '/master.zip'
            ],
            expire='7d')
        archive.extract(tarball, self.srcdir)
        self.srcdir = os.path.join(self.srcdir, 'gcc-master')

        os.chdir(self.srcdir)
        process.run('./configure', ignore_status=True, sudo=True)
        build.make(self.srcdir, ignore_status=True)
Ejemplo n.º 13
0
    def setUp(self):
        '''
        Setup Blktests
        '''
        smm = SoftwareManager()
        for package in ['gcc', 'make', 'util-linux', 'fio', 'device-mapper', 'gcc-c++']:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel(package + ' is needed for the test to be run')

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

        build.make(self.sourcedir)
Ejemplo n.º 14
0
 def setUp(self):
     """
     Setup the system for test.
     """
     self.enable_prob = "1"
     self.disable_prob = "0"
     dist = distro.detect()
     smg = SoftwareManager()
     if dist.name in ["Ubuntu", "unknown", 'debian']:
         deps = ['libc-bin']
     elif 'SuSE' in dist.name:
         deps = ['glibc-devel']
     else:
         deps = ['glibc-common']
     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)
Ejemplo n.º 15
0
 def setUp(self):
     """
     Verifies if we have list of packages installed on OS
     and also skips the test if user gives the current OS boot disk as
     disk input it may erase the data
     :param disk: test disk where the disk operations can be done
     :param fs: type of filesystem to create
     :param dir: path of the directory to mount the disk device
     """
     smm = SoftwareManager()
     pkg = ""
     if 'ppc' not in platform.processor():
         self.cancel("Processor is not ppc64")
     self.disk = self.params.get('disk', default=None)
     self.dirs = self.params.get('dir', default=self.workdir)
     self.fstype = self.params.get('fs', default='ext4')
     self.log.info("disk: %s, dir: %s, fstype: %s", self.disk, self.dirs,
                   self.fstype)
     if not self.disk:
         self.cancel("No disk input, please update yaml and re-run")
     cmd = "df --output=source"
     if self.disk in process.system_output(cmd, ignore_status=True) \
             .decode("utf-8"):
         self.cancel("Given disk is os boot disk,"
                     "it will be harmful to run this test")
     pkg_list = ["lshw"]
     self.distro = distro.detect().name
     if self.distro == 'Ubuntu':
         pkg_list.append("hwinfo")
     if self.fstype == 'ext4':
         pkg_list.append('e2fsprogs')
     if self.fstype == 'xfs':
         pkg_list.append('xfsprogs')
     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 self.distro == 'Ubuntu':
             pkg_list.append("btrfs-tools")
     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)
 def setUp(self):
     '''
     set up required packages and gather necessary test inputs
     '''
     smm = SoftwareManager()
     packages = [
         'src', 'rsct.basic', 'rsct.core.utils', 'rsct.core', 'DynamicRM',
         'powerpc-utils'
     ]
     for pkg in packages:
         if not smm.check_installed(pkg) and not smm.install(pkg):
             self.cancel('%s is needed for the test to be run' % pkg)
     self.hmc_ip = self.get_mcp_component("HMCIPAddr")
     if not self.hmc_ip:
         self.cancel("HMC IP not got")
     self.hmc_pwd = self.params.get("hmc_pwd", '*', default=None)
     self.hmc_username = self.params.get("hmc_username", '*', default=None)
     self.lpar = self.get_partition_name("Partition Name")
     if not self.lpar:
         self.cancel("LPAR Name not got from lparstat command")
     self.session = Session(self.hmc_ip,
                            user=self.hmc_username,
                            password=self.hmc_pwd)
     if not self.session.connect():
         self.cancel("failed connetion to HMC")
     cmd = 'lssyscfg -r sys  -F name'
     output = self.session.cmd(cmd)
     self.server = ''
     for line in output.stdout_text.splitlines():
         if line in self.lpar:
             self.server = line
             break
     if not self.server:
         self.cancel("Managed System not got")
     self.sriov_adapter = self.params.get('sriov_adapter',
                                          '*',
                                          default=None).split(' ')
     self.sriov_port = self.params.get('sriov_port', '*',
                                       default=None).split(' ')
     self.ipaddr = self.params.get('ipaddr', '*', default="").split(' ')
     self.netmask = self.params.get('netmasks', '*', default="").split(' ')
     self.peer_ip = self.params.get('peer_ip', '*', default="").split(' ')
     self.mac_id = self.params.get('mac_id',
                                   default="02:03:03:03:03:01").split(' ')
     self.mac_id = [mac.replace(':', '') for mac in self.mac_id]
     self.local = LocalHost()
 def setUp(self):
     '''
     To check and install dependencies for the test
     '''
     self.peer = self.params.get("peer_ip", default="")
     self.user = self.params.get("user_name", default="root")
     self.peer_password = self.params.get("peer_password",
                                          '*',
                                          default="None")
     interfaces = netifaces.interfaces()
     self.iface = self.params.get("interface", default="")
     if self.iface not in interfaces:
         self.cancel("%s interface is not available" % self.iface)
     self.ipaddr = self.params.get("host_ip", default="")
     self.netmask = self.params.get("netmask", default="")
     configure_network.set_ip(self.ipaddr, self.netmask, self.iface)
     self.session = Session(self.peer,
                            user=self.user,
                            password=self.peer_password)
     self.count = self.params.get("count", default="500000")
     smm = SoftwareManager()
     pkgs = ["net-tools"]
     detected_distro = distro.detect()
     if detected_distro.name == "Ubuntu":
         pkgs.extend(["openssh-client", "iputils-ping"])
     elif detected_distro.name == "SuSE":
         pkgs.extend(["openssh", "iputils"])
     else:
         pkgs.extend(["openssh-clients", "iputils"])
     for pkg in pkgs:
         if not smm.check_installed(pkg) and not smm.install(pkg):
             self.cancel("%s package is need to test" % pkg)
     if self.peer == "":
         self.cancel("peer ip should specify in input")
     cmd = "ip addr show  | grep %s" % self.peer
     output = self.session.cmd(cmd)
     result = ""
     result = result.join(output.stdout.decode("utf-8"))
     self.peerif = result.split()[-1]
     if self.peerif == "":
         self.cancel("unable to get peer interface")
     cmd = "ip -f inet -o addr show %s | awk '{print $4}' | cut -d / -f1"\
           % self.iface
     self.local_ip = process.system_output(cmd, shell=True).strip()
     if self.local_ip == "":
         self.cancel("unable to get local ip")
Ejemplo n.º 18
0
 def setUp(self):
     dist = distro.detect()
     sm = SoftwareManager()
     sos_pkg = ""
     if not process.system("sosreport", ignore_status=True, sudo=True):
         self.log.info("sosreport is installed")
     elif dist.name == 'Ubuntu':
         sos_pkg = 'sosreport'
     # 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 ['rhel', 'redhat']:
         sos_pkg = 'sos'
     else:
         self.skip("sosreport is not supported on this distro ")
     if sos_pkg and not sm.check_installed(sos_pkg) and not sm.install(sos_pkg):
         self.skip("Package %s is missing and could not be installed" % sos_pkg)
Ejemplo n.º 19
0
    def setUp(self):
        '''
        Install the basic packages to support perf
        '''

        # Check for basic utilities
        smm = SoftwareManager()
        detected_distro = distro.detect()
        distro_name = detected_distro.name

        if detected_distro.arch != 'ppc64le':
            self.cancel('This test is not supported on %s architecture' %
                        detected_distro.arch)

        if cpu.get_family() == 'power8':
            self.cancel('This test not applies to Power8')

        if 'PowerNV' not in genio.read_file('/proc/cpuinfo').rstrip(
                '\t\r\n\0'):
            self.cancel('This test applies only to PowerNV')

        deps = ['gcc', 'make']
        if 'Ubuntu' in distro_name:
            deps.extend(
                ['linux-tools-common',
                 'linux-tools-%s' % platform.uname()[2]])
        elif 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)

        # Collect nest events
        self.list_of_nest_events = []
        for line in process.get_command_output_matching('perf list', 'nest_'):
            line = line.split(' ')[2]
            if 'pm_nest' in line:
                continue
            self.list_of_nest_events.append(line)

        # Clear the dmesg, by that we can capture the delta at the end of the
        # test.
        process.run("dmesg -c", sudo=True)
Ejemplo n.º 20
0
    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.dirs = self.params.get('dir', default=self.workdir)
        self.fstype = self.params.get('fs', default='ext4')

        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 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.dirs)
            self.log.info("Test will run on %s", self.dirs)
            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.dirs)
            try:
                self.part_obj.mount()
            except PartitionError:
                self.fail("Mounting disk %s on directory %s failed" %
                          (self.disk, self.dirs))
            self.link = "/tmp/link"
            os.symlink(self.dirs, self.link)
Ejemplo n.º 21
0
    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']
        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.skip('File system ' + self._args +
                      ' is unsupported in ' + detected_distro.name)
Ejemplo n.º 22
0
    def setUp(self):
        """
        Build binary and filter tests based on the environment
        """
        smm = SoftwareManager()
        deps = ['gcc', 'make', 'patch']
        detected_distro = distro.detect()
        skip_offline = self.params.get("skip_softoffline", default=True)
        if detected_distro.name in ["Ubuntu", 'debian']:
            deps.extend(['libpthread-stubs0-dev', 'git'])
        elif detected_distro.name == "SuSE":
            deps.extend(['glibc-devel-static', 'git-core'])
        else:
            deps.extend(['glibc-static', 'git', 'runc'])
        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)
        git.get_repo("https://gitlab.com/harish-24/linux-mm",
                     destination_dir=self.logdir)
        os.chdir(self.logdir)
        build.make(self.logdir)
        tst_list = process.system_output('./random -l').decode().splitlines()
        self.test_dic = {}
        for line in tst_list:
            keyval = line.split(":")
            self.test_dic[keyval[0]] = keyval[1]
        skip_numa = False
        if len(memory.numa_nodes_with_memory()) < 2:
            skip_numa = True
        rm_list = []
        for key, val in self.test_dic.items():
            if skip_numa:
                if 'NUMA' in val or 'migrate' in val:
                    if key not in rm_list:
                        rm_list.append(key)
            if skip_offline:
                if 'soft offlin' in val:
                    if key not in rm_list:
                        rm_list.append(key)
            if detected_distro.name == "SuSE":
                if 'runc' in val:
                    if key not in rm_list:
                        rm_list.append(key)

        for item in rm_list:
            self.test_dic.pop(item)
Ejemplo n.º 23
0
 def setUp(self):
     '''
     Install the basic packages to support PAM
     '''
     # Check for basic utilities
     smm = SoftwareManager()
     deps = ['gcc', 'make', 'autoconf']
     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-pam/linux-pam/archive/master.zip"
     tarball = self.fetch_asset(url, expire='7d')
     archive.extract(tarball, self.workdir)
     self.sourcedir = os.path.join(self.workdir, 'linux-pam-master')
     os.chdir(self.sourcedir)
     process.run('./autogen.sh', ignore_status=True)
     process.run('./configure', ignore_status=True)
Ejemplo n.º 24
0
    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)

        pkg_list = ['libaio', 'libaio-devel']
        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 == 'Ubuntu':
                pkg_list.append('btrfs-tools')

        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'
Ejemplo n.º 25
0
 def setUp(self):
     sm = SoftwareManager()
     deps = ['gcc', 'make', 'automake', 'autoconf']
     for package in deps:
         if not sm.check_installed(package) and not sm.install(package):
             self.error(package + ' is needed for the test to be run')
     url = "https://github.com/linux-test-project/ltp/archive/master.zip"
     tarball = self.fetch_asset("ltp-master.zip", locations=[url])
     archive.extract(tarball, self.srcdir)
     ltp_dir = os.path.join(self.srcdir, "ltp-master")
     os.chdir(ltp_dir)
     build.make(ltp_dir, extra_args='autotools')
     ltpbin_dir = os.path.join(ltp_dir, 'bin')
     os.mkdir(ltpbin_dir)
     process.system('./configure --prefix=%s' % ltpbin_dir)
     build.make(ltp_dir)
     build.make(ltp_dir, extra_args='install')
 def setUp(self):
     '''
     To check and install dependencies for the test
     '''
     smm = SoftwareManager()
     pkgs = ["ethtool", "net-tools"]
     detected_distro = distro.detect()
     if detected_distro.name == "Ubuntu":
         pkgs.extend(["iputils-ping"])
     elif detected_distro.name == "SuSE":
         pkgs.extend(["iputils"])
     else:
         pkgs.extend(["iputils"])
     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()
     interface = self.params.get("interface")
     if interface not in interfaces:
         self.cancel("%s interface is not available" % interface)
     self.iface = interface
     self.ipaddr = self.params.get("host_ip", default="")
     self.netmask = self.params.get("netmask", default="")
     self.peer = self.params.get("peer_ip")
     if not self.peer:
         self.cancel("No peer provided")
     if self.iface[0:2] == 'ib':
         configure_network.set_ip(self.ipaddr, self.netmask, self.iface,
                                  interface_type='Infiniband')
     else:
         configure_network.set_ip(self.ipaddr, self.netmask, self.iface,
                                  interface_type='Ethernet')
     if not wait.wait_for(configure_network.is_interface_link_up,
                          timeout=120, args=[self.iface]):
         self.cancel("Link up of interface is taking longer than 120s")
     if not configure_network.ping_check(self.iface, self.peer, "5"):
         self.cancel("No connection to peer")
     self.args = self.params.get("arg", default='')
     self.elapse = self.params.get("action_elapse", default='')
     self.priv_test = self.params.get("privflag_test", default=False)
     if self.priv_test:
         cmd = "ethtool --show-priv-flags %s" % (self.iface)
         self.ret_val = process.run(cmd, shell=True, verbose=True,
                                    ignore_status=True)
         if self.ret_val.exit_status:
             self.cancel("Device Doesn't support Private flags")
Ejemplo n.º 27
0
    def setUp(self):
        """
        Build strace

        Source:
        http://github.com/strace/strace.git
        """
        smm = SoftwareManager()
        for package in ['make', 'gcc', 'autoconf', 'automake']:
            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('https://github.com/strace/strace.git',
                     destination_dir=self.workdir)
        os.chdir(self.workdir)
        process.run('./bootstrap', ignore_status=True, sudo=True)
        process.run('./configure', ignore_status=True, sudo=True)
        build.make(self.workdir)
Ejemplo n.º 28
0
    def setUp(self):
        """
        Build coremark
        """
        smm = SoftwareManager()
        if not smm.check_installed("gcc") and not smm.install("gcc"):
            self.error("Gcc is needed for the test to be run")

        data_dir = os.path.abspath(self.datadir)
        self.srcdir = os.path.join(data_dir, 'source_code')

        os.chdir(self.srcdir)

        d_distro = distro.detect()
        arch = d_distro.arch
        if arch == 'aarch32':
            build.make(
                self.srcdir,
                extra_args=
                'PORT_DIR=linux CC=gcc \'XCFLAGS=-mfloat-abi=hard -mfpu=vfpv4 -mcpu=cortex-a15\' compile'
            )
        elif arch == 'aarch64':
            build.make(self.srcdir,
                       extra_args='PORT_DIR=linux64 CC=gcc compile')
        elif arch == 'x86_64':
            build.make(
                self.srcdir,
                extra_args='PORT_DIR=linux64 CC=gcc \'XCFLAGS=-msse4\' compile'
            )
        else:
            build.make(self.srcdir, extra_args='linux')

        exec_path = os.path.join(self.srcdir, 'bin')
        if not os.path.exists(exec_path):
            try:
                os.mkdir(exec_path)
            except:
                print "Failed to create bin folder"
                return -1

        process.run('cp coremark.exe ./bin/coremark')
        if arch == 'x86_64' or arch == 'aarch64':
            process.run('make PORT_DIR=linux64 CC=gcc clean')
        else:
            process.run('make PORT_DIR=linux CC=gcc clean')
 def setUp(self):
     """
     Identify the network virtualized device.
     """
     smm = SoftwareManager()
     for pkg in ["net-tools"]:
         if not smm.check_installed(pkg) and not smm.install(pkg):
             self.cancel("%s package is need to test" % pkg)
     interfaces = netifaces.interfaces()
     self.interface = self.params.get('interface')
     if self.interface not in interfaces:
         self.cancel("%s interface is not available" % self.interface)
     self.device = process.system_output("ls -l /sys/class/net/ | \
                                          grep %s | cut -d '/' -f \
                                          5" % self.interface,
                                         shell=True).strip()
     self.count = int(self.params.get('count', default="1"))
     self.peer_ip = self.params.get('peer_ip', default=None)
Ejemplo n.º 30
0
    def setUp(self):
        smm = SoftwareManager()
        memsize = int(memory.meminfo.MemFree.b * 0.1)
        self.nr_pages = self.params.get('nr_pages', default=None)
        self.offline = self.params.get('offline', default='s')
        self.touch = self.params.get('touch', default=True)

        if not self.nr_pages:
            self.nr_pages = int(memsize / memory.get_page_size())

        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 ['ksm_poison.c', 'Makefile']:
            self.copyutil(file_name)

        build.make(self.teststmpdir)