def setUp(self): ''' Build ebizzy Source: http://liquidtelecom.dl.sourceforge.net/project/ebizzy/ebizzy/0.3 /ebizzy-0.3.tar.gz ''' sm = SoftwareManager() for package in ['gcc', 'make', 'patch']: if not sm.check_installed(package) and not sm.install(package): self.cancel("%s is needed for the test to be run" % package) tarball = self.fetch_asset('http://liquidtelecom.dl.sourceforge.net' '/project/ebizzy/ebizzy/0.3' '/ebizzy-0.3.tar.gz') archive.extract(tarball, self.workdir) version = os.path.basename(tarball.split('.tar.')[0]) self.sourcedir = os.path.join(self.workdir, version) patch = self.params.get( 'patch', default='Fix-build-issues-with-ebizzy.patch') os.chdir(self.sourcedir) p1 = 'patch -p0 < %s' % (self.get_data(patch)) process.run(p1, shell=True) process.run('[ -x configure ] && ./configure', shell=True) build.make(self.sourcedir)
def uncompress(self): """ Uncompress kernel source. """ log.info("Uncompressing tarball") path = os.path.join(self.work_dir, self.kernel_file) archive.extract(path, self.work_dir)
def setUp(self): ''' Build interbench Source: http://ck.kolivas.org/apps/interbench/interbench-0.31.tar.bz2 ''' sm_manager = SoftwareManager() if (not sm_manager.check_installed("gcc") and not sm_manager.install("gcc")): self.error("Gcc is needed for the test to be run") tarball = self.fetch_asset('http://ck.kolivas.org' '/apps/interbench/' 'interbench-0.31.tar.bz2') 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 for make file os.chdir(self.srcdir) makefile_patch = 'patch -p1 < %s ' % ( os.path.join(data_dir, 'makefile_fix.patch')) process.run(makefile_patch, shell=True) build.make(self.srcdir)
def setUp(self): """ fs_mark """ smm = SoftwareManager() tarball = self.fetch_asset('https://github.com/josefbacik/fs_mark/' 'archive/master.zip') archive.extract(tarball, self.teststmpdir) self.sourcedir = os.path.join(self.teststmpdir, 'fs_mark-master') os.chdir(self.sourcedir) process.run('make') build.make(self.sourcedir) self.disk = self.params.get('disk', default=None) self.num = self.params.get('num_files', default='1024') self.size = self.params.get('size', default='1000') self.dir = self.params.get('dir', default=self.srcdir) self.fstype = self.params.get('fs', default='ext4') if self.fstype == 'btrfs': if distro.detect().name == 'Ubuntu': if not smm.check_installed("btrfs-tools") and not \ smm.install("btrfs-tools"): self.cancel('btrfs-tools is needed for the test to be run') if self.disk is not None: self.part_obj = Partition(self.disk, mountpoint=self.dir) self.log.info("Test will run on %s", self.dir) self.log.info("Unmounting the disk before creating file system") self.part_obj.unmount() self.log.info("creating file system") self.part_obj.mkfs(self.fstype) self.log.info("Mounting disk %s on dir %s", self.disk, self.dir) self.part_obj.mount()
def setUp(self): ''' 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 posixtest Source: http://ufpr.dl.sourceforge.net/sourceforge/posixtest/posixtestsuite-1.5.2.tar.gz ''' sm = SoftwareManager() for package in ['gcc', 'make', 'patch']: if not sm.check_installed(package) and not sm.install(package): self.cancel("%s is needed for the test to be run" % package) tarball = self.fetch_asset('http://ufpr.dl.sourceforge.net' '/sourceforge/posixtest/posixtestsuite-1.5.2.tar.gz') data_dir = os.path.abspath(self.datadir) archive.extract(tarball, self.srcdir) version = os.path.basename(tarball.split('-1.')[0]) self.sourcedir = os.path.join(self.srcdir, version) patch = self.params.get( 'patch', default='posix-linux.patch') os.chdir(self.sourcedir) p1 = 'patch -p1 < %s/%s' % (data_dir, patch) process.run(p1, shell=True) build.make(self.sourcedir)
def setUp(self): sm = SoftwareManager() detected_distro = distro.detect() self.tmpdir = data_dir.get_tmp_dir() # Check for basic utilities for package in ['gcc', 'make', 'gfortran']: if detected_distro.name == "SuSE" and package == "gfortran": package = 'gcc-fortran' if detected_distro.name == "redhat" and package == "gfortran": package = 'gcc-gfortran' if not sm.check_installed(package) and not sm.install(package): self.error(package + ' is needed for the test to be run') atlas_url = 'https://sourceforge.net/projects/'\ 'math-atlas/files/Stable/3.10.3/atlas3.10.3.tar.bz2' lapack_url = 'http://www.netlib.org/lapack/lapack-3.6.1.tgz' atlas_url = self.params.get('atlas_url', default=atlas_url) lapack_url = self.params.get('lapack_url', default=lapack_url) atlas_tarball = self.fetch_asset(atlas_url, expire='7d') archive.extract(atlas_tarball, self.srcdir) self.atlas_dir = os.path.join(self.srcdir, 'ATLAS') self.atlas_build_dir = os.path.join(self.atlas_dir, 'atlas_build_dir') os.makedirs(self.atlas_build_dir) lapack_tarball = self.fetch_asset(lapack_url, expire='7d') os.chdir(self.atlas_build_dir) config_args = '--shared -b 64 '\ '--with-netlib-lapack-tarfile=%s' % lapack_tarball config_args = self.params.get('config_args', default=config_args) process.system('../configure %s' % config_args) # Tune and compile library build.make(self.atlas_build_dir)
def setUp(self): ''' Build ebizzy Source: http://liquidtelecom.dl.sourceforge.net/project/ebizzy/ebizzy/0.3 /ebizzy-0.3.tar.gz ''' sm = SoftwareManager() if not sm.check_installed("gcc") and not sm.install("gcc"): self.error("Gcc is needed for the test to be run") tarball = self.fetch_asset('http://liquidtelecom.dl.sourceforge.net' '/project/ebizzy/ebizzy/0.3' '/ebizzy-0.3.tar.gz') data_dir = os.path.abspath(self.datadir) archive.extract(tarball, self.srcdir) version = os.path.basename(tarball.split('.tar.')[0]) self.srcdir = os.path.join(self.srcdir, version) patch = self.params.get( 'patch', default='Fix-build-issues-with-ebizzy.patch') os.chdir(self.srcdir) p1 = 'patch -p0 < %s/%s' % (data_dir, patch) process.run(p1, shell=True) process.run('[ -x configure ] && ./configure', shell=True) build.make(self.srcdir)
def setUp(self): ''' Build 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 ebizzy ''' if 'ppc' not in distro.detect().arch: self.cancel("Processor is not ppc64") smg = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make', 'patch'] if 'Ubuntu' in detected_distro.name: deps.extend(['linux-tools-common', 'linux-tools-%s' % platform.uname()[2]]) elif detected_distro.name == "SuSE": deps.extend(['cpupower']) else: deps.extend(['kernel-tools']) for package in deps: if not smg.check_installed(package) and not smg.install(package): self.cancel("%s is needed for the test to be run" % package) tarball = self.fetch_asset('http://liquidtelecom.dl.sourceforge.net' '/project/ebizzy/ebizzy/0.3' '/ebizzy-0.3.tar.gz') archive.extract(tarball, self.workdir) version = os.path.basename(tarball.split('.tar.')[0]) self.sourcedir = os.path.join(self.workdir, version) patch = self.params.get( 'patch', default='Fix-build-issues-with-ebizzy.patch') os.chdir(self.sourcedir) fix_patch = 'patch -p0 < %s' % (self.get_data(patch)) process.run(fix_patch, shell=True) process.run("./configure") build.make(self.sourcedir)
def setUp(self): 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): sm = SoftwareManager() dist = distro.detect() packages = ['gcc', 'dejagnu', 'flex', 'bison', 'texinfo'] if dist.name == 'Ubuntu': packages.extend(['g++', 'binutils-dev']) # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif dist.name in ['SuSE', 'rhel', 'fedora', 'redhat']: packages.extend(['gcc-c++', 'binutils-devel', 'texi2html']) else: self.fail('no packages list for your distro.') for package in packages: if not sm.check_installed(package) and not sm.install(package): self.error("Fail to install %s required for this test." % package) test_type = self.params.get('type', default='upstream') if test_type == 'upstream': gdb_version = self.params.get('gdb_version', default='7.10') tarball = self.fetch_asset( "http://ftp.gnu.org/gnu/gdb/gdb-%s.tar.gz" % gdb_version) archive.extract(tarball, self.workdir) sourcedir = os.path.join( self.workdir, os.path.basename(tarball.split('.tar')[0])) elif test_type == 'distro': sourcedir = os.path.join(self.workdir, 'gdb-distro') if not os.path.exists(sourcedir): os.makedirs(sourcedir) sourcedir = sm.get_source("gdb", sourcedir) os.chdir(sourcedir) process.run('./configure', ignore_status=True, sudo=True) build.make(sourcedir)
def setUp(self): ''' Build Ioping Test ''' # Check for basic utilities smm = SoftwareManager() self.count = self.params.get('count', default='2') self.mode = self.params.get('mode', default='-C') self.deadline = self.params.get('deadline', default='10') self.period = self.params.get('period', default='10') self.interval = self.params.get('interval', default='1s') self.size = self.params.get('size', default='4k') self.wsize = self.params.get('wsize', default='10m') self.disk = self.params.get('disk', default='/home') for package in ['gcc', 'make']: if not smm.check_installed(package) and not smm.install(package): self.cancel( "Fail to install %s required for this test." % package) tarball = self.fetch_asset('https://storage.googleapis.com/' 'google-code-archive-downloads/v2/' 'code.google.com/ioping/' 'ioping-0.8.tar.gz', expire='0d') archive.extract(tarball, self.teststmpdir) version = os.path.basename(tarball.split('.tar.')[0]) self.sourcedir = os.path.join(self.teststmpdir, version) build.make(self.sourcedir)
def setUp(self): ''' Build 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): """ 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): ''' 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): """ Download 'nvme-cli'. """ self.device = self.params.get('device', default='/dev/nvme0') self.disk = self.params.get('disk', default='/dev/nvme0n1') self.test = self.params.get('test', default='') if not self.test: self.cancel('no test specified in yaml') cmd = 'ls %s' % self.device if process.system(cmd, ignore_status=True) is not 0: self.cancel("%s does not exist" % self.device) 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') py_pkgs = ['nose', 'nose2', 'pep8', 'flake8', 'pylint', 'epydoc'] installed_py_pkgs = [pkg[1] for pkg in list(pkgutil.iter_modules())] py_pkgs_not_installed = list(set(py_pkgs) - set(installed_py_pkgs)) if py_pkgs_not_installed: self.cancel("python packages %s not installed" % ", ".join(py_pkgs_not_installed)) 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") 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))
def setUp(self): # Check for basic utilities self._sm = SoftwareManager() # Install required tools and resolve dependencies needed_deps = ['make', 'gcc', 'dejagnu', 'elfutils', 'autoconf', 'automake'] dist = distro.detect() if dist.name.lower() == 'ubuntu': needed_deps.extend(['build-essential']) for pkg in needed_deps: self.check_install(pkg) run_type = self.params.get("type", default="upstream") # Extract - binutils # Source: https://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.bz2 if run_type == "upstream": version = self.params.get('binutils_version', default='2.27') locations = [ "https://www.mirrorservice.org/sites/sourceware.org" "/pub/binutils/releases/binutils-%s.tar.bz2" % version] tarball = self.fetch_asset("binutils-%s.tar.bz2" % version, locations=locations) archive.extract(tarball, self.workdir) self.sourcedir = os.path.join( self.workdir, os.path.basename(tarball.split('.tar.')[0])) elif run_type == "distro": self.sourcedir = os.path.join(self.workdir, "binutils-distro") if not os.path.exists(self.sourcedir): self.sourcedir = self._sm.get_source("binutils", self.sourcedir) # Compile the binutils os.chdir(self.sourcedir) process.run('./configure') build.make(self.sourcedir)
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): 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 'nvme-cli' and setup the device. """ self.device = self.params.get('device', default='/dev/nvme0') cmd = 'ls %s' % self.device if process.system(cmd, ignore_status=True) is not 0: self.skip("%s does not exist" % self.device) locations = ["https://github.com/linux-nvme/nvme-cli/archive/" "master.zip"] tarball = self.fetch_asset("nvme-cli.zip", locations=locations, expire='15d') archive.extract(tarball, self.srcdir) os.chdir("%s/nvme-cli-master" % self.srcdir) process.system("./NVME-VERSION-GEN", ignore_status=True) if process.system_output("cat NVME-VERSION-FILE").strip("\n").\ split()[-1] != process.system_output("nvme version").\ strip("\n").split()[-1]: build.make(".") build.make(".", extra_args='install') self.id_ns = self.create_namespace() self.log.info(self.id_ns) cmd = "nvme id-ns %s | grep 'in use' | awk '{print $5}' | \ awk -F':' '{print $NF}'" % self.id_ns self.format_size = process.system_output(cmd, shell=True).strip('\n') self.format_size = pow(2, int(self.format_size)) cmd = "nvme id-ns %s | grep 'in use' | awk '{print $2}'" % self.id_ns self.lba = process.system_output(cmd, shell=True).strip('\n')
def setUp(self): softm = SoftwareManager() pkgs = ['gcc', 'make'] if distro.detect().name in ['SuSE', 'Ubuntu']: pkgs.extend(['libpfm4']) else: pkgs.extend(['libpfm']) for pkg in pkgs: if not softm.check_installed(pkg) and not softm.install(pkg): self.cancel("%s is needed for the test to be run" % pkg) test_type = self.params.get('type', default='upstream') if test_type == 'upstream': tarball = self.fetch_asset( 'https://netix.dl.sourceforge.net/project/perfmon2/' 'libpfm4/libpfm-4.9.0.tar.gz', expire='1d') archive.extract(tarball, self.teststmpdir) version = os.path.basename(tarball.split('.tar.')[0]) self.path = os.path.join(self.teststmpdir, version) elif test_type == 'distro': sourcedir = os.path.join(self.teststmpdir, 'libpfm-distro') if not os.path.exists(sourcedir): os.makedirs(sourcedir) if distro.detect().name == 'Ubuntu': self.path = softm.get_source('libpfm4', sourcedir) else: self.path = softm.get_source('libpfm', sourcedir) os.chdir(self.path) build.make(self.path)
def setUp(self): smm = SoftwareManager() self.failures = [] dist = distro.detect() deps = ['gcc', 'make'] if dist.name == 'Ubuntu': 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 = self.params.get('url', default="ftp://sourceware.org/pub/" "valgrind/valgrind-3.13.0.tar.bz2") 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): ''' 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 Integrity Test ''' # Check for basic utilities smm = SoftwareManager() self.scenario_arg = self.params.get('scenario_arg', default='1') if self.scenario_arg not in ['1', '2', '3']: self.cancel("Test need to skip as scenario needs to be 1-3") detected_distro = distro.detect() deps = ['gcc', 'make'] if detected_distro.name == "Ubuntu": deps.extend(['libnuma-dev']) elif detected_distro.name in ["centos", "rhel", "fedora"]: deps.extend(['numactl-devel']) else: deps.extend(['libnuma-devel']) for packages in deps: if not smm.check_installed(packages) and not smm.install(packages): self.cancel('%s is needed for the test to be run' % packages) archive.extract(self.get_data("Integritytests.tar"), self.workdir) self.build_dir = os.path.join(self.workdir, 'Integritytests') build.make(self.build_dir)
def setUp(self): """ Build 'fio'. """ default_url = "http://brick.kernel.dk/snaps/fio-2.1.10.tar.gz" url = self.params.get('fio_tool_url', default=default_url) self.disk = self.params.get('disk', default=None) self.dir = self.params.get('dir', default=self.srcdir) fstype = self.params.get('fs', default='ext4') tarball = self.fetch_asset(url) archive.extract(tarball, self.teststmpdir) fio_version = os.path.basename(tarball.split('.tar.')[0]) self.sourcedir = os.path.join(self.teststmpdir, fio_version) build.make(self.sourcedir) smm = SoftwareManager() if fstype == 'btrfs': if distro.detect().name == 'Ubuntu': if not smm.check_installed("btrfs-tools") and not \ smm.install("btrfs-tools"): self.cancel('btrfs-tools is needed for the test to be run') if self.disk is not None: self.part_obj = Partition(self.disk, mountpoint=self.dir) self.log.info("Unmounting disk/dir before creating file system") self.part_obj.unmount() self.log.info("creating file system") self.part_obj.mkfs(fstype) self.log.info("Mounting disk %s on directory %s", self.disk, self.dir) self.part_obj.mount()
def setUp(self): ''' Build 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): sm = SoftwareManager() detected_distro = distro.detect() self.tmpdir = data_dir.get_tmp_dir() # Check for basic utilities for package in ['gcc', 'make', 'gfortran']: if detected_distro.name == "SuSE" and package == "gfortran": package = 'gcc-fortran' # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon if detected_distro.name in ["rhel", "redhat"] and package == "gfortran": package = 'gcc-gfortran' if not sm.check_installed(package) and not sm.install(package): self.error(package + ' is needed for the test to be run') atlas_url = 'https://sourceforge.net/projects/'\ 'math-atlas/files/Stable/3.10.3/atlas3.10.3.tar.bz2' lapack_url = 'http://www.netlib.org/lapack/lapack-3.6.1.tgz' atlas_url = self.params.get('atlas_url', default=atlas_url) lapack_url = self.params.get('lapack_url', default=lapack_url) atlas_tarball = self.fetch_asset(atlas_url, expire='7d') archive.extract(atlas_tarball, self.workdir) self.atlas_dir = os.path.join(self.workdir, 'ATLAS') self.atlas_build_dir = os.path.join(self.atlas_dir, 'atlas_build_dir') os.makedirs(self.atlas_build_dir) lapack_tarball = self.fetch_asset(lapack_url, expire='7d') os.chdir(self.atlas_build_dir) config_args = '--shared -b 64 '\ '--with-netlib-lapack-tarfile=%s '\ '--cripple-atlas-performance' % lapack_tarball config_args = self.params.get('config_args', default=config_args) process.system('../configure %s' % config_args) # Tune and compile library build.make(self.atlas_build_dir)
def setUp(self): ''' Build 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): """ Setting up the env for the kernel building """ smg = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make', 'automake', 'autoconf', 'time', 'bison', 'flex'] if 'Ubuntu' in detected_distro.name: deps.extend(['libpopt0', 'libc6', 'libc6-dev', 'libpopt-dev', 'libcap-ng0', 'libcap-ng-dev', 'elfutils', 'libelf1', 'libnuma-dev', 'libfuse-dev', 'libssl-dev']) elif 'SuSE' in detected_distro.name: deps.extend(['libpopt0', 'glibc', 'glibc-devel', 'popt-devel', 'libcap2', 'libcap-devel', 'libcap-ng-devel', 'openssl-devel']) 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']) 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) self.kernel_version = platform.uname()[2] self.iterations = self.params.get('runs', default=1) self.threads = self.params.get( 'cpus', default=2 * cpu.online_cpus_count()) self.location = self.params.get( 'url', default='https://github.com/torvalds/linux/archive' '/master.zip') self.config_path = os.path.join('/boot/config-', self.kernel_version) # Uncompress the kernel archive to the work directory tarball = self.fetch_asset("kernbench.zip", locations=[self.location], expire='1d') archive.extract(tarball, self.workdir)
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') build.make(self.build_dir)
def setUp(self): """ Build tiobench. Source: https://github.com/mkuoppal/tiobench.git """ s_mngr = SoftwareManager() if not s_mngr.check_installed("gcc") and not s_mngr.install("gcc"): self.error('Gcc is needed for the test to be run') locations = ["https://github.com/mkuoppal/tiobench/archive/master.zip"] tarball = self.fetch_asset("tiobench.zip", locations=locations) archive.extract(tarball, self.srcdir) os.chdir(os.path.join(self.srcdir, "tiobench-master")) build.make(".")
def test(self): parallel_procs = [] os.chdir(self.tmpdir) # This is the reference copy of the linux tarball # that will be used for subsequent comparisons self.log.info('Unpacking base copy') self.base_dir = os.path.join(self.tmpdir, 'linux.orig') archive.extract(self.tarball, self.base_dir) self.log.info('Unpacking test copies') for j in range(self.sim_cps): tmp_dir = 'linux.%s' % j if self.parallel: os.mkdir(tmp_dir) # Start parallel process tar_cmd = 'tar jxf ' + self.tarball + ' -C ' + tmp_dir self.log.info("Unpacking tarball to %s", tmp_dir) obj = process.SubProcess(cmd=tar_cmd, verbose=False, shell=True) obj.start() parallel_procs.append(obj) else: self.log.info("Unpacking tarball to %s", tmp_dir) archive.extract(self.tarball, tmp_dir) # Wait for the subprocess before comparison if self.parallel: self.log.info("Wait background processes before proceed") for proc in parallel_procs: proc.wait() parallel_procs = [] self.log.info('Comparing test copies with base copy') for j in range(self.sim_cps): kernel_ver = os.path.basename(self.tarball).strip('.tar.bz2') tmp_dir = 'linux.%s/%s' % (j, kernel_ver) if self.parallel: diff_cmd = 'diff -U3 -rN linux.orig/' + kernel_ver diff_cmd += ' ' + tmp_dir self.log.info("Comparing linux.orig with %s", tmp_dir) obj = process.SubProcess(cmd=diff_cmd, verbose=False, shell=True) obj.start() parallel_procs.append(obj) else: try: self.log.info('Comparing linux.orig with %s', tmp_dir) process.system('diff -U3 -rN linux.orig linux.%s' % j) except process.CmdError, error: self.nfail += 1 self.log.info('Error comparing trees: %s', error)
def setUp(self): """ Build 'stress'. Source: http://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz """ tarball = self.fetch_asset( 'http://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz') archive.extract(tarball, self.srcdir) stress_version = os.path.basename(tarball.split('.tar.')[0]) self.srcdir = os.path.join(self.srcdir, stress_version) os.chdir(self.srcdir) process.run('./configure') build.make(self.srcdir)
def setUp(self): sm = SoftwareManager() for package in ['gcc', 'make']: if not sm.check_installed(package) and not sm.install(package): self.error(package + ' is needed for the test to be run') tarball = self.fetch_asset( "https://www.samba.org/ftp/tridge/dbench/dbench-3.04.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', ignore_status=True, sudo=True) build.make(self.srcdir)
def setUp(self): """ Build the synctest suite. """ self.cwd = os.getcwd() sync_tarball = self.params.get('sync_tarball', '*', 'synctest.tar.bz2') tarball_path = os.path.join(self.datadir, sync_tarball) archive.extract(tarball_path, self.srcdir) srcdir = os.path.join(self.srcdir, 'synctest') os.chdir(srcdir) if self.params.get('debug_symbols', default=True): build.make(srcdir, env={'CFLAGS': '-g -O0'}, extra_args='synctest') else: build.make(srcdir)
def do_test_advcal_2018(self, file_path, kernel_name, args=None): archive.extract(file_path, self.workdir) for entry in os.scandir(self.workdir): if entry.name.startswith('day') and entry.is_dir(): kernel_path = os.path.join(entry.path, kernel_name) break kernel_command_line = '' console_pattern = 'QEMU advent calendar' self.run_rr(kernel_path, kernel_command_line, console_pattern, args=args)
def setUp(self): """ Build 'fio'. """ default_url = "https://brick.kernel.dk/snaps/fio-git-latest.tar.gz" url = self.params.get('fio_tool_url', default=default_url) self.disk = self.params.get('disk', default=None) self.dirs = self.params.get('dir', default=self.workdir) fstype = self.params.get('fs', default='ext4') tarball = self.fetch_asset(url) archive.extract(tarball, self.teststmpdir) self.sourcedir = os.path.join(self.teststmpdir, "fio") build.make(self.sourcedir) smm = SoftwareManager() if fstype == 'btrfs': ver = int(distro.detect().version) rel = int(distro.detect().release) if distro.detect().name == 'rhel': if (ver == 7 and rel >= 4) or ver > 7: self.cancel("btrfs is not supported with \ RHEL 7.4 onwards") if distro.detect().name in ['Ubuntu', 'debian']: pkg_list = ['libaio-dev'] if fstype == 'btrfs': pkg_list.append('btrfs-progs') else: pkg_list = ['libaio', 'libaio-devel'] for pkg in pkg_list: if pkg and not smm.check_installed(pkg) and not smm.install(pkg): self.cancel( "Package %s is missing and could not be installed" % pkg) if self.disk is not None: self.part_obj = Partition(self.disk, mountpoint=self.dirs) self.log.info("Unmounting disk/dir before creating file system") self.part_obj.unmount() self.log.info("creating file system") self.part_obj.mkfs(fstype) self.log.info("Mounting disk %s on directory %s", self.disk, self.dirs) try: self.part_obj.mount() except PartitionError: self.fail("Mounting disk %s on directory %s failed" % (self.disk, self.dirs)) self.fio_file = 'fiotest-image'
def setUp(self): ''' To check and install dependencies for the test ''' smm = SoftwareManager() for package in ['gcc', 'make', 'automake', 'autoconf']: if not smm.check_installed(package) and not smm.install(package): self.cancel("%s is needed for the test to be run" % package) self.disk = self.params.get('disk', default=None) self.mount_point = self.params.get('dir', default=self.workdir) self.script = self.params.get('script') fstype = self.params.get('fs', default='ext4') self.args = self.params.get('args', default='') if fstype == 'btrfs': ver = int(distro.detect().version) rel = int(distro.detect().release) if distro.detect().name == 'rhel': if (ver == 7 and rel >= 4) or ver > 7: self.cancel("btrfs is not supported with \ RHEL 7.4 onwards") if self.disk is not None: self.part_obj = Partition(self.disk, mountpoint=self.mount_point) self.log.info("Unmounting the disk/dir if it is already mounted") self.part_obj.unmount() self.log.info("creating %s file system on %s", fstype, self.disk) self.part_obj.mkfs(fstype) self.log.info("mounting %s on %s", self.disk, self.mount_point) try: self.part_obj.mount() except PartitionError: self.fail("Mounting disk %s on directory %s failed" % (self.disk, self.mount_point)) url = "https://github.com/linux-test-project/ltp/" url += "archive/master.zip" tarball = self.fetch_asset("ltp-master.zip", locations=[url], expire='7d') archive.extract(tarball, self.teststmpdir) ltp_dir = os.path.join(self.teststmpdir, "ltp-master") os.chdir(ltp_dir) build.make(ltp_dir, extra_args='autotools') self.ltpbin_dir = os.path.join(ltp_dir, 'bin') if not os.path.isdir(self.ltpbin_dir): os.mkdir(self.ltpbin_dir) process.system('./configure --prefix=%s' % self.ltpbin_dir, ignore_status=True) build.make(ltp_dir) build.make(ltp_dir, extra_args='install')
def setUp(self): """ To check and install dependencies for the test """ smm = SoftwareManager() detected_distro = distro.detect() pkgs = ["gcc", "autoconf", "perl", "m4", "git-core"] if detected_distro.name == "Ubuntu": pkgs.extend(["libsctp1", "libsctp-dev", "lksctp-tools"]) else: pkgs.extend(["lksctp-tools", "lksctp-tools-devel"]) for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) interfaces = netifaces.interfaces() self.iface = self.params.get("interface", default="") self.peer_ip = self.params.get("peer_ip", default="") if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) if self.peer_ip == "": self.cancel("%s peer machine is not available" % self.peer_ip) self.peer_user = self.params.get("peer_user_name", default="root") uperf_download = self.params.get("uperf_download", default="https:" "//github.com/uperf/uperf/" "archive/master.zip") tarball = self.fetch_asset(uperf_download, expire='7d') archive.extract(tarball, self.teststmpdir) self.uperf_dir = os.path.join(self.teststmpdir, "uperf-master") cmd = "scp -r %s %s@%s:/tmp" % (self.uperf_dir, self.peer_user, self.peer_ip) if process.system(cmd, shell=True, ignore_status=True) != 0: self.cancel("unable to copy the uperf into peer machine") cmd = "ssh %s@%s \"cd /tmp/uperf-master;autoreconf -fi;./configure " \ "ppc64le;make\"" % (self.peer_user, self.peer_ip) if process.system(cmd, ignore_status=True, shell=True, sudo=True): self.cancel("Unable to compile Uperf into peer machine") self.uperf_run = str(self.params.get("UPERF_SERVER_RUN", default=0)) if self.uperf_run == '1': cmd = "ssh %s@%s \"cd /tmp/uperf-master/src;./uperf -s\""\ % (self.peer_user, self.peer_ip) obj = process.SubProcess(cmd, verbose=False, shell=True) obj.start() os.chdir(self.uperf_dir) process.system('autoreconf -fi', shell=True) process.system('./configure ppc64le', shell=True) build.make(self.uperf_dir) self.expected_tp = self.params.get("EXPECTED_THROUGHPUT", default="85") speed = int(read_file("/sys/class/net/%s/speed" % self.iface)) self.expected_tp = int(self.expected_tp) * speed / 100
def test_sparc64_sun4u(self): """ :avocado: tags=arch:sparc64 :avocado: tags=machine:sun4u """ tar_url = ('https://www.qemu-advent-calendar.org' '/2018/download/day23.tar.xz') tar_hash = '142db83cd974ffadc4f75c8a5cad5bcc5722c240' file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) archive.extract(file_path, self.workdir) self.vm.set_console() self.vm.add_args('-kernel', self.workdir + '/day23/vmlinux', '-append', self.KERNEL_COMMON_COMMAND_LINE) self.vm.launch() wait_for_console_pattern(self, 'Starting logging: OK')
def setUp(self): """ Build the synctest suite. """ self.cwd = os.getcwd() tarball_path = self.get_data_path(self.params.get('sync_tarball', 'synctest.tar.bz2')) archive.extract(tarball_path, self.srcdir) self.srcdir = os.path.join(self.srcdir, 'synctest') if self.params.get('debug_symbols', True): build.make(self.srcdir, env={'CFLAGS': '-g -O0'}, extra_args='synctest') else: build.make(self.srcdir)
def test_ppc_mpc8544ds(self): """ :avocado: tags=arch:ppc :avocado: tags=machine:mpc8544ds """ tar_url = ('https://www.qemu-advent-calendar.org' '/2020/download/day17.tar.gz') tar_hash = '7a5239542a7c4257aa4d3b7f6ddf08fb6775c494' file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) archive.extract(file_path, self.workdir) self.vm.set_console() self.vm.add_args('-kernel', self.workdir + '/creek/creek.bin') self.vm.launch() wait_for_console_pattern(self, 'QEMU advent calendar 2020', self.panic_message)
def setUp(self): """ Build bonnie++ Source: http://www.coker.com.au/bonnie++/experimental/bonnie++-1.96.tgz """ bonnie_tarball = self.params.get('bonnie_tarball', default='bonnie++-1.96.tgz') tarball_path = self.get_data_path(bonnie_tarball) archive.extract(tarball_path, self.srcdir) bonnie_version = bonnie_tarball.split('.tgz')[0] self.srcdir = os.path.join(self.srcdir, bonnie_version) os.chdir(self.srcdir) process.run('./configure') build.make(self.srcdir)
def setUp(self): if "ppc" not in distro.detect().arch: self.cancel("supported only on Power platform") dist = distro.detect() if dist.name == 'Ubuntu': tar_ball = self.params.get('tar_ball_ubuntu', default='nstress_Ubuntu1410_ppc64_Nov_2015.tar') elif dist.name == 'rhel': tar_ball = self.params.get('tar_ball_rhel', default='nstress_RHEL71_LE_ppc64_Nov_2015.tar') elif dist.name == 'SuSE': tar_ball = self.params.get('tar_ball_sles', default='nstress_SLES12_ppc64_Nov_2015.tar') url = os.path.join('http://public.dhe.ibm.com/systems/power/community/wikifiles/PerfTools/', tar_ball) tarball = self.fetch_asset(url, expire='10d') archive.extract(tarball, self.workdir) self.duration = self.params.get('duration', default=300)
def setUp(self): """ Build 'stress'. Source: https://fossies.org/linux/privat/stress-1.0.4.tar.gz """ tarball = self.fetch_asset( 'https://fossies.org/linux/privat/stress-1.0.4.tar.gz', expire='7d') archive.extract(tarball, self.workdir) stress_version = os.path.basename(tarball.split('.tar.')[0]) self.sourcedir = os.path.join(self.workdir, stress_version) os.chdir(self.sourcedir) process.run('./configure') build.make(self.sourcedir)
def setUp(self): """ Build 'stress'. Source: http://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz """ stress_tarball = self.params.get('stress_tarball', default='stress-1.0.4.tar.gz') tarball_path = self.get_data_path(stress_tarball) archive.extract(tarball_path, self.srcdir) stress_version = stress_tarball.split('.tar.')[0] self.srcdir = os.path.join(self.srcdir, stress_version) os.chdir(self.srcdir) process.run('./configure') build.make(self.srcdir)
def extract_from_deb(self, deb, path): """ Extracts a file from a deb package into the test workdir :param deb: path to the deb archive :param file: path within the deb archive of the file to be extracted :returns: path of the extracted file """ cwd = os.getcwd() os.chdir(self.workdir) file_path = process.run("ar t %s" % deb).stdout_text.split()[2] process.run("ar x %s %s" % (deb, file_path)) archive.extract(file_path, self.workdir) os.chdir(cwd) return self.workdir + path
def setUp(self): """ fs_mark """ tarball = self.fetch_asset('http://prdownloads.source' 'forge.net/fsmark/fs_mark-3.3.tar.gz') archive.extract(tarball, self.srcdir) fs_version = os.path.basename(tarball.split('.tar.')[0]) self.srcdir = os.path.join(self.srcdir, fs_version) os.chdir(self.srcdir) process.run('make') build.make(self.srcdir) self.disk = self.params.get('disk', default=None) self.fstype = self.params.get('fs', default='ext4')
def setUp(self): smg = SoftwareManager() dist = distro.detect() self.args = self.params.get('args', default='') self.mem_leak = self.params.get('mem_leak', default=0) deps = ['gcc', 'make', 'automake', 'autoconf', 'psmisc'] if dist.name == "Ubuntu": deps.extend(['libnuma-dev']) elif dist.name in ["centos", "rhel", "fedora"]: deps.extend(['numactl-devel']) elif dist.name == "SuSE": deps.extend(['libnuma-devel', 'iputils']) self.ltpbin_dir = self.mount_dir = None self.thp = False if self.args in self.mem_tests: self.mount_dir = self.params.get('tmpfs_mount_dir', default=None) if self.mount_dir: self.setup_tmpfs_dir() over_commit = self.params.get('overcommit', default=True) if not over_commit: process.run('echo 2 > /proc/sys/vm/overcommit_memory', shell=True, ignore_status=True) 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) clear_dmesg() url = self.params.get( 'url', default='https://github.com/linux-test-project/ltp/archive/master.zip') match = next((ext for ext in [".zip", ".tar"] if ext in url), None) tarball = '' if match: tarball = self.fetch_asset( "ltp-master%s" % match, locations=[url], expire='7d') else: self.cancel("Provided LTP Url is not valid") archive.extract(tarball, self.workdir) ltp_dir = os.path.join(self.workdir, "ltp-master") os.chdir(ltp_dir) build.make(ltp_dir, extra_args='autotools') if not self.ltpbin_dir: self.ltpbin_dir = os.path.join(self.teststmpdir, 'bin') if not os.path.exists(self.ltpbin_dir): os.mkdir(self.ltpbin_dir) process.system('./configure --prefix=%s' % self.ltpbin_dir) build.make(ltp_dir) build.make(ltp_dir, extra_args='install')
def setUp(self): """ Resolve the packages dependencies and download the source. """ smg = SoftwareManager() self.comp = self.params.get('comp', default='') if self.comp: self.comp = '-C %s' % self.comp detected_distro = distro.detect() deps = ['gcc', 'make', 'automake', 'autoconf'] if 'Ubuntu' in detected_distro.name: deps.extend([ 'libpopt0', 'libc6', 'libc6-dev', 'libcap-dev', 'libpopt-dev', 'libcap-ng0', 'libcap-ng-dev', 'libnuma-dev', 'libfuse-dev', 'elfutils', 'libelf1' ]) elif 'SuSE' in detected_distro.name: deps.extend([ 'popt', 'glibc', 'glibc-devel', 'popt-devel', 'sudo', 'libcap2', 'libcap-devel', 'libcap-ng-devel', 'fuse', 'fuse-devel', 'glibc-devel-static' ]) # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif detected_distro.name in ['centos', 'fedora', 'rhel', 'redhat']: deps.extend([ 'popt', 'glibc', 'glibc-devel', 'glibc-static', 'libcap-ng', 'libcap', 'libcap-devel', 'fuse-devel', 'libcap-ng-devel' ]) for package in deps: if not smg.check_installed(package) and not smg.install(package): self.cancel("Fail to install %s required for this test." % (package)) location = ["https://github.com/torvalds/linux/archive/master.zip"] tarball = self.fetch_asset("kselftest.zip", locations=location, expire='1d') archive.extract(tarball, self.workdir) self.buldir = os.path.join(self.workdir, '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): smm = SoftwareManager() detected_distro = distro.detect() self.stressors = self.params.get('stressors', default=None) self.ttimeout = self.params.get('ttimeout', default='300') self.workers = self.params.get( 'workers', default=multiprocessing.cpu_count()) self.class_type = self.params.get('class', default='all') self.verify = self.params.get('verify', default=True) self.syslog = self.params.get('syslog', default=True) self.metrics = self.params.get('metrics', default=True) self.maximize = self.params.get('maximize', default=True) self.times = self.params.get('times', default=True) self.aggressive = self.params.get('aggressive', default=True) self.exclude = self.params.get('exclude', default=None) self.v_stressors = self.params.get('v_stressors', default=None) self.parallel = self.params.get('parallel', default=True) deps = ['gcc', 'make'] if 'Ubuntu' in detected_distro.name: deps.extend([ 'libaio-dev', 'libapparmor-dev', 'libattr1-dev', 'libbsd-dev', 'libcap-dev', 'libgcrypt11-dev', 'libkeyutils-dev', 'libsctp-dev', 'zlib1g-dev']) else: deps.extend(['libattr-devel', 'libbsd-devel', 'libcap-devel', 'libgcrypt-devel', 'keyutils-libs-devel', 'zlib-devel', 'libaio-devel']) for package in deps: if not smm.check_installed(package) and not smm.install(package): self.log.info( '%s is needed, get the source and build', package) tarball = self.fetch_asset('stressng.zip', locations=['https://github.com/Colin' 'IanKing/stress-ng/archive' '/master.zip'], expire='7d') archive.extract(tarball, self.workdir) sourcedir = os.path.join(self.workdir, 'stress-ng-master') os.chdir(sourcedir) result = build.run_make(sourcedir, process_kwargs={'ignore_status': True}) for line in str(result).splitlines(): if 'error:' in line: self.cancel( "Unsupported OS, Please check the build logs !!") build.make(sourcedir, extra_args='install') clear_dmesg()
def setUp(self): ''' Build fsfuzzer Source: https://github.com/stevegrubb/fsfuzzer.git ''' detected_distro = distro.detect() d_name = detected_distro.name.lower() smm = SoftwareManager() deps = ['gcc', 'patch', 'libtool', 'autoconf', 'automake', 'make'] if d_name == 'ubuntu': deps.extend(['libattr1-dev']) else: deps.extend(['libattr-devel']) for package in deps: if not smm.check_installed(package) and not smm.install(package): self.cancel("Fail to install/check %s, which is needed for" "fsfuzz to run" % package) locations = [ "https://github.com/stevegrubb/fsfuzzer/archive/" "master.zip" ] tarball = self.fetch_asset("fsfuzzer.zip", locations=locations) archive.extract(tarball, self.srcdir) os.chdir(os.path.join(self.srcdir, "fsfuzzer-master")) if d_name == "ubuntu": # Patch for ubuntu fuzz_fix_patch = 'patch -p1 < %s' % (os.path.join( self.datadir, 'fsfuzz_fix.patch')) if process.system(fuzz_fix_patch, shell=True, ignore_status=True): self.log.warn("Unable to apply sh->bash patch!") process.run('./autogen.sh', shell=True) process.run('./configure', shell=True) build.make('.') self._args = self.params.get('fstype', default='') self._fsfuzz = os.path.abspath(os.path.join('.', "fsfuzz")) fs_sup = process.system_output('%s %s' % (self._fsfuzz, ' --help')) match = re.search(r'%s' % self._args, fs_sup, re.M | re.I) if not match: self.cancel('File system ' + self._args + ' is unsupported in ' + detected_distro.name)
def setUp(self): ''' Install the basic packages to support openssl ''' # Check for basic utilities smm = SoftwareManager() deps = ['gcc', 'make'] 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/openssl/openssl/archive/master.zip" tarball = self.fetch_asset(url, expire='7d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join(self.workdir, 'openssl-master') os.chdir(self.sourcedir) process.run('./Configure', ignore_status=True)
def setUp(self): """ Build the synctest suite. """ self.cwd = os.getcwd() sync_tarball = self.params.get("sync_tarball", "*", "synctest.tar.bz2") tarball_path = self.get_data(sync_tarball) if tarball_path is None: self.cancel(f"Test is missing data file {tarball_path}") archive.extract(tarball_path, self.workdir) srcdir = os.path.join(self.workdir, "synctest") os.chdir(srcdir) if self.params.get("debug_symbols", default=True): build.make(srcdir, env={"CFLAGS": "-g -O0"}, extra_args="synctest") else: build.make(srcdir)
def setUp(self): sm = SoftwareManager() for package in ['gcc', 'make']: if not sm.check_installed(package) and not sm.install(package): self.cancel("Fail to install %s required for this test." % package) gsl_version = self.params.get('gsl_version', default='2.2') tarball = self.fetch_asset("ftp://ftp.gnu.org/gnu/gsl/gsl-%s.tar.gz" % gsl_version, expire='10d') archive.extract(tarball, self.workdir) self.sourcedir = os.path.join( self.workdir, os.path.basename(tarball.split('.tar')[0])) os.chdir(self.sourcedir) process.run('./configure', ignore_status=True, sudo=True) build.make(self.sourcedir)
def build_perf_test(self): """ Building the perf event test suite Source : https://github.com/deater/perf_event_tests """ 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) self.sourcedir = os.path.join(self.workdir, 'perf_event_tests-master') if build.make(self.sourcedir, extra_args="-s -S"): self.fail("Building of perf event test suite failed")
def setUp(self): """ Extract compilebench Source: https://oss.oracle.com/~mason/compilebench/compilebench-0.6.tar.bz2 """ tarball = self.fetch_asset( 'https://oss.oracle.com/~mason/compilebench/compilebench-0.6.tar.bz2' ) archive.extract(tarball, self.workdir) cb_version = os.path.basename(tarball.split('.tar.')[0]) self.sourcedir = os.path.join(self.workdir, cb_version) os.chdir(self.sourcedir) compilebench_fix_patch = 'patch -p1 < %s' % self.get_data( 'fix_compilebench') process.run(compilebench_fix_patch, shell=True)
def test_arm_ast2500_evb_sdk(self): """ :avocado: tags=arch:arm :avocado: tags=machine:ast2500-evb """ image_url = ('https://github.com/AspeedTech-BMC/openbmc/releases/' 'download/v08.01/ast2500-default-obmc.tar.gz') image_hash = ('5375f82b4c43a79427909342a1e18b4e48bd663e38466862145d27bb358796fd') image_path = self.fetch_asset(image_url, asset_hash=image_hash, algorithm='sha256') archive.extract(image_path, self.workdir) self.do_test_arm_aspeed_sdk_start( self.workdir + '/ast2500-default/image-bmc', '0x0') self.wait_for_console_pattern('ast2500-default login:')
def test_arm_canona1100(self): """ :avocado: tags=arch:arm :avocado: tags=machine:canon-a1100 :avocado: tags=device:pflash_cfi02 """ tar_url = ('https://www.qemu-advent-calendar.org' '/2018/download/day18.tar.xz') tar_hash = '068b5fc4242b29381acee94713509f8a876e9db6' file_path = self.fetch_asset(tar_url, asset_hash=tar_hash) archive.extract(file_path, self.workdir) self.vm.set_console() self.vm.add_args('-bios', self.workdir + '/day18/barebox.canon-a1100.bin') self.vm.launch() wait_for_console_pattern(self, 'running /env/bin/init')