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

Unified Diff: tests/bitmaps/TestBmpBlock.py

Issue 6508006: Enable EFIv1 compression in bmpbklk_utility. (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Added tests, updated copyrights, moved bmpblk_util.h as suggested. 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 | « tests/bitmaps/Background.bmp ('k') | tests/bitmaps/Word.bmp » ('j') | no next file with comments »
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 77ef41991ac8dac94e4e46093ef7eb82afa2c962..ced270ee0cc908c42cb7a83480177b71494b0c25 100755
--- a/tests/bitmaps/TestBmpBlock.py
+++ b/tests/bitmaps/TestBmpBlock.py
@@ -19,7 +19,7 @@ def runprog(*args):
return (p.returncode, out, err)
-class TestBmpBlock(unittest.TestCase):
+class TestFailures(unittest.TestCase):
def testNoArgs(self):
"""Running with no args should print usage and fail."""
@@ -40,6 +40,72 @@ class TestBmpBlock(unittest.TestCase):
self.assertNotEqual(0, rc)
self.assertTrue(err.count("Unsupported image format"))
+ def testBadCompression(self):
+ """Wrong compression types should fail."""
+ rc, out, err = runprog(prog, '-z', '99', '-c', 'case_simple.yaml', 'FOO')
+ self.assertNotEqual(0, rc)
+ self.assertTrue(err.count("compression type"))
+
+
+class TestOverWrite(unittest.TestCase):
+
+ def setUp(self):
+ rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+
+ def testOverwrite(self):
+ """Create, unpack, unpack again, with and without -f"""
+ rc, out, err = runprog(prog, '-c', 'case_simple.yaml', 'FOO')
+ self.assertEqual(0, rc)
+ rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+ rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', 'FOO')
+ self.assertNotEqual(0, rc)
+ self.assertTrue(err.count("File exists"))
+ rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', '-f', 'FOO')
+ self.assertEqual(0, rc)
+
+ def tearDown(self):
+ rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+
+
+class TestPackUnpack(unittest.TestCase):
+
+ def setUp(self):
+ rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+
+ def testPackUnpack(self):
+ """Create, unpack, recreate without compression"""
+ rc, out, err = runprog(prog, '-c', 'case_simple.yaml', 'FOO')
+ self.assertEqual(0, rc)
+ rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+ os.chdir('./FOO_DIR')
+ rc, out, err = runprog(prog, '-c', 'config.yaml', 'BAR')
+ self.assertEqual(0, rc)
+ rc, out, err = runprog('/usr/bin/cmp', '../FOO', 'BAR')
+ self.assertEqual(0, rc)
+ os.chdir('..')
+
+ def testPackUnpackZ(self):
+ """Create, unpack, recreate with explicit compression"""
+ rc, out, err = runprog(prog, '-z', '1', '-c', 'case_simple.yaml', 'FOO')
+ self.assertEqual(0, rc)
+ rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+ os.chdir('./FOO_DIR')
+ rc, out, err = runprog(prog, '-z', '1', '-c', 'config.yaml', 'BAR')
+ self.assertEqual(0, rc)
+ rc, out, err = runprog('/usr/bin/cmp', '../FOO', 'BAR')
+ self.assertEqual(0, rc)
+ os.chdir('..')
+
+ def tearDown(self):
+ rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+
# Run these tests
if __name__ == '__main__':
« no previous file with comments | « tests/bitmaps/Background.bmp ('k') | tests/bitmaps/Word.bmp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698