Ejemplo n.º 1
0
 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})
Ejemplo n.º 2
0
    def setUp(self):
        """
        Build 'HTX'.
        """
        if 'ppc64' not in process.system_output('uname -a', shell=True):
            self.cancel("Platform does not supports")

        if distro.detect().name != 'Ubuntu':
            self.cancel("Distro does not support")

        self.mdt_file = self.params.get('mdt_file', default='mdt.hd')
        self.time_limit = int(self.params.get('time_limit', default=2)) * 3600
        self.block_devices = self.params.get('disk', default=None)
        if self.block_devices is None:
            self.cancel("Needs the block devices to run the HTX")
        self.block_device = []
        for disk in self.block_devices.split():
            self.block_device.append(disk.rsplit("/")[-1])
        self.block_device = " ".join(self.block_device)

        packages = [
            'git', 'gcc', 'make', 'libncurses5', 'g++', 'libdapl-dev',
            'ncurses-dev', 'libncurses-dev', 'libcxl-dev'
        ]
        smm = SoftwareManager()
        for pkg in packages:
            if not smm.check_installed(pkg) and not smm.install(pkg):
                self.cancel("Can not install %s" % pkg)

        url = "https://github.com/open-power/HTX/archive/master.zip"
        tarball = self.fetch_asset("htx.zip", locations=[url], expire='7d')
        archive.extract(tarball, self.teststmpdir)
        htx_path = os.path.join(self.teststmpdir, "HTX-master")
        os.chdir(htx_path)

        build.run_make(htx_path, extra_args='all')
        build.run_make(htx_path, extra_args='deb')
        process.run('dpkg -r htxubuntu')
        process.run('dpkg --purge htxubuntu')
        process.run('dpkg -i htxubuntu.deb')
        if not os.path.exists("/usr/lpp/htx/mdt/%s" % self.mdt_file):
            self.cancel("MDT file %s not found" % self.mdt_file)
        self.smt = self.params.get('smt_change', default=False)
        if self.smt:
            self.max_smt_value = 8
            if cpu.get_cpu_arch().lower() == 'power7':
                self.max_smt_value = 4
            if cpu.get_cpu_arch().lower() == 'power6':
                self.max_smt_value = 2
            self.smt_values = ["off", "on"]
            for i in range(2, self.max_smt_value + 1):
                self.smt_values.append(str(i))
            self.curr_smt = process.system_output(
                "ppc64_cpu --smt | awk -F'=' \
                '{print $NF}' | awk '{print $NF}'",
                shell=True)
    def setUp(self):
        """
        Build 'HTX'.
        """
        if 'ppc64' not in process.system_output('uname -a', shell=True):
            self.cancel("Platform does not supports")

        if distro.detect().name != 'Ubuntu':
            self.cancel("Distro does not support")

        self.mdt_file = self.params.get('mdt_file', default='mdt.hd')
        self.time_limit = int(self.params.get('time_limit', default=2)) * 3600
        self.block_devices = self.params.get('disk', default=None)
        if self.block_devices is None:
            self.cancel("Needs the block devices to run the HTX")
        self.block_device = []
        for disk in self.block_devices.split():
            self.block_device.append(disk.rsplit("/")[-1])
        self.block_device = " ".join(self.block_device)

        packages = ['git', 'gcc', 'make', 'libncurses5', 'g++', 'libdapl-dev',
                    'ncurses-dev', 'libncurses-dev', 'libcxl-dev']
        smm = SoftwareManager()
        for pkg in packages:
            if not smm.check_installed(pkg) and not smm.install(pkg):
                self.cancel("Can not install %s" % pkg)

        url = "https://github.com/open-power/HTX/archive/master.zip"
        tarball = self.fetch_asset("htx.zip", locations=[url], expire='7d')
        archive.extract(tarball, self.teststmpdir)
        htx_path = os.path.join(self.teststmpdir, "HTX-master")
        os.chdir(htx_path)

        build.run_make(htx_path, extra_args='all')
        build.run_make(htx_path, extra_args='deb')
        process.run('dpkg -r htxubuntu')
        process.run('dpkg --purge htxubuntu')
        process.run('dpkg -i htxubuntu.deb')
        if not os.path.exists("/usr/lpp/htx/mdt/%s" % self.mdt_file):
            self.cancel("MDT file %s not found" % self.mdt_file)
        self.smt = self.params.get('smt_change', default=False)
        if self.smt:
            self.max_smt_value = 8
            if cpu.get_cpu_arch().lower() == 'power7':
                self.max_smt_value = 4
            if cpu.get_cpu_arch().lower() == 'power6':
                self.max_smt_value = 2
            self.smt_values = ["off", "on"]
            for i in range(2, self.max_smt_value + 1):
                self.smt_values.append(str(i))
            self.curr_smt = process.system_output("ppc64_cpu --smt | awk -F'=' \
                '{print $NF}' | awk '{print $NF}'", shell=True)
Ejemplo n.º 4
0
    def test(self):
        os.chdir(self.workdir)

        functional_test = self.params.get('functional_test', default=False)
        test_type = 'check'
        if functional_test:
            test_type = 'func'
        run_log = build.run_make(self.workdir,
                                 extra_args='BUILDTYPE=NATIVEONLY %s' %
                                 test_type,
                                 process_kwargs={
                                     'ignore_status': True
                                 }).stdout.decode('utf-8')
        parsed_results = []
        error = ""
        for idx, hp_size in enumerate(self.configured_page_sizes):
            parsed_results.append(self._log_parser(run_log, idx * 2))

            if parsed_results[idx][32]['FAIL']:
                error += "%s 32-bit tests failed for %sMB hugepage\n" % (
                    parsed_results[idx][32]['FAIL'], hp_size)

            if parsed_results[idx][64]['FAIL']:
                error += "%s 64-bit tests failed for %sMB hugepage\n" % (
                    parsed_results[idx][64]['FAIL'], hp_size)

        if error:
            self.fail(error)
Ejemplo n.º 5
0
    def build_tests(self, testdir_name):
        '''
        build different test builds
        '''
        if self.name.uid == 13:
            test_dir = os.path.join(self.buldir, testdir_name)
        else:
            test_dir = os.path.join(self.teststmpdir, testdir_name)
        os.chdir(test_dir)
        testdir_dict = {
            "": "check",
            "selftest": "run_tests",
            "test": "unsafe-check",
            "samples": "bench",
            "oct": "-j16",
            "tools/testing/selftests/powerpc/nx-gzip": "run_tests"
        }

        failed_tests = []
        output = build.run_make(test_dir,
                                extra_args=testdir_dict[testdir_name],
                                process_kwargs={"ignore_status": True})
        for line in output.stdout.decode('utf-8').splitlines():
            if "failed" in line:
                failed_tests.append(line)
        if failed_tests:
            self.fail("%s" % failed_tests)
Ejemplo n.º 6
0
    def test(self):
        '''
        1.perf test :Does sanity tests and
          execute the tests by calling each module
        2.Build perftool Test
          Source:
          https://github.com/rfmvh/perftool-testsuite
        '''
        count = 0
        # Built in perf test
        for string in process.run("perf test").stderr.splitlines():
            if 'FAILED' in str(string.splitlines()):
                self.log.info("Test case failed is %s" %
                              str(string.splitlines()))

        # perf testsuite
        for line in build.run_make(self.sourcedir,
                                   extra_args='check',
                                   process_kwargs={
                                       'ignore_status': True
                                   }).stdout.splitlines():
            if '-- [ FAIL ] --' in line:
                count += 1
                self.log.info(line)

        if count > 0:
            self.fail("%s Test failed" % count)
Ejemplo n.º 7
0
    def setUp(self):
        sm = SoftwareManager()
        detected_distro = distro.detect()
        self.stressor = self.params.get('stressor', default='mmapfork')
        self.ttimeout = self.params.get('ttimeout', default=300)
        self.workers = self.params.get('workers', default=0)
        if 'Ubuntu' in detected_distro.name:
            deps = ['stress-ng', 'libaio-dev', 'libapparmor-dev', 'libattr1-dev', 'libbsd-dev',
                    'libcap-dev', 'libgcrypt11-dev', 'libkeyutils-dev', 'libsctp-dev', 'zlib1g-dev']
        else:
            deps = ['libattr-devel', 'libbsd-devel', 'libcap-devel',
                    'libgcrypt-devel', 'keyutils-libs-devel', 'zlib-devel', 'libaio-devel']
        for package in deps:
            if not sm.check_installed(package) and not sm.install(package):
                self.log.info(
                    '%s is needed, get the source and build' % package)

        if 'Ubuntu' not in detected_distro.name:
            tarball = self.fetch_asset('stressng.zip', locations=[
                                       'https://github.com/ColinIanKing/'
                                       'stress-ng/archive/master.zip'],
                                       expire='7d')
            archive.extract(tarball, self.srcdir)
            self.srcdir = os.path.join(self.srcdir, 'stress-ng-master')
            os.chdir(self.srcdir)
            result = build.run_make(self.srcdir, ignore_status=True)
            for line in str(result).splitlines():
                if 'error:' in line:
                    self.cancel(
                        "Unsupported OS, Please check the build logs !!")
            build.make(self.srcdir, extra_args='install')
        clear_dmesg()
Ejemplo n.º 8
0
    def test(self):
        '''
        1.perf test :Does sanity tests and
          execute the tests by calling each module
        2.Build perftool Test
          Source:
          https://github.com/rfmvh/perftool-testsuite
        '''
        count = 0
        # Built in perf test
        for string in process.run("perf test").stderr.splitlines():
            if 'FAILED' in str(string.splitlines()):
                self.log.info("Test case failed is %s"
                              % str(string.splitlines()))

        # perf testsuite
        for line in build.run_make(self.sourcedir, extra_args='check',
                                   process_kwargs={'ignore_status': True}
                                   ).stdout.splitlines():
            if '-- [ FAIL ] --' in line:
                count += 1
                self.log.info(line)

        if count > 0:
            self.fail("%s Test failed" % count)
Ejemplo n.º 9
0
    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 !!")
Ejemplo n.º 10
0
    def test(self):
        self.count = 0
        for line in build.run_make(self.srcdir, extra_args='check',
                                   ignore_status=True).stdout.splitlines():
            if '-- [ FAIL ] --' in line:
                self.count += 1
                self.log.info(line)

        if self.count > 0:
            self.fail("%s Test failed" % self.count)
Ejemplo n.º 11
0
 def test(self):
     '''
     Running tests from audit-testsuite
     '''
     output = build.run_make(self.sourcedir,
                             extra_args="test",
                             process_kwargs={"ignore_status": True})
     for line in output.stdout_text.splitlines():
         if 'Result: FAIL' in line:
             self.log.info(line)
             self.fail("Some of the test(s) failed, refer to the log file")
Ejemplo n.º 12
0
    def test(self):
        self.count = 0
        for line in build.run_make(self.srcdir,
                                   extra_args='check',
                                   ignore_status=True).stdout.splitlines():
            if '-- [ FAIL ] --' in line:
                self.count += 1
                self.log.info(line)

        if self.count > 0:
            self.fail("%s Test failed" % self.count)
 def test_selftests(self):
     """
     Runs the selftests on the device.
     """
     err = []
     for line in build.run_make(os.path.join(self.nvme_dir, 'tests'),
                                extra_args='run',
                                ignore_status=True).stderr.splitlines():
         if 'FAIL:' in line:
             err.append(line.split('.')[1])
     self.fail("Some tests failed. Details below:\n%s" % "\n".join(err))
 def test_selftests(self):
     """
     Runs the selftests on the device.
     """
     err = []
     for line in build.run_make(os.path.join(self.nvme_dir, 'tests'),
                                extra_args='run',
                                ignore_status=True).stderr.splitlines():
         if 'FAIL:' in line:
             err.append(line.split('.')[1])
     self.fail("Some tests failed. Details below:\n%s" % "\n".join(err))
Ejemplo n.º 15
0
    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()
Ejemplo n.º 16
0
    def test(self):
        """
        Runs the gcc `make check`
        """
        ret = build.run_make(
            self.sourcedir, extra_args='check', ignore_status=True)
        self.summary = ret.stdout.splitlines()
        for index, line in enumerate(self.summary):
            if "=== gcc Summary ===" in line:
                self.get_summary(index + 2)

        if ret.exit_status:
            self.fail("Few gcc tests failed,refer the log file")
Ejemplo n.º 17
0
 def test(self):
     '''
     Running tests from krb5
     '''
     count = 0
     output = build.run_make(self.sourcedir, extra_args="check",
                             process_kwargs={"ignore_status": True})
     for line in output.stdout_text.splitlines():
         if '*** Failure:' in line:
             count += 1
             self.log.info(line)
     if count:
         self.fail("%s test(s) failed, please refer to the log" % count)
Ejemplo n.º 18
0
 def test(self):
     '''
     Running tests from keyutils
     '''
     count = 0
     output = build.run_make(self.make_path,
                             process_kwargs={"ignore_status": True})
     for line in output.stdout_text.splitlines():
         if 'FAILED' in line:
             count += 1
             self.log.info(line)
     if count:
         self.fail("%s test(s) failed, please refer to the log" % count)
Ejemplo n.º 19
0
 def test(self):
     '''
     Various test options are available which can be
     explored in INSTALL.txt file and used. Here, the test performs
     sanity tests using make check option if no extra user option is
     specified.
     '''
     make_option = self.params.get('make_option', default='check')
     ret = build.run_make(self.atlas_build_dir, extra_args=make_option,
                          process_kwargs={'ignore_status': True})
     if ret.exit_status:
         self.fail("Make check Has been Failed !!"
                   "Please, refer the log file")
Ejemplo n.º 20
0
 def test(self):
     '''
     Running tests from selinux-testsuite
     '''
     count = 0
     output = build.run_make(self.sourcedir,
                             extra_args="-C tests test",
                             process_kwargs={"ignore_status": True})
     for line in output.stderr_text.splitlines():
         if 'Failed test at' in line:
             count += 1
             self.log.info(line)
     if count:
         self.fail("%s test(s) failed, please refer to the log" % count)
Ejemplo n.º 21
0
    def test(self):
        """
        Runs the gcc `make check`
        """
        ret = build.run_make(self.srcdir,
                             extra_args='check',
                             ignore_status=True)
        self.summary = ret.stdout.splitlines()
        for index, line in enumerate(self.summary):
            if "=== gcc Summary ===" in line:
                self.get_summary(index + 2)

        if ret.exit_status:
            self.fail("Few gcc tests failed,refer the log file")
Ejemplo n.º 22
0
 def test(self):
     '''
     Running tests from annobin
     '''
     count = 0
     output = build.run_make(self.workdir, extra_args="check",
                             process_kwargs={"ignore_status": True})
     for line in output.stdout_text.splitlines():
         if 'FAIL:' in line and 'XFAIL:' not in line and \
            '# FAIL:' not in line:
             count += 1
             self.log.info(line)
     if count:
         self.fail("%s test(s) failed, please refer to the log" % count)
Ejemplo n.º 23
0
    def test(self):
        """
        Runs the gcc `make check`
        """
        ret = build.run_make(self.sourcedir,
                             extra_args='check',
                             process_kwargs={'ignore_status': True})
        self.summary = ret.stdout.decode("utf-8").splitlines()
        for index, line in enumerate(self.summary):
            if "=== gcc Summary ===" in line:
                self.get_summary(index + 2)

        if ret.exit_status:
            self.fail("Few gcc tests failed,refer the log file")
Ejemplo n.º 24
0
    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 !!")
Ejemplo n.º 25
0
    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 !!")
Ejemplo n.º 26
0
 def test_perf_testsuite(self):
     '''
     Build perftool Test
     Source: https://github.com/rfmvh/perftool-testsuite
     '''
     count = 0
     for line in build.run_make(self.sourcedir,
                                extra_args='check',
                                process_kwargs={
                                    'ignore_status': True
                                }).stdout.decode("utf-8").splitlines():
         if '-- [ FAIL ] --' in line:
             count += 1
             self.log.info(line)
     if count > 0:
         self.fail("%s Test failed" % count)
Ejemplo n.º 27
0
    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', 'libcap-devel',
                         'libgcrypt-devel', 'zlib-devel', 'libaio-devel'])
        for package in deps:
            if not smm.check_installed(package) and not smm.install(package):
                self.cancel("%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()
Ejemplo n.º 28
0
 def get_results(self, cmd):
     """
     run 'make' of given command and write the summary to respective files
     """
     summary = ''
     flag = False
     results = build.run_make(
         self.sourcedir, extra_args=cmd, ignore_status=True).stdout
     for line in results.splitlines():
         if line.startswith('==') and line.endswith('=='):
             flag = True
         if flag:
             summary += '%s\n' % line
     with open(os.path.join(self.outputdir, '%s_result' % cmd), 'w') as f_obj:
         f_obj.write(summary)
     if 'failed' in summary:
         self.failures.append(cmd)
Ejemplo n.º 29
0
 def get_results(self, cmd):
     """
     run 'make' of given command and write the summary to respective files
     """
     summary = ''
     flag = False
     results = build.run_make(
         self.sourcedir, extra_args=cmd, ignore_status=True).stdout
     for line in results.splitlines():
         if line.startswith('==') and line.endswith('=='):
             flag = True
         if flag:
             summary += '%s\n' % line
     with open(os.path.join(self.outputdir, '%s_result' % cmd), 'w') as f_obj:
         f_obj.write(summary)
     if 'failed' in summary:
         self.failures.append(cmd)
Ejemplo n.º 30
0
    def test(self):
        '''
        Execute regression tests for libunwind library
        '''
        results = build.run_make(self.sourcedir, extra_args='check',
                                 process_kwargs={'ignore_status': True}).stdout.decode("utf-8")

        fail_list = ['FAIL', 'XFAIL', 'ERROR']
        failures = []
        for failure in fail_list:
            num_fails = re.compile(r"# %s:(.*)" %
                                   failure).findall(results)[0].strip()
            if int(num_fails):
                failures.append({failure: num_fails})

        if failures:
            self.fail('Test failed with following:%s' % failures)
Ejemplo n.º 31
0
    def test(self):
        """
        Execute self test of libvecpf library
        """
        results = build.run_make(self.sourcedir, extra_args='check',
                                 process_kwargs={'ignore_status': True}).stdout

        fail_list = ['FAIL', 'XFAIL', 'ERROR']
        failures = []
        for failure in fail_list:
            num_fails = re.compile(r"# %s:(.*)" %
                                   failure).findall(results)[0].strip()
            if int(num_fails):
                failures.append({failure: num_fails})

        if failures:
            self.fail('Test failed with following:%s' % failures)
Ejemplo n.º 32
0
 def test(self):
     ret = build.run_make(self.build_dir, extra_args='check',
                          process_kwargs={"ignore_bg_processes": True,
                                          "ignore_status": True})
     logfile = os.path.join(self.logdir, "debug.log")
     if ret.exit_status != 0:
         with open(logfile, 'r') as f:
             file_buff = f.read().splitlines()
             for index, line in enumerate(file_buff):
                 if 'Summary' in line:
                     failures = file_buff[index + 1].split()[3]
                     if int(failures) != 0:
                         self.fail("No of Failures occured %s"
                                   "\nCheck logs for more info" % failures)
     else:
         self.log.info("Tests Have been Passed\n"
                       "Please Check Logfile %s run info" % logfile)
 def test(self):
     """
     Selftests for non-NFIT devices
     """
     self.log.info("Running NDCTL selftests")
     failed_tests = []
     output = build.run_make(
         self.sourcedir, extra_args='check -j 1', process_kwargs={"ignore_status": True})
     for line in output.stdout.decode('utf-8').splitlines():
         if "Testsuite summary" in line:
             break
         if "PASS" in line:
             self.log.info("Passed test %s", line)
         if "FAIL" in line:
             failed_tests.append(line)
     if failed_tests:
         self.fail("%s" % failed_tests)
Ejemplo n.º 34
0
    def test(self):
        '''
        Execute regression tests for libunwind library
        '''
        results = build.run_make(self.sourcedir, extra_args='check',
                                 ignore_status=True).stdout

        fail_list = ['FAIL', 'XFAIL', 'ERROR']
        failures = []
        for failure in fail_list:
            num_fails = re.compile(r"# %s:(.*)" %
                                   failure).findall(results)[0].strip()
            if int(num_fails):
                failures.append({failure: num_fails})

        if failures:
            self.fail('Test failed with following:%s' % failures)
Ejemplo n.º 35
0
 def test(self):
     ret = build.run_make(self.build_dir, extra_args='check',
                          process_kwargs={"ignore_bg_processes": True,
                                          "ignore_status": True})
     logfile = os.path.join(self.logdir, "debug.log")
     if ret.exit_status != 0:
         with open(logfile, 'r') as f:
             file_buff = f.read().splitlines()
             for index, line in enumerate(file_buff):
                 if 'Summary' in line:
                     failures = file_buff[index+1].split()[3]
                     if int(failures) != 0:
                         self.fail("No of Failures occured %s"
                                   "\nCheck logs for more info" % failures)
     else:
         self.log.info("Tests Have been Passed\n"
                       "Please Check Logfile %s run info" % logfile)
Ejemplo n.º 36
0
    def test(self):
        """
        Execute self test of libvecpf library
        """
        results = build.run_make(self.srcdir,
                                 extra_args='check',
                                 ignore_status=True).stdout

        fail_list = ['FAIL', 'XFAIL', 'ERROR']
        failures = []
        for failure in fail_list:
            num_fails = re.compile(r"# %s:(.*)" %
                                   failure).findall(results)[0].strip()
            if int(num_fails):
                failures.append({failure: num_fails})

        if failures:
            self.fail('Test failed with following:%s' % failures)
Ejemplo n.º 37
0
    def test(self):
        os.chdir(self.srcdir)

        parsed_results = self._log_parser(
            build.run_make(self.srcdir,
                           extra_args='BUILDTYPE=NATIVEONLY check').stdout)
        error = ""

        if parsed_results[32]['FAIL']:
            error += "%s tests failed for 32-bit\n" % (
                parsed_results[32]['FAIL'])

        if parsed_results[64]['FAIL']:
            error += "%s tests failed for 64-bit" % (
                parsed_results[64]['FAIL'])

        if error:
            self.fail(error)
Ejemplo n.º 38
0
    def test(self):
        os.chdir(self.workdir)

        parsed_results = self._log_parser(
            build.run_make(self.workdir,
                           extra_args='BUILDTYPE=NATIVEONLY check').stdout)
        error = ""

        if parsed_results[32]['FAIL']:
            error += "%s tests failed for 32-bit\n" % (
                parsed_results[32]['FAIL'])

        if parsed_results[64]['FAIL']:
            error += "%s tests failed for 64-bit" % (
                parsed_results[64]['FAIL'])

        if error:
            self.fail(error)
Ejemplo n.º 39
0
    def test(self):
        """
        Execute strace self tests
        """
        results = build.run_make(self.src_st,
                                 extra_args='-k check',
                                 process_kwargs={
                                     'ignore_status': True
                                 }).stdout

        fail_list = ['FAIL', 'XFAIL', 'ERROR']
        failures = []
        for failure in fail_list:
            num_fails = re.compile(r"# %s:(.*)" % failure).findall(
                results.decode('utf-8'))[0].strip()
            if int(num_fails):
                failures.append({failure: num_fails})

        if failures:
            self.fail('Test failed with following:%s' % failures)
Ejemplo n.º 40
0
    def test(self):
        os.chdir(self.workdir)

        run_log = build.run_make(
            self.workdir, extra_args='BUILDTYPE=NATIVEONLY check').stdout
        parsed_results = []
        error = ""
        for idx, hp_size in enumerate(self.page_sizes):
            parsed_results.append(self._log_parser(run_log, idx * 2))

            if parsed_results[idx][32]['FAIL']:
                error += "%s 32-bit tests failed for %sMB hugepage\n" % (
                    parsed_results[idx][32]['FAIL'], hp_size)

            if parsed_results[idx][64]['FAIL']:
                error += "%s 64-bit tests failed for %sMB hugepage\n" % (
                    parsed_results[idx][64]['FAIL'], hp_size)

        if error:
            self.fail(error)
Ejemplo n.º 41
0
    def setUp(self):
        """
        Resolve the packages dependencies and download the source.
        """
        smg = SoftwareManager()
        detected_distro = distro.detect()
        deps = ['gcc', 'make', 'automake', 'autoconf']

        if 'Ubuntu' in detected_distro.name:
            deps.extend([
                'libpopt0', 'libc6', 'libc6-dev', 'libpopt-dev', 'libcap-ng0',
                'libcap-ng-dev'
            ])
        elif 'SuSE' in detected_distro.name:
            deps.extend([
                'popt', 'glibc', 'glibc-devel', 'popt-devel', 'libcap1',
                'libcap1-devel', 'libcap-ng', 'libcap-ng-devel'
            ])
        elif detected_distro.name in ['centos', 'fedora', 'redhat']:
            deps.extend([
                'popt', 'glibc', 'glibc-devel', 'glibc-static', 'libcap-ng',
                'libcap', 'libcap-devel'
            ])

        for package in deps:
            if not smg.check_installed(package) and not smg.install(package):
                self.error('%s is needed for the test to be run !!' %
                           (package))

        location = ["https://github.com/torvalds/linux/archive/master.zip"]
        tarball = self.fetch_asset("kselftest.zip",
                                   locations=location,
                                   expire='1d')
        archive.extract(tarball, self.srcdir)
        self.buldir = os.path.join(self.srcdir, 'linux-master')
        self.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 !!")
Ejemplo n.º 42
0
    def setUp(self):
        """
        Resolve the packages dependencies and download the source.
        """
        smg = SoftwareManager()
        detected_distro = distro.detect()
        deps = ['gcc', 'make', 'automake', 'autoconf']

        if 'Ubuntu' in detected_distro.name:
            deps.extend(['libpopt0', 'libc6', 'libc6-dev',
                         'libpopt-dev', 'libcap-ng0', 'libcap-ng-dev',
                         'libnuma-dev', 'libfuse-dev'])
        elif 'SuSE' in detected_distro.name:
            deps.extend(['popt', 'glibc', 'glibc-devel', 'popt-devel',
                         'libcap2', 'libcap-devel', 'libcap-ng-devel'])
        # FIXME: "redhat" as the distro name for RHEL is deprecated
        # on Avocado versions >= 50.0.  This is a temporary compatibility
        # enabler for older runners, but should be removed soon
        elif detected_distro.name in ['centos', 'fedora', 'rhel', 'redhat']:
            deps.extend(['popt', 'glibc', 'glibc-devel', 'glibc-static',
                         'libcap-ng', 'libcap', 'libcap-devel'])

        for package in deps:
            if not smg.check_installed(package) and not smg.install(package):
                self.cancel(
                    "Fail to install %s required for this test." % (package))

        location = ["https://github.com/torvalds/linux/archive/master.zip"]
        tarball = self.fetch_asset("kselftest.zip", locations=location,
                                   expire='1d')
        archive.extract(tarball, self.srcdir)
        self.buldir = os.path.join(self.srcdir, 'linux-master')
        self.sourcedir = os.path.join(self.buldir, self.testdir)
        result = build.run_make(self.sourcedir)
        for line in str(result).splitlines():
            if 'ERROR' in line:
                self.fail("Compilation failed, Please check the build logs !!")
Ejemplo n.º 43
0
    def setUp(self):
        """
        Resolve the packages dependencies and download the source.
        """
        smg = SoftwareManager()
        self.comp = self.params.get('comp', default='')
        run_type = self.params.get('type', default='upstream')
        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))

        if run_type == 'upstream':
            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')
        else:
            # Make sure kernel source repo is configured
            if detected_distro.name in ['centos', 'fedora', 'rhel']:
                self.buldir = smg.get_source('kernel', self.workdir)
                self.buldir = os.path.join(
                    self.buldir, os.listdir(self.buldir)[0])
            elif 'Ubuntu' in detected_distro.name:
                self.buldir = smg.get_source('linux', self.workdir)
            elif 'SuSE' in detected_distro.name:
                smg.get_source('kernel-source', self.workdir)
                packages = '/usr/src/packages/'
                os.chdir(os.path.join(packages, 'SOURCES'))
                process.system('./mkspec', ignore_status=True)
                shutil.copy(os.path.join(packages, 'SOURCES/kernel'
                                                   '-default.spec'),
                            os.path.join(packages, 'SPECS/kernel'
                                                   '-default.spec'))
                self.buldir = smg.prepare_source(os.path.join(
                    packages, 'SPECS/kernel'
                              '-default.spec'), dest_path=self.teststmpdir)
                for l_dir in glob.glob(os.path.join(self.buldir, 'linux*')):
                    if os.path.isdir(l_dir) and 'Makefile' in os.listdir(l_dir):
                        self.buldir = os.path.join(
                            self.buldir, os.listdir(self.buldir)[0])

        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 !!")
Ejemplo n.º 44
0
 def test(self):
     result = build.run_make(self.test_dir)
     for line in str(result).splitlines():
         if '[FAIL]' in line:
             self.fail("test failed, Please check debug log for failed"
                       "test cases")