releasetools: Update tests to match SparseImage change.
The previous change in commit 22632cc82c0404bdbddaef41eb79cc99071894d0
changed the behavior in loading file map. It now always puts a copy of
the input text in `extra` field. Update the tests accordingly.
Bug: 79951650
Test: Use a lunch'd target; `atest --host releasetools_test`
Change-Id: Iccf06c817c1305bf9946d7759c6f6f6af21fe85e
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index ceb023f..cc59cba 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -749,10 +749,12 @@
self.assertNotIn(
'incomplete', sparse_image.file_map['/system/file2'].extra)
- # All other entries should look normal without any tags.
+ # '/system/file1' will only contain one field -- a copy of the input text.
+ self.assertEqual(1, len(sparse_image.file_map['/system/file1'].extra))
+
+ # Meta entries should not have any extra tag.
self.assertFalse(sparse_image.file_map['__COPY'].extra)
self.assertFalse(sparse_image.file_map['__NONZERO-0'].extra)
- self.assertFalse(sparse_image.file_map['/system/file1'].extra)
@test_utils.SkipIfExternalToolsUnavailable()
def test_GetSparseImage_incompleteRanges(self):
@@ -775,7 +777,9 @@
with zipfile.ZipFile(target_files, 'r') as input_zip:
sparse_image = common.GetSparseImage('system', tempdir, input_zip, False)
- self.assertFalse(sparse_image.file_map['/system/file1'].extra)
+ self.assertEqual(
+ '1-5 9-10',
+ sparse_image.file_map['/system/file1'].extra['text_str'])
self.assertTrue(sparse_image.file_map['/system/file2'].extra['incomplete'])
@test_utils.SkipIfExternalToolsUnavailable()
@@ -801,7 +805,9 @@
with zipfile.ZipFile(target_files, 'r') as input_zip:
sparse_image = common.GetSparseImage('system', tempdir, input_zip, False)
- self.assertFalse(sparse_image.file_map['//system/file1'].extra)
+ self.assertEqual(
+ '1-5 9-10',
+ sparse_image.file_map['//system/file1'].extra['text_str'])
self.assertTrue(sparse_image.file_map['//system/file2'].extra['incomplete'])
self.assertTrue(
sparse_image.file_map['/system/app/file3'].extra['incomplete'])
@@ -826,7 +832,9 @@
with zipfile.ZipFile(target_files, 'r') as input_zip:
sparse_image = common.GetSparseImage('system', tempdir, input_zip, False)
- self.assertFalse(sparse_image.file_map['//system/file1'].extra)
+ self.assertEqual(
+ '1-5 9-10',
+ sparse_image.file_map['//system/file1'].extra['text_str'])
self.assertTrue(sparse_image.file_map['//init.rc'].extra['incomplete'])
@test_utils.SkipIfExternalToolsUnavailable()