Ejemplo n.º 1
0
    def __init__(self,
                 job,
                 build_dir,
                 config_dir,
                 orig_file,
                 overrides,
                 defconfig=False,
                 name=None,
                 make=None):
        self.build_dir = build_dir
        self.config_dir = config_dir
        self.orig_config = os.path.join(config_dir, 'config.orig')
        self.running_config = utils.running_config()

        # 1. Get original config file
        self.build_config = os.path.join(build_dir, '.config')
        if (orig_file == '' and not defconfig
                and not make):  # use user default
            s = job.config_get("kernel.default_config_set")
            defconf = None
            if s and name:
                defconf = config_by_name(name, s)
            if not defconf:
                defconf = job.config_get("kernel.default_config")
            if defconf:
                orig_file = defconf
            else:
                if self.running_config is not None:
                    orig_file = self.running_config
        if (orig_file == '' and not make and defconfig):  # use defconfig
            make = 'defconfig'
        if (orig_file == '' and make):  # use the config command
            logging.debug("using %s to configure kernel" % make)
            os.chdir(build_dir)
            make_return = utils.system('make %s > /dev/null' % make)
            self.config_record(make)
            if make_return:
                raise error.TestError('make %s failed' % make)
        else:
            logging.debug("using %s to configure kernel", orig_file)
            utils.get_file(orig_file, self.orig_config)
            self.update_config(self.orig_config, self.orig_config + '.new')
            diff_configs(self.orig_config, self.orig_config + '.new')

        # 2. Apply overrides
        if overrides:
            logging.debug("using %s to re-configure kernel", overrides)
            self.over_config = os.path.join(config_dir, 'config.over')
            overrides_local = self.over_config + '.changes'
            utils.get_file(overrides, overrides_local)
            apply_overrides(self.build_config, overrides_local,
                            self.over_config)
            self.update_config(self.over_config, self.over_config + '.new')
            diff_configs(self.over_config, self.over_config + '.new')
        else:
            self.over_config = self.orig_config
Ejemplo n.º 2
0
    def __init__(self, job, build_dir, config_dir, orig_file, overrides,
                 defconfig=False, name=None, make=None):
        self.build_dir = build_dir
        self.config_dir = config_dir
        self.orig_config = os.path.join(config_dir, 'config.orig')
        running_config = utils.running_config()
        if running_config is None:
            running_config = ''
        if running_config.endswith('.gz'):
            tmp_running_config = '/tmp/running_config'
            utils.system('cat %s | gunzip > %s' %
                         (running_config, tmp_running_config))
            running_config = tmp_running_config

        self.running_config = running_config

        # 1. Get original config file
        self.build_config = os.path.join(build_dir, '.config')
        if (orig_file == '' and not defconfig and not make): # use user default
            s = job.config_get("kernel.default_config_set")
            defconf = None
            if s and name:
                defconf = config_by_name(name, s)
            if not defconf:
                defconf = job.config_get("kernel.default_config")
            if defconf:
                orig_file = defconf
            else:
                if self.running_config:
                    orig_file = self.running_config
        if (orig_file == '' and not make and defconfig): # use defconfig
            make = 'defconfig'
        if (orig_file == '' and make): # use the config command
            logging.debug("using %s to configure kernel" % make)
            os.chdir(build_dir)
            make_return = utils.system('make %s > /dev/null' % make)
            self.config_record(make)
            if make_return:
                raise error.TestError('make %s failed' % make)
        else:
            logging.debug("using %s to configure kernel", orig_file)
            utils.get_file(orig_file, self.orig_config)
            self.update_config(self.orig_config, self.orig_config + '.new')
            diff_configs(self.orig_config, self.orig_config + '.new')

        # 2. Apply overrides
        if overrides:
            logging.debug("using %s to re-configure kernel", overrides)
            self.over_config = os.path.join(config_dir, 'config.over')
            overrides_local = self.over_config + '.changes'
            utils.get_file(overrides, overrides_local)
            apply_overrides(self.build_config, overrides_local, self.over_config)
            self.update_config(self.over_config, self.over_config + '.new')
            diff_configs(self.over_config, self.over_config + '.new')
        else:
            self.over_config = self.orig_config
Ejemplo n.º 3
0
    def initialize(self):
        # Check if the kernel supports cpu hotplug
        if utils.running_config():
            utils.check_for_kernel_feature('HOTPLUG_CPU')

        # Check cpu nums, if equals 1, quit.
        if utils.count_cpus() == 1:
            e_msg = 'Single CPU online detected, test not supported.'
            raise error.TestNAError(e_msg)

        # Have a simple and quick check first, FIX me please.
        utils.system('dmesg -c > /dev/null')
        for cpu in utils.cpu_online_map():
            if os.path.isfile('/sys/devices/system/cpu/cpu%s/online' % cpu):
                utils.system('echo 0 > /sys/devices/system/cpu/cpu%s/online' % cpu, 1)
                utils.system('dmesg -c')
                time.sleep(3)
                utils.system('echo 1 > /sys/devices/system/cpu/cpu%s/online' % cpu, 1)
                utils.system('dmesg -c')
                time.sleep(3)
Ejemplo n.º 4
0
    def initialize(self):
        # Check if the kernel supports cpu hotplug
        if utils.running_config():
            utils.check_for_kernel_feature('HOTPLUG_CPU')

        # Check cpu nums, if equals 1, quit.
        if utils.count_cpus() == 1:
            e_msg = 'Single CPU online detected, test not supported.'
            raise error.TestNAError(e_msg)

        # Have a simple and quick check first, FIX me please.
        utils.system('dmesg -c > /dev/null')
        for cpu in utils.cpu_online_map():
            if os.path.isfile('/sys/devices/system/cpu/cpu%s/online' % cpu):
                utils.system('echo 0 > /sys/devices/system/cpu/cpu%s/online' % cpu, 1)
                utils.system('dmesg -c')
                time.sleep(3)
                utils.system('echo 1 > /sys/devices/system/cpu/cpu%s/online' % cpu, 1)
                utils.system('dmesg -c')
                time.sleep(3)