Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Unified Diff: tests/bitmaps/TestBmpBlock.py

Issue 6541001: Allow yaml file to specify default compression for images (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utility/bmpblk_util.c » ('j') | utility/include/bmpblk_utility.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/bitmaps/TestBmpBlock.py
diff --git a/tests/bitmaps/TestBmpBlock.py b/tests/bitmaps/TestBmpBlock.py
index 265bd24df222f5247da2ad599ee8945688983b12..ca7ef4a06ddd8cdd7b5dc206aec9280f6126536b 100755
--- a/tests/bitmaps/TestBmpBlock.py
+++ b/tests/bitmaps/TestBmpBlock.py
@@ -73,6 +73,7 @@ class TestOverWrite(unittest.TestCase):
class TestPackUnpack(unittest.TestCase):
def setUp(self):
+ self._cwd = os.getcwd()
rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO')
self.assertEqual(0, rc)
@@ -110,7 +111,39 @@ class TestPackUnpack(unittest.TestCase):
"""Create, unpack, recreate with LZMA compression"""
self.doPackUnpackZ('2');
+ def doPackUnpackImplicitZ(self, comp, noncomp):
+ """Create with given compression, unpack, repack without specifying"""
+ # create with the specified compression scheme
+ rc, out, err = runprog(prog, '-z', comp, '-c', 'case_simple.yaml', 'FOO')
+ self.assertEqual(0, rc)
+ # unpack. yaml file should have compression scheme in it
+ rc, out, err = runprog(prog, '-f', '-x', '-d', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+ os.chdir('./FOO_DIR')
+ # create with no compression specified, should use default from yaml
+ rc, out, err = runprog(prog, '-c', 'config.yaml', 'BAR')
+ self.assertEqual(0, rc)
+ # so new output should match original
+ rc, out, err = runprog('/usr/bin/cmp', '../FOO', 'BAR')
+ self.assertEqual(0, rc)
+ # Now make sure that specifying a compression arg will override the default
+ for mycomp in noncomp:
+ # create with compression scheme different from default
+ rc, out, err = runprog(prog, '-z', str(mycomp), '-c', 'config.yaml', 'BAR')
+ self.assertEqual(0, rc)
+ # should be different binary
+ rc, out, err = runprog('/usr/bin/cmp', '../FOO', 'BAR')
+ self.assertNotEqual(0, rc)
+ os.chdir('..')
+
+ def testPackUnpackImplicitZ(self):
+ """Create, unpack, recreate with implicit compression"""
+ self._allowed = range(3)
+ for c in self._allowed:
+ self.doPackUnpackImplicitZ(str(c), [x for x in self._allowed if x != c])
+
def tearDown(self):
+ os.chdir(self._cwd)
rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO')
self.assertEqual(0, rc)
« no previous file with comments | « no previous file | utility/bmpblk_util.c » ('j') | utility/include/bmpblk_utility.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698