def setUp(self): smm = SoftwareManager() self.failures = [] dist = distro.detect() deps = ['gcc', 'make'] if dist.name in ['Ubuntu', 'debian']: deps.extend(['g++']) # 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', 'centos', 'redhat']: deps.extend(['gcc-c++']) 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) run_type = self.params.get('type', default='upstream') if run_type == "upstream": url = "ftp://sourceware.org/pub/valgrind/" version = self.params.get('version', default="3.18.1") url = '%s/valgrind-%s.tar.bz2' % (url, version) tarball = self.fetch_asset(url) archive.extract(tarball, self.workdir) version = os.path.basename(tarball.split('.tar.')[0]) self.sourcedir = os.path.join(self.workdir, version) elif run_type == "distro": self.sourcedir = os.path.join(self.workdir, 'valgrind-distro') if not os.path.exists(self.sourcedir): os.makedirs(self.sourcedir) self.sourcedir = smm.get_source('valgrind', self.sourcedir) os.chdir(self.sourcedir) process.run('./configure', ignore_status=True, sudo=True)
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.cancel('%s is needed for the test to be run' % package) run_type = self.params.get('type', default='upstream') if run_type == "upstream": url = 'https://github.com/bminor/glibc/archive/master.zip' tarball = self.fetch_asset("glibc.zip", locations=[url], expire='7d') archive.extract(tarball, self.workdir) glibc_dir = os.path.join(self.workdir, "glibc-master") elif run_type == "distro": glibc_dir = os.path.join(self.workdir, "glibc-distro") if not os.path.exists(glibc_dir): os.makedirs(glibc_dir) glibc_dir = sm.get_source("glibc", glibc_dir) os.chdir(self.build_dir) process.run('%s/configure --prefix=%s' % (glibc_dir, self.params.get("prefix", default="/usr")), ignore_status=True, sudo=True) build.make(self.build_dir)
def setUp(self): """ Build 'aiostress'. Source: https://oss.oracle.com/~mason/aio-stress/aio-stress.c """ smm = SoftwareManager() packages = [] dist_name = distro.detect().name.lower() if dist_name == 'ubuntu': packages.extend(['libaio1', 'libaio-dev']) elif dist_name in ['centos', 'fedora', 'rhel']: packages.extend(['libaio', 'libaio-devel']) elif dist_name == 'suse': packages.extend(['libaio1', 'libaio-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) aiostress = self.fetch_asset( 'https://oss.oracle.com/~mason/aio-stress/aio-stress.c') os.chdir(self.workdir) # This requires libaio.h in order to build # -laio -lpthread is provided at end as a workaround for Ubuntu process.run('gcc -Wall -o aio-stress %s -laio -lpthread' % aiostress)
def setUp(self): ''' Setup Blktests ''' self.disk = self.params.get('disk', default='') self.dev_type = self.params.get('type', default='') smm = SoftwareManager() dist = distro.detect() if dist.name in ['Ubuntu', 'debian']: packages = [ 'gcc', 'make', 'util-linux', 'fio', 'libdevmapper-dev', 'g++' ] else: packages = [ 'gcc', 'make', 'util-linux', 'fio', 'device-mapper', 'gcc-c++' ] for package in packages: 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)
def setUp(self): ''' Build Rmaptest Source: https://www.kernel.org/pub/linux/kernel/people/mbligh/tools/rmap-test.c ''' # Check for basic utilities smm = SoftwareManager() if not smm.check_installed("gcc") and not smm.install("gcc"): self.cancel('Gcc is needed for the test to be run') rmaptest = self.fetch_asset( 'https://www.kernel.org/pub/' 'linux/kernel/people/mbligh/' 'tools/rmap-test.c', expire='7d') shutil.copyfile(rmaptest, os.path.join(self.workdir, 'rmap-test.c')) os.chdir(self.workdir) if 'CC' in os.environ: cc = '$CC' else: cc = 'cc' process.system('%s -Wall -o rmaptest rmap-test.c' % cc, ignore_status=True)
def setUp(self): """ Setting up the env for the kernel building """ smg = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make', 'automake', 'autoconf', 'time', 'bison', 'flex'] if detected_distro.name in ['Ubuntu', 'debian']: linux_headers = 'linux-headers-%s' % os.uname()[2] deps.extend([ 'libpopt0', 'libc6', 'libc6-dev', 'libpopt-dev', 'libcap-ng0', 'libcap-ng-dev', 'elfutils', 'libelf1', 'libnuma-dev', 'libfuse-dev', 'libssl-dev', linux_headers ]) elif 'SuSE' in detected_distro.name: deps.extend([ 'libpopt0', 'glibc', 'glibc-devel', 'popt-devel', 'libcap2', 'libcap-devel', 'kernel-syms', 'libcap-ng-devel', 'openssl-devel', 'kernel-source' ]) elif detected_distro.name in ['centos', 'fedora', 'rhel']: deps.extend([ 'popt', 'glibc', 'glibc-devel', 'libcap-ng', 'libcap', 'libcap-devel', 'elfutils-libelf', 'elfutils-libelf-devel', 'openssl-devel', 'kernel-devel', 'kernel-headers' ]) 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)
def _run_software_manager(self, cmd, package, queue): software_manager = SoftwareManager() if not software_manager.is_capable(): output = { "result": "error", "stdout": "", "stderr": ("Package manager not supported or not" " available."), } queue.put(output) if cmd == "install": result, stdout, stderr = self._install(software_manager, cmd, package) elif cmd == "remove": result, stdout, stderr = self._remove(software_manager, cmd, package) elif cmd == "check": result, stdout, stderr = self._check(software_manager, package) output = {"result": result, "stdout": stdout, "stderr": stderr} queue.put(output)
def setUp(self): ''' Build Ioping Test ''' # Check for basic utilities smm = SoftwareManager() self.count = self.params.get('count', default='8') 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("ioping.zip", locations="https://github.com/" "koct9i/ioping/archive/master.zip", expire='1d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join(self.workdir, 'ioping-master') build.make(self.sourcedir)
def setUp(self): softm = SoftwareManager() for package in ['gcc', 'make']: if not softm.check_installed(package) and not softm.install( package): self.cancel("%s is needed for the test to be run" % package) test_type = self.params.get('type', default='upstream') if test_type == 'upstream': papi_url = self.params.get( 'url', default="https://bitbucket.org/icl/papi.git") git.get_repo(papi_url, destination_dir=self.teststmpdir) self.path = os.path.join(self.teststmpdir, 'src') elif test_type == 'distro': sourcedir = os.path.join(self.teststmpdir, 'papi-distro') if not os.path.exists(sourcedir): os.makedirs(sourcedir) self.path = softm.get_source("papi", sourcedir) self.path = os.path.join(self.path, 'src') os.chdir(self.path) process.run('./configure', shell=True) build.make(self.path)
def setUp(self): """ Install pre-requisite packages """ smg = SoftwareManager() self.dist = distro.detect() if self.dist.name not in ['rhel', 'SuSE']: self.cancel('Unsupported OS %s' % self.dist.name) deps = ['gcc', 'make', 'glibc-static', 'zlib', 'zlib-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)) self.url = self.params.get( 'url', default="https://github.com/libnxz/power-gzip") self.branch = self.params.get('git_branch', default='master') git.get_repo(self.url, branch=self.branch, destination_dir=self.teststmpdir) if self.branch == 'develop': process.run('./configure', sudo=True, shell=True) os.chdir(self.teststmpdir) build.make(self.teststmpdir)
def setUp(self): ''' Function for preliminary set-up to execute the test ''' self.err_paths = [] self.device_list = [] smm = SoftwareManager() for pkg in ["lsscsi", "pciutils"]: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s is not installed" % pkg) self.wwids = self.params.get('wwids', default='') self.pci_device = self.params.get("pci_devices", default='') self.count = int(self.params.get("count", default=1)) system_pci_adress = pci.get_pci_addresses() system_wwids = multipath.get_multipath_wwids() if self.wwids: self.wwids = self.wwids.split(' ') for wwid in self.wwids: if wwid not in system_wwids: self.cancel("%s not present in the system", wwid) for path in multipath.get_paths(wwid): self.device_list.append(path) elif self.pci_device: self.pci_device = self.pci_device.split(' ') for pci_id in self.pci_device: if pci_id not in system_pci_adress: self.cancel("%s not present in the system", pci_id) cmd = "ls -l /dev/disk/by-path/" output = process.system_output(cmd).decode('utf-8') for line in output.splitlines(): if pci_id in line and 'part' not in line: self.device_list.append(line.split('/')[-1]) else: self.cancel("please provide pci adrees or wwids of scsi disk")
def setUp(self): """ Checking if the required packages are installed, if not found packages will be installed. """ smm = SoftwareManager() if not smm.check_installed("mdadm"): self.log.info("Mdadm must be installed before continuing the test") if SoftwareManager().install("mdadm") is False: self.cancel("Unable to install mdadm") disks = self.params.get('disks', default='').strip(" ") if not disks: self.cancel('No disks given') required_disks = self.params.get('required_disks', default=1) disks = disks.split() raidlevel = str(self.params.get('raid', default='0')) if len(disks) < required_disks: self.cancel("Minimum %d disks required for %s" % (required_disks, raidlevel)) spare_disks = self.params.get('spare_disks', default='').strip(" ") if spare_disks: spare_disks = spare_disks.split() raid = self.params.get('raidname', default='/dev/md/mdsraid') metadata = str(self.params.get('metadata', default='1.2')) self.remove_add_disk = '' if raidlevel not in ['0', 'linear']: self.remove_add_disk = disks[-1] self.sraid = softwareraid.SoftwareRaid(raid, raidlevel, disks, metadata, spare_disks)
def setUp(self): """ Verifies if powerpc-utils is installed, and gets current SMT value. """ if 'ppc' not in distro.detect().arch: self.cancel("Processor is not ppc64") if SoftwareManager().check_installed("powerpc-utils") is False: if SoftwareManager().install("powerpc-utils") is False: self.cancel("powerpc-utils is not installing") self.loop = int(self.params.get('test_loop', default=100)) self.smt_str = "ppc64_cpu --smt" # Dynamically set max SMT specified at boot time process.system("%s=on" % self.smt_str, shell=True) # and get its value smt_op = process.system_output(self.smt_str, shell=True).decode() if "is not SMT capable" in smt_op: self.cancel("Machine is not SMT capable") if "Inconsistent state" in smt_op: self.cancel("Machine has mix of ST and SMT cores") self.curr_smt = smt_op.strip().split("=")[-1].split()[-1] self.smt_subcores = 0 if os.path.exists("/sys/devices/system/cpu/subcores_per_core"): self.smt_subcores = 1 self.failures = 0 self.failure_message = "\n" self.smt_values = {1: "off"} self.key = 0 self.value = "" self.max_smt_value = int(self.curr_smt)
def setUp(self): if not memory.check_hotplug(): self.cancel("UnSupported : memory hotplug not enabled\n") smm = SoftwareManager() if not smm.check_installed('stress') and not smm.install('stress'): tarball = self.fetch_asset( 'https://fossies.org/linux/privat/old/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()
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 if detected_distro.arch != 'ppc64le': self.cancel('This test is not supported on %s architecture' % detected_distro.arch) 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', 'kernel-devel']) 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) archive.extract(self.get_data("wptest-master.tar.gz"), self.workdir) self.build_dir = os.path.join(self.workdir, 'wptest-master') build.make(self.build_dir) os.chdir(self.build_dir) process.run("insmod wptest.ko") if not os.path.exists('wptest.ko'): self.fail("module is not inserted")
def setUp(self): """ Install necessary packages to build the linux module """ if 'power' not in cpu.get_family(): self.cancel('Test Only supported on Power') pkgs = ['gcc', 'make', 'kernel-devel'] smm = SoftwareManager() 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) tarball = self.fetch_asset("ipistorm.zip", locations=[ "https://github.com/antonblanchard/ipistorm" "/archive/master.zip"], expire='7d') archive.extract(tarball, self.teststmpdir) teststmpdir = os.path.join(self.teststmpdir, "ipistorm-master") os.chdir(teststmpdir) kernel_version = platform.uname()[2] if not os.path.exists(os.path.join("/lib/modules", kernel_version)): self.cancel( "Modules of running kernel missing to build ipistorm module") build.make(teststmpdir) if not os.path.isfile(os.path.join(teststmpdir, 'ipistorm.ko')): self.fail("No ipistorm.ko found, module build failed") int_op = genio.read_file("/proc/interrupts") if "XIVE" not in int_op: self.cancel("Test is supported only with XIVE")
def setUp(self): ''' Install the basic packages to support PerfProbe test ''' # Check for basic utilities smm = SoftwareManager() detected_distro = distro.detect() parser = configparser.ConfigParser() parser.read(self.get_data('probe.cfg')) self.perf_probe = parser.get(detected_distro.name, 'probepoint') deps = ['gcc', 'make'] if detected_distro.name in ['rhel', 'SuSE']: deps.extend(['perf']) else: self.cancel("Install the package perf\ for %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('perf_test.c'), os.path.join(self.teststmpdir, 'perf_test.c')) shutil.copyfile(self.get_data('Makefile'), os.path.join(self.teststmpdir, 'Makefile')) build.make(self.teststmpdir) os.chdir(self.teststmpdir)
def setUp(self): ''' Build Hackbench Source: http://people.redhat.com/~mingo/cfs-scheduler/tools/hackbench.c ''' self._threshold_time = self.params.get('time_val', default=None) self._num_groups = self.params.get('num_groups', default=90) self._iterations = self.params.get('iterations', default=1) self.results = None sm = SoftwareManager() if not sm.check_installed("gcc") and not sm.install("gcc"): self.cancel("Gcc is needed for the test to be run") hackbench = self.fetch_asset('http://people.redhat.com' '/~mingo/cfs-scheduler/' 'tools/hackbench.c') shutil.copyfile(hackbench, os.path.join(self.workdir, 'hackbench.c')) os.chdir(self.workdir) if 'CC' in os.environ: cc = '$CC' else: cc = 'cc' process.system('%s hackbench.c -o hackbench -lpthread' % cc)
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) # Getting the parameters from yaml file self.optname = self.params.get('name', default='all') self.option = self.params.get('option', default='') # Clear the dmesg, by that we can capture the delta at the end of the test. process.run("dmesg -C", sudo=True)
def _run_software_manager(self, cmd, package, queue): software_manager = SoftwareManager() if not software_manager.is_capable(): output = { 'result': 'error', 'stdout': '', 'stderr': ('Package manager not supported or not' ' available.') } queue.put(output) if cmd == 'install': result, stdout, stderr = self._install(software_manager, cmd, package) elif cmd == 'remove': result, stdout, stderr = self._remove(software_manager, cmd, package) elif cmd == 'check': result, stdout, stderr = self._check(software_manager, package) output = {'result': result, 'stdout': stdout, 'stderr': stderr} queue.put(output)
def setUp(self): ''' Install the packages ''' # Check for basic utilities smm = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make'] if 'Ubuntu' in detected_distro.name: kernel_ver = platform.uname()[2] deps.extend(['linux-tools-common', 'linux-tools-%s' % kernel_ver]) elif detected_distro.name in ['debian']: deps.extend(['linux-perf']) elif detected_distro.name in ['rhel', 'SuSE', 'fedora']: deps.extend(['perf']) else: self.cancel("Perf package installation not supported on %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) tarball = self.fetch_asset('perf-event.zip', locations=[ 'https://github.com/deater/' 'perf_event_tests/archive/' 'master.zip'], expire='7d') archive.extract(tarball, self.workdir)
def setUp(self): sm = SoftwareManager() distro_name = distro.detect().name deps = ['gcc', 'make'] if distro_name in ['rhel', 'fedora', 'centos']: deps.extend(['kernel-tools']) elif 'SuSE' in distro_name: deps.extend(['cpupower']) for package in deps: if not sm.check_installed(package) and not sm.install(package): self.cancel("%s is needed for the test to be run" % package) output = self.run_cmd_out("cpupower idle-info --silent") for line in output.splitlines(): if 'Available idle states: ' in line: self.states_list = (line.split('Available idle states: ')[-1])\ .split() break self.log.info("Idle states on the system are: %s" % self.states_list) for line in output.splitlines(): if 'Number of idle states: ' in line: self.states_tot = int(line.split('Number of idle states: ')[1]) break self.log.info("Total Idle states: %d" % self.states_tot) self.run_cmd_out("cpupower monitor")
def setUp(self): """ Sets up NVMf configuration """ self.nss = self.params.get('namespaces', default='') self.peer_ips = self.params.get('peer_ips', default='') if not self.nss or not self.peer_ips: self.cancel("No inputs provided") self.peer_user = self.params.get("peer_user", default="root") self.peer_password = self.params.get("peer_password", default=None) self.nss = self.nss.split(' ') self.peer_ips = self.peer_ips.split(' ') self.ids = range(1, len(self.peer_ips) + 1) if len(self.nss) != len(self.peer_ips): self.cancel("Count of namespace and peer ips mismatch") smm = SoftwareManager() if not smm.check_installed("nvme-cli") and not \ smm.install("nvme-cli"): self.cancel('nvme-cli is needed for the test to be run') try: if not linux_modules.module_is_loaded("nvme-rdma"): linux_modules.load_module("nvme-rdma") except CmdError: self.cancel("nvme-rdma module not loadable") self.cfg_tmpl = self.get_data("nvmf_template.cfg") dirname = os.path.dirname(os.path.abspath(self.cfg_tmpl)) self.cfg_file = os.path.join(dirname, "nvmf.cfg") self.nvmf_discovery_file = "/etc/nvme/discovery.conf"
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) run_type = self.params.get("type", default="distro") if run_type == "upstream": source = self.params.get('url', default="https://github.com/" "strace/strace.git") git.get_repo(source, destination_dir=os.path.join(self.workdir, 'strace')) self.src_st = os.path.join(self.workdir, "strace") os.chdir(self.src_st) process.run('./bootstrap', ignore_status=True, sudo=True) elif run_type == "distro": self.src_st = os.path.join(self.workdir, "strace-distro") if not os.path.exists(self.src_st): self.src_st = smm.get_source("strace", self.src_st) os.chdir(self.src_st) process.run('./configure', ignore_status=True, sudo=True) build.make(self.src_st)
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')
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 self.cpu_family = cpu.get_family()[5:] if detected_distro.arch != 'ppc64le': self.cancel('This test is not supported on %s architecture' % detected_distro.arch) deps = ['gcc', 'make'] if self.distro_name in ['Ubuntu']: deps.extend(['linux-tools-common', 'linux-tools-%s' % platform.uname()[2]]) elif self.distro_name in ['debian']: deps.extend(['linux-tools-%s' % platform.uname()[2][3]]) 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) for filename in ['name_events_p8', 'raw_codes_p8', 'name_events_p9', 'raw_codes_p9', 'name_events_p10', 'raw_codes_p10']: self.copy_files(filename) os.chdir(self.teststmpdir) # Clear the dmesg to capture the delta at the end of the test. process.run("dmesg -C")
def setUp(self): ''' get all parameters ''' self.option = self.params.get("test_opt", default='') self.tool = self.params.get("tool", default='') self.warn_msg = self.params.get("warn_msg", default='') self.pci_device = self.params.get("pci_device", default=None) if self.pci_device: if 'LOC_CODE' in self.option: location_code = pci.get_slot_from_sysfs(self.pci_device) self.option = self.option.replace('LOC_CODE', location_code) if 'INTERFACE' in self.option: adapter_type = pci.get_pci_class_name(self.pci_device) interface = pci.get_interfaces_in_pci_address( self.pci_device, adapter_type)[0] self.option = self.option.replace('INTERFACE', interface) if 'DEVICE_PATH_NAME' in self.option: adapter_type = pci.get_pci_class_name(self.pci_device) interface = pci.get_interfaces_in_pci_address( self.pci_device, adapter_type)[0] path = '/sys/class/net/%s/device/uevent' % interface output = open(path, 'r').read() for line in output.splitlines(): if "OF_FULLNAME" in line: device_path_name = line.split('=')[-1] self.option = self.option.replace('DEVICE_PATH_NAME', device_path_name) smm = SoftwareManager() if not smm.check_installed("pciutils") and not smm.install("pciutils"): self.cancel("pciutils package is need to test")
def install_packages(self): ''' Install necessary packages ''' smm = SoftwareManager() packages = [ 'ksh', 'src', 'rsct.basic', 'rsct.core.utils', 'rsct.core', 'DynamicRM', 'powerpc-utils' ] detected_distro = distro.detect() if detected_distro.name == "Ubuntu": packages.extend(['python-paramiko']) self.log.info("Test is running on: %s", detected_distro.name) 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) if detected_distro.name == "Ubuntu": ubuntu_url = self.params.get('ubuntu_url', default=None) debs = self.params.get('debs', default=None) for deb in debs: deb_url = os.path.join(ubuntu_url, deb) deb_install = self.fetch_asset(deb_url, expire='7d') shutil.copy(deb_install, self.workdir) process.system("dpkg -i %s/%s" % (self.workdir, deb), ignore_status=True, sudo=True)
def setUp(self): ''' Install the basic packages to support cryptsetup ''' # 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([ "autoconf", "automake", "gettext", "gettext-devel", "libtool", "device-mapper", "device-mapper-devel", "device-mapper-libs", "popt-devel", "json-c", "json-c-devel", "libblkid-devel", "libssh-devel" ]) else: self.cancel("Unsupported distro %s for cryptsetup 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://gitlab.com/cryptsetup/cryptsetup/" git.get_repo(url, destination_dir=self.workdir) os.chdir(self.workdir) process.run("./autogen.sh") process.run("./configure") build.make(self.workdir)
def setUp(self): ''' Install the basic packages to support perf and systemtap-sdt-devel ''' # Check for basic utilities smm = SoftwareManager() detected_distro = distro.detect() self.distro_name = detected_distro.name deps = ['gcc'] if 'Ubuntu' in self.distro_name: deps.extend( ['linux-tools-common', 'linux-tools-%s' % platform.uname()[2]]) elif self.distro_name in ['rhel', 'SuSE']: deps.extend(['perf', 'systemtap-sdt-devel.ppc64le']) 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('tick-dtrace.d'), os.path.join(self.workdir, 'tick-dtrace.d')) shutil.copyfile(self.get_data('tick-main.c'), os.path.join(self.workdir, 'tick-main.c')) os.chdir(self.workdir) process.run("dtrace -G -s tick-dtrace.d -o tick-dtrace.o") process.run("dtrace -h -s tick-dtrace.d -o tick-dtrace.h") process.run("gcc -c tick-main.c") process.run("gcc -o tick tick-main.o tick-dtrace.o")