test_api_base: also test compressed files
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 26 Nov 2012 15:58:48 +0000 (17:58 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 26 Nov 2012 16:15:44 +0000 (18:15 +0200)
Change-Id: Iae27bcea6fac825a2c6d1f82b125afda5db31859
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
TODO
tests/test_api_base.py

diff --git a/TODO b/TODO
index be02874..2189fea 100644 (file)
--- 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
index 2cec130..27175ab 100644 (file)
@@ -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()