From: Artem Bityutskiy Date: Mon, 26 Nov 2012 15:58:48 +0000 (+0200) Subject: test_api_base: also test compressed files X-Git-Tag: v1.0~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a34538fb4b875a6a80d40b900bb4075b61017ac8;p=tools%2Fbmap-tools.git test_api_base: also test compressed files Change-Id: Iae27bcea6fac825a2c6d1f82b125afda5db31859 Signed-off-by: Artem Bityutskiy --- diff --git a/TODO b/TODO index be02874..2189fea 100644 --- a/TODO +++ b/TODO @@ -2,4 +2,3 @@ better. Currently we are calling it for each block. 2. When bmaptool is killed or Ctrl-C'ed half-way through, it should delete the files it creates. -3. Test compressed images as well diff --git a/tests/test_api_base.py b/tests/test_api_base.py index 2cec130..27175ab 100644 --- a/tests/test_api_base.py +++ b/tests/test_api_base.py @@ -122,7 +122,17 @@ def _do_test(f_image): assert filecmp.cmp(f_bmap1.name, f_bmap2.name, False) # - # Pass 4: copy the sparse file without bmap and make sure it is + # Pass 4: test compressed files copying with bmap + # + + for compressed in tests.helpers.compress_test_file(f_image): + writer = BmapCopy.BmapCopy(compressed, f_copy, f_bmap1) + writer.copy() + + assert _calculate_sha1(f_copy) == image_sha1 + + # + # Pass 5: copy the sparse file without bmap and make sure it is # identical to the original file # @@ -134,6 +144,16 @@ def _do_test(f_image): writer.copy(False, True) assert _calculate_sha1(f_copy) == image_sha1 + # + # Pass 6: test compressed files copying without bmap + # + + for compressed in tests.helpers.compress_test_file(f_image): + writer = BmapCopy.BmapCopy(compressed, f_copy) + writer.copy() + + assert _calculate_sha1(f_copy) == image_sha1 + # Close temporary files, which will also remove them f_copy.close() f_bmap1.close()