• Home
  • Raw
  • Download

Lines Matching refs:self

39   def setUp(self):  argument
40 self.testdata_dir = get_testdata_dir()
42 self.partition_size = 1024 * 1024
43 self.prop_dict = {
47 'system_size': self.partition_size
50 self.hash_algorithm = "sha256"
51 self.fixed_salt = (
53 self.expected_root_hash = (
56 def _CreateSimg(self, raw_data): # pylint: disable=no-self-use argument
66 def _GenerateImage(self): argument
72 'verity_key': os.path.join(self.testdata_dir, 'testkey'),
77 self.assertIsNotNone(verity_image_builder)
84 output_file = self._CreateSimg(raw_image)
92 def test_CreateHashtreeInfoGenerator(self): argument
93 image_file = sparse_img.SparseImage(self._GenerateImage())
96 'system', image_file, self.prop_dict)
97 self.assertEqual(
99 self.assertEqual(self.partition_size, generator.partition_size)
100 self.assertTrue(generator.fec_supported)
103 def test_DecomposeSparseImage(self): argument
104 image_file = sparse_img.SparseImage(self._GenerateImage())
107 self.partition_size, 4096, True)
109 self.assertEqual(991232, generator.filesystem_size)
110 self.assertEqual(12288, generator.hashtree_size)
111 self.assertEqual(32768, generator.metadata_size)
114 def test_ParseHashtreeMetadata(self): argument
115 image_file = sparse_img.SparseImage(self._GenerateImage())
117 self.partition_size, 4096, True)
123 self.assertEqual(
124 self.hash_algorithm, generator.hashtree_info.hash_algorithm)
125 self.assertEqual(self.fixed_salt, generator.hashtree_info.salt)
126 self.assertEqual(self.expected_root_hash, generator.hashtree_info.root_hash)
129 def test_ValidateHashtree_smoke(self): argument
131 self.partition_size, 4096, True)
132 generator.image = sparse_img.SparseImage(self._GenerateImage())
138 info.hash_algorithm = self.hash_algorithm
139 info.salt = self.fixed_salt
140 info.root_hash = self.expected_root_hash
142 self.assertTrue(generator.ValidateHashtree())
145 def test_ValidateHashtree_failure(self): argument
147 self.partition_size, 4096, True)
148 generator.image = sparse_img.SparseImage(self._GenerateImage())
154 info.hash_algorithm = self.hash_algorithm
155 info.salt = self.fixed_salt
156 info.root_hash = "a" + self.expected_root_hash[1:]
158 self.assertFalse(generator.ValidateHashtree())
161 def test_Generate(self): argument
162 image_file = sparse_img.SparseImage(self._GenerateImage())
163 generator = CreateHashtreeInfoGenerator('system', 4096, self.prop_dict)
166 self.assertEqual(RangeSet(data=[0, 991232 // 4096]), info.filesystem_range)
167 self.assertEqual(RangeSet(data=[991232 // 4096, (991232 + 12288) // 4096]),
169 self.assertEqual(self.hash_algorithm, info.hash_algorithm)
170 self.assertEqual(self.fixed_salt, info.salt)
171 self.assertEqual(self.expected_root_hash, info.root_hash)
186 def test_init(self): argument
187 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
189 self.assertIsNotNone(verity_image_builder)
190 self.assertEqual(1, verity_image_builder.version)
192 def test_init_MissingProps(self): argument
193 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
195 self.assertIsNone(CreateVerityImageBuilder(prop_dict))
197 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
199 self.assertIsNone(CreateVerityImageBuilder(prop_dict))
202 def test_CalculateMaxImageSize(self): argument
203 verity_image_builder = CreateVerityImageBuilder(self.DEFAULT_PROP_DICT)
205 self.assertLess(size, self.DEFAULT_PARTITION_SIZE)
208 self.assertEqual(
211 self.DEFAULT_PARTITION_SIZE))
231 def test_Build(self): argument
232 self._BuildAndVerify(
233 self.DEFAULT_PROP_DICT,
237 def test_Build_ValidationCheck(self): argument
240 self.assertRaises(
242 self._BuildAndVerify,
243 self.DEFAULT_PROP_DICT,
247 def test_Build_FecDisabled(self): argument
248 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
250 self._BuildAndVerify(
255 def test_Build_SquashFs(self): argument
256 verity_image_builder = CreateVerityImageBuilder(self.DEFAULT_PROP_DICT)
283 def test_init(self): argument
284 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
286 self.assertIsNotNone(verity_image_builder)
287 self.assertEqual(2, verity_image_builder.version)
289 def test_init_MissingProps(self): argument
290 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
293 self.assertIsNone(verity_image_builder)
296 def test_Build(self): argument
297 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
299 self.assertIsNotNone(verity_image_builder)
300 self.assertEqual(2, verity_image_builder.version)
321 def _test_CalculateMinPartitionSize_SetUp(self): argument
336 self.assertEqual(2, builder.version)
339 def test_CalculateMinPartitionSize_LinearFooterSize(self): argument
341 image_sizes, builder = self._test_CalculateMinPartitionSize_SetUp()
345 self.assertEqual(
350 def test_AVBCalcMinPartitionSize_SlowerGrowthFooterSize(self): argument
358 image_sizes, builder = self._test_CalculateMinPartitionSize_SetUp()
363 self.assertGreaterEqual(
367 self.assertLess(
371 def test_CalculateMinPartitionSize_FasterGrowthFooterSize(self): argument
380 image_sizes, builder = self._test_CalculateMinPartitionSize_SetUp()
385 self.assertGreaterEqual(
389 self.assertLess(
394 def test_CalculateVbmetaDigest(self): argument
395 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
397 self.assertEqual(2, verity_image_builder.version)
419 self.assertIsNotNone(digest)