def setUp(self): smm = SoftwareManager() self.hpagesize = int( self.params.get('hpagesize', default=memory.get_huge_page_size() / 1024)) cpu_info = genio.read_file("/proc/cpuinfo") if 'Radix' in cpu_info and self.hpagesize == 16: self.cancel("This hugepage size is not supported.") if 'Hash' in cpu_info and self.hpagesize != 16: self.cancel("This hugepage size is not supported.") self.num_huge = int(self.params.get('num_pages', default='1')) 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 ['hugepage_sanity.c', 'Makefile']: self.copyutil(file_name) build.make(self.teststmpdir)
def setUp(self): """ Checking if the required packages are installed, if not found packages will be installed """ smm = SoftwareManager() if not smm.check_installed("smartctl"): self.log.info("smartctl should be installed prior to the test") if smm.install("smartmontools") is False: self.cancel("Unable to install smartctl") self.option = self.params.get('option') self.disks = self.params.get('disk') if self.disks is '' or self.option is '': self.cancel(" Test skipped!!, please ensure Block device and \ options are specified in yaml file") cmd = "df -h /boot | grep %s" % (self.disks) if process.system(cmd, timeout=300, ignore_status=True, shell=True) == 0: self.cancel(" Skipping it's OS disk")
def setUp(self): smm = SoftwareManager() self.options = self.params.get('option', default='-l') if self.options == "-p": self.plugin = self.params.get('plugin_val', default='kdump') self.options = "%s %s" % (self.options, self.plugin) for package in ['make', 'gcc']: 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( 'ServiceReport.zip', locations=[ 'https://github.com/linux-ras/ServiceReport' '/archive/master.zip' ], expire='7d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join(self.workdir, 'ServiceReport-master') build.make(self.sourcedir)
def setUp(self): self.nr_chunks = self.params.get('nr_chunks', default=1) self.hpage = self.params.get('h_page', default=False) self.hpage_commit = self.params.get('h_commit', default=False) self.thp = self.params.get('thp', default=False) nodes = memory.numa_nodes_with_memory() if len(nodes) < 2: self.cancel('Test requires two numa nodes to run.' 'Node list with memory: %s' % nodes) dist = distro.detect() pkgs = ['gcc', 'make'] 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']) 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) # Enable THP if self.thp: try: memory.set_thp_value("enabled", "always") except Exception as details: self.fail("Failed to enable thp %s" % details) for file_name in ['node_move_pages.c', 'Makefile']: self.copyutil(file_name) build.make(self.teststmpdir)
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 'debian' in detected_distro.name: deps.extend(['powerpc-ibm-utils']) 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) url = 'http://sourceforge.net/projects//ebizzy/files/ebizzy/0.3/' \ 'ebizzy-0.3.tar.gz' tarball = self.fetch_asset(self.params.get("ebizy_url", default=url), expire='7d') self.cpu_unit = self.params.get('cpu_unit', default=.1) self.dlpar_loop = self.params.get('range', default=10) 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): ''' Install the basic packages to support perf ''' # Check for basic utilities smm = SoftwareManager() self.detected_distro = distro.detect() self.distro_name = self.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 ['SuSE', 'fedora', 'centos']: deps.extend(['perf']) elif self.distro_name == 'rhel' and int( self.detected_distro.version) < 9: deps.extend(['perf']) elif self.distro_name == 'rhel' and int( self.detected_distro.version) >= 9: deps.extend(['perf', 'perf-debuginfo']) else: self.cancel("Install the package for perf supported\ by %s" % self.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
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) fin = open("Makefile", "rt") data = fin.read() data = data.replace('-lm -o $@ flail.c', '-o $@ flail.c -lm') fin.close() fin = open("Makefile", "wt") fin.write(data) fin.close() build.make(self.build_dir)
def setUp(self): ''' Install the basic packages to support seccomp ''' # 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(['gperf']) 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/seccomp/libseccomp/archive/refs/heads/main.zip" tarball = self.fetch_asset(url, expire='7d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join(self.workdir, 'libseccomp-main') os.chdir(self.sourcedir) process.run("./autogen.sh") process.run("./configure")
def setUp(self): smg = SoftwareManager() dist = distro.detect() if dist.name in ['Ubuntu']: linux_tools = "linux-tools-" + os.uname()[2] pkgs = [linux_tools] if dist.name in ['Ubuntu']: pkgs.extend(['linux-tools-common']) elif dist.name in ['debian']: pkgs = ['linux-perf'] 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) self.temp_file = tempfile.NamedTemporaryFile().name
def setUp(self): """ Build 'stress'. Source: https://fossies.org/linux/privat/old/stress-1.0.4.tar.gz """ 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) tarball = self.fetch_asset( 'https://fossies.org/linux/privat/old/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): smg = SoftwareManager() if 'SuSE' in distro.detect().name: if not smg.check_installed("kernel-source") and not\ smg.install("kernel-source"): self.cancel("Failed to install kernel-source for this test.") if not os.path.exists("/usr/src/linux"): self.cancel("kernel source missing after install") self.buldir = "/usr/src/linux" shutil.copy('/boot/config-%s' % platform.uname()[2], '%s/.config' % self.buldir) os.chdir(self.buldir) process.system("sed -i 's/^.*CONFIG_SYSTEM_TRUSTED_KEYS/#&/g'\ .config", shell=True, sudo=True) process.system("sed -i 's/^.*CONFIG_SYSTEM_TRUSTED_KEYRING/#&/g' \ .config", shell=True, sudo=True) process.system("sed -i 's/^.*CONFIG_MODULE_SIG_KEY/#&/g' .config", shell=True, sudo=True) process.system("sed -i 's/^.*CONFIG_DEBUG_INFO_BTF/#&/g' .config", shell=True, sudo=True) process.system('make') process.system('make modules_install') """ Verifies if CONFIG_RCU_TORTURE_TEST is enabled """ self.results = [] self.log.info("Check if CONFIG_RCU_TORTURE_TEST is enabled\n") ret = linux_modules.check_kernel_config('CONFIG_RCU_TORTURE_TEST') if ret == linux_modules.ModuleConfig.NOT_SET: self.cancel("CONFIG_RCU_TORTURE_TEST is not set in .config !!\n") self.log.info("Check rcutorture module is already loaded\n") if linux_modules.module_is_loaded('rcutorture'): linux_modules.unload_module('rcutorture')
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() detected_distro = distro.detect() packages = ['gcc', 'libtool', 'autoconf', 'automake', 'make'] if detected_distro.name in ["SuSE", "rhel", "centos", "fedora"]: packages.extend(['gcc-c++']) elif detected_distro.name == "Ubuntu": packages.extend(['g++']) for package in packages: 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 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 'ppc64' not in detected_distro.arch: self.cancel('This test is not supported on %s architecture' % detected_distro.arch) if 'PowerNV' in genio.read_file('/proc/cpuinfo'): self.cancel('This test is only supported on LPAR') 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) # Collect all hv_gpci events self.list_of_hv_gpci_events = [] for line in process.get_command_output_matching( 'perf list', 'hv_gpci'): line = line.split(',')[0].split('/')[1] self.list_of_hv_gpci_events.append(line) # Clear the dmesg, by that we can capture the delta at the end of # the test. process.run("dmesg -c")
def setUp(self): """ Identify the 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.virtual_device = self.params.get('virtual_device') self.virtual_slot = self.params.get('virtual_slot') if "T" in self.virtual_slot: self.virtual_slot = self.virtual_slot.split("-T")[0] output = process.system_output("lsslot", shell=True) for line in output.decode("utf-8").splitlines(): if self.virtual_slot in line: self.device_type = line.split()[-1] self.device = line.split()[-2] self.count = int(self.params.get('count', default="1")) self.peer_ip = self.params.get('peer_ip', default=None) self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") local = LocalHost() if self.device_type in ["l-lan", "vnic"]: if self.virtual_device not in interfaces: self.cancel("%s interface is not available" % self.virtual_device) self.networkinterface = NetworkInterface(self.virtual_device, local) if self.virtual_device in local.get_default_route_interface(): self.cancel("Test could not run on default interface") try: self.networkinterface.add_ipaddr(self.ipaddr, self.netmask) self.networkinterface.save(self.ipaddr, self.netmask) except Exception: self.networkinterface.save(self.ipaddr, self.netmask) self.networkinterface.bring_up() else: if disk.is_root_device(self.virtual_device): self.cancel("Test could not run on root disk")
def setUp(self): ''' Install the pre-requisites packages and download kernel source ''' self.testdir = "tools/testing/selftests/ftrace" smg = SoftwareManager() self.version = self.params.get('type', default='upstream') detected_distro = distro.detect() if self.version == 'distro': # Make sure kernel source repo is configured if detected_distro.name in ['rhel', 'centos']: self.buldir = smg.get_source("kernel", self.workdir) self.buldir = os.path.join(self.buldir, os.listdir(self.buldir)[0]) elif 'SuSE' in detected_distro.name: if not smg.check_installed("kernel-source") and not\ smg.install("kernel-source"): self.cancel( "Failed to install kernel-source for this test.") if not os.path.exists("/usr/src/linux"): self.cancel("kernel source missing after install") self.buldir = "/usr/src/linux" else: location = self.params.get('location', default='https://github.c' 'om/torvalds/linux/archive/master.zip') self.output = "linux-master" match = next((ext for ext in [".zip", ".tar"] if ext in location), None) if match: tarball = self.fetch_asset("kselftest%s" % match, locations=[location], expire='1d') archive.extract(tarball, self.workdir) else: git.get_repo(location, destination_dir=self.workdir) self.buldir = os.path.join(self.workdir, self.output) os.chdir(os.path.join(self.buldir, self.testdir))
def setUp(self): ''' Install the basic packages to support perf and systemtap-sdt-devel ''' # Check for basic utilities smm = SoftwareManager() distro_name = distro.detect().name deps = [] if 'Ubuntu' in distro_name: deps.extend(['linux-tools-common', 'linux-tools-%s' % platform.uname()[2]]) elif 'rhel' in distro_name: deps.extend(['perf', 'kernel-debuginfo']) elif 'SuSE' in distro_name: deps.extend(['perf', 'kernel-default-debuginfo']) else: self.cancel("Install the package for perf supported\ by %s" % 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.fail_flag = False
def setUp(self): sm = SoftwareManager() self.is_fail = 0 dist = distro.detect() packages = ['lshw', 'net-tools', 'pciutils'] if dist.name == "SuSE" and int(dist.version) < 15: self.cancel("lshw not supported on SLES-%s. Please run " "on SLES15 or higher versions only " % dist.version) if ((dist.name == 'Ubuntu' and int(dist.version) >= 18) or (dist.name in ["SuSE", 'debian'])): packages.extend(['iproute2']) else: packages.extend(['iproute']) if dist.name in ['Ubuntu', 'debian']: if 'IBM' in process.system_output('lshw -class system', shell='true').decode(): packages.extend(['powerpc-ibm-utils']) 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)
def setUp(self): ''' Build fs-fuzz Source: https://github.com/regehr/fs-fuzz ''' # Check for basic utilities smm = SoftwareManager() for package in ['make', 'gcc']: if not smm.check_installed(package) and not smm.install(package): self.cancel('%s is needed for the test to be run' % package) locations = ['https://github.com/regehr/fs-fuzz/archive/master.zip'] tarball = self.fetch_asset("fs-fuzz.zip", locations=locations, expire='7d') archive.extract(tarball, self.workdir) self.build_dir = os.path.join(self.workdir, 'fs-fuzz-master') build.make(self.build_dir) self.clear_dmesg()
def setUp(self): # Check for basic utilities smm = SoftwareManager() dist = distro.detect() deps = ["gcc", "make"] if dist.name in ['Ubuntu', 'debian']: deps.extend(['libncurses-dev']) elif dist.name in ['rhel', 'SuSE']: deps.extend(['ncurses-devel']) 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) git.get_repo('git://git.code.sf.net/p/perfmon2/libpfm4', destination_dir=self.workdir) os.chdir(self.workdir) build.make('.')
def __init__(self, log, results_file, output_dir): self.active = True s_mg = SoftwareManager() self.log = log if not s_mg.check_installed("gnuplot") and not s_mg.install("gnuplot"): self.log.warn("Command gnuplot not found, disabling graph " "generation") self.active = False if not os.path.isdir(output_dir): os.makedirs(output_dir) self.output_dir = output_dir if not os.path.isfile(results_file): self.log.error( "Invalid file %s provided, disabling graph " "generation", results_file) self.active = False self.results_file = None else: self.results_file = results_file self.generate_data_source()
def setUp(self): sm = SoftwareManager() dist = distro.detect() packages = ['gcc', 'dejagnu', 'flex', 'bison', 'texinfo', 'make'] 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 ['rhel', 'fedora', 'redhat']: packages.extend(['gcc-c++', 'binutils-devel', 'texi2html']) elif dist.name == 'SuSE': packages.extend([ 'gcc-c++', 'binutils-devel', 'glibc-devel', 'glibc-devel-static' ]) 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.cancel("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='10.2') 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 self.numa_pid = None distro_name = distro.detect().name.lower() smm = SoftwareManager() deps = ['gcc', 'numatop', 'make'] if distro_name == 'ubuntu': deps.extend(['libnuma-dev', 'libncurses-dev', 'pkg-config', 'check']) elif distro_name in ['rhel', 'fedora']: deps.extend(['ncurses-devel', 'numactl-libs', 'numactl-devel', 'check-devel', 'libtool']) elif distro_name == 'suse': deps.extend(['ncurses-devel', 'libnuma-devel', 'check-devel', 'autoconf', 'libtool']) else: self.cancel("Install corresponding libnuma packages") for package in deps: 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/intel/numatop/archive/master.zip"] tarball = self.fetch_asset("numatop.zip", locations=locations, expire='7d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join(self.workdir, 'numatop-master') os.chdir(self.sourcedir) process.run('./autogen.sh', shell=True, sudo=True) build.make(self.sourcedir, extra_args='check')
def setUp(self): """ Mount MOFED iso. """ self.iso_location = self.params.get('iso_location', default='') self.kernelc = self.params.get("kernel_compile", default="Y") if self.iso_location is '': self.cancel("No ISO location given") self.option = self.params.get('option', default='') self.uninstall_flag = self.params.get('uninstall', default=True) detected_distro = distro.detect() pkgs = [] self.uname = linux_modules.platform.uname()[2] kernel_ver = "kernel-devel-%s" % self.uname smm = SoftwareManager() if detected_distro.name == "SuSE": pkgs.extend([ "make", "gcc", "python3-devel", "kernel-source", "kernel-syms", "insserv-compat", "rpm-build" ]) # 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 ['rhel', 'fedora', 'redhat']: pkgs.extend([ "make", "gcc", "python36-devel", "tcsh", "kernel-rpm-macros", "gdb-headless", "rpm-build", "gcc-gfortran", kernel_ver ]) for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("Not able to install %s" % pkg) self.iso = self.fetch_asset(self.iso_location, expire='10d') cmd = "mount -o loop %s %s" % (self.iso, self.workdir) process.run(cmd, shell=True) self.pwd = os.getcwd() if self.options_check() is False: self.cancel("option %s not supported with this MOFED" % self.option)
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', 'patch'] if dist.name in ['Ubuntu', 'debian']: packages.extend(['g++']) elif dist.name in ['SuSE', 'fedora', 'rhel', 'centos']: 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) elif dist.name in ['Ubuntu', 'debian']: process.system("sed -i 's/g++.*/& -lrt/' Makefile", shell=True) build.make(self.teststmpdir)
def setUp(self): ''' Install the basic packages to support selinux ''' # Check for basic utilities smm = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make'] self.sourcedir = None if detected_distro.name in [ 'rhel', 'SuSE', 'fedora', 'centos', 'redhat' ]: deps.extend([ "perl-Test", "perl-Test-Harness", "perl-Test-Simple", "perl-libs", "selinux-policy-devel", "net-tools", "netlabel_tools", "iptables", "libbpf", "lksctp-tools-devel", "attr", "libbpf-devel", "keyutils-libs-devel", "quota", "xfsprogs-devel", "libuuid-devel", "nftables", "kernel-devel", "kernel-modules", "perl-Test-Harness", "coreutils", "netlabel_tools", "libsepol", "checkpolicy", "libselinux", "policycoreutils", "libsemanage", "nfs-utils", "policycoreutils-newrole", "xfsprogs-devel", "libselinux-devel" ]) else: self.cancel("Install the package for selinux 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/SELinuxProject/selinux-testsuite/archive/master.zip" tarball = self.fetch_asset(url, expire='7d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join(self.workdir, 'selinux-testsuite-master') os.chdir(self.sourcedir) if not linux.enable_selinux_enforcing(): self.fail("Unable to enter in to 'Enforcing' mode") if build.make(self.sourcedir, extra_args="-C policy load") > 0: self.cancel("Failed to load the policies")
def setUp(self): ''' Build Stutter Test Source: https://github.com/gaowanlong/stutter/archive/master.zip ''' # 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) locations = ["https://github.com/gaowanlong/stutter/archive/" "master.zip"] tarball = self.fetch_asset("stutter.zip", locations=locations, expire='7d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join(self.workdir, 'stutter-master') self._memory = self.params.get('memory', default=memory.meminfo.MemTotal.k) 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') if not os.path.exists(self._logdir): os.makedirs(self._logdir) # export env variable, used by test script os.environ['MEMTOTAL_BYTES'] = str(self._memory) os.environ['ITERATIONS'] = self._iteration os.environ['LOGDIR_RESULTS'] = self._logdir os.environ['TESTDISK_DIR'] = self._rundir build.make(self.sourcedir)
def setUp(self): ''' Install the basic packages to support annobin ''' # Check for basic utilities smm = SoftwareManager() self.distro_name = distro.detect().name deps = ['gcc', 'make', 'autoconf', 'texinfo'] # Ubuntu requires gcc-?-plugin-dev with different names aligned with # gcc versions like 5,6,7,8 skipping Ubuntu for this test. # In SLES 'gcc-plugin-devel' package not available, skipping. if self.distro_name in ['rhel', 'fedora', 'centos']: deps.extend(['gcc-plugin-devel', 'rpm-devel']) else: self.cancel("%s not supported for this test" % self.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://sourceware.org/git/annobin.git" git.get_repo(url, destination_dir=self.workdir) os.chdir(self.workdir) process.run('autoreconf', ignore_status=True) process.run('./configure', ignore_status=True)
def setUp(self): ''' Setup memtester ''' smm = SoftwareManager() for pkg in ['gcc', 'make']: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel('%s is needed for the test to be run' % pkg) tarball = self.fetch_asset('memtester.zip', locations=[ 'https://github.com/jnavila/' 'memtester/archive/master.zip' ], expire='7d') archive.extract(tarball, self.workdir) sourcedir = os.path.join(self.workdir, 'memtester-master') os.chdir(sourcedir) process.system('chmod 755 extra-libs.sh', shell=True, sudo=True, ignore_status=True) build.make(sourcedir)
def install_packages(self): ''' Install required packages ''' smm = SoftwareManager() packages = ['ksh', 'src', 'rsct.basic', 'rsct.core.utils', 'rsct.core', 'DynamicRM', 'pciutils'] 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): """ Setting up the env for SDT markers """ smg = SoftwareManager() self.libpthread = [] self.libc = [] self.temp_file = tempfile.NamedTemporaryFile().name detected_distro = distro.detect() if 'ppc' not in distro.detect().arch: self.cancel("Test supportd only on ppc64 arch") deps = ['gcc', 'make'] if 'Ubuntu' in detected_distro.name: deps.extend(['libc-dev', 'libc-bin', 'linux-tools-common', 'linux-tools-%s' % platform.uname()[2]]) elif detected_distro.name in ['rhel', 'SuSE', 'fedora', 'centos']: deps.extend(['perf', 'glibc', 'glibc-devel']) else: self.cancel("Install the package for perf supported by %s" % detected_distro.name) 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)