Merge "Fix DataImage.ReadRangeSet()"

am: 3f8c09f8a5

Change-Id: If01f367cd3c244d01288d0eddb7bb17aec2b6c43
This commit is contained in:
Yifan Hong 2019-04-10 11:14:12 -07:00 committed by android-build-merger
commit 43de6ab1ec
2 changed files with 9 additions and 2 deletions

View file

@ -174,7 +174,7 @@ class DataImage(Image):
return h.hexdigest()
def ReadRangeSet(self, ranges):
return [self._GetRangeData(ranges)]
return list(self._GetRangeData(ranges))
def TotalSha1(self, include_clobbered_blocks=False):
if not include_clobbered_blocks:

View file

@ -16,7 +16,7 @@
import common
from blockimgdiff import (
BlockImageDiff, EmptyImage, HeapItem, ImgdiffStats, Transfer)
BlockImageDiff, DataImage, EmptyImage, HeapItem, ImgdiffStats, Transfer)
from rangelib import RangeSet
from test_utils import ReleaseToolsTestCase
@ -261,3 +261,10 @@ class ImgdiffStatsTest(ReleaseToolsTestCase):
self.assertRaises(AssertionError, imgdiff_stats.Log, "/system/app/app1.apk",
"invalid reason")
class DataImageTest(ReleaseToolsTestCase):
def test_read_range_set(self):
data = "file" + ('\0' * 4092)
image = DataImage(data)
self.assertEqual(data, "".join(image.ReadRangeSet(image.care_map)))