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

Side by Side Diff: tests/bitmaps/TestBmpBlock.py

Issue 6523019: Enable LZMA compression in bmpbklk_utility. (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Remove unnecessary code 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « firmware/include/bmpblk_header.h ('k') | utility/Makefile » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python -tt 1 #!/usr/bin/python -tt
2 # 2 #
3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Unit tests for bmpblk_utility. 7 """Unit tests for bmpblk_utility.
8 """ 8 """
9 9
10 import os 10 import os
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 self.assertEqual(0, rc) 82 self.assertEqual(0, rc)
83 rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', 'FOO') 83 rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', 'FOO')
84 self.assertEqual(0, rc) 84 self.assertEqual(0, rc)
85 os.chdir('./FOO_DIR') 85 os.chdir('./FOO_DIR')
86 rc, out, err = runprog(prog, '-c', 'config.yaml', 'BAR') 86 rc, out, err = runprog(prog, '-c', 'config.yaml', 'BAR')
87 self.assertEqual(0, rc) 87 self.assertEqual(0, rc)
88 rc, out, err = runprog('/usr/bin/cmp', '../FOO', 'BAR') 88 rc, out, err = runprog('/usr/bin/cmp', '../FOO', 'BAR')
89 self.assertEqual(0, rc) 89 self.assertEqual(0, rc)
90 os.chdir('..') 90 os.chdir('..')
91 91
92 def testPackUnpackZ(self): 92 def doPackUnpackZ(self, comp):
93 """Create, unpack, recreate with explicit compression""" 93 """Create, unpack, recreate with a given compression"""
94 rc, out, err = runprog(prog, '-z', '1', '-c', 'case_simple.yaml', 'FOO') 94 rc, out, err = runprog(prog, '-z', comp, '-c', 'case_simple.yaml', 'FOO')
95 self.assertEqual(0, rc) 95 self.assertEqual(0, rc)
96 rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', 'FOO') 96 rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', 'FOO')
97 self.assertEqual(0, rc) 97 self.assertEqual(0, rc)
98 os.chdir('./FOO_DIR') 98 os.chdir('./FOO_DIR')
99 rc, out, err = runprog(prog, '-z', '1', '-c', 'config.yaml', 'BAR') 99 rc, out, err = runprog(prog, '-z', comp, '-c', 'config.yaml', 'BAR')
100 self.assertEqual(0, rc) 100 self.assertEqual(0, rc)
101 rc, out, err = runprog('/usr/bin/cmp', '../FOO', 'BAR') 101 rc, out, err = runprog('/usr/bin/cmp', '../FOO', 'BAR')
102 self.assertEqual(0, rc) 102 self.assertEqual(0, rc)
103 os.chdir('..') 103 os.chdir('..')
104 104
105 def testPackUnpackZ1(self):
106 """Create, unpack, recreate with EFIv1 compression"""
107 self.doPackUnpackZ('1');
108
109 def testPackUnpackZ2(self):
110 """Create, unpack, recreate with LZMA compression"""
111 self.doPackUnpackZ('2');
112
105 def tearDown(self): 113 def tearDown(self):
106 rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO') 114 rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO')
107 self.assertEqual(0, rc) 115 self.assertEqual(0, rc)
108 116
109 117
110 # Run these tests 118 # Run these tests
111 if __name__ == '__main__': 119 if __name__ == '__main__':
112 varname = 'BMPBLK' 120 varname = 'BMPBLK'
113 if varname not in os.environ: 121 if varname not in os.environ:
114 print('You must specify the path to bmpblk_utility in the $%s ' 122 print('You must specify the path to bmpblk_utility in the $%s '
115 'environment variable.' % varname) 123 'environment variable.' % varname)
116 sys.exit(1) 124 sys.exit(1)
117 prog = os.environ[varname] 125 prog = os.environ[varname]
118 print "Testing prog...", prog 126 print "Testing prog...", prog
119 unittest.main() 127 unittest.main()
120 128
OLDNEW
« no previous file with comments | « firmware/include/bmpblk_header.h ('k') | utility/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698