Merge lp:~pwlars/qa-iso-static-validation-test/pep8 into lp:qa-iso-static-validation-test
- pep8
- Merge into trunk
Proposed by
Paul Larson
Status: | Merged |
---|---|
Merged at revision: | 15 |
Proposed branch: | lp:~pwlars/qa-iso-static-validation-test/pep8 |
Merge into: | lp:qa-iso-static-validation-test |
Diff against target: |
330 lines (+71/-67) 1 file modified
iso_static_validation.py (+71/-67) |
To merge this branch: | bzr merge lp:~pwlars/qa-iso-static-validation-test/pep8 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Para Siva | Approve | ||
Review via email: mp+124925@code.launchpad.net |
Commit message
Description of the change
No other changes or cleanups in this branch, just enough to make it pass
pep8 compliance.
To post a comment you must log in.
Revision history for this message
Para Siva (psivaa) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'iso_static_validation.py' | |||
2 | --- iso_static_validation.py 2012-08-30 08:57:30 +0000 | |||
3 | +++ iso_static_validation.py 2012-09-18 13:39:20 +0000 | |||
4 | @@ -28,20 +28,19 @@ | |||
5 | 28 | import subprocess | 28 | import subprocess |
6 | 29 | import hashlib | 29 | import hashlib |
7 | 30 | import unittest | 30 | import unittest |
8 | 31 | import time | ||
9 | 32 | import datetime | ||
10 | 33 | import re | 31 | import re |
11 | 34 | import tempfile | 32 | import tempfile |
12 | 35 | import shutil | 33 | import shutil |
13 | 36 | 34 | ||
14 | 37 | # Defaults | 35 | # Defaults |
16 | 38 | #DEFAULT_ISOROOT = os.path.expanduser('/var/lib/ubuntu-server-iso-testing/isos/ubuntu/') | 36 | #DEFAULT_ISOROOT = os.path.expanduser( |
17 | 37 | # '/var/lib/ubuntu-server-iso-testing/isos/ubuntu/') | ||
18 | 39 | DEFAULT_URL = 'http://cdimage.ubuntu.com/' | 38 | DEFAULT_URL = 'http://cdimage.ubuntu.com/' |
19 | 40 | 39 | ||
20 | 41 | #constants | 40 | #constants |
24 | 42 | ONE_MB_BLOCK=2**20 | 41 | ONE_MB_BLOCK = 2 ** 20 |
25 | 43 | PRECISE_SIZE_LIMIT_MB=737148928 | 42 | PRECISE_SIZE_LIMIT_MB = 737148928 |
26 | 44 | QUANTAL_SIZE_LIMIT_MB=838860800 | 43 | QUANTAL_SIZE_LIMIT_MB = 838860800 |
27 | 45 | 44 | ||
28 | 46 | #Read the iso name and initialise global variables | 45 | #Read the iso name and initialise global variables |
29 | 47 | parser = argparse.ArgumentParser() | 46 | parser = argparse.ArgumentParser() |
30 | @@ -49,10 +48,11 @@ | |||
31 | 49 | parser.add_argument('--name') | 48 | parser.add_argument('--name') |
32 | 50 | args = parser.parse_args() | 49 | args = parser.parse_args() |
33 | 51 | 50 | ||
35 | 52 | logging.basicConfig(level = logging.INFO) | 51 | logging.basicConfig(level=logging.INFO) |
36 | 53 | 52 | ||
37 | 54 | if args.name == None or '.iso' not in args.name or args.isoroot == None: | 53 | if args.name == None or '.iso' not in args.name or args.isoroot == None: |
39 | 55 | print 'The usage:', sys.argv[0], '--name release-variant-arch.iso --isoroot ~/iso_location' | 54 | print('The usage:', sys.argv[0], |
40 | 55 | '--name release-variant-arch.iso --isoroot ~/iso_location') | ||
41 | 56 | sys.exit(1) | 56 | sys.exit(1) |
42 | 57 | else: | 57 | else: |
43 | 58 | st_name = args.name.rstrip('.iso') | 58 | st_name = args.name.rstrip('.iso') |
44 | @@ -68,6 +68,7 @@ | |||
45 | 68 | else: | 68 | else: |
46 | 69 | ubiquity_image = False | 69 | ubiquity_image = False |
47 | 70 | 70 | ||
48 | 71 | |||
49 | 71 | class TestValidateISO(unittest.TestCase): | 72 | class TestValidateISO(unittest.TestCase): |
50 | 72 | @classmethod | 73 | @classmethod |
51 | 73 | def setUpClass(cls): | 74 | def setUpClass(cls): |
52 | @@ -76,7 +77,7 @@ | |||
53 | 76 | except OSError: | 77 | except OSError: |
54 | 77 | logging.error("Creating temp dirrectory failed") | 78 | logging.error("Creating temp dirrectory failed") |
55 | 78 | unittest.fail("Setup error") | 79 | unittest.fail("Setup error") |
57 | 79 | 80 | ||
58 | 80 | def setUp(self): | 81 | def setUp(self): |
59 | 81 | self.iso_name = args.name | 82 | self.iso_name = args.name |
60 | 82 | self.block_size = ONE_MB_BLOCK | 83 | self.block_size = ONE_MB_BLOCK |
61 | @@ -84,7 +85,7 @@ | |||
62 | 84 | self.st_release = st_release | 85 | self.st_release = st_release |
63 | 85 | self.st_variant = st_variant | 86 | self.st_variant = st_variant |
64 | 86 | self.st_arch = st_arch | 87 | self.st_arch = st_arch |
66 | 87 | 88 | ||
67 | 88 | if self.st_release != 'precise': | 89 | if self.st_release != 'precise': |
68 | 89 | self.url = DEFAULT_URL | 90 | self.url = DEFAULT_URL |
69 | 90 | else: | 91 | else: |
70 | @@ -100,7 +101,7 @@ | |||
71 | 100 | if self.st_release == 'precise': | 101 | if self.st_release == 'precise': |
72 | 101 | self.url = os.path.join(DEFAULT_URL, 'ubuntu-server', | 102 | self.url = os.path.join(DEFAULT_URL, 'ubuntu-server', |
73 | 102 | 'precise', 'daily') | 103 | 'precise', 'daily') |
75 | 103 | else: # current dev release | 104 | else: # current dev release |
76 | 104 | self.url = os.path.join(DEFAULT_URL, 'ubuntu-server', 'daily') | 105 | self.url = os.path.join(DEFAULT_URL, 'ubuntu-server', 'daily') |
77 | 105 | else: | 106 | else: |
78 | 106 | self.fail("Image name be in the form of release-variant-arch.iso") | 107 | self.fail("Image name be in the form of release-variant-arch.iso") |
79 | @@ -134,10 +135,10 @@ | |||
80 | 134 | sha256 = hashlib.sha256() | 135 | sha256 = hashlib.sha256() |
81 | 135 | with open(self.iso_location) as f: | 136 | with open(self.iso_location) as f: |
82 | 136 | while True: | 137 | while True: |
87 | 137 | data = f.read(self.block_size) | 138 | data = f.read(self.block_size) |
88 | 138 | if not data: | 139 | if not data: |
89 | 139 | break | 140 | break |
90 | 140 | sha256.update(data) | 141 | sha256.update(data) |
91 | 141 | sha256 = sha256.hexdigest() | 142 | sha256 = sha256.hexdigest() |
92 | 142 | logging.debug("Expected Checksum: '%s'", iso_sha256) | 143 | logging.debug("Expected Checksum: '%s'", iso_sha256) |
93 | 143 | logging.debug("Local File Checksum: '%s'", sha256) | 144 | logging.debug("Local File Checksum: '%s'", sha256) |
94 | @@ -146,13 +147,13 @@ | |||
95 | 146 | # Test if the list file in the repository matches the content of the iso | 147 | # Test if the list file in the repository matches the content of the iso |
96 | 147 | def test_files_list(self): | 148 | def test_files_list(self): |
97 | 148 | if self.st_variant == 'server': | 149 | if self.st_variant == 'server': |
99 | 149 | list_url = os.path.join(self.url, 'current', | 150 | list_url = os.path.join(self.url, 'current', |
100 | 150 | self.st_release + '-' + 'server' + '-' + | 151 | self.st_release + '-' + 'server' + '-' + |
101 | 151 | self.st_arch + '.list') | 152 | self.st_arch + '.list') |
102 | 152 | else: | 153 | else: |
104 | 153 | list_url = os.path.join(self.url, 'current', | 154 | list_url = os.path.join(self.url, 'current', |
105 | 154 | self.st_release + '-' + | 155 | self.st_release + '-' + |
107 | 155 | self.st_variant + '-' + | 156 | self.st_variant + '-' + |
108 | 156 | self.st_arch + '.list') | 157 | self.st_arch + '.list') |
109 | 157 | 158 | ||
110 | 158 | try: | 159 | try: |
111 | @@ -164,9 +165,9 @@ | |||
112 | 164 | 165 | ||
113 | 165 | logging.debug('Extracting list file info from ISO') | 166 | logging.debug('Extracting list file info from ISO') |
114 | 166 | cmd = ["bsdtar", "-tf", self.iso_location] | 167 | cmd = ["bsdtar", "-tf", self.iso_location] |
118 | 167 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 168 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
119 | 168 | stderr = subprocess.PIPE) | 169 | stderr=subprocess.PIPE) |
120 | 169 | (stdout, stderr) = output.communicate () | 170 | (stdout, stderr) = output.communicate() |
121 | 170 | logging.debug('Checking for error in extracting the file list') | 171 | logging.debug('Checking for error in extracting the file list') |
122 | 171 | self.assertEqual(stderr, '') | 172 | self.assertEqual(stderr, '') |
123 | 172 | 173 | ||
124 | @@ -175,12 +176,12 @@ | |||
125 | 175 | self.assertIn(list_entry[1:].rstrip(), stdout) | 176 | self.assertIn(list_entry[1:].rstrip(), stdout) |
126 | 176 | 177 | ||
127 | 177 | # Test if the manfest is the same as that is given in the server | 178 | # Test if the manfest is the same as that is given in the server |
129 | 178 | @unittest.skipUnless(ubiquity_image, | 179 | @unittest.skipUnless(ubiquity_image, |
130 | 179 | "manifest only for ubiquity based images") | 180 | "manifest only for ubiquity based images") |
131 | 180 | def test_manifest(self): | 181 | def test_manifest(self): |
133 | 181 | manifest_url = os.path.join(self.url, 'current', | 182 | manifest_url = os.path.join(self.url, 'current', |
134 | 182 | self.st_release + '-' + | 183 | self.st_release + '-' + |
136 | 183 | self.st_variant + '-' + | 184 | self.st_variant + '-' + |
137 | 184 | self.st_arch + '.manifest') | 185 | self.st_arch + '.manifest') |
138 | 185 | try: | 186 | try: |
139 | 186 | manifest = urllib2.urlopen(manifest_url) | 187 | manifest = urllib2.urlopen(manifest_url) |
140 | @@ -192,9 +193,9 @@ | |||
141 | 192 | logging.debug('Extracting manifest from the iso') | 193 | logging.debug('Extracting manifest from the iso') |
142 | 193 | cmd = ["bsdtar", "-xf", self.iso_location, "-C", self.temp_dir, | 194 | cmd = ["bsdtar", "-xf", self.iso_location, "-C", self.temp_dir, |
143 | 194 | "casper/filesystem.manifest"] | 195 | "casper/filesystem.manifest"] |
147 | 195 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 196 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
148 | 196 | stderr = subprocess.PIPE) | 197 | stderr=subprocess.PIPE) |
149 | 197 | (stdout, stderr) = output.communicate () | 198 | (stdout, stderr) = output.communicate() |
150 | 198 | logging.debug('Check for error in extracting manifest info from iso') | 199 | logging.debug('Check for error in extracting manifest info from iso') |
151 | 199 | self.assertEqual(stderr, '') | 200 | self.assertEqual(stderr, '') |
152 | 200 | 201 | ||
153 | @@ -212,9 +213,9 @@ | |||
154 | 212 | logging.debug('Extract distro information of the image from the iso') | 213 | logging.debug('Extract distro information of the image from the iso') |
155 | 213 | cmd = ["bsdtar", "-xf", self.iso_location, "-C", | 214 | cmd = ["bsdtar", "-xf", self.iso_location, "-C", |
156 | 214 | self.temp_dir, "./.disk/info"] | 215 | self.temp_dir, "./.disk/info"] |
160 | 215 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 216 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
161 | 216 | stderr = subprocess.PIPE) | 217 | stderr=subprocess.PIPE) |
162 | 217 | (stdout, stderr) = output.communicate () | 218 | (stdout, stderr) = output.communicate() |
163 | 218 | logging.debug('Checking for error in extracting distro info from iso') | 219 | logging.debug('Checking for error in extracting distro info from iso') |
164 | 219 | self.assertEqual(stderr, '') | 220 | self.assertEqual(stderr, '') |
165 | 220 | 221 | ||
166 | @@ -240,36 +241,36 @@ | |||
167 | 240 | self.assertIn(id_server, build_info_line) | 241 | self.assertIn(id_server, build_info_line) |
168 | 241 | 242 | ||
169 | 242 | # Test if wubi is present for desktop or dvd and it is a valid PE | 243 | # Test if wubi is present for desktop or dvd and it is a valid PE |
171 | 243 | @unittest.skipUnless(st_variant =='desktop' and | 244 | @unittest.skipUnless(st_variant == 'desktop' and |
172 | 244 | st_arch != 'powerpc', "Skipping non ubiquity images") | 245 | st_arch != 'powerpc', "Skipping non ubiquity images") |
173 | 245 | def test_wubi(self): | 246 | def test_wubi(self): |
174 | 246 | logging.debug('Extracting wubi from the desktop images') | 247 | logging.debug('Extracting wubi from the desktop images') |
176 | 247 | cmd = ["bsdtar", "-xf", self.iso_location, "-C", | 248 | cmd = ["bsdtar", "-xf", self.iso_location, "-C", |
177 | 248 | self.temp_dir, "./wubi.exe"] | 249 | self.temp_dir, "./wubi.exe"] |
181 | 249 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 250 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
182 | 250 | stderr = subprocess.PIPE) | 251 | stderr=subprocess.PIPE) |
183 | 251 | (stdout, stderr) = output.communicate () | 252 | (stdout, stderr) = output.communicate() |
184 | 252 | logging.debug('Check for error in extracting wubi.exe from the iso') | 253 | logging.debug('Check for error in extracting wubi.exe from the iso') |
185 | 253 | self.assertEqual(stderr, '') | 254 | self.assertEqual(stderr, '') |
186 | 254 | 255 | ||
187 | 255 | wubi_path = os.path.join(self.temp_dir, './wubi.exe') | 256 | wubi_path = os.path.join(self.temp_dir, './wubi.exe') |
188 | 256 | 257 | ||
189 | 257 | cmd = ["file", wubi_path] | 258 | cmd = ["file", wubi_path] |
193 | 258 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 259 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
194 | 259 | stderr = subprocess.PIPE) | 260 | stderr=subprocess.PIPE) |
195 | 260 | (stdout, stderr) = output.communicate () | 261 | (stdout, stderr) = output.communicate() |
196 | 261 | logging.debug('Check that wubi has a valid PE header') | 262 | logging.debug('Check that wubi has a valid PE header') |
197 | 262 | self.assertEqual(stderr, '') | 263 | self.assertEqual(stderr, '') |
198 | 263 | self.assertIn(" PE32 executable (GUI)", stdout) | 264 | self.assertIn(" PE32 executable (GUI)", stdout) |
199 | 264 | 265 | ||
200 | 265 | # Test if the relevant files are present in the iso for desktop iso | 266 | # Test if the relevant files are present in the iso for desktop iso |
202 | 266 | @unittest.skipUnless(st_variant == 'desktop' and | 267 | @unittest.skipUnless(st_variant == 'desktop' and |
203 | 267 | st_arch != 'powerpc', "Skipping for non desktop iso") | 268 | st_arch != 'powerpc', "Skipping for non desktop iso") |
204 | 268 | def test_files_ubiquity(self): | 269 | def test_files_ubiquity(self): |
205 | 269 | cmd = ["bsdtar", "-tf", self.iso_location] | 270 | cmd = ["bsdtar", "-tf", self.iso_location] |
209 | 270 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 271 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
210 | 271 | stderr = subprocess.PIPE) | 272 | stderr=subprocess.PIPE) |
211 | 272 | (stdout, stderr) = output.communicate () | 273 | (stdout, stderr) = output.communicate() |
212 | 273 | logging.debug('Check for error in extracting file list from the iso') | 274 | logging.debug('Check for error in extracting file list from the iso') |
213 | 274 | self.assertEqual(stderr, '') | 275 | self.assertEqual(stderr, '') |
214 | 275 | files_list = open("data/file_list_ubiquity") | 276 | files_list = open("data/file_list_ubiquity") |
215 | @@ -282,9 +283,9 @@ | |||
216 | 282 | "This file list test is only specific for dvd") | 283 | "This file list test is only specific for dvd") |
217 | 283 | def test_files_ubiquity_dvd(self): | 284 | def test_files_ubiquity_dvd(self): |
218 | 284 | cmd = ["bsdtar", "-tf", self.iso_location] | 285 | cmd = ["bsdtar", "-tf", self.iso_location] |
222 | 285 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 286 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
223 | 286 | stderr = subprocess.PIPE) | 287 | stderr=subprocess.PIPE) |
224 | 287 | (stdout, stderr) = output.communicate () | 288 | (stdout, stderr) = output.communicate() |
225 | 288 | logging.debug('Check for error in extracting file list from the iso') | 289 | logging.debug('Check for error in extracting file list from the iso') |
226 | 289 | self.assertEqual(stderr, '') | 290 | self.assertEqual(stderr, '') |
227 | 290 | files_list = open("data/file_list_ubiquity_dvd") | 291 | files_list = open("data/file_list_ubiquity_dvd") |
228 | @@ -300,15 +301,15 @@ | |||
229 | 300 | @unittest.skipIf(ubiquity_image, "Skipping for ubiquity images") | 301 | @unittest.skipIf(ubiquity_image, "Skipping for ubiquity images") |
230 | 301 | def test_files_di(self): | 302 | def test_files_di(self): |
231 | 302 | cmd = ["bsdtar", "-tf", self.iso_location] | 303 | cmd = ["bsdtar", "-tf", self.iso_location] |
235 | 303 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 304 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
236 | 304 | stderr = subprocess.PIPE) | 305 | stderr=subprocess.PIPE) |
237 | 305 | (stdout, stderr) = output.communicate () | 306 | (stdout, stderr) = output.communicate() |
238 | 306 | logging.debug('Check for error in extracting file list from the iso') | 307 | logging.debug('Check for error in extracting file list from the iso') |
239 | 307 | self.assertEqual(stderr, '') | 308 | self.assertEqual(stderr, '') |
240 | 308 | 309 | ||
241 | 309 | if self.st_arch == 'powerpc' or self.st_arch == 'amd64+mac': | 310 | if self.st_arch == 'powerpc' or self.st_arch == 'amd64+mac': |
242 | 310 | files_list = open("data/file_list_di_powerpc") | 311 | files_list = open("data/file_list_di_powerpc") |
244 | 311 | else: #i386 or amd64 | 312 | else: # i386 or amd64 |
245 | 312 | files_list = open("data/file_list_di") | 313 | files_list = open("data/file_list_di") |
246 | 313 | 314 | ||
247 | 314 | for list_server in files_list: | 315 | for list_server in files_list: |
248 | @@ -321,42 +322,43 @@ | |||
249 | 321 | def test_vmlinuz(self): | 322 | def test_vmlinuz(self): |
250 | 322 | cmd = ["bsdtar", "-xf", self.iso_location, "-C", | 323 | cmd = ["bsdtar", "-xf", self.iso_location, "-C", |
251 | 323 | self.temp_dir, "casper/vmlinuz"] | 324 | self.temp_dir, "casper/vmlinuz"] |
255 | 324 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 325 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
256 | 325 | stderr = subprocess.PIPE) | 326 | stderr=subprocess.PIPE) |
257 | 326 | (stdout, stderr) = output.communicate () | 327 | (stdout, stderr) = output.communicate() |
258 | 327 | logging.debug('Asserting that vmlinuz is present in the iso') | 328 | logging.debug('Asserting that vmlinuz is present in the iso') |
259 | 328 | self.assertEqual(stderr, '') | 329 | self.assertEqual(stderr, '') |
260 | 329 | 330 | ||
261 | 330 | vmlinuz_path = os.path.join(self.temp_dir, 'casper/vmlinuz') | 331 | vmlinuz_path = os.path.join(self.temp_dir, 'casper/vmlinuz') |
262 | 331 | 332 | ||
263 | 332 | cmd = ["file", vmlinuz_path] | 333 | cmd = ["file", vmlinuz_path] |
267 | 333 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 334 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
268 | 334 | stderr = subprocess.PIPE) | 335 | stderr=subprocess.PIPE) |
269 | 335 | (stdout, stderr) = output.communicate () | 336 | (stdout, stderr) = output.communicate() |
270 | 336 | logging.debug('Check if vmlinuz present in the iso is a Linux kernel') | 337 | logging.debug('Check if vmlinuz present in the iso is a Linux kernel') |
271 | 337 | self.assertEqual(stderr, '') | 338 | self.assertEqual(stderr, '') |
272 | 338 | self.assertIn("Linux kernel", stdout) | 339 | self.assertIn("Linux kernel", stdout) |
273 | 339 | 340 | ||
275 | 340 | # Test if filesystem.squashfs is present and | 341 | # Test if filesystem.squashfs is present and |
276 | 341 | # if that is a squash fs for ubiquity based images | 342 | # if that is a squash fs for ubiquity based images |
277 | 342 | @unittest.skipUnless(ubiquity_image, "Skipping for non ubiquity images") | 343 | @unittest.skipUnless(ubiquity_image, "Skipping for non ubiquity images") |
278 | 343 | def test_filesystem_squashfs(self): | 344 | def test_filesystem_squashfs(self): |
279 | 344 | logging.debug('Extracting the filesystem.squashfs') | 345 | logging.debug('Extracting the filesystem.squashfs') |
281 | 345 | cmd = ["bsdtar", "-xf" , self.iso_location, "-C", | 346 | cmd = ["bsdtar", "-xf", self.iso_location, "-C", |
282 | 346 | self.temp_dir, "casper/filesystem.squashfs"] | 347 | self.temp_dir, "casper/filesystem.squashfs"] |
286 | 347 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 348 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
287 | 348 | stderr = subprocess.PIPE) | 349 | stderr=subprocess.PIPE) |
288 | 349 | (stdout, stderr) = output.communicate () | 350 | (stdout, stderr) = output.communicate() |
289 | 350 | logging.debug('Check for error in extracting filesystem.squashfs') | 351 | logging.debug('Check for error in extracting filesystem.squashfs') |
290 | 351 | self.assertEqual(stderr, '') | 352 | self.assertEqual(stderr, '') |
291 | 352 | 353 | ||
293 | 353 | squashfs_path = os.path.join(self.temp_dir, 'casper/filesystem.squashfs') | 354 | squashfs_path = os.path.join(self.temp_dir, |
294 | 355 | 'casper/filesystem.squashfs') | ||
295 | 354 | 356 | ||
296 | 355 | logging.debug('Checking the file is an actual .squashfs') | 357 | logging.debug('Checking the file is an actual .squashfs') |
297 | 356 | cmd = ["file", squashfs_path] | 358 | cmd = ["file", squashfs_path] |
301 | 357 | output = subprocess.Popen(cmd, stdout = subprocess.PIPE, | 359 | output = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
302 | 358 | stderr = subprocess.PIPE) | 360 | stderr=subprocess.PIPE) |
303 | 359 | (stdout, stderr) = output.communicate () | 361 | (stdout, stderr) = output.communicate() |
304 | 360 | logging.debug('Check if signature contains \"Squashfs filesystem\"') | 362 | logging.debug('Check if signature contains \"Squashfs filesystem\"') |
305 | 361 | self.assertEqual(stderr, '') | 363 | self.assertEqual(stderr, '') |
306 | 362 | self.assertIn("Squashfs filesystem", stdout) | 364 | self.assertIn("Squashfs filesystem", stdout) |
307 | @@ -369,7 +371,7 @@ | |||
308 | 369 | #self.assertEqual(stderr, '') | 371 | #self.assertEqual(stderr, '') |
309 | 370 | #self.assertIn("created 1 directories", stdout) | 372 | #self.assertIn("created 1 directories", stdout) |
310 | 371 | 373 | ||
312 | 372 | # Test if the report.html exists for the d-i based images | 374 | # Test if the report.html exists for the d-i based images |
313 | 373 | # and that it does not have any conflicting packages | 375 | # and that it does not have any conflicting packages |
314 | 374 | @unittest.skipIf(ubiquity_image, "Skipping for ubiquity based images") | 376 | @unittest.skipIf(ubiquity_image, "Skipping for ubiquity based images") |
315 | 375 | def test_report_html(self): | 377 | def test_report_html(self): |
316 | @@ -392,10 +394,12 @@ | |||
317 | 392 | 394 | ||
318 | 393 | if(self.st_release == 'precise'): | 395 | if(self.st_release == 'precise'): |
319 | 394 | # check if the size of the image fits a 703MB cd for precise | 396 | # check if the size of the image fits a 703MB cd for precise |
321 | 395 | self.assertTrue(statinfo.st_size < PRECISE_SIZE_LIMIT_MB, "Size: %s" % (statinfo.st_size)) | 397 | self.assertTrue(statinfo.st_size < PRECISE_SIZE_LIMIT_MB, |
322 | 398 | "Size: %s" % (statinfo.st_size)) | ||
323 | 396 | else: | 399 | else: |
324 | 397 | # check if the size of the image fits a 800MB cd for quantal | 400 | # check if the size of the image fits a 800MB cd for quantal |
326 | 398 | self.assertTrue(statinfo.st_size < QUANTAL_SIZE_LIMIT_MB, "Size: %s" % (statinfo.st_size)) | 401 | self.assertTrue(statinfo.st_size < QUANTAL_SIZE_LIMIT_MB, |
327 | 402 | "Size: %s" % (statinfo.st_size)) | ||
328 | 399 | 403 | ||
329 | 400 | # clean up | 404 | # clean up |
330 | 401 | @classmethod | 405 | @classmethod |