def test_cbfs_functions(self): """Test global functions of cbfs_util""" self.assertEqual(cbfs_util.ARCHITECTURE_X86, cbfs_util.find_arch('x86')) self.assertIsNone(cbfs_util.find_arch('bad-arch')) self.assertEqual(cbfs_util.COMPRESS_LZMA, cbfs_util.find_compress('lzma')) self.assertIsNone(cbfs_util.find_compress('bad-comp'))
def ReadEntries(self): """Read the subnodes to find out what should go in this CBFS""" for node in self._node.subnodes: entry = Entry.Create(self, node) entry.ReadNode() entry._cbfs_name = fdt_util.GetString(node, 'cbfs-name', entry.name) entry._type = fdt_util.GetString(node, 'cbfs-type') compress = fdt_util.GetString(node, 'cbfs-compress', 'none') entry._cbfs_offset = fdt_util.GetInt(node, 'cbfs-offset') entry._cbfs_compress = cbfs_util.find_compress(compress) if entry._cbfs_compress is None: self.Raise("Invalid compression in '%s': '%s'" % (node.name, compress)) self._entries[entry._cbfs_name] = entry