binman: Use the tools.Decompress method
authorSimon Glass <sjg@chromium.org>
Mon, 8 Jul 2019 19:18:42 +0000 (13:18 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 24 Jul 2019 03:27:57 +0000 (20:27 -0700)
Update the compression test to use the tools module to decompress the
output data.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/ftest.py

index c74e12d13c814bfba70a97288d238899b1c8a91b..6ff871b3c1699fa55102597f0ab57bc53aad3f9a 100644 (file)
@@ -59,7 +59,7 @@ BMPBLK_DATA           = b'bmp'
 VBLOCK_DATA           = b'vblk'
 FILES_DATA            = (b"sorry I'm late\nOh, don't bother apologising, I'm " +
                          b"sorry you're alive\n")
-COMPRESS_DATA         = b'data to compress'
+COMPRESS_DATA         = b'compress xxxxxxxxxxxxxxxxxxxxxx data'
 REFCODE_DATA          = b'refcode'
 
 
@@ -1560,16 +1560,7 @@ class TestFunctional(unittest.TestCase):
             self._ResetDtbs()
 
     def _decompress(self, data):
-        out = os.path.join(self._indir, 'lz4.tmp')
-        with open(out, 'wb') as fd:
-            fd.write(data)
-        return tools.Run('lz4', '-dc', out, binary=True)
-        '''
-        try:
-            orig = lz4.frame.decompress(data)
-        except AttributeError:
-            orig = lz4.decompress(data)
-        '''
+        return tools.Decompress(data, 'lz4')
 
     def testCompress(self):
         """Test compression of blobs"""