def setUp(self): # Check for basic utilities sm = SoftwareManager() detected_distro = distro.detect() deps = ['dejagnu', 'expect'] if detected_distro.name == "SuSE": deps.append("git-core") else: deps.append("git") if detected_distro.name in ["Ubuntu", 'debian']: deps.extend(["libxml2-utils", "tclsh"]) if detected_distro.name == "Ubuntu": deps.extend(["oprofile"]) elif (detected_distro.name == "rhel" and detected_distro.version >= "8"): deps.append("perf") else: deps.append("oprofile") for package in deps: if not sm.check_installed(package) and not sm.install(package): self.cancel('%s is needed for the test to be run' % package) git.get_repo('https://git.code.sf.net/p/oprofile/oprofile-tests', destination_dir=self.workdir) os.chdir(self.workdir) os.chdir("testsuite/")
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): ''' 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): ''' Build schbench Source: https://github.com/gautshen/misc.git ''' sm = SoftwareManager() distro_name = distro.detect().name deps = ['gcc', 'make'] if 'Ubuntu' in distro_name: deps.extend(['linux-tools-common', 'linux-tools-%s' % platform.uname()[2]]) elif distro_name in ['rhel', 'SuSE', 'fedora', 'centos']: deps.extend(['perf']) else: self.cancel("Install the package for perf supported \ by %s" % distro_name) for package in deps: if not sm.check_installed(package) and not sm.install(package): self.cancel("%s is needed for the test to be run" % package) url = 'https://github.com/gautshen/misc.git' pc_url = self.params.get("pc_url", default=url) git.get_repo(pc_url, destination_dir=self.workdir) self.sourcedir = os.path.join(self.workdir, 'producer_consumer') os.chdir(self.sourcedir) 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): softm = SoftwareManager() for package in ['gcc', 'make']: if not softm.check_installed(package) and not softm.install( package): self.cancel("%s is needed for the test to be run" % package) test_type = self.params.get('type', default='upstream') if test_type == 'upstream': papi_url = self.params.get( 'url', default="https://bitbucket.org/icl/papi.git") git.get_repo(papi_url, destination_dir=self.teststmpdir) self.path = os.path.join(self.teststmpdir, 'src') elif test_type == 'distro': sourcedir = os.path.join(self.teststmpdir, 'papi-distro') if not os.path.exists(sourcedir): os.makedirs(sourcedir) self.path = softm.get_source("papi", sourcedir) self.path = os.path.join(self.path, 'src') os.chdir(self.path) process.run('./configure', shell=True) build.make(self.path)
def setUp(self): """ 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): ''' Install the basic packages to support libgcrypt ''' # Check for basic utilities smm = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make'] if detected_distro.name in ['rhel', 'SuSE', 'fedora', 'centos']: deps.extend([ "autoconf", "automake", "libgpg-error-devel", "libgpg-error", "transfig" ]) else: self.cancel("Unsupported distro %s for libgcrypt package" % detected_distro.name) for package in deps: if not smm.check_installed(package) and not smm.install(package): self.cancel('%s is needed for the test to be run' % package) url = "https://dev.gnupg.org/source/libgcrypt.git" git.get_repo(url, destination_dir=self.workdir) os.chdir(self.workdir) process.run("./autogen.sh") process.run("./configure --enable-maintainer-mode") if build.make(self.workdir): # If the make fails then need to run make with -lpthread build.run_make(self.workdir, extra_args="CFLAGS+=-lpthread", process_kwargs={"ignore_status": True})
def setUp(self): """ Install all the required dependencies Building source tarball requires packages specific to os that needs to be installed, if not installed test will stop. """ backend = SoftwareManager() dist = distro.detect() dist_name = dist.name.lower() if not backend.check_installed("gcc") and not backend.install("gcc"): self.error("gcc is needed for the test to be run") pkgs = ['git', 'wget', 'autoconf', 'automake', 'dejagnu', 'binutils'] if dist_name == 'suse': sles_deps = [ 'build', 'libdw-devel', 'libelf-devel', 'elfutils', 'binutils-devel', 'libtool', 'gcc-c++' ] pkgs += sles_deps # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif dist_name in ("rhel", "fedora", "redhat"): rhel_deps = [ 'elfutils-devel', 'elfutils-libelf-devel', 'elfutils-libelf', 'elfutils-libs', 'libtool-ltdl' ] pkgs += rhel_deps elif dist_name == 'ubuntu': ubuntu_deps = [ 'elfutils', 'libelf-dev', 'libtool', 'libelf1', 'librpmbuild3', 'binutils-dev' ] pkgs += ubuntu_deps else: self.log.warn("Unsupported OS!") for pkg in pkgs: if not backend.check_installed(pkg): if backend.install(pkg): self.log.warn("%s installed successfully", pkg) else: self.error("Fail to install package- %s required for " "this test" % pkg) # Source: git clone git://git.debian.org/git/collab-maint/ltrace.git git.get_repo('git://git.debian.org/git/collab-maint/ltrace.git', destination_dir=os.path.join(self.srcdir, 'ltrace')) self.src_lt = os.path.join(self.srcdir, "ltrace") os.chdir(self.src_lt) process.run('./autogen.sh') process.run('./configure') build.make(self.src_lt)
def setUp(self): """ Install all the required dependencies Building source tarball requires packages specific to os that needs to be installed, if not installed test will stop. """ smm = SoftwareManager() dist = distro.detect() dist_name = dist.name.lower() packages = ['gcc', 'wget', 'autoconf', 'automake', 'dejagnu', 'binutils', 'patch'] if dist_name == 'suse': packages.extend(['libdw-devel', 'libelf-devel', 'git-core', 'elfutils', 'binutils-devel', 'libtool', 'gcc-c++']) # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif dist_name in ("rhel", "fedora", "redhat"): packages.extend(['elfutils-devel', 'elfutils-libelf-devel', 'git', 'elfutils-libelf', 'elfutils-libs', 'libtool-ltdl']) elif dist_name == 'ubuntu': packages.extend(['elfutils', 'libelf-dev', 'libtool', 'git', 'libelf1', 'librpmbuild3', 'binutils-dev']) else: self.cancel("Unsupported OS!") for package in packages: if not smm.check_installed(package) and not smm.install(package): self.cancel("Fail to install %s required for this test." % package) run_type = self.params.get("type", default="upstream") if run_type == "upstream": source = self.params.get('url', default="git://git.debian.org/git/" "collab-maint/ltrace.git") git.get_repo(source, destination_dir=os.path.join( self.srcdir, 'ltrace')) self.src_lt = os.path.join(self.srcdir, "ltrace") os.chdir(self.src_lt) process.run('patch -p1 < %s' % os.path.join(self.datadir, 'ltrace.patch'), shell=True) elif run_type == "distro": self.src_lt = os.path.join(self.srcdir, "ltrace-distro") if not os.path.exists(self.src_lt): self.src_lt = smm.get_source("ltrace", self.src_lt) os.chdir(self.src_lt) process.run('./autogen.sh') process.run('./configure') build.make(self.src_lt)
def test_gpu_burn(self): ''' GPU burn tests ''' self.log.info("test_gpu_burn: GPU Burn tests") git.get_repo('https://github.com/wilicc/gpu-burn.git', destination_dir=self.workdir) os.chdir(self.workdir) build.make(self.workdir) output = process.system_output('./gpu_burn', ignore_status=True, shell=True) self.process_output(output)
def setUp(self): """ Install all the required dependencies Building source tarball requires packages specific to os that needs to be installed, if not installed test will stop. """ backend = SoftwareManager() dist = distro.detect() if not backend.check_installed("gcc") and not backend.install("gcc"): self.error("gcc is needed for the test to be run") pkgs = ['git', 'wget', 'autoconf', 'automake', 'dejagnu', 'binutils'] if dist.name == 'sles': sles_deps = ['build', 'libdw-devel', 'libelf-devel', 'elfutils', 'binutils-devel', 'libtool', 'gcc-c++'] pkgs += sles_deps elif dist.name in ("redhat", "fedora"): rhel_deps = ['elfutils-devel', 'elfutils-libelf-devel', 'elfutils-libelf', 'elfutils-libs', 'libtool-ltdl'] pkgs += rhel_deps elif dist.name == 'ubuntu': ubuntu_deps = ['elfutils', 'libelf-dev', 'libtool', 'libelf1', 'librpmbuild3', 'binutils-dev'] pkgs += ubuntu_deps else: self.log.warn("Unsupported OS!") for pkg in pkgs: if not backend.check_installed(pkg): if backend.install(pkg): self.log.warn("%s installed successfully", pkg) else: self.error("Fail to install package- %s required for " "this test" % pkg) # Source: git clone git://git.debian.org/git/collab-maint/ltrace.git git.get_repo('git://git.debian.org/git/collab-maint/ltrace.git', destination_dir=os.path.join(self.srcdir, 'ltrace')) self.src_lt = os.path.join(self.srcdir, "ltrace") os.chdir(self.src_lt) process.run('./autogen.sh') process.run('./configure') build.make(self.src_lt)
def setUp(self): ''' Build Pmqa Test Source: git://git.linaro.org/power/pm-qa.git ''' # 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') 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): ''' Install the basic packages to support keyutils ''' # 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://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git" git.get_repo(url, destination_dir=self.workdir) os.environ['AUTOMATED'] = '1' self.make_path = os.path.join(self.workdir, 'tests') os.chdir(self.make_path)
def setUp(self): smm = SoftwareManager() detected_distro = distro.detect() # TODO: Add debs for Ubuntu. if detected_distro.name == "Ubuntu": self.cancel("Skip the test for ubuntu as debs needs to be" "added in packages") packages = [ 'make', 'gcc', 'systemtap', 'systemtap-runtime', 'elfutils', 'kernel-devel', 'dejagnu' ] # 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 ["redhat", "rhel"]: packages.extend([ 'git', 'kernel-debug', 'kernel-debuginfo', 'kernel-debug-debuginfo', 'elfutils-devel' ]) if detected_distro.name == "SuSE": packages.extend([ 'git-core', 'kernel-default-devel', 'libebl1', 'kernel-default-debuginfo', 'kernel-devel', 'kernel-macros', 'libdw-devel', 'libebl-devel', 'libelf-devel' ]) for package in packages: if not smm.check_installed(package) and not smm.install(package): self.cancel(' %s is needed for the test to be run' % package) git.get_repo('git://sourceware.org/git/systemtap.git', destination_dir=self.workdir) os.chdir(self.workdir) process.run('./configure', ignore_status=True, sudo=True) build.make(self.workdir) build.make(self.workdir, extra_args='install') self.test_dir = os.path.join(self.workdir, "testsuite") os.chdir(self.test_dir) # Run a simple systemtap script to make sure systemtap and the # kernel debuginfo packages are correctly installed script_result = process.system( "PATH=%s/bin:$PATH stap -v /bin/true " "-e 'probe vfs.read { exit()" " }'", ignore_status=True, sudo=True, shell=True) if script_result != 0: self.cancel("simple systemtap test failed," "kernel debuginfo package may be missing")
def setUp(self): """ Resolve the packages dependencies and download the source. """ smg = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make', 'automake', 'autoconf'] sdeps = ['git-core', 'popt', 'glibc', 'glibc-devel', 'popt-devel', 'libcap1', 'libcap1-devel', 'libcap-ng', 'libcap-ng-devel'] udeps = ['git', 'popt', 'build-essential', 'libpopt-dev', 'libpopt0', 'libcap-dev', 'libcap-ng-dev'] rdeps = ['git', 'popt', 'popt-static', 'glibc', 'glibc-devel', 'glibc-static', 'libcap-ng', 'libcap-ng-devel', 'libcap1', 'libcap1-devel'] cdeps = ['git', 'popt', 'popt-static', 'glibc', 'glibc-devel', 'glibc-static', 'libcap-ng', 'libcap-ng-devel', 'libcap', 'libcap-devel'] if 'Ubuntu' in detected_distro.name: deps = deps + udeps elif 'redhat' in detected_distro.name: deps = deps + rdeps elif 'SuSE' in detected_distro.name: deps = deps + sdeps elif 'centos' in detected_distro.name: deps = deps + cdeps for package in deps: if not smg.check_installed(package) and not smg.install(package): self.error( '%s is needed for the test to be run !!' % (package)) url = self.params.get( 'url', default='https://www.kernel.org/pub/linux/kernel') if 'git' not in url: version = self.params.get('version', default='4.8.6') tarball_base = 'linux-%s.tar.gz' % (version) tarball_url = '%s/v%s.x/%s' % (url, version[:1], tarball_base) self.log.info('Downloading linux kernel tarball') self.tarball = self.fetch_asset(tarball_url) archive.extract(self.tarball, self.srcdir) linux_src = 'linux-%s' % (version) self.buldir = os.path.join(self.srcdir, linux_src) else: self.log.info('Cloning linux kernel source') git.get_repo(url, destination_dir=self.srcdir) self.srcdir = os.path.join(self.buldir, self.testdir) result = build.run_make(self.srcdir) for line in str(result).splitlines(): if 'ERROR' in line: self.fail("Compilation failed, Please check the build logs !!")
def setUp(self): ''' Build schbench Source: https://git.kernel.org/pub/scm/linux/kernel/git/mason/schbench.git ''' sm = SoftwareManager() for package in ['gcc', 'make']: if not sm.check_installed(package) and not sm.install(package): self.cancel("%s is needed for the test to be run" % package) url = 'https://git.kernel.org/pub/scm/linux/kernel/git/mason/schbench.git' schbench_url = self.params.get("schbench_url", default=url) git.get_repo(schbench_url, destination_dir=self.workdir) os.chdir(self.workdir) build.make(self.workdir)
def setUp(self): ''' Build schbench Source: https://github.com/gautshen/misc.git ''' sm = SoftwareManager() for package in ['gcc', 'make']: if not sm.check_installed(package) and not sm.install(package): self.cancel("%s is needed for the test to be run" % package) url = 'https://github.com/gautshen/misc.git' pc_url = self.params.get("pc_url", default=url) git.get_repo(pc_url, destination_dir=self.workdir) self.sourcedir = os.path.join(self.workdir, 'producer_consumer') os.chdir(self.sourcedir) build.make(self.sourcedir)
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 download_test_provider(provider, update=False): """ Download a test provider defined on a .ini file inside test-providers.d. This function will only download test providers that are in git repos. Local filesystems don't need this functionality. :param provider: Test provider name, such as 'io-github-autotest-qemu'. """ provider_info = get_test_provider_info(provider) uri = provider_info.get('uri') if not uri.startswith('file://'): uri = provider_info.get('uri') branch = provider_info.get('branch') ref = provider_info.get('ref') pubkey = provider_info.get('pubkey') download_dst = data_dir.get_test_provider_dir(provider) repo_downloaded = os.path.isdir(os.path.join(download_dst, '.git')) original_dir = os.getcwd() if not repo_downloaded or update: download_dst = git.get_repo(uri=uri, branch=branch, commit=ref, destination_dir=download_dst) os.chdir(download_dst) try: process.run('git remote add origin %s' % uri) except process.CmdError: pass process.run('git pull origin %s' % branch) os.chdir(download_dst) process.system('git log -1') os.chdir(original_dir)
def setUp(self): ''' Build Pmqa Test Source: git://git.linaro.org/power/pm-qa.git ''' # 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.workdir) self.test_type = self.params.get('run_arg', default='cpufreq')
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.cancel( "Fail to install %s required for this test." % package) git.get_repo('git://git.code.sf.net/p/perfmon2/libpfm4', destination_dir=self.workdir) os.chdir(self.workdir) build.make('.')
def 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): ''' 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.workdir) self.test_type = self.params.get('run_arg', default='cpufreq')
def setUp(self): """ Build 'fio and ezfio'. """ self.device = self.params.get("device", 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) fio_path = os.path.join(self.srcdir, "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.srcdir, "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") self.cwd = os.getcwd()
def setUp(self): # Check for basic utilities sm = SoftwareManager() detected_distro = distro.detect() deps = ['oprofile', 'dejagnu', 'expect'] if detected_distro.name == "SuSE": deps.append("git-core") else: deps.append("git") if detected_distro.name == "Ubuntu": deps.append("libxml2-utils") deps.append("tclsh") for package in deps: if not sm.check_installed(package) and not sm.install(package): self.cancel('%s is needed for the test to be run' % package) git.get_repo('git://git.code.sf.net/p/oprofile/oprofile-tests', destination_dir=self.workdir) os.chdir(self.workdir) os.chdir("testsuite/")
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): if process.system("which sysbench", ignore_status=True): softmanager = SoftwareManager() if not softmanager.check_installed('sysbench') \ and not softmanager.install('sysbench'): '''Install the package from upstream''' self.log.info( 'Sysbench is not available in repo, Hence will ' 'install it from upstream') for package in ("autoconf", "libtool", "make"): if not softmanager.check_installed(package) \ and not softmanager.install(package): self.cancel( "Fail to install %s required for this test." "" % package) self.urllink = self.params.get( 'url-link', default="https://github.com/akopytov/" "sysbench.git") self.fixlink = self.params.get('fixlink', default=None) self.fix_dir = self.params.get('fixdir', default=None) self.bch = self.params.get('branch', default='master') git.get_repo(self.urllink, branch=self.bch, destination_dir=self.teststmpdir) if self.fixlink and self.fix_dir: fixpath = '%s%s' % (self.teststmpdir, self.fix_dir) shutil.rmtree(fixpath) git.get_repo(self.fixlink, branch="ppc64-port", destination_dir=fixpath) os.chdir(self.teststmpdir) self.run_cmd("./autogen.sh") self.run_cmd("./configure --without-mysql") self.run_cmd("make install") self.max_time = self.params.get('max-time', default=None) self.max_request = self.params.get('max-request', default=None) self.num_threads = int(self.params.get('num-threads', default=2)) self.test_type = self.params.get('type', default='cpu') self.cpu_max_prime = int(self.params.get('cpu-max-prime', default=100)) self.threads_locks = self.params.get('threads-locks', default=None) self.clear_dmesg()
def setUp(self): smm = SoftwareManager() detected_distro = distro.detect() # TODO: Add debs for Ubuntu. if detected_distro.name == "Ubuntu": self.cancel("Skip the test for ubuntu as debs needs to be" "added in packages") packages = ['make', 'gcc', 'systemtap', 'systemtap-runtime', 'elfutils', 'kernel-devel', 'dejagnu'] # 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 ["redhat", "rhel"]: packages.extend(['git', 'kernel-debug', 'kernel-debuginfo', 'kernel-debug-debuginfo', 'elfutils-devel']) if detected_distro.name == "SuSE": packages.extend(['git-core', 'kernel-default-devel', 'libebl1', 'kernel-default-debuginfo', 'kernel-devel', 'kernel-macros', 'libdw-devel', 'libebl-devel', 'libelf-devel']) for package in packages: if not smm.check_installed(package) and not smm.install(package): self.cancel(' %s is needed for the test to be run' % package) git.get_repo('git://sourceware.org/git/systemtap.git', destination_dir=self.workdir) os.chdir(self.workdir) process.run('./configure', ignore_status=True, sudo=True) build.make(self.workdir) build.make(self.workdir, extra_args='install') self.test_dir = os.path.join(self.workdir, "testsuite") os.chdir(self.test_dir) # Run a simple systemtap script to make sure systemtap and the # kernel debuginfo packages are correctly installed script_result = process.system("PATH=%s/bin:$PATH stap -v /bin/true " "-e 'probe vfs.read { exit()" " }'", ignore_status=True, sudo=True, shell=True) if script_result != 0: self.cancel("simple systemtap test failed," "kernel debuginfo package may be missing")
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) nvme_path = os.path.join(self.srcdir, 'nvme') nvme_link = 'https://github.com/linux-nvme/nvme-cli.git' git.get_repo(nvme_link, destination_dir=nvme_path) build.make(nvme_path) build.make(nvme_path, 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') self.format_namespace()
def setUp(self): softm = SoftwareManager() for package in ['gcc', 'make']: if not softm.check_installed(package) and not softm.install(package): self.cancel("%s is needed for the test to be run" % package) test_type = self.params.get('type', default='upstream') if test_type == 'upstream': git.get_repo('https://github.com/arm-hpc/papi.git', destination_dir=self.teststmpdir) self.path = os.path.join(self.teststmpdir, 'src') elif test_type == 'distro': sourcedir = os.path.join(self.teststmpdir, 'papi-distro') if not os.path.exists(sourcedir): os.makedirs(sourcedir) self.path = softm.get_source("papi", sourcedir) self.path = os.path.join(self.path, 'src') os.chdir(self.path) process.run('./configure', shell=True) build.make(self.path)
def download_test_provider(provider, update=False): """ Download a test provider defined on a .ini file inside test-providers.d. This function will only download test providers that are in git repos. Local filesystems don't need this functionality. :param provider: Test provider name, such as 'io-github-autotest-qemu'. """ provider_info = get_test_provider_info(provider) uri = provider_info.get('uri') if not uri.startswith('file://'): uri = provider_info.get('uri') branch = provider_info.get('branch') ref = provider_info.get('ref') pubkey = provider_info.get('pubkey') download_dst = data_dir.get_test_provider_dir(provider) dir_existed = os.path.exists(download_dst) repo_downloaded = os.path.isdir(os.path.join(download_dst, '.git')) original_dir = os.getcwd() try: if not repo_downloaded or update: download_dst = git.get_repo(uri=uri, branch=branch, commit=ref, destination_dir=download_dst) os.chdir(download_dst) try: process.run('git remote add origin %s' % uri) except process.CmdError: pass process.run('git pull origin %s' % branch) except: if not dir_existed and os.path.isdir(download_dst): logging.error('Cleaning up provider %s download dir %s', provider, download_dst) shutil.rmtree(download_dst) raise # sanity check to ensure the git repository is OK: try: os.chdir(download_dst) process.system('git log -1') except process.CmdError: logging.error('Something is unexpectedly wrong with the git repository at %s', download_dst) raise finally: os.chdir(original_dir)
def setUp(self): """ Build xfstest Source: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git """ self.use_dd = False root_fs = process.system_output( "df -T / | awk 'END {print $2}'", shell=True) if root_fs in ['ext3', 'ext4']: self.use_dd = True sm = SoftwareManager() self.detected_distro = distro.detect() packages = ['e2fsprogs', 'automake', 'gcc', 'quota', 'attr', 'make', 'xfsprogs', 'gawk'] if 'Ubuntu' in self.detected_distro.name: packages.extend( ['xfslibs-dev', 'uuid-dev', 'libuuid1', 'libattr1-dev', 'libacl1-dev', 'libgdbm-dev', 'uuid-runtime', 'libaio-dev', 'fio', 'dbench', 'btrfs-tools']) if '14' in self.detected_distro.version: packages.extend(['libtool']) elif '18' in self.detected_distro.version: packages.extend(['libtool-bin', 'libgdbm-compat-dev']) else: packages.extend(['libtool-bin']) # 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 self.detected_distro.name in ['centos', 'fedora', 'rhel', 'redhat', 'SuSE']: packages.extend(['acl', 'bc', 'dump', 'indent', 'libtool', 'lvm2', 'xfsdump', 'psmisc', 'sed', 'libacl-devel', 'libattr-devel', 'libaio-devel', 'libuuid-devel', 'openssl-devel', 'xfsprogs-devel']) if self.detected_distro.name == 'SuSE': packages.extend(['libbtrfs-devel', 'libcap-progs']) else: packages.extend(['btrfs-progs-devel']) if self.detected_distro.name in ['centos', 'fedora']: packages.extend(['fio', 'dbench']) else: self.cancel("test not supported in %s" % self.detected_distro.name) 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) self.skip_dangerous = self.params.get('skip_dangerous', default=True) self.test_range = self.params.get('test_range', default=None) self.scratch_mnt = self.params.get( 'scratch_mnt', default='/mnt/scratch') self.test_mnt = self.params.get('test_mnt', default='/mnt/test') self.disk_mnt = self.params.get('disk_mnt', default='/mnt/loop_device') self.dev_type = self.params.get('type', default='loop') self.fs_to_test = self.params.get('fs', default='ext4') if process.system('which mkfs.%s' % self.fs_to_test, ignore_status=True): self.cancel('Unknown filesystem %s' % self.fs_to_test) mount = True self.devices = [] shutil.copyfile(self.get_data('local.config'), os.path.join(self.teststmpdir, 'local.config')) shutil.copyfile(self.get_data('group'), os.path.join(self.teststmpdir, 'group')) if self.dev_type == 'loop': base_disk = self.params.get('disk', default=None) loop_size = self.params.get('loop_size', default='7GiB') if not base_disk: # Using root for file creation by default check = (int(loop_size.split('GiB')[0]) * 2) + 1 if disk.freespace('/') / 1073741824 > check: self.disk_mnt = '' mount = False else: self.cancel('Need %s GB to create loop devices' % check) self._create_loop_device(base_disk, loop_size, mount) else: self.test_dev = self.params.get('disk_test', default=None) self.scratch_dev = self.params.get('disk_scratch', default=None) self.devices.extend([self.test_dev, self.scratch_dev]) # mkfs for devices if self.devices: cfg_file = os.path.join(self.teststmpdir, 'local.config') with open(cfg_file, "r") as sources: lines = sources.readlines() with open(cfg_file, "w") as sources: for line in lines: if line.startswith('export TEST_DEV'): sources.write( re.sub(r'export TEST_DEV=.*', 'export TEST_DEV=%s' % self.devices[0], line)) elif line.startswith('export TEST_DIR'): sources.write( re.sub(r'export TEST_DIR=.*', 'export TEST_DIR=%s' % self.test_mnt, line)) elif line.startswith('export SCRATCH_DEV'): sources.write(re.sub( r'export SCRATCH_DEV=.*', 'export SCRATCH_DEV=%s' % self.devices[1], line)) elif line.startswith('export SCRATCH_MNT'): sources.write( re.sub( r'export SCRATCH_MNT=.*', 'export SCRATCH_MNT=%s' % self.scratch_mnt, line)) break for dev in self.devices: dev_obj = partition.Partition(dev) dev_obj.mkfs(fstype=self.fs_to_test) git.get_repo('git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git', destination_dir=self.teststmpdir) build.make(self.teststmpdir) self.available_tests = self._get_available_tests() self.test_list = self._create_test_list(self.test_range) self.log.info("Tests available in srcdir: %s", ", ".join(self.available_tests)) if not self.test_range: self.exclude = self.params.get('exclude', default=None) self.gen_exclude = self.params.get('gen_exclude', default=None) self.share_exclude = self.params.get('share_exclude', default=None) if self.exclude or self.gen_exclude or self.share_exclude: self.exclude_file = os.path.join(self.teststmpdir, 'exclude') if self.exclude: self._create_test_list(self.exclude, self.fs_to_test, dangerous=False) if self.gen_exclude: self._create_test_list(self.gen_exclude, "generic", dangerous=False) if self.share_exclude: self._create_test_list(self.share_exclude, "shared", dangerous=False) if self.detected_distro.name is not 'SuSE': process.run('useradd 123456-fsgqa', sudo=True) process.run('useradd fsgqa', sudo=True) else: process.run('useradd -m -U fsgqa', sudo=True) process.run('groupadd sys', sudo=True) if not os.path.exists(self.scratch_mnt): os.makedirs(self.scratch_mnt) if not os.path.exists(self.test_mnt): os.makedirs(self.test_mnt)
def setUp(self): # 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 sm = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make', 'patch'] if detected_distro.name == "Ubuntu": deps += ['libpthread-stubs0-dev', 'git'] elif detected_distro.name == "SuSE": deps += ['glibc-devel-static', 'git-core'] else: deps += ['glibc-static', 'git'] for package in deps: if not sm.check_installed(package) and not sm.install(package): self.cancel(' %s is needed for the test to be run' % package) kernel.check_version("2.6.16") if detected_distro.name == "Ubuntu": op = glob.glob("/usr/lib/*/libpthread.a") else: op = glob.glob("/usr/lib*/libpthread.a") if not op: self.error("libpthread.a is required!!!" "\nTry installing glibc-static") # Get arguments: self.hugetlbfs_dir = self.params.get('hugetlbfs_dir', default=None) pages_requested = self.params.get('pages_requested', default=20) # Check hugepages: pages_available = 0 if os.path.exists('/proc/sys/vm/nr_hugepages'): Hugepages_support = process.system_output('cat /proc/meminfo', verbose=False, shell=True) if 'HugePages_' not in Hugepages_support: self.error("No Hugepages Configured") memory.set_num_huge_pages(pages_requested) pages_available = memory.get_num_huge_pages() else: self.error("Kernel does not support hugepages") # Check no of hugepages : if pages_available < pages_requested: self.error('%d pages available, < %d pages requested' % (pages_available, pages_requested)) # Check if hugetlbfs is mounted cmd_result = process.run('grep hugetlbfs /proc/mounts', verbose=False) if not cmd_result: if not self.hugetlbfs_dir: self.hugetlbfs_dir = os.path.join(self.tmpdir, 'hugetlbfs') os.makedirs(self.hugetlbfs_dir) process.system('mount -t hugetlbfs none %s' % self.hugetlbfs_dir) data_dir = os.path.abspath(self.datadir) git.get_repo('https://github.com/libhugetlbfs/libhugetlbfs.git', destination_dir=self.srcdir) os.chdir(self.srcdir) patch = self.params.get('patch', default='elflink.patch') process.run('patch -p1 < %s' % data_dir + '/' + patch, shell=True) # 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", "fedora", "redhat"]: falloc_patch = 'patch -p1 < %s ' % ( os.path.join(data_dir, 'falloc.patch')) process.run(falloc_patch, shell=True) build.make(self.srcdir, extra_args='BUILDTYPE=NATIVEONLY')
def setUp(self): # Check for basic utilities sm = SoftwareManager() detected_distro = distro.detect() deps = ['gcc', 'make', 'patch'] if detected_distro.name == "Ubuntu": deps += ['libpthread-stubs0-dev', 'git'] elif detected_distro.name == "SuSE": deps += ['glibc-devel-static', 'git-core'] else: deps += ['glibc-static', 'git'] for package in deps: if not sm.check_installed(package) and not sm.install(package): self.cancel(' %s is needed for the test to be run' % package) kernel.check_version("2.6.16") if detected_distro.name == "Ubuntu": op = glob.glob("/usr/lib/*/libpthread.a") else: op = glob.glob("/usr/lib*/libpthread.a") if not op: self.cancel("libpthread.a is required!!!" "\nTry installing glibc-static") # Get arguments: self.hugetlbfs_dir = self.params.get('hugetlbfs_dir', default=None) pages_requested = self.params.get('pages_requested', default=20) # Check hugepages: pages_available = 0 if os.path.exists('/proc/sys/vm/nr_hugepages'): Hugepages_support = genio.read_file("/proc/meminfo").rstrip("\n") if 'HugePages_' not in Hugepages_support: self.cancel("No Hugepages Configured") memory.set_num_huge_pages(pages_requested) pages_available = memory.get_num_huge_pages() else: self.cancel("Kernel does not support hugepages") # Check no of hugepages : if pages_available < pages_requested: self.cancel('%d pages available, < %d pages requested' % (pages_available, pages_requested)) # Check if hugetlbfs is mounted cmd_result = process.run( 'grep hugetlbfs /proc/mounts', verbose=False, sudo=True) if not cmd_result: if not self.hugetlbfs_dir: self.hugetlbfs_dir = os.path.join(self.tmpdir, 'hugetlbfs') os.makedirs(self.hugetlbfs_dir) if process.system('mount -t hugetlbfs none %s' % self.hugetlbfs_dir, sudo=True, ignore_status=True): self.cancel("hugetlbfs mount failed") git.get_repo('https://github.com/libhugetlbfs/libhugetlbfs.git', destination_dir=self.workdir) os.chdir(self.workdir) patch = self.params.get('patch', default='elflink.patch') process.run('patch -p1 < %s' % self.get_data(patch), shell=True) build.make(self.workdir, extra_args='BUILDTYPE=NATIVEONLY')
def setUp(self): # 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 sm = SoftwareManager() detected_distro = distro.detect() if not sm.check_installed("gcc") and not sm.install("gcc"): self.error('Gcc is needed for the test to be run') if not sm.check_installed("make") and not sm.install("make"): self.error('make is needed for the test to be run') if detected_distro.name == "SuSE": if not sm.check_installed("git-core") and not sm.install("git-" "core"): self.error('git is needed for the test to be run') else: if not sm.check_installed("git") and not sm.install("git"): self.error('git is needed for the test to be run') kernel.check_version("2.6.16") if detected_distro.name == "Ubuntu": op = glob.glob("/usr/lib/*/libpthread.a") else: op = glob.glob("/usr/lib*/libpthread.a") if not op: self.error("libpthread.a is required!!!" "\nTry installing glibc-static") # Get arguments: self.hugetlbfs_dir = self.params.get('hugetlbfs_dir', default=None) pages_requested = self.params.get('pages_requested', default=20) # Check hugepages: pages_available = 0 if os.path.exists('/proc/sys/vm/nr_hugepages'): Hugepages_support = process.system_output('cat /proc/meminfo', verbose=False, shell=True) if 'HugePages_' not in Hugepages_support: self.error("No Hugepages Configured") memory.set_num_huge_pages(pages_requested) pages_available = memory.get_num_huge_pages() else: self.error("Kernel does not support hugepages") # Check no of hugepages : if pages_available < pages_requested: self.error('%d pages available, < %d pages requested' % pages_available, pages_requested) # Check if hugetlbfs is mounted cmd_result = process.run('grep hugetlbfs /proc/mounts', verbose=False) if not cmd_result: if not self.hugetlbfs_dir: self.hugetlbfs_dir = os.path.join(self.tmpdir, 'hugetlbfs') os.makedirs(self.hugetlbfs_dir) process.system('mount -t hugetlbfs none %s' % self.hugetlbfs_dir) data_dir = os.path.abspath(self.datadir) git.get_repo('https://github.com/libhugetlbfs/libhugetlbfs.git', destination_dir=self.srcdir) os.chdir(self.srcdir) patch = self.params.get('patch', default='elflink.patch') process.run('patch -p1 < %s' % data_dir + '/' + patch, shell=True) build.make(self.srcdir, extra_args='BUILDTYPE=NATIVEONLY')