Esempio n. 1
0
  def test_Generate(self):
    image_file = sparse_img.SparseImage(self._generate_image())
    generator = CreateHashtreeInfoGenerator('system', 4096, self.prop_dict)
    info = generator.Generate(image_file)

    self.assertEqual(RangeSet(data=[0, 991232 / 4096]), info.filesystem_range)
    self.assertEqual(RangeSet(data=[991232 / 4096, (991232 + 12288) / 4096]),
                     info.hashtree_range)
    self.assertEqual(self.hash_algorithm, info.hash_algorithm)
    self.assertEqual(self.fixed_salt, info.salt)
    self.assertEqual(self.expected_root_hash, info.root_hash)
Esempio n. 2
0
    def test_CreateHashtreeInfoGenerator(self):
        image_file = sparse_img.SparseImage(self._GenerateImage())

        generator = CreateHashtreeInfoGenerator('system', image_file,
                                                self.prop_dict)
        self.assertEqual(VerifiedBootVersion1HashtreeInfoGenerator,
                         type(generator))
        self.assertEqual(self.partition_size, generator.partition_size)
        self.assertTrue(generator.fec_supported)