Exemplo n.º 1
0
 def _check_kernel_config(self, config_option):
     # This function checks the kernel configuration with the input
     # 'config_option' a string. If the required configuration not set then
     # test gets cancelled.
     ret = linux_modules.check_kernel_config(config_option)
     if ret == linux_modules.ModuleConfig.NOT_SET:
         self.cancel("%s not set." % config_option)
Exemplo n.º 2
0
 def setUp(self):
     # Check the required kernel config parameter set or not.
     cfg_param = "CONFIG_PAPR_SCM"
     ret = linux_modules.check_kernel_config(cfg_param)
     if ret == linux_modules.ModuleConfig.NOT_SET:
         self.cancel("%s not set." % cfg_param)
     else:
         self.log.info("%s set." % cfg_param)
     # Install required packages
     smm = SoftwareManager()
     detected_distro = distro.detect()
     if 'ppc64' not in detected_distro.arch:
         self.cancel("Processor is not PowerPC")
     deps = ['gcc', 'make']
     if 'Ubuntu' in detected_distro.name:
         deps.extend(['linux-tools-common', 'linux-tools-%s'
                      % platform.uname()[2]])
     elif detected_distro.name in ['rhel', 'SuSE', 'fedora', 'centos']:
         deps.extend(['perf'])
     else:
         self.cancel("Install the package for perf supported by %s"
                     % detected_distro.name)
     for package in deps:
         if not smm.check_installed(package) and not smm.install(package):
             self.cancel('%s is needed for the test to be run' % package)
     # Set required variables
     self.base_dir = "/sys/devices/"
     self.pmu_list = []
     self.all_events = {}
     # Collect the PMU names from sysfs dir.
     for files in os.listdir(self.base_dir):
         if "nmem" in files:
             self.pmu_list.append(files)
     if self.pmu_list:
         self.log.info("Found PMUs: %s" % self.pmu_list)
     else:
         # If PMUs not found then cancel the test run
         self.cancel("nmem PMUs not found")
     # Once the PMUs are there, collect the list of events
     output = process.system_output('perf list nmem', shell=True,
                                    ignore_status=True)
     for ln in output.decode().splitlines():
         ln = ln.strip()
         # Skip empty line and header
         if not ln or "List of pre-defined events" in ln:
             continue
         else:
             ln = ln.split('[')[0].strip()
             for pmu in self.pmu_list:
                 if ln.split('/')[0] in pmu:
                     # Collecting the events per PMU
                     # ex:{nmem0: [ev1, ev2, ...], nmem1: [ev1, ev2, ...]}
                     self.all_events.setdefault(pmu, []).append(ln)
     if not self.all_events:
         self.cancel("Can not extract events from 'perf list nmem'")
Exemplo n.º 3
0
    def setUp(self):
        """
        Verifies if CONFIG_RCU_TORTURE_TEST is enabled
        """
        self.results = []
        self.log.info("Check if CONFIG_RCU_TORTURE_TEST is enabled\n")
        ret = linux_modules.check_kernel_config('CONFIG_RCU_TORTURE_TEST')
        if ret == linux_modules.ModuleConfig.NOT_SET:
            self.cancel("CONFIG_RCU_TORTURE_TEST is not set in .config !!\n")

        self.log.info("Check rcutorture module is already  loaded\n")
        if linux_modules.module_is_loaded('rcutorture'):
            linux_modules.unload_module('rcutorture')
Exemplo n.º 4
0
    def setUp(self):
        """
        Verifies if CONFIG_RCU_TORTURE_TEST is enabled
        """
        self.results = []
        self.log.info("Check if CONFIG_RCU_TORTURE_TEST is enabled\n")
        ret = linux_modules.check_kernel_config("CONFIG_RCU_TORTURE_TEST")
        if ret == 0:
            self.fail("CONFIG_RCU_TORTURE_TEST is not set in .config !!\n")

        self.log.info("Check rcutorture module is already  loaded\n")
        if linux_modules.module_is_loaded("rcutorture"):
            linux_modules.unload_module("rcutorture")
Exemplo n.º 5
0
    def setUp(self):
        """
        Check pre-requisites before running sensors command
        Testcase should be executed only on bare-metal environment.
        """
        s_mg = SoftwareManager()
        d_distro = distro.detect()
        if d_distro.name == "Ubuntu":
            if not s_mg.check_installed("lm-sensors") and not s_mg.install(
                    "lm-sensors"):
                self.cancel('Need sensors to run the test')
        elif d_distro.name == "SuSE":
            if not s_mg.check_installed("sensors") and not s_mg.install(
                    "sensors"):
                self.cancel('Need sensors to run the test')
        else:
            if not s_mg.check_installed("lm_sensors") and not s_mg.install(
                    "lm_sensors"):
                self.cancel('Need sensors to run the test')
        if d_distro.arch in ["ppc64", "ppc64le"]:
            if not cpu._list_matches(
                    open('/proc/cpuinfo').readlines(),
                    'platform\t: PowerNV\n'):
                self.cancel(
                    'sensors test is applicable to bare-metal environment.')

            config_check = linux_modules.check_kernel_config(
                'CONFIG_SENSORS_IBMPOWERNV')
            if config_check == 0:
                self.cancel('Config is not set')
            elif config_check == 1:
                if linux_modules.load_module('ibmpowernv'):
                    if linux_modules.module_is_loaded('ibmpowernv'):
                        self.log.info('Module Loaded Successfully')
                    else:
                        self.cancel('Module Loading Failed')
            else:
                self.log.info('Module is Built In')

        if not d_distro.name == "Ubuntu":
            try:
                process.run('service lm_sensors stop', sudo=True)
                process.run('service lm_sensors start', sudo=True)
                process.run('service lm_sensors status', sudo=True)
            except process.CmdError:
                self.error(
                    'Starting Service Failed. Make sure module is loaded')
        cmd = "yes | sudo sensors-detect"
        det_op = process.run(cmd, shell=True, ignore_status=True).stdout
        if 'no sensors were detected' in det_op:
            self.cancel('No sensors found to test !')
Exemplo n.º 6
0
    def setUp(self):
        """
        Check pre-requisites before running sensors command
        Testcase should be executed only on bare-metal environment.
        """
        s_mg = SoftwareManager()
        d_distro = distro.detect()
        if d_distro.name == "Ubuntu":
            if not s_mg.check_installed("lm-sensors") and not s_mg.install(
                    "lm-sensors"):
                self.cancel('Need sensors to run the test')
        elif d_distro.name == "SuSE":
            if not s_mg.check_installed("sensors") and not s_mg.install(
                    "sensors"):
                self.cancel('Need sensors to run the test')
        else:
            if not s_mg.check_installed("lm_sensors") and not s_mg.install(
                    "lm_sensors"):
                self.cancel('Need sensors to run the test')
        if d_distro.arch in ["ppc64", "ppc64le"]:
            if not cpu._list_matches(open('/proc/cpuinfo').readlines(),
                                     'platform\t: PowerNV\n'):
                self.cancel(
                    'sensors test is applicable to bare-metal environment.')

            config_check = linux_modules.check_kernel_config(
                'CONFIG_SENSORS_IBMPOWERNV')
            if config_check == 0:
                self.cancel('Config is not set')
            elif config_check == 1:
                if linux_modules.load_module('ibmpowernv'):
                    if linux_modules.module_is_loaded('ibmpowernv'):
                        self.log.info('Module Loaded Successfully')
                    else:
                        self.cancel('Module Loading Failed')
            else:
                self.log.info('Module is Built In')

        if not d_distro.name == "Ubuntu":
            try:
                process.run('service lm_sensors stop', sudo=True)
                process.run('service lm_sensors start', sudo=True)
                process.run('service lm_sensors status', sudo=True)
            except process.CmdError:
                self.error(
                    'Starting Service Failed. Make sure module is loaded')
        cmd = "yes | sudo sensors-detect"
        det_op = process.run(cmd, shell=True, ignore_status=True).stdout
        if 'no sensors were detected' in det_op:
            self.cancel('No sensors found to test !')
Exemplo n.º 7
0
    def setUp(self):
        smg = SoftwareManager()
        if 'SuSE' in distro.detect().name:
            if not smg.check_installed("kernel-source") and not\
                    smg.install("kernel-source"):
                self.cancel("Failed to install kernel-source for this test.")
            if not os.path.exists("/usr/src/linux"):
                self.cancel("kernel source missing after install")
            self.buldir = "/usr/src/linux"
            shutil.copy('/boot/config-%s' % platform.uname()[2],
                        '%s/.config' % self.buldir)
            os.chdir(self.buldir)
            process.system("sed -i 's/^.*CONFIG_SYSTEM_TRUSTED_KEYS/#&/g'\
                           .config",
                           shell=True,
                           sudo=True)
            process.system("sed -i 's/^.*CONFIG_SYSTEM_TRUSTED_KEYRING/#&/g' \
                           .config",
                           shell=True,
                           sudo=True)
            process.system("sed -i 's/^.*CONFIG_MODULE_SIG_KEY/#&/g' .config",
                           shell=True,
                           sudo=True)
            process.system("sed -i 's/^.*CONFIG_DEBUG_INFO_BTF/#&/g' .config",
                           shell=True,
                           sudo=True)
            process.system('make')
            process.system('make modules_install')
        """
        Verifies if CONFIG_RCU_TORTURE_TEST is enabled
        """
        self.results = []
        self.log.info("Check if CONFIG_RCU_TORTURE_TEST is enabled\n")
        ret = linux_modules.check_kernel_config('CONFIG_RCU_TORTURE_TEST')
        if ret == linux_modules.ModuleConfig.NOT_SET:
            self.cancel("CONFIG_RCU_TORTURE_TEST is not set in .config !!\n")

        self.log.info("Check rcutorture module is already  loaded\n")
        if linux_modules.module_is_loaded('rcutorture'):
            linux_modules.unload_module('rcutorture')
Exemplo n.º 8
0
 def check_kernel_support(self):
     if linux_modules.check_kernel_config(
             "CONFIG_LIVEPATCH") == linux_modules.ModuleConfig.NOT_SET:
         self.fail("Livepatch support not available")
Exemplo n.º 9
0
 def check_kernel_support(self):
     if linux_modules.check_kernel_config(
             "CONFIG_OPTPROBES") == linux_modules.ModuleConfig.NOT_SET:
         return 0
     return 1
Exemplo n.º 10
0
 def check_kernel_support(self):
     if linux_modules.check_kernel_config("CONFIG_UPROBE_EVENTS") != 2:
         return 0
     return 1
Exemplo n.º 11
0
 def _check_kernel_config(self, config_option):
     ret = linux_modules.check_kernel_config(config_option)
     if ret == linux_modules.ModuleConfig.NOT_SET:
         self.no_config.append(config_option)
Exemplo n.º 12
0
 def check_kernel_support(self):
     if linux_modules.check_kernel_config("CONFIG_UPROBE_EVENTS") != 2:
         return 0
     return 1