Lines Matching refs:self
37 def setUp(self): argument
38 self.testdata_dir = get_testdata_dir()
40 self.partition_size = 1024 * 1024
41 self.prop_dict = {
45 'system_size': self.partition_size
48 self.hash_algorithm = "sha256"
49 self.fixed_salt = \
51 self.expected_root_hash = \
54 def _create_simg(self, raw_data): argument
63 self.assertEqual(0, p.returncode)
67 def _generate_image(self): argument
73 'verity_key': os.path.join(self.testdata_dir, 'testkey'),
78 self.assertIsNotNone(verity_image_builder)
85 output_file = self._create_simg(raw_image)
92 def test_CreateHashtreeInfoGenerator(self): argument
93 image_file = sparse_img.SparseImage(self._generate_image())
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)
102 def test_DecomposeSparseImage(self): argument
103 image_file = sparse_img.SparseImage(self._generate_image())
106 self.partition_size, 4096, True)
108 self.assertEqual(991232, generator.filesystem_size)
109 self.assertEqual(12288, generator.hashtree_size)
110 self.assertEqual(32768, generator.metadata_size)
112 def test_ParseHashtreeMetadata(self): argument
113 image_file = sparse_img.SparseImage(self._generate_image())
115 self.partition_size, 4096, True)
121 self.assertEqual(
122 self.hash_algorithm, generator.hashtree_info.hash_algorithm)
123 self.assertEqual(self.fixed_salt, generator.hashtree_info.salt)
124 self.assertEqual(self.expected_root_hash, generator.hashtree_info.root_hash)
126 def test_ValidateHashtree_smoke(self): argument
128 self.partition_size, 4096, True)
129 generator.image = sparse_img.SparseImage(self._generate_image())
135 info.hash_algorithm = self.hash_algorithm
136 info.salt = self.fixed_salt
137 info.root_hash = self.expected_root_hash
139 self.assertTrue(generator.ValidateHashtree())
141 def test_ValidateHashtree_failure(self): argument
143 self.partition_size, 4096, True)
144 generator.image = sparse_img.SparseImage(self._generate_image())
150 info.hash_algorithm = self.hash_algorithm
151 info.salt = self.fixed_salt
152 info.root_hash = "a" + self.expected_root_hash[1:]
154 self.assertFalse(generator.ValidateHashtree())
156 def test_Generate(self): argument
157 image_file = sparse_img.SparseImage(self._generate_image())
158 generator = CreateHashtreeInfoGenerator('system', 4096, self.prop_dict)
161 self.assertEqual(RangeSet(data=[0, 991232 / 4096]), info.filesystem_range)
162 self.assertEqual(RangeSet(data=[991232 / 4096, (991232 + 12288) / 4096]),
164 self.assertEqual(self.hash_algorithm, info.hash_algorithm)
165 self.assertEqual(self.fixed_salt, info.salt)
166 self.assertEqual(self.expected_root_hash, info.root_hash)
181 def test_init(self): argument
182 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
184 self.assertIsNotNone(verity_image_builder)
185 self.assertEqual(1, verity_image_builder.version)
187 def test_init_MissingProps(self): argument
188 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
190 self.assertIsNone(CreateVerityImageBuilder(prop_dict))
192 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
194 self.assertIsNone(CreateVerityImageBuilder(prop_dict))
196 def test_CalculateMaxImageSize(self): argument
197 verity_image_builder = CreateVerityImageBuilder(self.DEFAULT_PROP_DICT)
199 self.assertLess(size, self.DEFAULT_PARTITION_SIZE)
202 self.assertEqual(
205 self.DEFAULT_PARTITION_SIZE))
224 def test_Build(self): argument
225 self._BuildAndVerify(
226 self.DEFAULT_PROP_DICT,
229 def test_Build_SanityCheck(self): argument
232 self.assertRaises(
234 self._BuildAndVerify,
235 self.DEFAULT_PROP_DICT,
238 def test_Build_FecDisabled(self): argument
239 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
241 self._BuildAndVerify(
245 def test_Build_SquashFs(self): argument
246 verity_image_builder = CreateVerityImageBuilder(self.DEFAULT_PROP_DICT)
273 def test_init(self): argument
274 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
276 self.assertIsNotNone(verity_image_builder)
277 self.assertEqual(2, verity_image_builder.version)
279 def test_init_MissingProps(self): argument
280 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
283 self.assertIsNone(verity_image_builder)
285 def test_Build(self): argument
286 prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
288 self.assertIsNotNone(verity_image_builder)
289 self.assertEqual(2, verity_image_builder.version)
310 def _test_CalculateMinPartitionSize_SetUp(self): argument
325 self.assertEqual(2, builder.version)
328 def test_CalculateMinPartitionSize_LinearFooterSize(self): argument
330 image_sizes, builder = self._test_CalculateMinPartitionSize_SetUp()
334 self.assertEqual(
339 def test_AVBCalcMinPartitionSize_SlowerGrowthFooterSize(self): argument
347 image_sizes, builder = self._test_CalculateMinPartitionSize_SetUp()
352 self.assertGreaterEqual(
356 self.assertLess(
360 def test_CalculateMinPartitionSize_FasterGrowthFooterSize(self): argument
369 image_sizes, builder = self._test_CalculateMinPartitionSize_SetUp()
374 self.assertGreaterEqual(
378 self.assertLess(