Merge "releasetools: Update partitions in deterministic order."
This commit is contained in:
@@ -2370,14 +2370,16 @@ class DynamicPartitionsDifference(object):
|
|||||||
def __init__(self, info_dict, block_diffs, progress_dict=None,
|
def __init__(self, info_dict, block_diffs, progress_dict=None,
|
||||||
source_info_dict=None):
|
source_info_dict=None):
|
||||||
if progress_dict is None:
|
if progress_dict is None:
|
||||||
progress_dict = dict()
|
progress_dict = {}
|
||||||
|
|
||||||
self._remove_all_before_apply = False
|
self._remove_all_before_apply = False
|
||||||
if source_info_dict is None:
|
if source_info_dict is None:
|
||||||
self._remove_all_before_apply = True
|
self._remove_all_before_apply = True
|
||||||
source_info_dict = dict()
|
source_info_dict = {}
|
||||||
|
|
||||||
|
block_diff_dict = collections.OrderedDict(
|
||||||
|
[(e.partition, e) for e in block_diffs])
|
||||||
|
|
||||||
block_diff_dict = {e.partition:e for e in block_diffs}
|
|
||||||
assert len(block_diff_dict) == len(block_diffs), \
|
assert len(block_diff_dict) == len(block_diffs), \
|
||||||
"Duplicated BlockDifference object for {}".format(
|
"Duplicated BlockDifference object for {}".format(
|
||||||
[partition for partition, count in
|
[partition for partition, count in
|
||||||
|
@@ -1151,7 +1151,7 @@ class FakeSparseImage(object):
|
|||||||
class DynamicPartitionsDifferenceTest(test_utils.ReleaseToolsTestCase):
|
class DynamicPartitionsDifferenceTest(test_utils.ReleaseToolsTestCase):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_op_list(output_path):
|
def get_op_list(output_path):
|
||||||
with zipfile.ZipFile(output_path, 'r') as output_zip:
|
with zipfile.ZipFile(output_path) as output_zip:
|
||||||
with output_zip.open("dynamic_partitions_op_list") as op_list:
|
with output_zip.open("dynamic_partitions_op_list") as op_list:
|
||||||
return [line.strip() for line in op_list.readlines()
|
return [line.strip() for line in op_list.readlines()
|
||||||
if not line.startswith("#")]
|
if not line.startswith("#")]
|
||||||
@@ -1176,12 +1176,12 @@ super_group_foo_partition_list=system vendor
|
|||||||
|
|
||||||
self.assertEqual(str(self.script).strip(), """
|
self.assertEqual(str(self.script).strip(), """
|
||||||
assert(update_dynamic_partitions(package_extract_file("dynamic_partitions_op_list")));
|
assert(update_dynamic_partitions(package_extract_file("dynamic_partitions_op_list")));
|
||||||
patch(vendor);
|
|
||||||
verify(vendor);
|
|
||||||
unmap_partition("vendor");
|
|
||||||
patch(system);
|
patch(system);
|
||||||
verify(system);
|
verify(system);
|
||||||
unmap_partition("system");
|
unmap_partition("system");
|
||||||
|
patch(vendor);
|
||||||
|
verify(vendor);
|
||||||
|
unmap_partition("vendor");
|
||||||
""".strip())
|
""".strip())
|
||||||
|
|
||||||
lines = self.get_op_list(self.output_path)
|
lines = self.get_op_list(self.output_path)
|
||||||
@@ -1229,7 +1229,8 @@ super_group_qux_group_size={group_qux_size}
|
|||||||
grown = lines.index("resize_group group_baz 4294967296")
|
grown = lines.index("resize_group group_baz 4294967296")
|
||||||
added = lines.index("add_group group_qux 1073741824")
|
added = lines.index("add_group group_qux 1073741824")
|
||||||
|
|
||||||
self.assertLess(max(removed, shrunk) < min(grown, added),
|
self.assertLess(max(removed, shrunk),
|
||||||
|
min(grown, added),
|
||||||
"ops that remove / shrink partitions must precede ops that "
|
"ops that remove / shrink partitions must precede ops that "
|
||||||
"grow / add partitions")
|
"grow / add partitions")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user