示例#1
0
    def execute(self, base_tree, patches, config, config_list=None):
        kernel = self.job.kernel(base_tree, self.outputdir)
        if patches:
            kernel.patch(*patches)
        kernel.config(config, config_list)

        kernel.build()
示例#2
0
    def execute(self, base_tree, patches, config, config_list=None):
        kernel = self.job.kernel(base_tree, self.resultsdir)
        kernel.patch(patches)
        kernel.config(config, config_list)

        os.environ['PATH'] = self.srcdir + ':' + os.environ['PATH']
        results = os.path.join(self.resultsdir, 'sparse')
        kernel.build(make_opts='C=1', logfile=results)
示例#3
0
    def execute(self, base_tree, patches, config, config_list = None):
        kernel = self.job.kernel(base_tree, self.resultsdir)
        kernel.patch(patches)
        kernel.config(config, config_list)

        os.environ['PATH'] = self.srcdir + ':' + os.environ['PATH']
        results = os.path.join (self.resultsdir, 'sparse')
        kernel.build(make_opts = 'C=1', logfile = results)
示例#4
0
    def execute(self,
                kernel=None,
                patch=None,
                build_target=None,
                base_tree=None,
                config=None):

        if (kernel is None) and (base_tree is None):
            raise error.TestError(
                "Test requires at least kernel or base_tree parameters")

        if not kernel:
            kernel = self.job.kernel(base_tree)
            if patch:
                kernel.patch(patch)
            if not config:
                kernel.config()
            else:
                kernel.config(config)

        logfile = os.path.join(self.resultsdir, 'sparse_log')
        errlog = os.path.join(self.resultsdir, 'sparse_error')

        os.chdir(kernel.build_dir)
        kernel.set_cross_cc()
        # It is important to clean kernel before the check in order
        # generate comparable results
        kernel.clean()

        if not build_target:
            build_target = self.build_target

        # TODO Add more debug defines
        debug_def = 'CF="-D__CHECK_ENDIAN__"'
        make_opts = 'C=2 %s CHECK="%s -p=kernel"' % (
            debug_def, os.path.join(self.srcdir, 'sparse'))

        make_cmd = " %s %s 2> %s | tee %s" % (make_opts, build_target, errlog,
                                              logfile)
        utils.make(make_cmd)

        # Account number of warnings and error and store as key-value
        lf = open(logfile, 'r')
        ef = open(errlog, 'r')
        warn_cnt = len(re.findall(r'warning: ', lf.read(), re.MULTILINE))
        warn_cnt += len(re.findall(r'warning: ', ef.read(), re.MULTILINE))
        lf.seek(0)
        ef.seek(0)
        err_cnt = len(re.findall(r'error: ', lf.read(), re.MULTILINE))
        err_cnt += len(re.findall(r'error: ', ef.read(), re.MULTILINE))
        ef.close()
        lf.close()
        self.write_test_keyval({'warnings': warn_cnt, 'errors': err_cnt})
示例#5
0
    def execute(self, kernel=None, patch=None, build_target=None, base_tree=None, config=None):

        if (kernel is None) and (base_tree is None):
            raise error.TestError("Test requires at least kernel or base_tree parameters")

        if not kernel:
            kernel = self.job.kernel(base_tree)
            if patch:
                kernel.patch(patch)
            if not config:
                kernel.config()
            else:
                kernel.config(config)

        logfile = os.path.join(self.resultsdir, 'sparse_log')
        errlog = os.path.join(self.resultsdir, 'sparse_error')

        os.chdir(kernel.build_dir)
        kernel.set_cross_cc()
        # It is important to clean kernel before the check in order
        # generate comparable results
        kernel.clean()

        if not build_target:
            build_target = self.build_target

        # TODO Add more debug defines
        debug_def = 'CF="-D__CHECK_ENDIAN__"'
        make_opts = 'C=2 %s CHECK="%s -p=kernel"' % (debug_def, os.path.join(self.srcdir, 'sparse'))

        make_cmd = " %s %s 2> %s | tee %s" % (make_opts, build_target, errlog, logfile)
        utils.make(make_cmd)

        # Account number of warnings and error and store as key-value
        lf = open(logfile, 'r')
        ef = open(errlog, 'r')
        warn_cnt = len(re.findall(r'warning: ', lf.read(), re.MULTILINE))
        warn_cnt += len(re.findall(r'warning: ', ef.read(), re.MULTILINE))
        lf.seek(0)
        ef.seek(0)
        err_cnt = len(re.findall(r'error: ', lf.read(), re.MULTILINE))
        err_cnt += len(re.findall(r'error: ', ef.read(), re.MULTILINE))
        ef.close()
        lf.close()
        self.write_test_keyval({'warnings': warn_cnt,
                                'errors': err_cnt})
示例#6
0
    def execute(self,
                kernel=None,
                build_target=None,
                base_tree=None,
                patch=None,
                config=None):
        """
        Arguments:
                {kernel | base_tree} [build_target]
                kernel: kernel object
                base_tree [patch, config] : kernel's base tree
        """
        own_kernel = False
        if (kernel is None) and (base_tree is None):
            raise error.TestError(
                "Test requires at least one parameter {kernel | base_tree}")

        if not kernel:
            kernel = self.job.kernel(base_tree)
            own_kernel = True
            if patch:
                kernel.patch(patch)
            if not config:
                kernel.config()
            else:
                kernel.config(config)

        os.chdir(kernel.build_dir)
        kernel.set_cross_cc()
        # It is important to clean kernel before the check in order
        # generate comparable results
        kernel.clean()
        # Problem: smatch works badly with CONFIG_DYNAMIC_DEBUG=y, so we have to
        # disable it which require changes of original config
        # Solution: save original .config and restore after test
        if not own_kernel:
            orig_config = os.path.join(self.tmpdir, 'kernel-config.orig')
            logging.info('Saving original kernel config at %s', orig_config)
            shutil.copyfile('.config', orig_config)

        override = os.path.join(self.bindir, 'config.override')
        kernel.config(orig_config, override)

        logfile = os.path.join(self.resultsdir, 'smatch.log')
        errlog = os.path.join(self.resultsdir, 'smatch.log.error')

        if not build_target:
            build_target = self.build_target

        # TODO Add more debug defines
        debug_def = 'CF="-D__CHECK_ENDIAN__"'
        make_opts = 'C=2 %s CHECK="%s -p=kernel"' % \
            (debug_def, os.path.join(self.srcdir, 'smatch'))

        make_cmd = " %s %s 2> %s | tee %s" % (make_opts, build_target, errlog,
                                              logfile)
        utils.make(make_cmd)

        # Account errors and warnings and save it in key-value
        lf = open(logfile, 'r')
        ef = open(errlog, 'r')
        warn_cnt = len(
            re.findall(r'(warn:|warning:) ', lf.read(), re.MULTILINE))
        warn_cnt += len(
            re.findall(r'(warn:|warning:) ', ef.read(), re.MULTILINE))
        lf.seek(0)
        ef.seek(0)
        err_cnt = len(re.findall(r'error: ', lf.read(), re.MULTILINE))
        err_cnt += len(re.findall(r'error: ', ef.read(), re.MULTILINE))
        ef.close()
        lf.close()
        self.write_test_keyval({'warnings': warn_cnt, 'errors': err_cnt})

        if not own_kernel:
            logging.info('Restoring original kernel config')
            kernel.config(orig_config)
示例#7
0
    def execute(self, kernel=None, build_target=None, base_tree=None,
                patch=None, config=None):
        """
        Arguments:
                {kernel | base_tree} [build_target]
                kernel: kernel object
                base_tree [patch, config] : kernel's base tree
        """
        own_kernel = False
        if (kernel is None) and (base_tree is None):
            raise error.TestError("Test requires at least one parameter {kernel | base_tree}")

        if not kernel:
            kernel = self.job.kernel(base_tree)
            own_kernel = True
            if patch:
                kernel.patch(patch)
            if not config:
                kernel.config()
            else:
                kernel.config(config)

        os.chdir(kernel.build_dir)
        kernel.set_cross_cc()
        # It is important to clean kernel before the check in order
        # generate comparable results
        kernel.clean()
        # Problem: smatch works badly with CONFIG_DYNAMIC_DEBUG=y, so we have to
        # disable it which require changes of original config
        # Solution: save original .config and restore after test
        if not own_kernel:
            orig_config = os.path.join(self.tmpdir, 'kernel-config.orig')
            logging.info('Saving original kernel config at %s', orig_config)
            shutil.copyfile('.config', orig_config)

        override = os.path.join(self.bindir, 'config.override')
        kernel.config(orig_config, override)

        logfile = os.path.join(self.resultsdir, 'smatch.log')
        errlog = os.path.join(self.resultsdir, 'smatch.log.error')

        if not build_target:
            build_target = self.build_target

        # TODO Add more debug defines
        debug_def = 'CF="-D__CHECK_ENDIAN__"'
        make_opts = 'C=2 %s CHECK="%s -p=kernel"' % \
            (debug_def, os.path.join(self.srcdir, 'smatch'))

        make_cmd = " %s %s 2> %s | tee %s" % (make_opts, build_target, errlog, logfile)
        utils.make(make_cmd)

        # Account errors and warnings and save it in key-value
        lf = open(logfile, 'r')
        ef = open(errlog, 'r')
        warn_cnt = len(re.findall(r'(warn:|warning:) ', lf.read(), re.MULTILINE))
        warn_cnt += len(re.findall(r'(warn:|warning:) ', ef.read(), re.MULTILINE))
        lf.seek(0)
        ef.seek(0)
        err_cnt = len(re.findall(r'error: ', lf.read(), re.MULTILINE))
        err_cnt += len(re.findall(r'error: ', ef.read(), re.MULTILINE))
        ef.close()
        lf.close()
        self.write_test_keyval({'warnings': warn_cnt,
                                'errors': err_cnt})

        if not own_kernel:
            logging.info('Restoring original kernel config')
            kernel.config(orig_config)