releasetools: Update partitions in deterministic order.
Previously it was using regular dict.
Test: python -m unittest test_common.DynamicPartitionsDifferenceTest
Change-Id: If108a4512aeaf9d3c8775c030cad6e44342b9d3d
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 9b76734..7ce361b 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -1151,7 +1151,7 @@
class DynamicPartitionsDifferenceTest(test_utils.ReleaseToolsTestCase):
@staticmethod
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:
return [line.strip() for line in op_list.readlines()
if not line.startswith("#")]
@@ -1176,12 +1176,12 @@
self.assertEqual(str(self.script).strip(), """
assert(update_dynamic_partitions(package_extract_file("dynamic_partitions_op_list")));
-patch(vendor);
-verify(vendor);
-unmap_partition("vendor");
patch(system);
verify(system);
unmap_partition("system");
+patch(vendor);
+verify(vendor);
+unmap_partition("vendor");
""".strip())
lines = self.get_op_list(self.output_path)
@@ -1229,7 +1229,8 @@
grown = lines.index("resize_group group_baz 4294967296")
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 "
"grow / add partitions")