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 install_packages(self): ''' Install necessary packages ''' smm = SoftwareManager() detected_distro = distro.detect() self.log.info("Test is running on %s", detected_distro.name) if not smm.check_installed("ksh") and not smm.install("ksh"): self.cancel('ksh is needed for the test to be run') if detected_distro.name == "Ubuntu": if not smm.check_installed("python-paramiko") and not \ smm.install("python-paramiko"): self.cancel('python-paramiko is needed for the test to be run') ubuntu_url = self.params.get('ubuntu_url', default=None) debs = self.params.get('debs', default=None) if not ubuntu_url or not debs: self.cancel("No url specified") 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) else: url = self.params.get('url', default=None) if not url: self.cancel("No url specified") rpm_install = self.fetch_asset(url, expire='7d') shutil.copy(rpm_install, self.workdir) os.chdir(self.workdir) process.run('chmod +x ibmtools') process.run('./ibmtools --install --managed')
def setUp(self): ''' Install the basic packages to support perf ''' # Check for basic utilities smm = SoftwareManager() detected_distro = distro.detect() kernel_ver = platform.uname()[2] deps = ['gcc', 'make'] if 'Ubuntu' in detected_distro.name: deps.extend(['linux-tools-common', 'linux-tools-%s' % kernel_ver]) # 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', 'SuSE', 'fedora', 'centos', 'redhat']: 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) locations = ["https://github.com/rfmvh/perftool-testsuite/archive/" "master.zip"] tarball = self.fetch_asset("perftool.zip", locations=locations, expire='7d') archive.extract(tarball, self.srcdir) self.sourcedir = os.path.join(self.srcdir, 'perftool-testsuite-master')
def setUp(self): ''' Build FileBench Source: https://github.com/filebench/filebench/releases/download/1.5-alpha3/filebench-1.5-alpha3.tar.gz ''' # Check for basic utilities smm = SoftwareManager() deps = ['libtool', 'automake', 'autoconf', 'bison', 'gcc', 'flex'] for package in deps: if not smm.check_installed(package) and not smm.install(package): self.error(package + ' is needed for the test to be run') self._testfile = self.params.get('testfile', default='fileserver.f') tarball = self.fetch_asset('https://github.com/filebench/' 'filebench/releases/ownload/1.5-alpha3/' 'filebench-1.5-alpha3.tar.gz', expire='7d') archive.extract(tarball, self.srcdir) version = os.path.basename(tarball.split('.tar.')[0]) self.srcdir = os.path.join(self.srcdir, version) os.chdir(self.srcdir) process.run('./configure', shell=True, sudo=True) build.make(self.srcdir) build.make(self.srcdir, extra_args='install') # Setup test file t_dir = '/usr/local/share/filebench/workloads/' shutil.copyfile(os.path.join(t_dir, self._testfile), os.path.join(self.srcdir, self._testfile))
def setUp(self): ''' Build Stutter Test Source: https://github.com/gaowanlong/stutter/archive/master.zip ''' # Check for basic utilities smm = SoftwareManager() if not smm.check_installed("gcc") and not smm.install("gcc"): self.error('Gcc is needed for the test to be run') locations = ["https://github.com/gaowanlong/stutter/archive/" "master.zip"] tarball = self.fetch_asset("stutter.zip", locations=locations, expire='7d') archive.extract(tarball, self.srcdir) self.srcdir = os.path.join(self.srcdir, 'stutter-master') mem_byte = str(memory.memtotal()) print mem_byte self._memory = self.params.get('memory', default=mem_byte) self._iteration = self.params.get('iteration', default='10') self._logdir = self.params.get('logdir', default='/var/tmp/logdir') self._rundir = self.params.get('rundir', default='/tmp') process.run('mkdir -p %s' % self._logdir) # export env variable, used by test script os.environ['MEMTOTAL_BYTES'] = self._memory os.environ['ITERATIONS'] = self._iteration os.environ['LOGDIR_RESULTS'] = self._logdir os.environ['TESTDISK_DIR'] = self._rundir build.make(self.srcdir)
def setUp(self): ''' Install the basic packages to support perf ''' # Check for basic utilities smm = SoftwareManager() detected_distro = distro.detect() self.distro_name = detected_distro.name deps = ['gcc', 'make'] if 'Ubuntu' in self.distro_name: deps.extend(['linux-tools-common', 'linux-tools-%s' % platform.uname()[2]]) elif self.distro_name in ['rhel', 'SuSE', 'fedora', 'centos']: deps.extend(['perf']) else: self.cancel("Install the package for perf supported\ by %s" % detected_distro.name) for package in deps: if not smm.check_installed(package) and not smm.install(package): self.cancel('%s is needed for the test to be run' % package) shutil.copyfile(self.get_data('uprobe.c'), os.path.join(self.teststmpdir, 'uprobe.c')) shutil.copyfile(self.get_data('Makefile'), os.path.join(self.teststmpdir, 'Makefile')) build.make(self.teststmpdir) os.chdir(self.teststmpdir) self.temp_file = tempfile.NamedTemporaryFile().name self.cmdProbe = "perf probe -x" self.recProbe = "perf record -o %s -e probe_uprobe_test:doit" % self.temp_file self.report = "perf report --input=%s" % self.temp_file self.distro_version = detected_distro.version
def setUp(self): """ Build xfstest Source: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git """ sm = SoftwareManager() packages = ['xfslibs-dev', 'uuid-dev', 'libtool-bin', 'e2fsprogs', 'automake', 'gcc', 'libuuid1', 'quota', 'attr', 'libattr1-dev', 'make', 'libacl1-dev', 'xfsprogs', 'libgdbm-dev', 'gawk', 'fio', 'dbench', 'uuid-runtime'] for package in packages: if not sm.check_installed(package) and not sm.install(package): self.error("Fail to install %s required for this test." % package) self.test_range = self.params.get('test_range', default=None) if self.test_range is None: self.fail('Please provide a test_range.') self.skip_dangerous = self.params.get('skip_dangerous', default=True) git.get_repo('git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git', destination_dir=self.srcdir) data_dir = os.path.abspath(self.datadir) shutil.copyfile(os.path.join(data_dir, 'group'), os.path.join(self.srcdir, 'group')) build.make(self.srcdir) self.available_tests = self._get_available_tests() self.test_list = self._create_test_list() self.log.info("Tests available in srcdir: %s", ", ".join(self.available_tests)) process.run('useradd fsgqa', sudo=True) process.run('useradd 123456-fsgqa', sudo=True)
def setUp(self): """ Download 'nvme-cli'. """ self.device = self.params.get('device', default='/dev/nvme0') self.disk = self.params.get('disk', default='/dev/nvme0n1') cmd = 'ls %s' % self.device if process.system(cmd, ignore_status=True) is not 0: self.skip("%s does not exist" % self.device) smm = SoftwareManager() if not smm.check_installed("nvme-cli") and not \ smm.install("nvme-cli"): self.skip('nvme-cli is needed for the test to be run') python_packages = pip.get_installed_distributions() python_packages_list = [i.key for i in python_packages] python_pkgs = ['nose', 'nose2', 'pep8', 'flake8', 'pylint', 'epydoc'] for py_pkg in python_pkgs: if py_pkg not in python_packages_list: self.skip("python package %s not installed" % py_pkg) url = 'https://codeload.github.com/linux-nvme/nvme-cli/zip/master' tarball = self.fetch_asset("nvme-cli-master.zip", locations=[url], expire='7d') archive.extract(tarball, self.teststmpdir) self.nvme_dir = os.path.join(self.teststmpdir, "nvme-cli-master") print os.listdir(self.nvme_dir) os.chdir(os.path.join(self.nvme_dir, 'tests')) msg = ['{'] msg.append(' \"controller\": \"%s\",' % self.device) msg.append(' \"ns1\": \"%s\",' % self.disk) msg.append(' \"log_dir\": \"%s\"' % self.outputdir) msg.append('}') with open('config.json', 'w') as config_file: config_file.write("\n".join(msg)) process.system("cat config.json")
def setUp(self): self.test_file = self.params.get('tmp_file', default='/tmp/dummy') self.duration = self.params.get('duration', default='30') self.threads = self.params.get( 'threads', default=cpu.online_cpus_count()) self.size = self.params.get( 'memory_to_test', default=int(0.9 * memory.meminfo.MemFree.m)) smm = SoftwareManager() for package in ['gcc', 'libtool', 'autoconf', 'automake', 'make']: if not smm.check_installed(package) and not smm.install(package): self.cancel("Failed to install %s, which is needed for" "the test to be run" % package) if not os.path.exists(self.test_file): try: os.mknod(self.test_file) except OSError: self.cancel("Skipping test since test file creation failed") loc = ["https://github.com/stressapptest/" "stressapptest/archive/master.zip"] tarball = self.fetch_asset("stressapp.zip", locations=loc, expire='7d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join(self.workdir, 'stressapptest-master') os.chdir(self.sourcedir) process.run('./configure', shell=True) build.make(self.sourcedir)
def setUp(self): ''' Build linsched Test Source: https://github.com/thejinxters/linux-scheduler-testing ''' # Check for basic utilities smm = SoftwareManager() deps = ['gcc', 'make', 'patch'] if distro.detect().name == "SuSE": deps.append('git-core') else: deps.append('git') for package in deps: if not smm.check_installed(package) and not smm.install(package): self.cancel( "Fail to install %s required for this test." % package) self.args = self.params.get('args', default='pi 100') git.get_repo('https://github.com/thejinxters/linux-scheduler-testing', destination_dir=self.srcdir) os.chdir(self.srcdir) fix_patch = 'patch -p1 < %s' % ( os.path.join(self.datadir, 'fix.patch')) process.run(fix_patch, shell=True, ignore_status=True) build.make(self.srcdir)
def setUp(self): ''' Build Bcc Test Source: https://github.com/iovisor/bcc ''' # Check for basic utilities detected_distro = distro.detect().name.lower() smm = SoftwareManager() # TODO: Add support for other distributions if not detected_distro == "ubuntu": self.cancel("Upsupported OS %s" % detected_distro) for package in ['bison', 'build-essential', 'cmake', 'flex', 'libedit-dev', 'libllvm3.8', 'llvm-3.8-dev', 'libclang-3.8-dev', 'python', 'zlib1g-dev', 'libelf-dev', 'clang-format-3.8', 'python-netaddr', 'python-pyroute2', 'arping', 'iperf', 'netperf', 'ethtool']: if not smm.check_installed(package) and not smm.install(package): self.cancel("Failed to install %s, which is needed for" "the test to be run" % package) locations = ["https://github.com/iovisor/bcc/archive/master.zip"] tarball = self.fetch_asset("bcc.zip", locations=locations, expire='7d') archive.extract(tarball, self.srcdir) self.sourcedir = os.path.join(self.srcdir, 'bcc-master') os.makedirs('%s/build' % self.sourcedir) self.builddir = '%s/build' % self.sourcedir os.chdir(self.builddir) process.run('cmake .. -DCMAKE_INSTALL_PREFIX=/usr', shell=True) build.make(self.builddir)
def setUp(self): ''' Build ebizzy Source: http://liquidtelecom.dl.sourceforge.net/project/ebizzy/ebizzy/0.3 /ebizzy-0.3.tar.gz ''' sm = SoftwareManager() if not sm.check_installed("gcc") and not sm.install("gcc"): self.error("Gcc is needed for the test to be run") tarball = self.fetch_asset('http://liquidtelecom.dl.sourceforge.net' '/project/ebizzy/ebizzy/0.3' '/ebizzy-0.3.tar.gz') data_dir = os.path.abspath(self.datadir) archive.extract(tarball, self.srcdir) version = os.path.basename(tarball.split('.tar.')[0]) self.srcdir = os.path.join(self.srcdir, version) patch = self.params.get( 'patch', default='Fix-build-issues-with-ebizzy.patch') os.chdir(self.srcdir) p1 = 'patch -p0 < %s/%s' % (data_dir, patch) process.run(p1, shell=True) process.run('[ -x configure ] && ./configure', shell=True) build.make(self.srcdir)
def setUp(self): ''' check the availability of perftest package installed perftest package should be installed ''' sm = SoftwareManager() depends = ["openssh-clients", "perftest"] for pkg in depends: if not sm.check_installed(pkg) and not sm.install(pkg): self.skip("%s package is need to test" % pkg) interfaces = netifaces.interfaces() self.flag = self.params.get("ext_flag", default="0") self.IF = self.params.get("Iface", default="") self.PEER_IP = self.params.get("PEERIP", default="") if self.IF not in interfaces: self.skip("%s interface is not available" % self.IF) if self.PEER_IP == "": self.skip("%s peer machine is not available" % self.PEER_IP) self.CA = self.params.get("CA_NAME", default="mlx4_0") self.PORT = self.params.get("PORT_NUM", default="1") self.PEER_CA = self.params.get("PEERCA", default="mlx4_0") self.PEER_PORT = self.params.get("PEERPORT", default="1") self.to = self.params.get("timeout", default="600") self.tool_name = self.params.get("tool", default="") if self.tool_name == "": self.skip("should specify tool name") self.log.info("test with %s" % (self.tool_name)) self.test_op = self.params.get("test_opt", default="").split(",") self.ext_test_op = self.params.get("ext_opt", default="").split(",")
def setUp(self): """ Build 'fio'. """ default_url = "http://brick.kernel.dk/snaps/fio-2.1.10.tar.gz" url = self.params.get('fio_tool_url', default=default_url) self.disk = self.params.get('disk', default=None) self.dir = self.params.get('dir', default=self.srcdir) fstype = self.params.get('fs', default='ext4') tarball = self.fetch_asset(url) archive.extract(tarball, self.teststmpdir) fio_version = os.path.basename(tarball.split('.tar.')[0]) self.sourcedir = os.path.join(self.teststmpdir, fio_version) build.make(self.sourcedir) smm = SoftwareManager() if fstype == 'btrfs': if distro.detect().name == 'Ubuntu': if not smm.check_installed("btrfs-tools") and not \ smm.install("btrfs-tools"): self.cancel('btrfs-tools is needed for the test to be run') if self.disk is not None: self.part_obj = Partition(self.disk, mountpoint=self.dir) self.log.info("Unmounting disk/dir before creating file system") self.part_obj.unmount() self.log.info("creating file system") self.part_obj.mkfs(fstype) self.log.info("Mounting disk %s on directory %s", self.disk, self.dir) self.part_obj.mount()
def setUp(self): ''' Check for required packages namely gcc, make, valgrind. Transfer the source file and make file. Compile ''' smm = SoftwareManager() dist = distro.detect() if dist.arch != "ppc64le": self.cancel("Test is not applicable!!") deps = ['gcc', 'make', 'valgrind'] for package in deps: if not smm.check_installed(package) and not smm.install(package): self.cancel('%s is needed for the test to be run' % package) self.log.info("Tranferring the files ...") shutil.copyfile(self.get_data('print_power_time_base.c'), os.path.join(self.teststmpdir, 'print_power_time_base.c')) self.log.info("About to compile ...") shutil.copyfile(self.get_data('Makefile'), os.path.join(self.teststmpdir, 'Makefile')) build.make(self.teststmpdir)
def setUp(self): """ Build 'fio and ezfio'. """ self.disk = self.params.get('disk', default='/dev/nvme0n1') cmd = 'ls %s' % self.disk if process.system(cmd, ignore_status=True) is not 0: self.cancel("%s does not exist" % self.disk) fio_path = os.path.join(self.teststmpdir, 'fio') fio_link = 'https://github.com/axboe/fio.git' git.get_repo(fio_link, destination_dir=fio_path) build.make(fio_path, make='./configure') build.make(fio_path) build.make(fio_path, extra_args='install') self.ezfio_path = os.path.join(self.teststmpdir, 'ezfio') ezfio_link = 'https://github.com/earlephilhower/ezfio.git' git.get_repo(ezfio_link, destination_dir=self.ezfio_path) self.utilization = self.params.get('utilization', default='100') # aio-max-nr is 65536 by default, and test fails if QD is 256 or above genio.write_file("/proc/sys/fs/aio-max-nr", "1048576") smm = SoftwareManager() # Not a package that must be installed, so not skipping. if not smm.check_installed("sdparm") and not smm.install("sdparm"): self.log.debug("Can not install sdparm") self.cwd = os.getcwd()
def setUp(self): self.tlbflush_max_entries = self.params.get('entries', default=200) self.tlbflush_iteration = self.params.get('iterations', default=50) self.nr_threads = self.params.get('nr_threads', default=50) # Check for basic utilities smm = SoftwareManager() for package in ['gcc', 'make', 'patch']: if not smm.check_installed(package) and not smm.install(package): self.cancel("%s is needed for this test." % package) data_dir = os.path.abspath(self.datadir) shutil.copyfile(os.path.join(data_dir, 'tlbflush.c'), os.path.join(self.srcdir, 'tlbflush.c')) os.chdir(self.srcdir) tlbflush_patch = 'patch -p1 < %s' % ( os.path.join(data_dir, 'tlbflush.patch')) process.run(tlbflush_patch, shell=True) cmd = 'gcc -DFILE_SIZE=$((128*1048576)) -g -O2 tlbflush.c \ -lpthread -o tlbflush' process.run(cmd, shell=True)
def setUp(self): ''' Build VA Test ''' # Check for basic utilities smm = SoftwareManager() self.scenario_arg = int(self.params.get('scenario_arg', default=1)) dic = {2: 1024, 3: 1024, 4: 131072, 5: 1, 6: 1, 7: 2} if self.scenario_arg not in range(1, 7): self.cancel("Test need to skip as scenario will be 1-7") if self.scenario_arg in [2, 3, 4]: if memory.meminfo.Hugepagesize.mb != 16: self.cancel( "Test need to skip as 16MB huge need to configured") elif self.scenario_arg in [5, 6, 7]: if memory.meminfo.Hugepagesize.gb != 16: self.cancel( "Test need to skip as 16GB huge need to configured") if self.scenario_arg != 1: memory.set_num_huge_pages(dic[self.scenario_arg]) for packages in ['gcc', 'make']: if not smm.check_installed(packages) and not smm.install(packages): self.cancle('%s is needed for the test to be run' % packages) shutil.copyfile(os.path.join(self.datadir, 'va_test.c'), os.path.join(self.teststmpdir, 'va_test.c')) shutil.copyfile(os.path.join(self.datadir, 'Makefile'), os.path.join(self.teststmpdir, 'Makefile')) build.make(self.teststmpdir)
def setUp(self): ''' Build interbench Source: http://ck.kolivas.org/apps/interbench/interbench-0.31.tar.bz2 ''' sm_manager = SoftwareManager() for pkg in ['gcc', 'patch']: if (not sm_manager.check_installed(pkg) and not sm_manager.install(pkg)): self.cancel("%s is needed for the test to be run" % pkg) disk_free_mb = (disk.freespace(self.teststmpdir) / 1024) / 1024 if memory.memtotal()/1024 > disk_free_mb: self.cancel('Disk space is less than total memory. Skipping test') tarball = self.fetch_asset('http://slackware.cs.utah.edu/pub/kernel' '.org/pub/linux/kernel/people/ck/apps/' 'interbench/interbench-0.31.tar.gz') data_dir = os.path.abspath(self.datadir) archive.extract(tarball, self.srcdir) version = os.path.basename(tarball.split('.tar.')[0]) self.sourcedir = os.path.join(self.srcdir, version) # Patch for make file os.chdir(self.sourcedir) makefile_patch = 'patch -p1 < %s ' % ( os.path.join(data_dir, 'makefile_fix.patch')) process.run(makefile_patch, shell=True) build.make(self.sourcedir)
def setUp(self): ''' To check and install dependencies for the test ''' sm = SoftwareManager() detected_distro = distro.detect() depends = ["openssh-clients"] if detected_distro.name == "Ubuntu": depends.append("ibverbs") elif detected_distro.name == "redhat": depends.append("libibverbs") for package in depends: if not sm.check_installed(package): self.error("%s package is need to test" % package) if process.system("ibstat", shell=True) != 0: self.skip("infiniband adaptors not available") interfaces = netifaces.interfaces() self.flag = self.params.get("ext_flag", default="0") self.IF = self.params.get("Iface", default="") self.PEER_IP = self.params.get("PEERIP", default="") if self.IF not in interfaces: self.skip("%s interface is not available" % self.IF) if self.PEER_IP == "": self.skip("%s peer machine is not available" % self.PEER_IP) self.CA = self.params.get("CA_NAME", default="mlx4_0") self.GID = int(self.params.get("GID_NUM", default="0")) self.PORT = int(self.params.get("PORT_NUM", default="1")) self.PEER_CA = self.params.get("PEERCA", default="mlx4_0") self.PEER_GID = int(self.params.get("PEERGID", default="0")) self.PEER_PORT = int(self.params.get("PEERPORT", default="1")) self.to = self.params.get("timeout", default="120")
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"): print "Mdadm must be installed before continuing the test" if SoftwareManager().install("mdadm") is False: self.cancel("Unable to install mdadm") cmd = "mdadm -V" self.check_pass(cmd, "Unable to get mdadm version") self.disk = self.params.get('disks', default='').strip(" ") self.raidlevel = str(self.params.get('raid', default='0')) self.metadata = str(self.params.get('metadata', default='1.2')) self.setup = self.params.get('setup', default=True) self.run_test = self.params.get('run_test', default=False) self.cleanup = self.params.get('cleanup', default=True) self.sparedisk = "" if self.raidlevel == 'linear' or self.raidlevel == '0': self.disk_count = len(self.disk.split(" ")) else: self.disk = self.disk.split(" ") self.sparedisk = self.disk.pop() self.remadd = ''.join(self.disk[-1:]) self.disk_count = len(self.disk) self.disk = ' '.join(self.disk) self.force = self.params.get('force', default=False)
def setUp(self): if not memory.check_hotplug(): self.cancel("UnSupported : memory hotplug not enabled\n") sm = SoftwareManager() if not sm.check_installed('stress') and not sm.install('stress'): tarball = self.fetch_asset( 'https://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz') archive.extract(tarball, self.teststmpdir) self.sourcedir = os.path.join( self.teststmpdir, os.path.basename(tarball.split('.tar.')[0])) os.chdir(self.sourcedir) process.run('[ -x configure ] && ./configure', shell=True) build.make(self.sourcedir) build.make(self.sourcedir, extra_args='install') self.iteration = self.params.get('iteration', default=1) self.stresstime = self.params.get('stresstime', default=10) self.vmcount = self.params.get('vmcount', default=4) self.iocount = self.params.get('iocount', default=4) self.memratio = self.params.get('memratio', default=5) self.blocks_hotpluggable = get_hotpluggable_blocks( (os.path.join('%s', 'memory*') % mem_path), self.memratio) if os.path.exists("%s/auto_online_blocks" % mem_path): if not self.__is_auto_online(): self.hotplug_all(self.blocks_hotpluggable) clear_dmesg()
def setUp(self): self.tlbflush_max_entries = self.params.get('entries', default=200) self.tlbflush_iteration = self.params.get('iterations', default=50) self.nr_threads = self.params.get('nr_threads', default=50) # Check for basic utilities smm = SoftwareManager() if not smm.check_installed("gcc") and not smm.install("gcc"): self.error( "Fail to install %s required for this test." % package) data_dir = os.path.abspath(self.datadir) shutil.copyfile(os.path.join(data_dir, 'tlbflush.c'), os.path.join(self.srcdir, 'tlbflush.c')) os.chdir(self.srcdir) os.system('cp tlbflush.c /root/pp/tlbflush.c') tlbflush_patch = 'patch -p1 < %s' % ( os.path.join(data_dir, 'tlbflush.patch')) process.run(tlbflush_patch, shell=True) cmd = 'gcc -DFILE_SIZE=$((128*1048576)) -g -O2 tlbflush.c \ -lpthread -o tlbflush' process.run(cmd, shell=True)
def setUp(self): ''' Build Connectathon Source: git://git.linux-nfs.org/projects/steved/cthon04.git ''' self.nfail = 0 # Check for root permission if os.geteuid() != 0: exit("You need to have root privileges to run this script." "\nPlease try again, using 'sudo'. Exiting.") # Check for basic utilities smm = SoftwareManager() detected_distro = distro.detect() packages = ['gcc', 'make'] if detected_distro.name == "SuSE": packages.extend(['git-core']) else: packages.extend(['git']) for package in packages: if not smm.check_installed(package) and not smm.install(package): self.error("Fail to install %s required for this test." % package) self.tmpdir = tempfile.mkdtemp(prefix='avocado_' + __name__) data_dir = os.path.abspath(self.datadir) git.get_repo('git://git.linux-nfs.org/projects/steved/cthon04.git', destination_dir=self.srcdir) os.chdir(self.srcdir) build.make(self.srcdir)
def setUp(self): smm = SoftwareManager() self.minthreads = self.params.get( 'minthrd', default=(500 + cpu.online_cpus_count())) self.maxthreads = self.params.get('maxthrd', default=None) self.iothreads = self.params.get('iothrd', default=self.minthreads/2) self.maxmem = self.params.get('maxmem', default=int( memory.meminfo.MemFree.m / self.minthreads)) self.maxio = self.params.get('maxio', default=None) self.longthreads = self.params.get('longthrd', default=False) self.shrtthreads = self.params.get('shortthrd', default=False) self.time = self.params.get('time', default=100) self.iotime = self.params.get('iotime', default=50) if self.longthreads and self.shrtthreads: self.cancel('Please choose right inputs') dist = distro.detect() packages = ['gcc'] if dist.name == 'Ubuntu': packages.extend(['g++']) elif dist.name in ['SuSE', 'fedora', 'rhel']: packages.extend(['gcc-c++']) for package in packages: if not smm.check_installed(package) and not smm.install(package): self.cancel('%s is needed for the test to be run' % package) for file_name in ['dwh.cpp', 'Makefile']: self.copyutil(file_name) os.chdir(self.teststmpdir) if dist.name in ['fedora', 'rhel']: process.system('patch -p0 < %s' % self.get_data('fofd.patch'), shell=True) build.make(self.teststmpdir)
def setUp(self): ''' 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): ''' 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.error('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): ''' Use 85% of memory with/without many process forked WARNING: System may go out-of-memory based on the available resource ''' smm = SoftwareManager() self.itern = int(self.params.get('iterations', default='10')) self.procs = int(self.params.get('procs', default='1')) self.minmem = int(self.params.get('minmem', default='10')) self.fails = [] if not (self.itern and self.procs and self.minmem): self.cancel( 'Please use a non-zero value for number' ' of iterations, processes and memory to be used') self.freemem = int((0.85 * memory.freememtotal()) / 1024) # Check for basic utilities for packages in ['gcc', 'make']: if not smm.check_installed(packages) and not smm.install(packages): self.cancel('%s is needed for the test to be run' % packages) shutil.copyfile(self.get_data('forkoff.c'), os.path.join(self.teststmpdir, 'forkoff.c')) shutil.copyfile(self.get_data('Makefile'), os.path.join(self.teststmpdir, 'Makefile')) build.make(self.teststmpdir)
def setUp(self): ''' Build IOZone Source: http://www.iozone.org/src/current/iozone3_434.tar ''' self.base_dir = os.path.abspath(self.basedir) smm = SoftwareManager() for package in ['gcc', 'make', 'patch']: if not smm.check_installed(package) and not smm.install(package): self.cancel("%s is needed for the test to be run" % package) tarball = self.fetch_asset( 'http://www.iozone.org/src/current/iozone3_434.tar') archive.extract(tarball, self.teststmpdir) version = os.path.basename(tarball.split('.tar')[0]) self.sourcedir = os.path.join(self.teststmpdir, version) make_dir = os.path.join(self.sourcedir, 'src', 'current') os.chdir(make_dir) patch = self.params.get('patch', default='makefile.patch') patch = os.path.join(self.datadir, patch) process.run('patch -p3 < %s' % patch, shell=True) d_distro = distro.detect() arch = d_distro.arch if arch == 'ppc': build.make(make_dir, extra_args='linux-powerpc') elif arch == 'ppc64' or arch == 'ppc64le': build.make(make_dir, extra_args='linux-powerpc64') elif arch == 'x86_64': build.make(make_dir, extra_args='linux-AMD64') else: build.make(make_dir, extra_args='linux')
def setUp(self): ''' Build numatop Test Source: https://github.com/01org/numatop.git ''' # Check for basic utilities # TODO: Add support for other distributions self.numa_pid = None detected_distro = distro.detect().name.lower() if not detected_distro == "ubuntu": self.cancel("Upsupported OS %s" % detected_distro) smm = SoftwareManager() for package in ['gcc', 'numatop', 'make', 'libnuma-dev']: if not smm.check_installed(package) and not smm.install(package): self.cancel("Failed to install %s, which is needed for" "the test to be run" % package) locations = ["https://github.com/01org/numatop/archive/master.zip"] tarball = self.fetch_asset("numatop.zip", locations=locations, expire='7d') archive.extract(tarball, self.srcdir) self.sourcedir = os.path.join(self.srcdir, 'numatop-master') os.chdir(self.sourcedir) build.make(self.sourcedir, extra_args='test')
def setUp(self): """ 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.skip("%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.skip("%s interface is not available" % self.iface) if self.peer_ip == "": self.skip("%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') tarball = self.fetch_asset('ftp://ftp.netperf.org/netperf/' 'netperf-2.7.0.tar.bz2', 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.skip("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")
def setUp(self): """ Verify the system is Baremetal and cpupower tool is installed. """ 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] ] 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)
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)
def setUp(self): sm = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make'] 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/julman99/eatmemory/archive/master.zip' tarball = self.fetch_asset("eatmemory.zip", locations=[url], expire='7d') archive.extract(tarball, self.srcdir) self.srcdir = os.path.join(self.srcdir, "eatmemory-master") build.make(self.srcdir) mem = self.params.get('memory_to_test', default=memory.memtotal()) self.mem_to_eat = self._mem_to_mbytes(mem) if self.mem_to_eat is None: self.error("Memory '%s' not valid." % mem)
def setUp(self): sm = SoftwareManager() self.detected_distro = distro.detect() if not sm.check_installed("powerpc-utils") and \ not sm.install("powerpc-utils"): self.cancel("powerpc-utils is needed for the test to be run") distro_name = self.detected_distro.name distro_ver = self.detected_distro.version distro_rel = self.detected_distro.release if distro_name == "rhel": if (distro_ver == "7" or (distro_ver == "8" and distro_rel < "4")): self.cancel("smtstate tool is supported only after RHEL8.4") elif distro_name == "SuSE": if (distro_ver == "12" or (distro_ver == "15" and distro_rel < 3)): self.cancel("smtstate tool is supported only after SLES15 SP3") else: self.cancel("Test case is supported only on RHEL and SLES")
def setUp(self): smm = SoftwareManager() # Check for basic utilities self.tmpdir = data_dir.get_tmp_dir() self.report_data = self.err = None self.build_dir = self.params.get('build_dir', default=self.tmpdir) for package in ['gcc', 'make', 'patch']: if not smm.check_installed(package) and not smm.install(package): self.cancel('%s is needed for the test to be run' % package) url = 'https://github.com/kdlucas/byte-unixbench/archive/master.zip' tarball = self.fetch_asset("byte-unixbench.zip", locations=[url], expire='7d') archive.extract(tarball, self.srcdir) self.sourcedir = os.path.join(self.srcdir, "byte-unixbench-master/UnixBench") os.chdir(self.sourcedir) build.make(self.sourcedir)
def setUp(self): ''' Install the basic packages to support krb5 ''' # 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/krb5/krb5/archive/master.zip" tarball = self.fetch_asset(url, expire='7d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join(self.workdir, 'krb5-master/src') os.chdir(self.sourcedir) process.run('autoreconf', ignore_status=True) process.run('./configure', ignore_status=True) build.make(self.sourcedir)
def setUp(self): ''' Build Pmqa Test Source: git://git.linaro.org/power/pm-qa.git ''' if not os.path.exists('/sys/devices/system/cpu/cpu0/cpufreq'): self.cancel('sysfs directory for cpufreq is unavailable.') # Check for basic utilities smm = SoftwareManager() for package in ['gcc', 'make']: if not smm.check_installed(package) and not smm.install(package): self.cancel("Fail to install %s required for this test." % package) git.get_repo('git://git.linaro.org/power/pm-qa.git', destination_dir=self.srcdir) self.test_type = self.params.get('run_arg', default='cpufreq')
def setUp(self): """ Preparing the machie for the cxl test """ self.script = self.params.get('script', default='memcpy_afu_ctx') self.args = self.params.get('args', default='') lspci_out = process.system_output("lspci") if "accelerators" not in lspci_out: self.cancel("No capi card preset. Unable to initialte the test") smngr = SoftwareManager() for pkgs in ['gcc', 'make', 'automake', 'autoconf']: if not smngr.check_installed(pkgs) and not smngr.install(pkgs): self.cancel('%s is needed for the test to be run' % pkgs) git.get_repo('https://github.com/ibm-capi/cxl-tests.git', destination_dir=self.teststmpdir) os.chdir(self.teststmpdir) if not os.path.isfile('memcpy_afu_ctx'): build.make(".")
def setUp(self): sm = SoftwareManager() self.detected_distro = distro.detect() if not sm.check_installed("powerpc-utils") and not sm.install( "powerpc-utils"): self.cancel("powerpc-utils is needed for the test to be run") distro_name = self.detected_distro.name if distro_name == "rhel": if (self.detected_distro.version < "8" or self.detected_distro.release < "4"): self.cancel("smtstate tool is supported only after rhel8.4") elif distro_name == "SuSE": if (self.detected_distro.version < 15 or self.detected_distro.release < 3): self.cancel("smtstate tool is supported only after sles15 sp3") else: self.cancel("Test case is supported only on RHEL and SLES")
def setUp(self): smm = SoftwareManager() memsize = int(memory.freememtotal() * 1024 * 0.9) self.nr_pages = self.params.get('nr_pages', default=None) self.in_err = self.params.get('induce_err', default=0) self.failure = self.params.get('failure', default=False) if not self.nr_pages: self.nr_pages = 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 ['mprotect.c', 'Makefile']: self.copyutil(file_name) build.make(self.teststmpdir)
def setUp(self): dist = distro.detect() sm = SoftwareManager() if dist.name in ['Ubuntu', 'debian']: 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', 'centos']: sos_pkg = 'sos' else: self.cancel("sosreport is not supported on %s" % dist.name) if not sm.check_installed(sos_pkg) and not sm.install(sos_pkg): self.cancel("Package %s is missing and could not be installed" % sos_pkg) if dist.name == "rhel" and dist.version > "7" and dist.release >= "4": self.sos_cmd = "sos report" else: self.sos_cmd = "sosreport"
def setUp(self): # Check for basic utilities smm = SoftwareManager() for package in ("gcc", "make"): if not smm.check_installed(package) and not smm.install(package): self.error("Fail to install %s required for this test." % package) git.get_repo( 'git://perfmon2.git.sourceforge.net/gitroot' '/perfmon2/libpfm4', destination_dir=self.srcdir) os.chdir(self.srcdir) build.make('.')
def setUp(self): ''' To check and install dependencies for the test ''' self.host_interfaces = self.params.get("host_interfaces", default="").split(",") if not self.host_interfaces: self.skip("user should specify host interfaces") smm = SoftwareManager() if not smm.check_installed("iputils-ping") and not\ smm.install("iputils-ping"): self.skip("iputils-ping package is need to test") self.peer_ips = self.params.get("peer_ips", default="").split(",") interfaces = netifaces.interfaces() for self.host_interface in self.host_interfaces: if self.host_interface not in interfaces: self.skip("interface is not available") self.count = self.params.get("count", default="1000")
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)
def setUp(self): sm = SoftwareManager() self.is_fail = 0 dist = distro.detect() packages = ['lshw', 'net-tools', 'pciutils'] if dist.name == "SuSE" and 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 dist.version.version >= 18) or dist.name == "SuSE": 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)
def setUp(self): """ Setup and install dependencies for the test. """ self.test_name = "ping6" 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("Iface", default="") self.peer_iface = self.params.get("PEER_Iface", default="") self.peer_ip = self.params.get("PEERIP", default="") self.ipv6_peer = self.params.get("IPV6_PEER", 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'] if 10 in netifaces.ifaddresses(self.iface): self.l_v6 = netifaces.ifaddresses(self.iface)[AF_INET6][0]['addr'] else: self.l_v6 = "" self.option = self.option.replace("PEER_Iface", self.peer_iface) self.option = self.option.replace("Iface", self.iface) self.option = self.option.replace("PEERIP", self.peer_ip) self.option = self.option.replace("LOCALIP", self.local_ip) self.option = self.option.replace("IPV6_PEER", self.ipv6_peer) self.option = self.option.replace("IPV6_LOCAL", self.l_v6) self.option_list = self.option.split(",")
def setUp(self): ''' To check and install dependencies for the test ''' interfaces = netifaces.interfaces() self.flag = self.params.get("ext_flag", default="0") self.IF = self.params.get("interface", default="") self.PEER_IP = self.params.get("peer_ip", default="") if self.IF not in interfaces: self.skip("%s interface is not available" % self.IF) if self.PEER_IP == "": self.skip("%s peer machine is not available" % self.PEER_IP) self.CA = self.params.get("CA_NAME", default="mlx4_0") self.GID = int(self.params.get("GID_NUM", default="0")) self.PORT = int(self.params.get("PORT_NUM", default="1")) self.PEER_CA = self.params.get("PEERCA", default="mlx4_0") self.PEER_GID = int(self.params.get("PEERGID", default="0")) self.PEER_PORT = int(self.params.get("PEERPORT", default="1")) self.to = self.params.get("timeout", default="120") sm = SoftwareManager() detected_distro = distro.detect() depends = ["openssh-clients"] if detected_distro.name == "Ubuntu": depends.append("ibverbs") cmd = "service ufw stop" elif detected_distro.name in ['redhat', 'fedora']: depends.append("libibverbs") 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") for package in depends: if not sm.check_installed(package): self.error("%s package is need to test" % package) if process.system("ibstat", shell=True, ignore_status=True) != 0: self.skip("infiniband adaptors not available")
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(["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) 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="") configure_network.set_ip(self.ipaddr, self.netmask, self.iface) if not wait.wait_for(configure_network.is_interface_link_up, timeout=120, args=[self.iface]): self.fail("Link up of interface is taking longer than 120 seconds") self.peer = self.params.get("peer_ip") if not self.peer: self.cancel("No peer provided") self.mtu = self.params.get("mtu", default=1500) self.peer_user = self.params.get("peer_user", default="root") self.peer_password = self.params.get("peer_password", '*', default=None) self.peerinfo = PeerInfo(self.peer, peer_user=self.peer_user, peer_password=self.peer_password) self.peer_interface = self.peerinfo.get_peer_interface(self.peer) self.mtu = self.params.get("mtu", default=1500) self.mtu_set() if not wait.wait_for(configure_network.is_interface_link_up, timeout=120, args=[self.iface]): self.fail("Link up of interface is taking longer than 120 seconds") if not configure_network.ping_check(self.iface, self.peer, "5"): self.cancel("No connection to peer")
def setUp(self): smm = SoftwareManager() dist = distro.detect() memsize = int(memory.freememtotal() * 1024 * 0.2) self.nr_pages = self.params.get( 'nr_pages', default=memsize / memory.get_page_size()) self.map_type = self.params.get('map_type', default='private') self.hpage = self.params.get('h_page', default=False) nodes = memory.numa_nodes_with_memory() if len(nodes) < 2: self.cancel('Test requires two numa nodes to run.' 'Node list with memory: %s' % nodes) pkgs = ['gcc', 'make'] hp_check = 0 if self.hpage: hp_size = memory.get_huge_page_size() for node in nodes: genio.write_file('/sys/devices/system/node/node%s/hugepages/hu' 'gepages-%skB/nr_hugepages' % (node, str(hp_size)), str(self.nr_pages)) for node in nodes: hp_check += int(genio.read_file( '/sys/devices/system/node/node%s/hugepages/hugepages-%skB' 'nr_hugepages' % (node, str(hp_size))).strip()) if hp_check < self.nr_pages: self.cancel('Not enough pages to be configured on nodes') if dist.name == "Ubuntu": pkgs.extend(['libpthread-stubs0-dev', 'libnuma-dev', 'libhugetlbfs-dev']) elif dist.name in ["centos", "rhel", "fedora"]: pkgs.extend(['numactl-devel', 'libhugetlbfs-devel']) else: pkgs.extend(['libnuma-devel', 'libhugetlbfs-devel']) for package in pkgs: if not smm.check_installed(package) and not smm.install(package): self.cancel('%s is needed for the test to be run' % package) for file_name in ['util.c', 'numa_test.c', 'Makefile']: self.copyutil(file_name) build.make(self.teststmpdir)
def setUp(self): """ To check and install dependencies for the test """ smm = SoftwareManager() for pkg in ["gcc", "autoconf", "perl", "m4"]: 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") iperf_download = self.params.get("iperf_download", default="https:" "//github.com/esnet/" "iperf/archive/master.zip") tarball = self.fetch_asset(iperf_download, expire='7d') archive.extract(tarball, self.teststmpdir) self.iperf_dir = os.path.join(self.teststmpdir, "iperf-master") cmd = "scp -r %s %s@%s:/tmp" % (self.iperf_dir, self.peer_user, self.peer_ip) if process.system(cmd, shell=True, ignore_status=True) != 0: self.cancel("unable to copy the iperf into peer machine") cmd = "ssh %s@%s \"cd /tmp/iperf-master;./configure; " \ "make\"" % (self.peer_user, self.peer_ip) if process.system(cmd, ignore_status=True, shell=True, sudo=True): self.cancel("Unable to compile Iperf into peer machine") self.iperf_run = str(self.params.get("IPERF_SERVER_RUN", default=0)) if self.iperf_run == '1': cmd = "ssh %s@%s \"cd /tmp/iperf-master/src/;./iperf3 -s\""\ % (self.peer_user, self.peer_ip) obj = process.SubProcess(cmd, verbose=False, shell=True) obj.start() os.chdir(self.iperf_dir) process.system('./configure', shell=True) build.make(self.iperf_dir) self.iperf = os.path.join(self.iperf_dir, 'src') self.expected_tp = self.params.get("EXPECTED_THROUGHPUT", default="85") speed = int(read_file("/sys/class/net/%s/speed" % self.iface)) self.expected_tp = int(self.expected_tp) * speed / 100
def setUp(self): ''' check the availability of perftest package installed perftest package should be installed ''' sm = SoftwareManager() depends = ["openssh-clients", "perftest"] for pkg in depends: if not sm.check_installed(pkg) and not sm.install(pkg): self.skip("%s package is need to test" % pkg) interfaces = netifaces.interfaces() self.flag = self.params.get("ext_flag", default="0") self.IF = self.params.get("interface", default="") self.PEER_IP = self.params.get("peer_ip", default="") if self.IF not in interfaces: self.skip("%s interface is not available" % self.IF) if self.PEER_IP == "": self.skip("%s peer machine is not available" % self.PEER_IP) self.CA = self.params.get("CA_NAME", default="mlx4_0") self.PORT = self.params.get("PORT_NUM", default="1") self.PEER_CA = self.params.get("PEERCA", default="mlx4_0") self.PEER_PORT = self.params.get("PEERPORT", default="1") self.to = self.params.get("timeout", default="600") self.tool_name = self.params.get("tool", default="") if self.tool_name == "": self.skip("should specify tool name") self.log.info("test with %s" % (self.tool_name)) self.test_op = self.params.get("test_opt", default="").split(",") self.ext_test_op = self.params.get("ext_opt", default="").split(",") 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")
def setUp(self): ''' Build Libunwind library Source: https://github.com/pathscale/libunwind/archive/vanilla_pathscale.zip ''' dist = distro.detect() smm = SoftwareManager() deps = ['gcc', 'libtool', 'autoconf', 'automake', 'make'] if dist.name == 'Ubuntu': deps.extend([ 'dh-autoreconf', 'dh-dist-zilla', 'g++', 'texlive-extra-utils' ]) elif dist.name in ['SuSE', 'rhel', 'fedora', 'redhat']: deps.extend(['gcc-c++']) else: self.cancel('Test not supported in %s' % dist.name) 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) tarball = self.fetch_asset( 'vanilla_pathscale.zip', locations=[ 'https://github.com/pathscale/libunwind/archive/' 'vanilla_pathscale.zip' ], expire='7d') archive.extract(tarball, self.srcdir) self.sourcedir = os.path.join(self.srcdir, 'libunwind-vanilla_pathscale') os.chdir(self.sourcedir) process.run('./autogen.sh', shell=True) ''' For configure options on different architecture please refer https://github.com/pathscale/libunwind ''' configure_option = self.params.get('configure_option', default='configure_option') process.run('./configure %s' % configure_option, shell=True) build.make(self.sourcedir) build.make(self.sourcedir, extra_args='install')
def setUp(self): """ Gets the console and set-up the machine for test """ if 'ppc' not in distro.detect().arch: self.cancel("Processor is not ppc64") eeh_enable_file = "/sys/kernel/debug/powerpc/eeh_enable" if '0x1' not in genio.read_file(eeh_enable_file).strip(): self.cancel("EEH is not enabled, please enable via FSP") self.max_freeze = self.params.get('max_freeze', default=1) self.pci_device = self.params.get('pci_device', default="") self.add_cmd = self.params.get('additional_command', default='') if not self.pci_device: self.cancel("No PCI Device specified") self.function = str(self.params.get('function')).split(" ") smm = SoftwareManager() if not smm.check_installed("pciutils") and not smm.install("pciutils"): self.cancel("pciutils package is need to test") self.mem_addr = pci.get_memory_address(self.pci_device) self.mask = pci.get_mask(self.pci_device) if self.is_baremetal(): cmd = "echo %d > /sys/kernel/debug/powerpc/eeh_max_freezes"\ % self.max_freeze process.system(cmd, ignore_status=True, shell=True) self.phb = self.pci_device.split(":", 1)[0] self.addr = genio.read_file("/sys/bus/pci/devices/%s/" "eeh_pe_config_addr" % self.pci_device) self.addr = str(self.addr).rstrip() self.err = 0 for line in process.system_output('lspci -vs %s' % self.pci_device, ignore_status=True, shell=True).decode("utf-8\ ").splitlines(): if 'Memory' in line and '64-bit, prefetchable' in line: self.err = 1 break else: self.pci_class_name = pci.get_pci_class_name(self.pci_device) if self.pci_class_name == 'fc_host': self.pci_class_name = 'scsi_host' self.pci_interface = pci.get_interfaces_in_pci_address( self.pci_device, self.pci_class_name)[-1] self.log.info("===============Testing EEH Frozen PE==================")
def setUp(self): sm = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'git', 'make', 'automake', 'autoconf'] for package in deps: if package == 'git' and detected_distro.name == "SuSE": package = 'git-core' if not sm.check_installed(package) and not sm.install(package): self.error(package + ' is needed for the test to be run') git.get_repo('https://github.com/linux-test-project/ltp.git', destination_dir=self.srcdir) os.chdir(self.srcdir) build.make(self.srcdir, extra_args='autotools') ltpbin_dir = os.path.join(self.srcdir, 'bin') os.mkdir(ltpbin_dir) process.system('./configure --prefix=%s' % ltpbin_dir) build.make(self.srcdir, extra_args='-j %d' % multiprocessing.cpu_count()) build.make(self.srcdir, extra_args='install')
def setUp(self): ''' Build Trinity Source: https://github.com/kernelslacker/trinity ''' """ Add not root user """ if process.system('getent group trinity', ignore_status=True): process.run('groupadd trinity', sudo=True) if process.system('getent passwd trinity', ignore_status=True): process.run('useradd -g trinity -m -d /home/trinity trinity', sudo=True) process.run('usermod -a -G trinity trinity', sudo=True) smm = SoftwareManager() for package in ("gcc", "make"): if not smm.check_installed(package) and not smm.install(package): self.error("Fail to install %s required for this test." % package) locations = [ "https://github.com/kernelslacker/trinity/archive/" "master.zip" ] tarball = self.fetch_asset("trinity.zip", locations=locations, expire='7d') archive.extract(tarball, self.srcdir) self.sourcedir = os.path.join(self.srcdir, 'trinity-master') os.chdir(self.sourcedir) process.run('chmod -R +x ' + self.sourcedir) process.run('./configure', shell=True) build.make('.') process.run('touch trinity.log') process.run('cp -r ' + self.sourcedir + ' /home/trinity') self.sourcedir = os.path.join('/home/trinity', 'trinity-master') process.run('chown -R trinity:trinity ' + self.sourcedir)
def setUp(self): """ Resolve the packages dependencies and download the source. """ smg = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make', 'automake', 'autoconf'] if 'Ubuntu' in detected_distro.name: deps.extend([ 'libpopt0', 'libc6', 'libc6-dev', 'libpopt-dev', 'libcap-ng0', 'libcap-ng-dev', 'libnuma-dev', 'libfuse-dev' ]) 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' ]) 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 !!")
def setUp(self): """ Verifies if we have gcc to compile disktest. :param disk: Disk to be used in test. :param dir: Directory of used in test. When the target does not exist, it's created. :param gigabytes: Disk space that will be used for the test to run. :param chunk_mb: Size of the portion of the disk used to run the test. Cannot be smaller than the total amount of RAM. """ softm = SoftwareManager() if not softm.check_installed("gcc") and not softm.install("gcc"): self.cancel('Gcc is needed for the test to be run') # Log of all the disktest processes self.disk_log = os.path.abspath(os.path.join(self.outputdir, "log.txt")) self._init_params() self._compile_disktest()
def setUp(self): """ Verify it is baremetal Install the cpupower tool """ if not os.path.exists('/proc/device-tree/ibm,opal/power-mgt'): self.cancel("Supported only on Power Non Virutalized environment") smm = SoftwareManager() detected_distro = distro.detect() if 'Ubuntu' in detected_distro.name: deps = [ 'linux-tools-common', 'linux-tools-%s' % platform.uname()[2] ] 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)
def setup_htx(self): """ Builds HTX """ detected_distro = distro.detect() packages = ['git', 'gcc', 'make'] if detected_distro.name in ['centos', 'fedora', 'rhel', 'redhat']: packages.extend(['gcc-c++', 'ncurses-devel', 'tar']) elif detected_distro.name == "Ubuntu": packages.extend( ['libncurses5', 'g++', 'ncurses-dev', 'libncurses-dev']) elif detected_distro.name == 'SuSE': packages.extend(['libncurses5', 'gcc-c++', 'ncurses-devel', 'tar']) else: self.cancel("Test not supported in %s" % detected_distro.name) smm = SoftwareManager() for pkg in packages: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("Can not install %s" % pkg) url = "https://github.com/open-power/HTX/archive/master.zip" tarball = self.fetch_asset("htx.zip", locations=[url], expire='7d') archive.extract(tarball, self.teststmpdir) htx_path = os.path.join(self.teststmpdir, "HTX-master") os.chdir(htx_path) exercisers = ["hxecapi_afu_dir", "hxedapl", "hxecapi", "hxeocapi"] for exerciser in exercisers: process.run("sed -i 's/%s//g' %s/bin/Makefile" % (exerciser, htx_path)) build.make(htx_path, extra_args='all') build.make(htx_path, extra_args='tar') process.run('tar --touch -xvzf htx_package.tar.gz') os.chdir('htx_package') if process.system('./installer.sh -f'): self.fail("Installation of htx fails:please refer job.log") self.log.info("Starting the HTX Deamon") process.run('/usr/lpp/htx/etc/scripts/htxd_run') self.log.info("Creating the HTX mdt files") process.run('htxcmdline -createmdt')