def test_conflict(self):
        confA = Config()
        confA.readConfigFile(self.configA.name)

        confB = Config()
        confB.readConfigFile(self.configB.name)

        self.assertTrue(confA.conflict(confB))
    def test_getConflicts(self):
        confA = Config()
        confA.readConfigFile(self.configA.name)

        confB = Config()
        confB.readConfigFile(self.configB.name)

        conflicts = confA.getConflicts(confB)
        self.assertIn("CONFIG_B", conflicts)
        self.assertIn("CONFIG_C", conflicts)
        self.assertIn("CONFIG_M", conflicts)
Exemplo n.º 3
0
    def verify(self, expanded_config='.config'):
        """
        verifies that the given expanded configuration satisfies the
        constraints of the given partial configuration.

        @return (all_items, violators)
          all_items: set of all items in partial configuration
          violators: list of items that violate the partial selection
        """

        partial_config = Config(self.kconfig)
        config = Config(expanded_config)
        conflicts = config.getConflicts(partial_config)

        return (partial_config.keys(), conflicts)
Exemplo n.º 4
0
    def test_conflict(self):
        confA = Config()
        confA.readConfigFile(self.configA.name)

        confB = Config()
        confB.readConfigFile(self.configB.name)

        self.assertTrue(confA.conflict(confB))
Exemplo n.º 5
0
    def test_getConflicts(self):
        confA = Config()
        confA.readConfigFile(self.configA.name)

        confB = Config()
        confB.readConfigFile(self.configB.name)

        conflicts = confA.getConflicts(confB)
        self.assertIn("CONFIG_B",conflicts)
        self.assertIn("CONFIG_C",conflicts)
        self.assertIn("CONFIG_M",conflicts)
Exemplo n.º 6
0
def guess_arch_from_filename(filename):
    """
    Guesses the 'best' architecture for the given filename.

    If the file is in the Linux HAL (e.g., 'arch/arm/init.c', then the
    architecture is deduced from the filename

    Defaults to 'vamos.default_architecture' (default: 'x86')

    returns a tuple (arch, subarch) with the architecture identifier (as
    in the subdirectory part) and the preferred "subarchitecture". The
    latter is used e.g. to disable CONFIG_64BIT on 'make allnoconfig'
    when compiling on a 64bit host (default behavior), unless
    vamos.prefer_32bit is set to False.
    """

    m = re.search("^arch/([^/]*)/", os.path.normpath(filename))
    if m:
        arch = m.group(1)
    else:
        arch = vamos.default_architecture

    subarch = guess_subarch_from_arch(arch)

    forced_64bit = False
    forced_32bit = False

    if arch == 'x86' and '.config' in filename:
        c = Config(filename)
        if c.valueOf('CONFIG_X86_64') == 'y' or c.valueOf(
                'CONFIG_64BIT') == 'y':
            subarch = 'x86_64'
            logging.debug("Config %s forces subarch x86_64", filename)
            forced_64bit = True

        if c.valueOf('CONFIG_X86_64') == 'n' or c.valueOf('CONFIG_64BIT') == 'n' \
                or c.valueOf('CONFIG_X86_32') == 'y':
            subarch = 'i386'
            logging.debug("Config %s forces subarch i386", filename)
            forced_32bit = True

    if forced_32bit and forced_64bit:
        logging.error(
            "%s is inconsistent: cannot enable 64bit and 32bit together (using %s)",
            filename, subarch)

    return (arch, subarch)
    def verify(self, expanded_config='.config'):
        """
        verifies that the given expanded configuration satisfies the
        constraints of the given partial configuration.

        @return (all_items, violators)
          all_items: set of all items in partial configuration
          violators: list of items that violate the partial selection
        """

        partial_config = Config(self.kconfig)
        config = Config(expanded_config)
        conflicts = config.getConflicts(partial_config)

        return (partial_config.keys(), conflicts)
Exemplo n.º 8
0
 def test_addFeature(self):
     confA = Config()
     confA.addFeature("CONFIG_FOO","m")
     self.assertEqual(confA.valueOf("CONFIG_FOO"),"m")
Exemplo n.º 9
0
 def test_valueOf(self):
     confA = Config()
     confA.readConfigFile(self.configA.name)
     self.assertEqual(confA.valueOf("CONFIG_A"),"y")
Exemplo n.º 10
0
 def test_readConfigFile(self):
     confA = Config(self.configA.name)
     self.assertTrue(confA.contains("CONFIG_A"))
 def test_addFeature(self):
     confA = Config()
     confA.addFeature("CONFIG_FOO", "m")
     self.assertEqual(confA.valueOf("CONFIG_FOO"), "m")
 def test_valueOf(self):
     confA = Config()
     confA.readConfigFile(self.configA.name)
     self.assertEqual(confA.valueOf("CONFIG_A"), "y")
 def test_readConfigFile(self):
     confA = Config(self.configA.name)
     self.assertTrue(confA.contains("CONFIG_A"))