Exemple #1
0
    def test_get_all_items(self):
        """
        Convert a list of Symbols, Choices, Menus, Comments 
        into a list containing only and Symbols 
        Choices. It recovers Symbols on the menus.
        """

        test_out = []
        utility.get_all_items(top_level_items, test_out)

        for item in test_out:
            if item.is_menu():
                raise Exception("There is a menu in the list.")
            elif item.is_comment():
                raise Exception("There is a menu in the list.")
Exemple #2
0
    def init_memory(self, path, arch, src_arch, config_file="", callback=None):
        """ If config_file == "", load default config
        Return -1 if configuration file does not exist or is not correct
        (argument or default)
        """
        if config_file != "":
            if not self.is_config_file_correct(config_file):
                return -1
        self.path = path
        self.arch = arch
        self.src_arch = src_arch

        self.config_file = config_file
        if config_file == "":
            self.config_file = self._get_default_config()
        if not os.path.isfile(self.config_file):
            # Config_file does not exist
            return -1

        utility.init_environ(self.path,
                             self.arch,
                             self.src_arch)

        if path[-1] != "/":
            path += "/"

        self.kconfig_infos = kconfiglib.Config(filename=path+"Kconfig",
                                               base_dir=path,
                                               print_warnings=False,
                                               callback=callback)

        self.kconfig_infos.load_config(self.config_file)

        self.top_level_items = self.kconfig_infos.get_top_level_items()
        self.menus = self.kconfig_infos.get_menus()
        self.top_menus = utility.get_top_menus(self.menus)
        self.sections = utility.get_top_menus(self.menus)
        self.items = []
        utility.get_all_items(self.top_level_items, self.items)
Exemple #3
0
    arch = "x86_64"
    srcarch = "x86"

    try:
        utility.init_environ(path, arch, srcarch)
        kconfig_infos = kconfiglib.Config(filename=path+"/Kconfig",
            base_dir=path, print_warnings=False)
    except Exception as e:
        sys.exit("Error -- Kernel's path : < " + path + " > is not correct")

    top_level_items = kconfig_infos.get_top_level_items()
    menus = kconfig_infos.get_menus()
    top_menus = utility.get_top_menus(menus)
    items = []
    utility.get_all_items(top_level_items, items)

else:
    sys.exit("Error -- Please give a kernel path in parameter")



class UnitTest(unittest.TestCase):
    """ Class function tests """

    def test_convert_list_xDim_to_1Dim(self):
        """
        This test is testing function convert_list_xDim_to_1Dim 
        whose purpose is to convert a multi-dimensional list 
        a list to a single dimension
        """