11 from fnmatch import fnmatchcase as matches
12 from cStringIO import StringIO
14 logg = logging.getLogger("test")
17 testdatadir = "testdata.d"
23 def shell_string(command):
24 return " ".join(["'%s'" % arg.replace("'","\\'") for arg in command])
26 def shell(command, shell=True, calls=False, cwd=None, env=None, lang=None, returncodes=None):
27 returncodes = returncodes or [ None, 0 ]
28 Shell = collections.namedtuple("Shell",["returncode", "output", "errors", "shell"])
29 if isinstance(command, basestring):
33 sh_command = shell_string(command)
35 env = os.environ.copy()
37 for name, value in env.items():
38 if name.startswith("LC_"):
40 env["LANG"] = lang # defines message format
41 env["LC_ALL"] = lang # other locale formats
42 build_libs = os.path.dirname(os.path.dirname(os.path.realpath(command[0])))+"/zzip/.libs"
43 if os.path.isdir(build_libs):
44 env["LD_LIBRARY_PATH"] = build_libs
46 output, errors = "", ""
48 logg.debug("result from %s: %s", cwd and cwd+"/" or "shell", sh_command)
49 run = subprocess.Popen(command, shell=shell, cwd=cwd, env=env)
51 logg.warning("EXIT %s: %s", run.returncode, command)
54 logg.debug("output from %s: %s", cwd and cwd+"/" or "shell", sh_command)
55 run = subprocess.Popen(command, shell=shell, cwd=cwd,
56 stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=None, env=env)
58 logg.warning("EXIT %s: %s", run.returncode, command)
59 output, errors = run.communicate() # run.wait()
61 logg.error("*E*: %s", sh_command)
62 for line in output.split("\n"):
64 logg.error("OUT: %s", line)
65 for line in errors.split("\n"):
67 logg.error("ERR: %s", line)
69 if run.returncode not in returncodes:
70 logg.warning("*%02i: %s", run.returncode, sh_command)
71 for line in output.split("\n"):
73 logg.warning("OUT: %s", line)
74 for line in errors.split("\n"):
76 logg.warning("ERR: %s", line)
77 raise subprocess.CalledProcessError(run.returncode, sh_command, output)
79 for line in output.split("\n"):
81 logg.debug("OUT: %s", line)
82 for line in errors.split("\n"):
84 logg.debug("ERR: %s", line)
85 return Shell(run.returncode, output, errors, sh_command)
87 def get_caller_name():
88 frame = inspect.currentframe().f_back.f_back
89 return frame.f_code.co_name
90 def get_caller_caller_name():
91 frame = inspect.currentframe().f_back.f_back.f_back
92 return frame.f_code.co_name
94 def download_raw(base_url, filename, into, style = "?raw=true"):
95 return download(base_url, filename, into, style)
96 def download(base_url, filename, into, style = ""):
98 if not os.path.isdir(data):
100 subname = urllib.quote_plus(base_url)
101 subdir = os.path.join(data, subname)
102 if not os.path.isdir(subdir):
104 subfile = os.path.join(subdir, filename)
105 if not os.path.exists(subfile):
106 logg.info("need %s", subfile)
107 d = urllib.urlopen(base_url + "/" + filename + style)
108 f = open(subfile, "w")
112 if not os.path.isdir(into):
114 shutil.copy(subfile, into)
117 def output(cmd, shell=True):
118 run = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE)
119 out, err = run.communicate()
121 def grep(pattern, lines):
122 if isinstance(lines, basestring):
123 lines = lines.split("\n")
125 if re.search(pattern, line.rstrip()):
127 def greps(lines, pattern):
128 return list(grep(pattern, lines))
129 def all_errors(lines):
130 if isinstance(lines, basestring):
131 lines = lines.split("\n")
141 return list(all_errors(lines))
143 class ZZipTest(unittest.TestCase):
146 if not os.path.isdir(testdatadir):
147 os.makedirs(testdatadir)
153 return os.path.join(self.s, name)
155 f = open(self.src(readme))
159 def mkfile(self, name, content):
160 b = os.path.dirname(name)
161 if not os.path.isdir(b):
166 def bins(self, name):
167 if name == "unzip": return unzip
168 if name == "mkzip": return mkzip
169 exe = os.path.join("..", "bins", name)
170 if exeext: exe += exeext
172 def gentext(self, size):
173 random.seed(1234567891234567890)
177 for i in xrange(size):
179 x = random.choice(" abcdefghijklmnopqrstuvwxyz\n")
180 if x == old1 or x == old2: continue
185 return result.getvalue()
186 def caller_testname(self):
187 name = get_caller_caller_name()
189 if x1 < 0: return name
190 x2 = name.find("_", x1+1)
191 if x2 < 0: return name
193 def testname(self, suffix = None):
194 name = self.caller_testname()
196 return name + "_" + suffix
198 def testzip(self, testname = None):
199 testname = testname or self.caller_testname()
200 zipname = testname + ".zip"
202 def testdir(self, testname = None):
203 testname = testname or self.caller_testname()
204 newdir = "tmp."+testname
205 if os.path.isdir(newdir):
206 shutil.rmtree(newdir)
209 def rm_testdir(self, testname = None):
210 testname = testname or self.caller_testname()
211 newdir = "tmp."+testname
212 if os.path.isdir(newdir):
213 shutil.rmtree(newdir)
215 def rm_testzip(self, testname = None):
216 testname = testname or self.caller_testname()
217 zipname = testname + ".zip"
218 if os.path.exists(zipname):
221 ################################################################
222 def test_1000_make_test0_zip(self):
223 """ create a test.zip for later tests using standard 'zip'
224 It will fall back to a variant in the source code if 'zip'
225 is not installed on the build host. The content is just
226 the README file that we can check for equality later on. """
229 exe=self.bins("mkzip")
230 filename = os.path.join(tmpdir,"README")
231 filetext = self.readme()
232 self.mkfile(filename, filetext)
233 shell("{exe} ../{zipfile} README".format(**locals()), cwd=tmpdir)
234 self.assertGreater(os.path.getsize(zipfile), 10)
235 def test_10001_make_test1_zip(self):
236 """ create a test1.zip for later tests using standard 'zip'
237 It will fall back to a variant in the source code if 'zip'
238 is not installed on the build host. The archive has 10
239 generic files that we can check for their content later. """
242 exe=self.bins("mkzip")
243 for i in [1,2,3,4,5,6,7,8,9]:
244 filename = os.path.join(tmpdir,"file.%i" % i)
245 filetext = "file-%i\n" % i
246 self.mkfile(filename, filetext)
247 filename = os.path.join(tmpdir,"README")
248 filetext = self.readme()
249 self.mkfile(filename, filetext)
250 shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
251 self.assertGreater(os.path.getsize(zipfile), 10)
252 def test_10002_make_test2_zip(self):
253 """ create a test2.zip for later tests using standard 'zip'
254 It will NOT fall back to a variant in the source code.
255 The archive has 100 generic files with known content. """
258 exe=self.bins("mkzip")
259 for i in xrange(100):
260 filename = os.path.join(tmpdir,"file.%02i" % i)
261 filetext = "file-%02i\n" % i
262 self.mkfile(filename, filetext)
263 filename = os.path.join(tmpdir,"README")
264 filetext = self.readme()
265 self.mkfile(filename, filetext)
266 shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
267 self.assertGreater(os.path.getsize(zipfile), 10)
268 def test_10003_make_test3_zip(self):
269 """ create a test3.zip for later tests using standard 'zip'
270 It will NOT fall back to a variant in the source code.
271 The archive has 1000 generic files with known content. """
274 exe=self.bins("mkzip")
275 for i in xrange(1000):
276 filename = os.path.join(tmpdir,"file.%03i" % i)
277 filetext = "file-%03i\n" % i
278 self.mkfile(filename, filetext)
279 filename = os.path.join(tmpdir,"README")
280 filetext = self.readme()
281 self.mkfile(filename, filetext)
282 shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
283 self.assertGreater(os.path.getsize(zipfile), 10)
284 def test_10004_make_test4_zip(self):
285 """ create a test4.zip for later tests using standard 'zip'
286 It will NOT fall back to a variant in the source code.
287 The archive has 10000 generic files with known content
288 and they are stored (NOT compressed) in the archive. """
291 exe=self.bins("mkzip")
292 for i in xrange(10000):
293 filename = os.path.join(tmpdir,"file%04i.txt" % i)
294 filetext = "file-%04i\n" % i
295 self.mkfile(filename, filetext)
296 filename = os.path.join(tmpdir,"README")
297 filetext = self.readme()
298 self.mkfile(filename, filetext)
299 shell("{exe} -n README ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
300 self.assertGreater(os.path.getsize(zipfile), 1000000)
301 def test_10005_make_test5_zip(self):
302 """ create a test5.zip for later tests using standard 'zip'
303 It will NOT fall back to a variant in the source code.
304 The archive has files at multiple subdirectories depth
305 and of varying sizes each. """
308 exe=self.bins("mkzip")
309 for depth in xrange(20):
311 for i in xrange(depth):
313 dirpath += "subdir%i/" % i
314 for size in xrange(18):
316 filetext = self.gentext(size)
317 filepart = "file%i-%i.txt" % (depth, size)
318 filename = os.path.join(tmpdir, dirpath + filepart )
319 self.mkfile(filename, filetext)
320 filename = os.path.join(tmpdir,"README")
321 filetext = self.readme()
322 self.mkfile(filename, filetext)
323 shell("{exe} ../{zipfile} -r file* subdir* README".format(**locals()), cwd=tmpdir)
324 self.assertGreater(os.path.getsize(zipfile), 1000000)
325 def test_10010_make_test0_dat(self):
326 """ create test.dat from test.zip with xorcopy """
327 zipfile = "test0.zip"
328 datfile = "test0x.dat"
329 exe = self.bins("zzxorcopy")
330 shell("{exe} {zipfile} {datfile}".format(**locals()))
331 self.assertGreater(os.path.getsize(datfile), 10)
332 self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
333 def test_10011_make_test1_dat(self):
334 """ create test.dat from test.zip with xorcopy """
335 zipfile = "test1.zip"
336 datfile = "test1x.dat"
337 exe = self.bins("zzxorcopy")
338 shell("{exe} {zipfile} {datfile}".format(**locals()))
339 self.assertGreater(os.path.getsize(datfile), 10)
340 self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
341 def test_10012_make_test2_dat(self):
342 """ create test.dat from test.zip with xorcopy """
343 zipfile = "test2.zip"
344 datfile = "test2x.dat"
345 exe = self.bins("zzxorcopy")
346 shell("{exe} {zipfile} {datfile}".format(**locals()))
347 self.assertGreater(os.path.getsize(datfile), 10)
348 self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
349 def test_10013_make_test3_dat(self):
350 """ create test.dat from test.zip with xorcopy """
351 zipfile = "test3.zip"
352 datfile = "test3x.dat"
353 exe = self.bins("zzxorcopy")
354 shell("{exe} {zipfile} {datfile}".format(**locals()))
355 self.assertGreater(os.path.getsize(datfile), 10)
356 self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
357 def test_10014_make_test4_dat(self):
358 """ create test.dat from test.zip with xorcopy """
359 zipfile = "test4.zip"
360 datfile = "test4x.dat"
361 exe = self.bins("zzxorcopy")
362 shell("{exe} {zipfile} {datfile}".format(**locals()))
363 self.assertGreater(os.path.getsize(datfile), 10)
364 self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile))
365 def test_20000_zziptest_test0_zip(self):
366 """ run zziptest on test.zip """
367 zipfile = "test0.zip"
368 logfile = "test0.log"
369 exe = self.bins("zziptest")
370 shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
371 self.assertGreater(os.path.getsize(logfile), 10)
372 def test_20001_zziptest_test1_zip(self):
373 """ run zziptest on test.zip """
374 zipfile = "test1.zip"
375 logfile = "test1.log"
376 exe = self.bins("zziptest")
377 shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
378 self.assertGreater(os.path.getsize(logfile), 10)
379 def test_20002_zziptest_test2_zip(self):
380 """ run zziptest on test.zip """
381 zipfile = "test2.zip"
382 logfile = "test2.log"
383 exe = self.bins("zziptest")
384 shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
385 self.assertGreater(os.path.getsize(logfile), 10)
386 def test_20003_zziptest_test3_zip(self):
387 """ run zziptest on test.zip """
388 zipfile = "test3.zip"
389 logfile = "test3.log"
390 exe = self.bins("zziptest")
391 shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
392 self.assertGreater(os.path.getsize(logfile), 10)
393 def test_20004_zziptest_test4_zip(self):
394 """ run zziptest on test.zip """
395 zipfile = "test4.zip"
396 logfile = "test4.log"
397 exe = self.bins("zziptest")
398 shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals()))
399 self.assertGreater(os.path.getsize(logfile), 10)
400 def test_20010_zzcat_test0_zip(self):
401 """ run zzcat on test.zip using just test/README """
402 zipfile = "test0.zip"
403 getfile = "test0/README"
404 logfile = "test0.readme.txt"
405 exe = self.bins("zzcat")
406 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
407 self.assertGreater(os.path.getsize(logfile), 10)
408 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
409 def test_20011_zzcat_test1_zip(self):
410 """ run zzcat on test.zip using just test/README """
411 zipfile = "test1.zip"
412 getfile = "test1/README"
413 logfile = "test1.readme.txt"
414 exe = self.bins("zzcat")
415 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
416 self.assertGreater(os.path.getsize(logfile), 10)
417 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
418 getfile = "test1/file.1"
419 run = shell("{exe} {getfile}".format(**locals()))
420 self.assertEqual("file-1\n", run.output)
421 def test_20012_zzcat_test2_zip(self):
422 """ run zzcat on test.zip using just test/README """
423 zipfile = "test2.zip"
424 getfile = "test2/README"
425 logfile = "test2.readme.txt"
426 exe = self.bins("zzcat")
427 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
428 self.assertGreater(os.path.getsize(logfile), 10)
429 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
430 getfile = "test2/file.22"
431 run = shell("{exe} {getfile}".format(**locals()))
432 self.assertEqual("file-22\n", run.output)
433 def test_20013_zzcat_test3_zip(self):
434 """ run zzcat on test.zip using just test/README """
435 zipfile = "test3.zip"
436 getfile = "test3/README"
437 logfile = "test3.readme.txt"
438 exe = self.bins("zzcat")
439 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
440 self.assertGreater(os.path.getsize(logfile), 10)
441 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
442 getfile = "test3/file.999"
443 run = shell("{exe} {getfile}".format(**locals()))
444 self.assertEqual("file-999\n", run.output)
445 def test_20014_zzcat_test4_zip(self):
446 """ run zzcat on test.zip using just test/README """
447 zipfile = "test4.zip"
448 getfile = "test4/README"
449 logfile = "test4.readme.txt"
450 exe = self.bins("zzcat")
451 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
452 self.assertGreater(os.path.getsize(logfile), 10)
453 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
454 getfile = "test4/file9999.txt"
455 run = shell("{exe} {getfile}".format(**locals()))
456 self.assertEqual("file-9999\n", run.output)
457 def test_20020_zzdir_test0_zip(self):
458 """ run zzdir on test0.zip using just 'test0' """
459 zipfile = "test0.zip"
461 exe = self.bins("zzdir")
462 run = shell("{exe} {getfile} ".format(**locals()))
463 self.assertIn(' README\n', run.output)
464 self.assertIn(' defl:N ', run.output)
465 self.assertLess(len(run.output), 30)
466 def test_20021_zzdir_test1_zip(self):
467 """ run zzdir on test1.zip using just 'test1' """
468 zipfile = "test1.zip"
470 exe = self.bins("zzdir")
471 run = shell("{exe} {getfile} ".format(**locals()))
472 self.assertIn(' file.1\n', run.output)
473 self.assertIn(' file.2\n', run.output)
474 self.assertIn(' file.9\n', run.output)
475 self.assertIn(' README\n', run.output)
476 self.assertIn(' defl:N ', run.output)
477 self.assertIn(' stored ', run.output)
478 def test_20022_zzdir_test2_zip(self):
479 """ run zzdir on test2.zip using just 'test2' """
480 zipfile = "test2.zip"
482 exe = self.bins("zzdir")
483 run = shell("{exe} {getfile} ".format(**locals()))
484 self.assertIn(' file.01\n', run.output)
485 self.assertIn(' file.22\n', run.output)
486 self.assertIn(' file.99\n', run.output)
487 self.assertIn(' defl:N ', run.output)
488 self.assertIn(' stored ', run.output)
489 def test_20023_zzdir_test3_zip(self):
490 """ run zzdir on test3.zip using just 'test3' """
491 zipfile = "test3.zip"
493 exe = self.bins("zzdir")
494 run = shell("{exe} {getfile} ".format(**locals()))
495 self.assertIn(' file.001\n', run.output)
496 self.assertIn(' file.222\n', run.output)
497 self.assertIn(' file.999\n', run.output)
498 self.assertIn(' defl:N ', run.output)
499 self.assertIn(' stored ', run.output)
500 def test_20024_zzdir_test4_zip(self):
501 """ run zzdir on test4.zip using just 'test4' """
502 zipfile = "test4.zip"
504 exe = self.bins("zzdir")
505 run = shell("{exe} {getfile} ".format(**locals()))
506 self.assertIn(' file0001.txt\n', run.output)
507 self.assertIn(' file2222.txt\n', run.output)
508 self.assertIn(' file9999.txt\n', run.output)
509 self.assertNotIn(' defl:N ', run.output)
510 self.assertIn(' stored ', run.output)
511 def test_20320_zzxordir_test0_dat(self):
512 """ run zzxordir on test0x.dat """
513 zipfile = "test0x.dat"
514 getfile = "test0x.dat"
515 exe = self.bins("zzdir")
516 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])
517 self.assertEqual(run.returncode, 1)
518 self.assertEqual("", run.output)
519 self.assertIn("did not open test", run.errors)
520 exe = self.bins("zzxordir")
521 run = shell("{exe} {getfile} ".format(**locals()))
522 self.assertIn(' README\n', run.output)
523 self.assertIn(' defl:N ', run.output)
524 self.assertLess(len(run.output), 30)
525 def test_20321_zzxordir_test1_dat(self):
526 """ run zzxordir on test1x.dat using just 'test1x' """
527 zipfile = "test1x.dat"
528 getfile = "test1x.dat"
529 exe = self.bins("zzdir")
530 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])
531 self.assertEqual(run.returncode, 1)
532 self.assertEqual("", run.output)
533 self.assertIn("did not open test", run.errors)
534 exe = self.bins("zzxordir")
535 run = shell("{exe} {getfile} ".format(**locals()))
536 self.assertIn(' file.1\n', run.output)
537 self.assertIn(' file.2\n', run.output)
538 self.assertIn(' file.9\n', run.output)
539 self.assertIn(' README\n', run.output)
540 self.assertIn(' defl:N ', run.output)
541 self.assertIn(' stored ', run.output)
542 def test_20322_zzxordir_test2_dat(self):
543 """ run zzxordir on test2x.dat using just 'test2x' """
544 zipfile = "test2x.dat"
546 exe = self.bins("zzdir")
547 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])
548 self.assertEqual(run.returncode, 1)
549 self.assertEqual("", run.output)
550 self.assertIn("did not open test", run.errors)
551 exe = self.bins("zzxordir")
552 run = shell("{exe} {getfile} ".format(**locals()))
553 self.assertIn(' file.01\n', run.output)
554 self.assertIn(' file.22\n', run.output)
555 self.assertIn(' file.99\n', run.output)
556 self.assertIn(' defl:N ', run.output)
557 self.assertIn(' stored ', run.output)
558 def test_20323_zzxordir_test3_dat(self):
559 """ run zzxordir on test3x.dat using just 'test3x' """
560 zipfile = "test3x.dat"
562 exe = self.bins("zzdir")
563 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])
564 self.assertEqual(run.returncode, 1)
565 self.assertEqual("", run.output)
566 self.assertIn("did not open test", run.errors)
567 exe = self.bins("zzxordir")
568 run = shell("{exe} {getfile} ".format(**locals()))
569 self.assertIn(' file.001\n', run.output)
570 self.assertIn(' file.222\n', run.output)
571 self.assertIn(' file.999\n', run.output)
572 self.assertIn(' defl:N ', run.output)
573 self.assertIn(' stored ', run.output)
574 def test_20324_zzxordir_test4_zip(self):
575 """ run zzxordir on test4x.dat using just 'test4x' """
576 zipfile = "test4x.dat"
578 exe = self.bins("zzdir")
579 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])
580 self.assertEqual(run.returncode, 1)
581 self.assertEqual("", run.output)
582 self.assertIn("did not open test", run.errors)
583 exe = self.bins("zzxordir")
584 run = shell("{exe} {getfile} ".format(**locals()))
585 self.assertIn(' file0001.txt\n', run.output)
586 self.assertIn(' file2222.txt\n', run.output)
587 self.assertIn(' file9999.txt\n', run.output)
588 self.assertNotIn(' defl:N ', run.output)
589 self.assertIn(' stored ', run.output)
590 def test_20340_zzxorcat_test0_zip(self):
591 """ run zzxorcat on testx.zip using just testx/README """
592 getfile = "test0x/README"
593 logfile = "test0x.readme.txt"
594 exe = self.bins("zzcat")
595 run = shell("{exe} {getfile} ".format(**locals()), lang="C")
596 self.assertEqual("", run.output)
597 self.assertIn("No such file or directory", run.errors)
598 exe = self.bins("zzxorcat")
599 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
600 self.assertGreater(os.path.getsize(logfile), 10)
601 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
602 def test_20341_zzxorcat_test1_zip(self):
603 """ run zzxorcat on testx.zip using just testx/README """
604 getfile = "test1x/README"
605 logfile = "test1x.readme.txt"
606 exe = self.bins("zzcat")
607 run = shell("{exe} {getfile} ".format(**locals()), lang="C")
608 self.assertEqual("", run.output)
609 self.assertIn("No such file or directory", run.errors)
610 exe = self.bins("zzxorcat")
611 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
612 self.assertGreater(os.path.getsize(logfile), 10)
613 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
614 getfile = "test1x/file.1"
615 run = shell("{exe} {getfile}".format(**locals()))
616 self.assertEqual("file-1\n", run.output)
617 def test_20342_zzxorcat_test2_zip(self):
618 """ run zzxorcat on testx.zip using just testx/README """
619 getfile = "test2x/README"
620 logfile = "test2x.readme.txt"
621 exe = self.bins("zzcat")
622 run = shell("{exe} {getfile} ".format(**locals()), lang="C")
623 self.assertEqual("", run.output)
624 self.assertIn("No such file or directory", run.errors)
625 exe = self.bins("zzxorcat")
626 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
627 self.assertGreater(os.path.getsize(logfile), 10)
628 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
629 getfile = "test2x/file.22"
630 run = shell("{exe} {getfile}".format(**locals()))
631 self.assertEqual("file-22\n", run.output)
632 def test_20343_zzxorcat_test3_zip(self):
633 """ run zzxorcat on testx.zip using just testx/README """
634 getfile = "test3x/README"
635 logfile = "test3x.readme.txt"
636 exe = self.bins("zzcat")
637 run = shell("{exe} {getfile} ".format(**locals()), lang="C")
638 self.assertEqual("", run.output)
639 self.assertIn("No such file or directory", run.errors)
640 exe = self.bins("zzxorcat")
641 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
642 self.assertGreater(os.path.getsize(logfile), 10)
643 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
644 getfile = "test3x/file.999"
645 run = shell("{exe} {getfile}".format(**locals()))
646 self.assertEqual("file-999\n", run.output)
647 def test_20344_zzxorcat_test4_zip(self):
648 """ run zzxorcat on testx.zip using just testx/README """
649 getfile = "test4x/README"
650 logfile = "test4x.readme.txt"
651 exe = self.bins("zzxorcat")
652 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))
653 self.assertGreater(os.path.getsize(logfile), 10)
654 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
655 getfile = "test4x/file9999.txt"
656 run = shell("{exe} {getfile}".format(**locals()))
657 self.assertEqual("file-9999\n", run.output)
658 #####################################################################
660 #####################################################################
661 def test_20400_infozip_cat_test0_zip(self):
662 """ run inzo-zip cat test.zip using just archive README """
663 zipfile = "test0.zip"
665 logfile = "test0.readme.pk.txt"
666 exe = self.bins("unzip")
667 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
668 self.assertGreater(os.path.getsize(logfile), 10)
669 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
670 def test_20401_infozip_cat_test1_zip(self):
671 """ run info-zip cat test.zip using just archive README """
672 zipfile = "test1.zip"
674 logfile = "test1.readme.pk.txt"
675 exe = self.bins("unzip")
676 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
677 self.assertGreater(os.path.getsize(logfile), 10)
678 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
680 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
681 self.assertEqual("file-1\n", run.output)
682 def test_20402_infozip_cat_test2_zip(self):
683 """ run info-zip cat test.zip using just archive README """
684 zipfile = "test2.zip"
686 logfile = "test2.readme.pk.txt"
687 exe = self.bins("unzip")
688 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
689 self.assertGreater(os.path.getsize(logfile), 10)
690 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
692 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
693 self.assertEqual("file-22\n", run.output)
694 def test_20405_zzcat_big_test5_zip(self):
695 """ run info-zip cat test.zip using archive README """
696 zipfile = "test5.zip"
698 logfile = "test5.readme.pk.txt"
699 exe = self.bins("unzip")
700 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
701 self.assertGreater(os.path.getsize(logfile), 10)
702 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
703 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"
704 compare = self.gentext(1024)
705 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
706 self.assertEqual(compare, run.output)
707 def test_20410_zzcat_big_test0_zip(self):
708 """ run zzcat-big on test.zip using just archive README """
709 zipfile = "test0.zip"
711 logfile = "test0.readme.big.txt"
712 exe = self.bins("unzzip-big")
713 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
714 self.assertGreater(os.path.getsize(logfile), 10)
715 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
716 def test_20411_zzcat_big_test1_zip(self):
717 """ run zzcat-big on test.zip using just archive README """
718 zipfile = "test1.zip"
720 logfile = "test1.readme.big.txt"
721 exe = self.bins("unzzip-big")
722 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
723 self.assertGreater(os.path.getsize(logfile), 10)
724 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
726 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
727 self.assertEqual("file-1\n", run.output)
728 def test_20412_zzcat_big_test2_zip(self):
729 """ run zzcat-seeke on test.zip using just archive README """
730 zipfile = "test2.zip"
732 logfile = "test2.readme.big.txt"
733 exe = self.bins("unzzip-big")
734 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
735 self.assertGreater(os.path.getsize(logfile), 10)
736 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
738 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
739 self.assertEqual("file-22\n", run.output)
740 def test_20415_zzcat_big_test5_zip(self):
741 """ run zzcat-big on test.zip using archive README """
742 zipfile = "test5.zip"
744 logfile = "test5.readme.zap.txt"
745 exe = self.bins("unzzip-big")
746 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
747 self.assertGreater(os.path.getsize(logfile), 10)
748 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
749 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"
750 compare = self.gentext(1024)
751 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
752 self.assertEqual(compare, run.output)
753 def test_20420_zzcat_mem_test0_zip(self):
754 """ run zzcat-mem on test.zip using just archive README """
755 zipfile = "test0.zip"
757 logfile = "test0.readme.mem.txt"
758 exe = self.bins("unzzip-mem")
759 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
760 self.assertGreater(os.path.getsize(logfile), 10)
761 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
762 def test_20421_zzcat_mem_test1_zip(self):
763 """ run zzcat-mem on test.zip using archive README """
764 zipfile = "test1.zip"
766 logfile = "test1.readme.mem.txt"
767 exe = self.bins("unzzip-mem")
768 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
769 self.assertGreater(os.path.getsize(logfile), 10)
770 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
772 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
773 self.assertEqual("file-1\n", run.output)
774 def test_20422_zzcat_mem_test2_zip(self):
775 """ run zzcat-mem on test.zip using archive README """
776 zipfile = "test2.zip"
778 logfile = "test2.readme.mem.txt"
779 exe = self.bins("unzzip-mem")
780 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
781 self.assertGreater(os.path.getsize(logfile), 10)
782 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
784 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
785 self.assertEqual("file-22\n", run.output)
786 def test_20423_zzcat_mem_test3_zip(self):
787 """ run zzcat-mem on test.zip using archive README """
788 zipfile = "test3.zip"
790 logfile = "test3.readme.mem.txt"
791 exe = self.bins("unzzip-mem")
792 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
793 self.assertGreater(os.path.getsize(logfile), 10)
794 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
796 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
797 self.assertEqual("file-999\n", run.output)
798 def test_20424_zzcat_mem_test4_zip(self):
799 """ run zzcat-mem on test.zip using archive README """
800 zipfile = "test4.zip"
802 logfile = "test4.readme.mem.txt"
803 exe = self.bins("unzzip-mem")
804 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
805 self.assertGreater(os.path.getsize(logfile), 10)
806 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
807 getfile = "file9999.txt"
808 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
809 self.assertEqual("file-9999\n", run.output)
810 def test_20425_zzcat_mem_test5_zip(self):
811 """ run zzcat-mem on test.zip using archive README """
812 zipfile = "test5.zip"
814 logfile = "test5.readme.zap.txt"
815 exe = self.bins("unzzip-mem")
816 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
817 self.assertGreater(os.path.getsize(logfile), 10)
818 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
819 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"
820 compare = self.gentext(1024)
821 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
822 self.assertEqual(compare, run.output)
823 def test_20430_zzcat_mix_test0_zip(self):
824 """ run zzcat-mix on test.zip using just archive README """
825 zipfile = "test0.zip"
827 logfile = "test0.readme.mix.txt"
828 exe = self.bins("unzzip-mix")
829 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
830 self.assertGreater(os.path.getsize(logfile), 10)
831 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
832 def test_20431_zzcat_mix_test1_zip(self):
833 """ run zzcat-mix on test.zip using archive README """
834 zipfile = "test1.zip"
836 logfile = "test1.readme.mix.txt"
837 exe = self.bins("unzzip-mix")
838 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
839 self.assertGreater(os.path.getsize(logfile), 10)
840 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
842 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
843 self.assertEqual("file-1\n", run.output)
844 def test_20432_zzcat_mix_test2_zip(self):
845 """ run zzcat-mix on test.zip using archive README """
846 zipfile = "test2.zip"
848 logfile = "test2.readme.mix.txt"
849 exe = self.bins("unzzip-mix")
850 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
851 self.assertGreater(os.path.getsize(logfile), 10)
852 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
854 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
855 self.assertEqual("file-22\n", run.output)
856 def test_20433_zzcat_mix_test3_zip(self):
857 """ run zzcat-mix on test.zip using archive README """
858 zipfile = "test3.zip"
860 logfile = "test3.readme.mix.txt"
861 exe = self.bins("unzzip-mix")
862 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
863 self.assertGreater(os.path.getsize(logfile), 10)
864 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
866 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
867 self.assertEqual("file-999\n", run.output)
868 def test_20434_zzcat_mix_test4_zip(self):
869 """ run zzcat-mix on test.zip using archive README """
870 zipfile = "test4.zip"
872 logfile = "test4.readme.mix.txt"
873 exe = self.bins("unzzip-mix")
874 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
875 self.assertGreater(os.path.getsize(logfile), 10)
876 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
877 getfile = "file9999.txt"
878 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
879 self.assertEqual("file-9999\n", run.output)
880 def test_20435_zzcat_mix_test5_zip(self):
881 """ run zzcat-mix on test.zip using archive README """
882 zipfile = "test5.zip"
884 logfile = "test5.readme.zap.txt"
885 exe = self.bins("unzzip-mix")
886 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
887 self.assertGreater(os.path.getsize(logfile), 10)
888 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
889 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"
890 compare = self.gentext(1024)
891 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
892 self.assertEqual(compare, run.output)
893 def test_20440_zzcat_zap_test0_zip(self):
894 """ run zzcat-zap on test.zip using just archive README """
895 zipfile = "test0.zip"
897 logfile = "test0.readme.txt"
898 exe = self.bins("unzzip")
899 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
900 self.assertGreater(os.path.getsize(logfile), 10)
901 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
902 def test_20441_zzcat_zap_test1_zip(self):
903 """ run zzcat-zap on test.zip using archive README """
904 zipfile = "test1.zip"
906 logfile = "test1.readme.zap.txt"
907 exe = self.bins("unzzip")
908 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
909 self.assertGreater(os.path.getsize(logfile), 10)
910 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
912 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
913 self.assertEqual("file-1\n", run.output)
914 def test_20442_zzcat_zap_test2_zip(self):
915 """ run zzcat-zap on test.zip using archive README """
916 zipfile = "test2.zip"
918 logfile = "test2.readme.zap.txt"
919 exe = self.bins("unzzip")
920 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
921 self.assertGreater(os.path.getsize(logfile), 10)
922 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
924 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
925 self.assertEqual("file-22\n", run.output)
926 def test_20443_zzcat_zap_test3_zip(self):
927 """ run zzcat-zap on test.zip using archive README """
928 zipfile = "test3.zip"
930 logfile = "test3.readme.zap.txt"
931 exe = self.bins("unzzip")
932 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
933 self.assertGreater(os.path.getsize(logfile), 10)
934 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
936 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
937 self.assertEqual("file-999\n", run.output)
938 def test_20444_zzcat_zap_test4_zip(self):
939 """ run zzcat-zap on test.zip using archive README """
940 zipfile = "test4.zip"
942 logfile = "test4.readme.zap.txt"
943 exe = self.bins("unzzip")
944 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
945 self.assertGreater(os.path.getsize(logfile), 10)
946 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
947 getfile = "file9999.txt"
948 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
949 self.assertEqual("file-9999\n", run.output)
950 def test_20445_zzcat_zap_test5_zip(self):
951 """ run zzcat-zap on test.zip using archive README """
952 zipfile = "test5.zip"
954 logfile = "test5.readme.zap.txt"
955 exe = self.bins("unzzip")
956 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))
957 self.assertGreater(os.path.getsize(logfile), 10)
958 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))
959 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"
960 compare = self.gentext(1024)
961 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))
962 self.assertEqual(compare, run.output)
964 def test_20500_infozipdir_test0_zip(self):
965 """ run info-zip dir test0.zip """
966 zipfile = "test0.zip"
967 getfile = "test0.zip"
968 exe = self.bins("unzip")
969 run = shell("{exe} -l {getfile} ".format(**locals()))
970 self.assertIn(' README\n', run.output)
971 self.assertLess(len(run.output), 230)
972 def test_20501_infozipdir_test1_zip(self):
973 """ run info-zip dir test1.zip """
974 zipfile = "test1.zip"
975 getfile = "test1.zip"
976 exe = self.bins("unzip")
977 run = shell("{exe} -l {getfile} ".format(**locals()))
978 self.assertIn(' file.1\n', run.output)
979 self.assertIn(' file.2\n', run.output)
980 self.assertIn(' file.9\n', run.output)
981 self.assertIn(' README\n', run.output)
982 def test_20502_infozipdir_big_test2_zip(self):
983 """ run info-zip dir test2.zip """
984 zipfile = "test2.zip"
985 getfile = "test2.zip"
986 exe = self.bins("unzip")
987 run = shell("{exe} -l {getfile} ".format(**locals()))
988 self.assertIn(' file.01\n', run.output)
989 self.assertIn(' file.22\n', run.output)
990 self.assertIn(' file.99\n', run.output)
991 def test_20503_infozipdir_big_test3_zip(self):
992 """ run info-zip dir test3.zip """
993 zipfile = "test3.zip"
994 getfile = "test3.zip"
995 exe = self.bins("unzip")
996 run = shell("{exe} -l {getfile} ".format(**locals()))
997 self.assertIn(' file.001\n', run.output)
998 self.assertIn(' file.222\n', run.output)
999 self.assertIn(' file.999\n', run.output)
1000 def test_20504_infozipdir_big_test4_zip(self):
1001 """ run info-zip dir test4.zip """
1002 zipfile = "test4.zip"
1003 getfile = "test4.zip"
1004 exe = self.bins("unzip")
1005 run = shell("{exe} -l {getfile} ".format(**locals()))
1006 self.assertIn(' file0001.txt\n', run.output)
1007 self.assertIn(' file2222.txt\n', run.output)
1008 self.assertIn(' file9999.txt\n', run.output)
1009 def test_20505_infozipdir_big_test5_zip(self):
1010 """ run info-zip dir on test5.zip """
1011 zipfile = "test5.zip"
1012 getfile = "test5.zip"
1013 exe = self.bins("unzzip-mix")
1014 run = shell("{exe} -v {getfile} ".format(**locals()))
1015 self.assertIn('/subdir14/file15-128.txt\n', run.output)
1016 self.assertIn('/subdir5/subdir6/', run.output)
1017 self.assertIn(' defl:N ', run.output)
1018 self.assertIn(' stored ', run.output)
1019 def test_20510_zzdir_big_test0_zip(self):
1020 """ run zzdir-big on test0.zip """
1021 zipfile = "test0.zip"
1022 getfile = "test0.zip"
1023 exe = self.bins("unzzip-big")
1024 run = shell("{exe} -l {getfile} ".format(**locals()))
1025 self.assertIn(' README\n', run.output)
1026 self.assertLess(len(run.output), 30)
1027 def test_20511_zzdir_big_test1_zip(self):
1028 """ run zzdir-big on test1.zip """
1029 zipfile = "test1.zip"
1030 getfile = "test1.zip"
1031 exe = self.bins("unzzip-big")
1032 run = shell("{exe} -l {getfile} ".format(**locals()))
1033 self.assertIn(' file.1\n', run.output)
1034 self.assertIn(' file.2\n', run.output)
1035 self.assertIn(' file.9\n', run.output)
1036 self.assertIn(' README\n', run.output)
1037 def test_20512_zzdir_big_test2_zip(self):
1038 """ run zzdir-big on test2.zip """
1039 zipfile = "test2.zip"
1040 getfile = "test2.zip"
1041 exe = self.bins("unzzip-big")
1042 run = shell("{exe} -l {getfile} ".format(**locals()))
1043 self.assertIn(' file.01\n', run.output)
1044 self.assertIn(' file.22\n', run.output)
1045 self.assertIn(' file.99\n', run.output)
1046 def test_20513_zzdir_big_test3_zip(self):
1047 """ run zzdir-big on test3.zip """
1048 zipfile = "test3.zip"
1049 getfile = "test3.zip"
1050 exe = self.bins("unzzip-big")
1051 run = shell("{exe} -l {getfile} ".format(**locals()))
1052 self.assertIn(' file.001\n', run.output)
1053 self.assertIn(' file.222\n', run.output)
1054 self.assertIn(' file.999\n', run.output)
1055 def test_20514_zzdir_big_test4_zip(self):
1056 """ run zzdir-big on test4.zip """
1057 zipfile = "test4.zip"
1058 getfile = "test4.zip"
1059 exe = self.bins("unzzip-big")
1060 run = shell("{exe} -l {getfile} ".format(**locals()))
1061 self.assertIn(' file0001.txt\n', run.output)
1062 self.assertIn(' file2222.txt\n', run.output)
1063 self.assertIn(' file9999.txt\n', run.output)
1064 def test_20515_zzdir_big_test5_zip(self):
1065 """ run zzdir-big on test5.zip """
1066 zipfile = "test5.zip"
1067 getfile = "test5.zip"
1068 exe = self.bins("unzzip-mix")
1069 run = shell("{exe} -v {getfile} ".format(**locals()))
1070 self.assertIn('/subdir14/file15-128.txt\n', run.output)
1071 self.assertIn('/subdir5/subdir6/', run.output)
1072 self.assertIn(' defl:N ', run.output)
1073 self.assertIn(' stored ', run.output)
1074 def test_20520_zzdir_mem_test0_zip(self):
1075 """ run zzdir-mem on test0.zip """
1076 zipfile = "test0.zip"
1077 getfile = "test0.zip"
1078 exe = self.bins("unzzip-mem")
1079 run = shell("{exe} -v {getfile} ".format(**locals()))
1080 self.assertIn(' README\n', run.output)
1081 self.assertIn(' defl:N ', run.output)
1082 self.assertLess(len(run.output), 30)
1083 def test_20521_zzdir_mem_test1_zip(self):
1084 """ run zzdir-mem on test1.zip """
1085 zipfile = "test1.zip"
1086 getfile = "test1.zip"
1087 exe = self.bins("unzzip-mem")
1088 run = shell("{exe} -v {getfile} ".format(**locals()))
1089 self.assertIn(' file.1\n', run.output)
1090 self.assertIn(' file.2\n', run.output)
1091 self.assertIn(' file.9\n', run.output)
1092 self.assertIn(' README\n', run.output)
1093 self.assertIn(' defl:N ', run.output)
1094 self.assertIn(' stored ', run.output)
1095 def test_20522_zzdir_mem_test2_zip(self):
1096 """ run zzdir-mem on test2.zip """
1097 zipfile = "test2.zip"
1098 getfile = "test2.zip"
1099 exe = self.bins("unzzip-mem")
1100 run = shell("{exe} -v {getfile} ".format(**locals()))
1101 self.assertIn(' file.01\n', run.output)
1102 self.assertIn(' file.22\n', run.output)
1103 self.assertIn(' file.99\n', run.output)
1104 self.assertIn(' defl:N ', run.output)
1105 self.assertIn(' stored ', run.output)
1106 def test_20523_zzdir_mem_test3_zip(self):
1107 """ run zzdir-mem on test3.zip """
1108 zipfile = "test3.zip"
1109 getfile = "test3.zip"
1110 exe = self.bins("unzzip-mem")
1111 run = shell("{exe} -v {getfile} ".format(**locals()))
1112 self.assertIn(' file.001\n', run.output)
1113 self.assertIn(' file.222\n', run.output)
1114 self.assertIn(' file.999\n', run.output)
1115 self.assertIn(' defl:N ', run.output)
1116 self.assertIn(' stored ', run.output)
1117 def test_20524_zzdir_mem_test4_zip(self):
1118 """ run zzdir-mem on test4.zip """
1119 zipfile = "test4.zip"
1120 getfile = "test4.zip"
1121 exe = self.bins("unzzip-mem")
1122 run = shell("{exe} -v {getfile} ".format(**locals()))
1123 self.assertIn(' file0001.txt\n', run.output)
1124 self.assertIn(' file2222.txt\n', run.output)
1125 self.assertIn(' file9999.txt\n', run.output)
1126 self.assertNotIn(' defl:N ', run.output)
1127 self.assertIn(' stored ', run.output)
1128 def test_20525_zzdir_mem_test5_zip(self):
1129 """ run zzdir-mem on test5.zip """
1130 zipfile = "test5.zip"
1131 getfile = "test5.zip"
1132 exe = self.bins("unzzip-mix")
1133 run = shell("{exe} -v {getfile} ".format(**locals()))
1134 self.assertIn('/subdir14/file15-128.txt\n', run.output)
1135 self.assertIn('/subdir5/subdir6/', run.output)
1136 self.assertIn(' defl:N ', run.output)
1137 self.assertIn(' stored ', run.output)
1138 def test_20530_zzdir_mix_test0_zip(self):
1139 """ run zzdir-mix on test0.zip """
1140 # self.skipTest("todo")
1141 zipfile = "test0.zip"
1142 getfile = "test0.zip"
1143 exe = self.bins("unzzip-mix")
1144 run = shell("{exe} -v {getfile} ".format(**locals()))
1145 self.assertIn(' README\n', run.output)
1146 self.assertIn(' defl:N ', run.output)
1147 self.assertLess(len(run.output), 30)
1148 def test_20531_zzdir_mix_test1_zip(self):
1149 """ run zzdir-mix on test1.zip """
1150 zipfile = "test1.zip"
1151 getfile = "test1.zip"
1152 exe = self.bins("unzzip-mix")
1153 run = shell("{exe} -v {getfile} ".format(**locals()))
1154 self.assertIn(' file.1\n', run.output)
1155 self.assertIn(' file.2\n', run.output)
1156 self.assertIn(' file.9\n', run.output)
1157 self.assertIn(' README\n', run.output)
1158 self.assertIn(' defl:N ', run.output)
1159 self.assertIn(' stored ', run.output)
1160 def test_20532_zzdir_mix_test2_zip(self):
1161 """ run zzdir-mix on test2.zip """
1162 zipfile = "test2.zip"
1163 getfile = "test2.zip"
1164 exe = self.bins("unzzip-mix")
1165 run = shell("{exe} -v {getfile} ".format(**locals()))
1166 self.assertIn(' file.01\n', run.output)
1167 self.assertIn(' file.22\n', run.output)
1168 self.assertIn(' file.99\n', run.output)
1169 self.assertIn(' defl:N ', run.output)
1170 self.assertIn(' stored ', run.output)
1171 def test_20533_zzdir_mix_test3_zip(self):
1172 """ run zzdir-mix on test3.zip """
1173 zipfile = "test3.zip"
1174 getfile = "test3.zip"
1175 exe = self.bins("unzzip-mix")
1176 run = shell("{exe} -v {getfile} ".format(**locals()))
1177 self.assertIn(' file.001\n', run.output)
1178 self.assertIn(' file.222\n', run.output)
1179 self.assertIn(' file.999\n', run.output)
1180 self.assertIn(' defl:N ', run.output)
1181 self.assertIn(' stored ', run.output)
1182 def test_20534_zzdir_mix_test4_zip(self):
1183 """ run zzdir-mix on test4.zip """
1184 zipfile = "test4.zip"
1185 getfile = "test4.zip"
1186 exe = self.bins("unzzip-mix")
1187 run = shell("{exe} -v {getfile} ".format(**locals()))
1188 self.assertIn(' file0001.txt\n', run.output)
1189 self.assertIn(' file2222.txt\n', run.output)
1190 self.assertIn(' file9999.txt\n', run.output)
1191 self.assertNotIn(' defl:N ', run.output)
1192 self.assertIn(' stored ', run.output)
1193 def test_20535_zzdir_mix_test5_zip(self):
1194 """ run zzdir-mix on test5.zip """
1195 zipfile = "test5.zip"
1196 getfile = "test5.zip"
1197 exe = self.bins("unzzip-mix")
1198 run = shell("{exe} -v {getfile} ".format(**locals()))
1199 self.assertIn('/subdir14/file15-128.txt\n', run.output)
1200 self.assertIn('/subdir5/subdir6/', run.output)
1201 self.assertIn(' defl:N ', run.output)
1202 self.assertIn(' stored ', run.output)
1203 def test_20540_zzdir_zap_test0_zip(self):
1204 """ run zzdir-zap on test0.zip """
1205 zipfile = "test0.zip"
1206 getfile = "test0.zip"
1207 exe = self.bins("unzzip")
1208 run = shell("{exe} -v {getfile} ".format(**locals()))
1209 self.assertIn(' README\n', run.output)
1210 self.assertIn(' defl:N ', run.output)
1211 self.assertLess(len(run.output), 30)
1212 def test_20541_zzdir_zap_test1_zip(self):
1213 """ run zzdir-zap on test1.zip """
1214 zipfile = "test1.zip"
1215 getfile = "test1.zip"
1216 exe = self.bins("unzzip")
1217 run = shell("{exe} -v {getfile} ".format(**locals()))
1218 self.assertIn(' file.1\n', run.output)
1219 self.assertIn(' file.2\n', run.output)
1220 self.assertIn(' file.9\n', run.output)
1221 self.assertIn(' README\n', run.output)
1222 self.assertIn(' defl:N ', run.output)
1223 self.assertIn(' stored ', run.output)
1224 def test_20542_zzdir_zap_test2_zip(self):
1225 """ run zzdir-zap on test2.zip """
1226 zipfile = "test2.zip"
1227 getfile = "test2.zip"
1228 exe = self.bins("unzzip")
1229 run = shell("{exe} -v {getfile} ".format(**locals()))
1230 self.assertIn(' file.01\n', run.output)
1231 self.assertIn(' file.22\n', run.output)
1232 self.assertIn(' file.99\n', run.output)
1233 self.assertIn(' defl:N ', run.output)
1234 self.assertIn(' stored ', run.output)
1235 def test_20543_zzdir_zap_test3_zip(self):
1236 """ run zzdir-zap on test3.zip """
1237 zipfile = "test3.zip"
1238 getfile = "test3.zip"
1239 exe = self.bins("unzzip")
1240 run = shell("{exe} -v {getfile} ".format(**locals()))
1241 self.assertIn(' file.001\n', run.output)
1242 self.assertIn(' file.222\n', run.output)
1243 self.assertIn(' file.999\n', run.output)
1244 self.assertIn(' defl:N ', run.output)
1245 self.assertIn(' stored ', run.output)
1246 def test_20544_zzdir_zap_test4_zip(self):
1247 """ run zzdir-zap on test4.zip """
1248 zipfile = "test4.zip"
1249 getfile = "test4.zip"
1250 exe = self.bins("unzzip")
1251 run = shell("{exe} -v {getfile} ".format(**locals()))
1252 self.assertIn(' file0001.txt\n', run.output)
1253 self.assertIn(' file2222.txt\n', run.output)
1254 self.assertIn(' file9999.txt\n', run.output)
1255 self.assertNotIn(' defl:N ', run.output)
1256 self.assertIn(' stored ', run.output)
1257 def test_20545_zzdir_zap_test5_zip(self):
1258 """ run zzdir-zap on test5.zip """
1259 zipfile = "test5.zip"
1260 getfile = "test5.zip"
1261 exe = self.bins("unzzip")
1262 run = shell("{exe} -v {getfile} ".format(**locals()))
1263 self.assertIn('/subdir14/file15-128.txt\n', run.output)
1264 self.assertIn('/subdir5/subdir6/', run.output)
1265 self.assertIn(' defl:N ', run.output)
1266 self.assertIn(' stored ', run.output)
1267 def test_20595_zzextract_zap_test5_zip(self):
1268 """ run zzextract-zap on test5.zip
1269 => coughs up a SEGFAULT in zzip_dir_close() ?!?"""
1270 zipfile = "test5.zip"
1271 getfile = "test5.zip"
1272 tmpdir = self.testdir()
1273 exe = self.bins("unzzip")
1274 run = shell("cd {tmpdir} && ../{exe} ../{getfile} ".format(**locals()))
1275 self.assertTrue(tmpdir+'/subdir1/subdir2/file3-1024.txt')
1278 url_CVE_2017_5977 = "https://github.com/asarubbo/poc/blob/master"
1279 zip_CVE_2017_5977 = "00153-zziplib-invalidread-zzip_mem_entry_extra_block"
1280 def test_59770_infozipdir_CVE_2017_5977(self):
1281 """ run info-zip dir test0.zip """
1282 tmpdir = self.testdir()
1283 filename = self.zip_CVE_2017_5977
1284 file_url = self.url_CVE_2017_5977
1285 download_raw(file_url, filename, tmpdir)
1286 exe = self.bins("unzip")
1287 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1288 returncodes = [0, 2])
1289 self.assertIn(" didn't find end-of-central-dir signature at end of central dir", run.errors)
1290 self.assertIn(" 2 extra bytes at beginning or within zipfile", run.errors)
1291 self.assertLess(len(run.output), 280)
1293 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
1295 self.assertLess(len(run.output), 90)
1296 self.assertLess(len(errors(run.errors)), 900)
1297 self.assertIn('test: mismatching "local" filename', run.errors)
1298 self.assertIn('test: unknown compression method', run.errors)
1299 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
1301 def test_59771_zzipdir_big_CVE_2017_5977(self):
1302 """ run info-zip -l $(CVE_2017_5977).zip """
1303 tmpdir = self.testdir()
1304 filename = self.zip_CVE_2017_5977
1305 file_url = self.url_CVE_2017_5977
1306 download_raw(file_url, filename, tmpdir)
1307 exe = self.bins("unzzip-big")
1308 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1310 self.assertLess(len(run.output), 30)
1311 self.assertLess(len(errors(run.errors)), 1)
1312 self.assertIn(" stored test", run.output)
1314 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1316 self.assertLess(len(run.output), 30)
1317 self.assertLess(len(errors(run.errors)), 1)
1318 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
1320 def test_59772_zzipdir_mem_CVE_2017_5977(self):
1321 """ run unzzip-mem -l $(CVE_2017_5977).zip """
1322 tmpdir = self.testdir()
1323 filename = self.zip_CVE_2017_5977
1324 file_url = self.url_CVE_2017_5977
1325 download_raw(file_url, filename, tmpdir)
1326 exe = self.bins("unzzip-mem")
1327 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1329 self.assertLess(len(run.output), 30)
1330 self.assertLess(len(errors(run.errors)), 1)
1331 self.assertIn(" 3 test", run.output)
1333 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1335 self.assertLess(len(run.output), 30)
1336 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1338 def test_59773_zzipdir_mix_CVE_2017_5977(self):
1339 """ run unzzip-mix -l $(CVE_2017_5977).zip """
1340 tmpdir = self.testdir()
1341 filename = self.zip_CVE_2017_5977
1342 file_url = self.url_CVE_2017_5977
1343 download_raw(file_url, filename, tmpdir)
1344 exe = self.bins("unzzip-mix")
1345 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1347 self.assertLess(len(run.output), 30)
1348 self.assertLess(len(errors(run.errors)), 1)
1349 self.assertIn(" 3 test", run.output)
1351 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1353 self.assertLess(len(run.output), 30)
1354 self.assertLess(len(errors(run.errors)), 1)
1355 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
1357 def test_59774_zzipdir_zap_CVE_2017_5977(self):
1358 """ run unzzip -l $(CVE_2017_5977).zip """
1359 tmpdir = self.testdir()
1360 filename = self.zip_CVE_2017_5977
1361 file_url = self.url_CVE_2017_5977
1362 download_raw(file_url, filename, tmpdir)
1363 exe = self.bins("unzzip")
1364 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1365 returncodes = [0, 255])
1366 self.assertLess(len(run.output), 30)
1367 self.assertLess(len(errors(run.errors)), 1)
1368 self.assertIn(" 3 test", run.output)
1370 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1372 self.assertLess(len(run.output), 30)
1373 self.assertLess(len(errors(run.errors)), 1)
1374 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # TODO
1376 def test_59779(self):
1377 """ check $(CVE).zip """
1378 tmpdir = self.testdir()
1379 filename = self.zip_CVE_2017_5977
1380 file_url = self.url_CVE_2017_5977
1381 download_raw(file_url, filename, tmpdir)
1382 shell("ls -l {tmpdir}/{filename}".format(**locals()))
1383 size = os.path.getsize(os.path.join(tmpdir, filename))
1384 self.assertEqual(size, 163)
1386 url_CVE_2017_5978 = "https://github.com/asarubbo/poc/blob/master"
1387 zip_CVE_2017_5978 = "00156-zziplib-oobread-zzip_mem_entry_new"
1388 def test_59780_infozipdir_CVE_2017_5978(self):
1389 """ run info-zip dir test0.zip """
1390 tmpdir = self.testdir()
1391 filename = self.zip_CVE_2017_5978
1392 file_url = self.url_CVE_2017_5978
1393 download_raw(file_url, filename, tmpdir)
1394 exe = self.bins("unzip")
1395 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1396 returncodes = [0, 3])
1397 self.assertIn(' missing 4608 bytes in zipfile', run.errors)
1398 self.assertIn(' attempt to seek before beginning of zipfile', run.errors)
1399 self.assertLess(len(run.output), 80)
1400 self.assertLess(len(errors(run.errors)), 430)
1402 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
1404 self.assertLess(len(run.output), 90)
1405 self.assertLess(len(errors(run.errors)), 900)
1406 self.assertIn('attempt to seek before beginning of zipfile', run.errors)
1407 self.assertFalse(os.path.exists(tmpdir+"/test"))
1409 def test_59781_zzipdir_big_CVE_2017_5978(self):
1410 """ run info-zip -l $(CVE_2017_5978).zip """
1411 tmpdir = self.testdir()
1412 filename = self.zip_CVE_2017_5978
1413 file_url = self.url_CVE_2017_5978
1414 download_raw(file_url, filename, tmpdir)
1415 exe = self.bins("unzzip-big")
1416 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1418 self.assertLess(len(run.output), 30)
1419 self.assertLess(len(errors(run.errors)), 1)
1420 self.assertIn(" stored (null)", run.output)
1422 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1423 returncodes = [0,1])
1424 self.assertLess(len(run.output), 30)
1425 self.assertLess(len(errors(run.errors)), 1)
1426 self.assertFalse(os.path.exists(tmpdir+"/test"))
1427 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
1429 def test_59782_zzipdir_mem_CVE_2017_5978(self):
1430 """ run unzzip-mem -l $(CVE_2017_5978).zip """
1431 tmpdir = self.testdir()
1432 filename = self.zip_CVE_2017_5978
1433 file_url = self.url_CVE_2017_5978
1434 download_raw(file_url, filename, tmpdir)
1435 exe = self.bins("unzzip-mem")
1436 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1438 self.assertLess(len(run.output), 1)
1439 self.assertLess(len(errors(run.errors)), 180)
1440 self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)
1441 self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)
1443 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1445 self.assertLess(len(run.output), 30)
1446 self.assertLess(len(errors(run.errors)), 300)
1447 self.assertIn("..(nil)", run.errors)
1448 self.assertFalse(os.path.exists(tmpdir+"/test"))
1449 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
1451 def test_59783_zzipdir_mix_CVE_2017_5978(self):
1452 """ run unzzip-mix -l $(CVE_2017_5978).zip """
1453 tmpdir = self.testdir()
1454 filename = self.zip_CVE_2017_5978
1455 file_url = self.url_CVE_2017_5978
1456 download_raw(file_url, filename, tmpdir)
1457 exe = self.bins("unzzip-mix")
1458 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1459 returncodes = [0,2])
1460 self.assertLess(len(run.output), 1)
1461 self.assertLess(len(errors(run.errors)), 180)
1462 self.assertTrue(greps(run.errors, "Invalid or"))
1464 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1465 returncodes = [0,2])
1466 self.assertLess(len(run.output), 30)
1467 self.assertLess(len(errors(run.errors)), 300)
1468 self.assertTrue(greps(run.errors, "Invalid or"))
1469 # self.assertIn("..(nil)", run.errors)
1470 self.assertFalse(os.path.exists(tmpdir+"/test"))
1471 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
1473 def test_59784_zzipdir_zap_CVE_2017_5978(self):
1474 """ run unzzip -l $(CVE_2017_5978).zip """
1475 tmpdir = self.testdir()
1476 filename = self.zip_CVE_2017_5978
1477 file_url = self.url_CVE_2017_5978
1478 download_raw(file_url, filename, tmpdir)
1479 exe = self.bins("unzzip")
1480 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1482 self.assertLess(len(run.output), 1)
1483 self.assertLess(len(errors(run.errors)), 180)
1485 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1486 returncodes = [0,3])
1487 self.assertLess(len(run.output), 30)
1488 self.assertLess(len(errors(run.errors)), 300)
1489 self.assertTrue(greps(run.errors, "Zipfile corrupted"))
1490 self.assertFalse(os.path.exists(tmpdir+"/test"))
1491 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
1493 def test_59789(self):
1494 """ check $(CVE).zip """
1495 tmpdir = self.testdir()
1496 filename = self.zip_CVE_2017_5978
1497 file_url = self.url_CVE_2017_5978
1498 download_raw(file_url, filename, tmpdir)
1499 shell("ls -l {tmpdir}/{filename}".format(**locals()))
1500 size = os.path.getsize(os.path.join(tmpdir, filename))
1501 self.assertEqual(size, 161)
1503 url_CVE_2017_5979 = "https://github.com/asarubbo/poc/blob/master"
1504 zip_CVE_2017_5979 = "00157-zziplib-nullptr-prescan_entry"
1505 def test_59790_infozipdir_CVE_2017_5979(self):
1506 """ run info-zip dir test0.zip """
1507 tmpdir = self.testdir()
1508 filename = self.zip_CVE_2017_5979
1509 file_url = self.url_CVE_2017_5979
1510 download_raw(file_url, filename, tmpdir)
1511 exe = self.bins("unzip")
1512 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1514 self.assertIn(' 1 file', run.output)
1515 self.assertLess(len(run.output), 330)
1516 self.assertLess(len(errors(run.errors)), 1)
1518 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
1520 self.assertLess(len(run.output), 90)
1521 self.assertLess(len(errors(run.errors)), 1)
1522 self.assertIn('extracting: a', run.output)
1523 self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)
1525 def test_59791_zzipdir_big_CVE_2017_5979(self):
1526 """ run info-zip -l $(CVE_2017_5979).zip """
1527 tmpdir = self.testdir()
1528 filename = self.zip_CVE_2017_5979
1529 file_url = self.url_CVE_2017_5979
1530 download_raw(file_url, filename, tmpdir)
1531 exe = self.bins("unzzip-big")
1532 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1534 self.assertLess(len(run.output), 30)
1535 self.assertLess(len(errors(run.errors)), 1)
1536 self.assertIn(" stored a", run.output)
1538 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1540 self.assertLess(len(run.output), 30)
1541 self.assertLess(len(errors(run.errors)), 1)
1542 self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)
1544 def test_59792_zzipdir_mem_CVE_2017_5979(self):
1545 """ run unzzip-mem -l $(CVE_2017_5979).zip """
1546 tmpdir = self.testdir()
1547 filename = self.zip_CVE_2017_5979
1548 file_url = self.url_CVE_2017_5979
1549 download_raw(file_url, filename, tmpdir)
1550 exe = self.bins("unzzip-mem")
1551 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1553 self.assertLess(len(run.output), 30)
1554 self.assertLess(len(errors(run.errors)), 1)
1555 self.assertIn(" 3 a", run.output)
1557 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1559 self.assertLess(len(run.output), 30)
1560 self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)
1562 def test_59793_zzipdir_mix_CVE_2017_5979(self):
1563 """ run unzzip-mix -l $(CVE_2017_5979).zip """
1564 tmpdir = self.testdir()
1565 filename = self.zip_CVE_2017_5979
1566 file_url = self.url_CVE_2017_5979
1567 download_raw(file_url, filename, tmpdir)
1568 exe = self.bins("unzzip-mix")
1569 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1571 self.assertLess(len(run.output), 30)
1572 self.assertLess(len(errors(run.errors)), 1)
1573 self.assertIn(" 3 a", run.output)
1575 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1577 self.assertLess(len(run.output), 30)
1578 self.assertLess(len(errors(run.errors)), 20)
1579 self.assertEqual(os.path.getsize(tmpdir+"/a"), 0) # FIXME
1580 # self.assertEqual(os.path.getsize(tmpdir+"/a"), 3) # FIXME
1582 def test_59794_zzipdir_zap_CVE_2017_5979(self):
1583 """ run unzzip -l $(CVE_2017_5979).zip """
1584 tmpdir = self.testdir()
1585 filename = self.zip_CVE_2017_5979
1586 file_url = self.url_CVE_2017_5979
1587 download_raw(file_url, filename, tmpdir)
1588 exe = self.bins("unzzip")
1589 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1590 returncodes = [0, 255])
1591 self.assertLess(len(run.output), 30)
1592 self.assertLess(len(errors(run.errors)), 1)
1593 self.assertIn(" 3 a", run.output)
1595 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1597 self.assertLess(len(run.output), 30)
1598 self.assertLess(len(errors(run.errors)), 20)
1599 self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)
1601 def test_59799(self):
1602 """ check $(CVE).zip """
1603 tmpdir = self.testdir()
1604 filename = self.zip_CVE_2017_5979
1605 file_url = self.url_CVE_2017_5979
1606 download_raw(file_url, filename, tmpdir)
1607 shell("ls -l {tmpdir}/{filename}".format(**locals()))
1608 size = os.path.getsize(os.path.join(tmpdir, filename))
1609 self.assertEqual(size, 155)
1612 url_CVE_2017_5974 = "https://github.com/asarubbo/poc/blob/master"
1613 zip_CVE_2017_5974 = "00150-zziplib-heapoverflow-__zzip_get32"
1614 def test_59740_infozipdir_CVE_2017_5974(self):
1615 """ run info-zip dir test0.zip """
1616 tmpdir = self.testdir()
1617 filename = self.zip_CVE_2017_5974
1618 file_url = self.url_CVE_2017_5974
1619 download_raw(file_url, filename, tmpdir)
1620 exe = self.bins("unzip")
1621 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1622 returncodes = [0, 9])
1623 self.assertIn(' 1 file', run.output)
1624 self.assertLess(len(run.output), 330)
1625 self.assertLess(len(errors(run.errors)), 1)
1627 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
1629 self.assertLess(len(run.output), 90)
1630 self.assertLess(len(errors(run.errors)), 1)
1631 self.assertIn(" extracting: test", run.output)
1632 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1634 def test_59741_zzipdir_big_CVE_2017_5974(self):
1635 """ run unzzip-big -l $(CVE_2017_5974).zip """
1636 tmpdir = self.testdir()
1637 filename = self.zip_CVE_2017_5974
1638 file_url = self.url_CVE_2017_5974
1639 download_raw(file_url, filename, tmpdir)
1640 exe = self.bins("unzzip-big")
1641 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1643 self.assertLess(len(run.output), 30)
1644 self.assertLess(len(errors(run.errors)), 1)
1645 self.assertIn(" stored test", run.output)
1647 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1649 self.assertLess(len(run.output), 30)
1650 self.assertLess(len(errors(run.errors)), 1)
1651 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1653 def test_59742_zzipdir_mem_CVE_2017_5974(self):
1654 """ run unzzip-mem -l $(CVE_2017_5974).zip """
1655 tmpdir = self.testdir()
1656 filename = self.zip_CVE_2017_5974
1657 file_url = self.url_CVE_2017_5974
1658 download_raw(file_url, filename, tmpdir)
1659 exe = self.bins("unzzip-mem")
1660 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1662 self.assertLess(len(run.output), 30)
1663 self.assertLess(len(errors(run.errors)), 1)
1664 self.assertIn(" 3 test", run.output)
1666 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1668 self.assertLess(len(run.output), 30)
1669 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1671 def test_59743_zzipdir_mix_CVE_2017_5974(self):
1672 """ run unzzip-mix -l $(CVE_2017_5974).zip """
1673 tmpdir = self.testdir()
1674 filename = self.zip_CVE_2017_5974
1675 file_url = self.url_CVE_2017_5974
1676 download_raw(file_url, filename, tmpdir)
1677 exe = self.bins("unzzip-mix")
1678 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1680 self.assertLess(len(run.output), 30)
1681 self.assertLess(len(errors(run.errors)), 1)
1682 self.assertIn(" 3 test", run.output)
1684 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1686 self.assertLess(len(run.output), 30)
1687 self.assertLess(len(errors(run.errors)), 1)
1688 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # FIXME
1689 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # FIXME
1691 def test_59744_zzipdir_zap_CVE_2017_5974(self):
1692 """ run unzzip -l $(CVE_2017_5974).zip """
1693 tmpdir = self.testdir()
1694 filename = self.zip_CVE_2017_5974
1695 file_url = self.url_CVE_2017_5974
1696 download_raw(file_url, filename, tmpdir)
1697 exe = self.bins("unzzip")
1698 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1699 returncodes = [0, 255])
1700 self.assertLess(len(run.output), 30)
1701 self.assertLess(len(errors(run.errors)), 1)
1702 self.assertIn(" 3 test", run.output)
1704 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1706 self.assertLess(len(run.output), 30)
1707 self.assertLess(len(errors(run.errors)), 1)
1708 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1710 def test_59749(self):
1711 """ check $(CVE).zip """
1712 tmpdir = self.testdir()
1713 filename = self.zip_CVE_2017_5974
1714 file_url = self.url_CVE_2017_5974
1715 download_raw(file_url, filename, tmpdir)
1716 shell("ls -l {tmpdir}/{filename}".format(**locals()))
1717 size = os.path.getsize(os.path.join(tmpdir, filename))
1718 self.assertEqual(size, 161)
1720 url_CVE_2017_5975 = "https://github.com/asarubbo/poc/blob/master"
1721 zip_CVE_2017_5975 = "00151-zziplib-heapoverflow-__zzip_get64"
1722 def test_59750_infozipdir_CVE_2017_5975(self):
1723 """ run info-zip dir test0.zip """
1724 tmpdir = self.testdir()
1725 filename = self.zip_CVE_2017_5975
1726 file_url = self.url_CVE_2017_5975
1727 download_raw(file_url, filename, tmpdir)
1728 exe = self.bins("unzip")
1729 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1730 returncodes = [0, 2])
1731 self.assertIn(' missing 10 bytes in zipfile', run.errors)
1732 self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors)
1733 self.assertIn(' 1 file', run.output)
1734 self.assertLess(len(run.output), 330)
1735 self.assertLess(len(errors(run.errors)), 430)
1737 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
1739 self.assertLess(len(run.output), 90)
1740 self.assertLess(len(errors(run.errors)), 900)
1741 self.assertIn('file #1: bad zipfile offset (local header sig): 127', run.errors)
1742 #self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1743 self.assertFalse(os.path.exists(tmpdir+"/test"))
1745 def test_59751_zzipdir_big_CVE_2017_5975(self):
1746 """ run info-zip -l $(CVE_2017_5975).zip """
1747 tmpdir = self.testdir()
1748 filename = self.zip_CVE_2017_5975
1749 file_url = self.url_CVE_2017_5975
1750 download_raw(file_url, filename, tmpdir)
1751 exe = self.bins("unzzip-big")
1752 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1754 self.assertLess(len(run.output), 30)
1755 self.assertLess(len(errors(run.errors)), 1)
1756 self.assertIn(" stored test", run.output)
1758 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1760 self.assertLess(len(run.output), 30)
1761 self.assertLess(len(errors(run.errors)), 1)
1762 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # TODO
1764 def test_59752_zzipdir_mem_CVE_2017_5975(self):
1765 """ run unzzip-mem -l $(CVE_2017_5975).zip """
1766 tmpdir = self.testdir()
1767 filename = self.zip_CVE_2017_5975
1768 file_url = self.url_CVE_2017_5975
1769 download_raw(file_url, filename, tmpdir)
1770 exe = self.bins("unzzip-mem")
1771 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1773 self.assertLess(len(run.output), 1)
1774 self.assertLess(len(errors(run.errors)), 180)
1775 self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)
1776 self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)
1778 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1780 self.assertLess(len(run.output), 30)
1781 self.assertLess(len(errors(run.errors)), 200)
1782 self.assertIn("..(nil)", run.errors)
1783 self.assertFalse(os.path.exists(tmpdir+"/test"))
1785 def test_59753_zzipdir_mix_CVE_2017_5975(self):
1786 """ run unzzip-mix -l $(CVE_2017_5975).zip """
1787 tmpdir = self.testdir()
1788 filename = self.zip_CVE_2017_5975
1789 file_url = self.url_CVE_2017_5975
1790 download_raw(file_url, filename, tmpdir)
1791 exe = self.bins("unzzip-mix")
1792 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1793 returncodes = [0,2])
1794 self.assertLess(len(run.output), 1)
1795 self.assertLess(len(errors(run.errors)), 180)
1796 self.assertTrue(greps(run.errors, "Invalid or"))
1798 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1799 returncodes = [0,2])
1800 self.assertLess(len(run.output), 30)
1801 self.assertLess(len(errors(run.errors)), 200)
1802 self.assertTrue(greps(run.errors, "Invalid or"))
1803 self.assertFalse(os.path.exists(tmpdir+"/test"))
1805 def test_59754_zzipdir_zap_CVE_2017_5975(self):
1806 """ run unzzip -l $(CVE_2017_5975).zip """
1807 tmpdir = self.testdir()
1808 filename = self.zip_CVE_2017_5975
1809 file_url = self.url_CVE_2017_5975
1810 download_raw(file_url, filename, tmpdir)
1811 exe = self.bins("unzzip")
1812 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1813 returncodes = [0,3])
1814 self.assertLess(len(run.output), 1)
1815 self.assertLess(len(errors(run.errors)), 180)
1816 self.assertIn(": Success", run.errors)
1818 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1819 returncodes = [0,3])
1820 self.assertLess(len(run.output), 30)
1821 self.assertLess(len(errors(run.errors)), 200)
1822 self.assertTrue(greps(run.errors, "Zipfile corrupted"))
1823 self.assertFalse(os.path.exists(tmpdir+"/test"))
1825 def test_59759(self):
1826 """ check $(CVE).zip """
1827 tmpdir = self.testdir()
1828 filename = self.zip_CVE_2017_5975
1829 file_url = self.url_CVE_2017_5975
1830 download_raw(file_url, filename, tmpdir)
1831 shell("ls -l {tmpdir}/{filename}".format(**locals()))
1832 size = os.path.getsize(os.path.join(tmpdir, filename))
1833 self.assertEqual(size, 151)
1836 url_CVE_2017_5976 = "https://github.com/asarubbo/poc/blob/master"
1837 zip_CVE_2017_5976 = "00152-zziplib-heapoverflow-zzip_mem_entry_extra_block"
1838 def test_59760_infozipdir_CVE_2017_5976(self):
1839 """ run info-zip dir test0.zip """
1840 tmpdir = self.testdir()
1841 filename = self.zip_CVE_2017_5976
1842 file_url = self.url_CVE_2017_5976
1843 download_raw(file_url, filename, tmpdir)
1844 exe = self.bins("unzip")
1845 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1846 returncodes = [0, 2])
1847 self.assertIn(' 27 extra bytes at beginning or within zipfile', run.errors)
1848 self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors)
1849 self.assertIn(' 1 file', run.output)
1850 self.assertLess(len(run.output), 330)
1851 self.assertLess(len(errors(run.errors)), 500)
1853 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
1855 self.assertLess(len(run.output), 190)
1856 self.assertLess(len(errors(run.errors)), 900)
1857 self.assertIn("extracting: test", run.output)
1858 self.assertIn('-27 bytes too long', run.errors)
1859 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1860 # self.assertFalse(os.path.exists(tmpdir+"/test"))
1862 def test_59761_zzipdir_big_CVE_2017_5976(self):
1863 """ run info-zip -l $(CVE_2017_5976).zip """
1864 tmpdir = self.testdir()
1865 filename = self.zip_CVE_2017_5976
1866 file_url = self.url_CVE_2017_5976
1867 download_raw(file_url, filename, tmpdir)
1868 exe = self.bins("unzzip-big")
1869 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1871 self.assertLess(len(run.output), 30)
1872 self.assertLess(len(errors(run.errors)), 1)
1873 self.assertIn(" stored test", run.output)
1875 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1877 self.assertLess(len(run.output), 30)
1878 self.assertLess(len(errors(run.errors)), 1)
1879 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1881 def test_59762_zzipdir_mem_CVE_2017_5976(self):
1882 """ run unzzip-mem -l $(CVE_2017_5976).zip """
1883 tmpdir = self.testdir()
1884 filename = self.zip_CVE_2017_5976
1885 file_url = self.url_CVE_2017_5976
1886 download_raw(file_url, filename, tmpdir)
1887 exe = self.bins("unzzip-mem")
1888 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1890 self.assertLess(len(run.output), 30)
1891 self.assertLess(len(errors(run.errors)), 1)
1892 self.assertIn("3 test", run.output)
1894 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1896 self.assertLess(len(run.output), 30)
1897 self.assertLess(len(errors(run.errors)), 30) # TODO
1898 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1900 def test_59763_zzipdir_mix_CVE_2017_5976(self):
1901 """ run unzzip-mix -l $(CVE_2017_5976).zip """
1902 tmpdir = self.testdir()
1903 filename = self.zip_CVE_2017_5976
1904 file_url = self.url_CVE_2017_5976
1905 download_raw(file_url, filename, tmpdir)
1906 exe = self.bins("unzzip-mix")
1907 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1909 self.assertLess(len(run.output), 30)
1910 self.assertLess(len(errors(run.errors)), 1)
1911 self.assertIn("3 test", run.output)
1913 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1915 self.assertLess(len(run.output), 30)
1916 self.assertLess(len(errors(run.errors)), 30)
1917 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # FIXME
1918 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # FIXME
1920 def test_59764_zzipdir_zap_CVE_2017_5976(self):
1921 """ run unzzip -l $(CVE_2017_5976).zip """
1922 tmpdir = self.testdir()
1923 filename = self.zip_CVE_2017_5976
1924 file_url = self.url_CVE_2017_5976
1925 download_raw(file_url, filename, tmpdir)
1926 exe = self.bins("unzzip")
1927 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1928 returncodes = [0, 255])
1929 self.assertLess(len(run.output), 30)
1930 self.assertLess(len(errors(run.errors)), 1)
1931 self.assertIn("3 test", run.output)
1933 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1935 self.assertLess(len(run.output), 30)
1936 self.assertLess(len(errors(run.errors)), 30)
1937 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1939 def test_59769(self):
1940 """ check $(CVE).zip """
1941 tmpdir = self.testdir()
1942 filename = self.zip_CVE_2017_5976
1943 file_url = self.url_CVE_2017_5976
1944 download_raw(file_url, filename, tmpdir)
1945 shell("ls -l {tmpdir}/{filename}".format(**locals()))
1946 size = os.path.getsize(os.path.join(tmpdir, filename))
1947 self.assertEqual(size, 188)
1949 url_CVE_2017_5980 = "https://github.com/asarubbo/poc/blob/master"
1950 zip_CVE_2017_5980 = "00154-zziplib-nullptr-zzip_mem_entry_new"
1951 def test_59800_infozipdir_CVE_2017_5980(self):
1952 """ run info-zip dir test0.zip """
1953 tmpdir = self.testdir()
1954 filename = self.zip_CVE_2017_5980
1955 file_url = self.url_CVE_2017_5980
1956 download_raw(file_url, filename, tmpdir)
1957 exe = self.bins("unzip")
1958 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1959 returncodes = [0, 2])
1960 self.assertIn(' missing 6 bytes in zipfile', run.errors)
1961 self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors)
1962 self.assertIn(' 1 file', run.output)
1963 self.assertLess(len(run.output), 330)
1964 self.assertLess(len(errors(run.errors)), 500)
1966 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
1968 self.assertLess(len(run.output), 90)
1969 self.assertLess(len(errors(run.errors)), 900)
1970 self.assertIn('file #1: bad zipfile offset (lseek)', run.errors)
1971 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1972 self.assertFalse(os.path.exists(tmpdir+"/test"))
1974 def test_59801_zzipdir_big_CVE_2017_5980(self):
1975 """ run info-zip -l $(CVE_2017_5980).zip """
1976 tmpdir = self.testdir()
1977 filename = self.zip_CVE_2017_5980
1978 file_url = self.url_CVE_2017_5980
1979 download_raw(file_url, filename, tmpdir)
1980 exe = self.bins("unzzip-big")
1981 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
1983 self.assertLess(len(run.output), 30)
1984 self.assertLess(len(errors(run.errors)), 1)
1985 self.assertIn(" stored (null)", run.output)
1987 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
1988 returncodes = [0,1])
1989 self.assertLess(len(run.output), 30)
1990 self.assertLess(len(errors(run.errors)), 1)
1991 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
1992 self.assertFalse(os.path.exists(tmpdir+"/test"))
1994 def test_59802_zzipdir_mem_CVE_2017_5980(self):
1995 """ run unzzip-mem -l $(CVE_2017_5980).zip """
1996 tmpdir = self.testdir()
1997 filename = self.zip_CVE_2017_5980
1998 file_url = self.url_CVE_2017_5980
1999 download_raw(file_url, filename, tmpdir)
2000 exe = self.bins("unzzip-mem")
2001 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2003 self.assertLess(len(run.output), 1)
2004 self.assertLess(len(errors(run.errors)), 180)
2005 self.assertTrue(greps(run.errors, "unable to load disk"))
2007 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2009 self.assertLess(len(run.output), 30)
2010 self.assertLess(len(errors(run.errors)), 200)
2011 self.assertFalse(os.path.exists(tmpdir+"/test"))
2012 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2014 def test_59803_zzipdir_mix_CVE_2017_5980(self):
2015 """ run unzzip-mix -l $(CVE_2017_5980).zip """
2016 tmpdir = self.testdir()
2017 filename = self.zip_CVE_2017_5980
2018 file_url = self.url_CVE_2017_5980
2019 download_raw(file_url, filename, tmpdir)
2020 exe = self.bins("unzzip-mix")
2021 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2023 self.assertLess(len(run.output), 1)
2024 self.assertLess(len(errors(run.errors)), 180)
2025 self.assertTrue(greps(run.errors, "Invalid or"))
2027 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2029 self.assertLess(len(run.output), 30)
2030 self.assertLess(len(errors(run.errors)), 200)
2031 self.assertFalse(os.path.exists(tmpdir+"/test"))
2032 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2034 def test_59804_zzipdir_zap_CVE_2017_5980(self):
2035 """ run unzzip -l $(CVE_2017_5980).zip """
2036 tmpdir = self.testdir()
2037 filename = self.zip_CVE_2017_5980
2038 file_url = self.url_CVE_2017_5980
2039 download_raw(file_url, filename, tmpdir)
2040 exe = self.bins("unzzip")
2041 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2043 self.assertLess(len(run.output), 1)
2044 self.assertLess(len(errors(run.errors)), 180)
2045 self.assertIn(": Success", run.errors)
2047 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2048 returncodes = [3]) # TODO
2049 self.assertLess(len(run.output), 30)
2050 self.assertLess(len(errors(run.errors)), 200)
2051 self.assertFalse(os.path.exists(tmpdir+"/test"))
2052 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2054 def test_59809(self):
2055 """ check $(CVE).zip """
2056 tmpdir = self.testdir()
2057 filename = self.zip_CVE_2017_5980
2058 file_url = self.url_CVE_2017_5980
2059 download_raw(file_url, filename, tmpdir)
2060 shell("ls -l {tmpdir}/{filename}".format(**locals()))
2061 size = os.path.getsize(os.path.join(tmpdir, filename))
2062 self.assertEqual(size, 155)
2065 url_CVE_2017_5981 = "https://github.com/asarubbo/poc/blob/master"
2066 zip_CVE_2017_5981 = "00161-zziplib-assertionfailure-seeko_C"
2067 def test_59810_infozipdir_CVE_2017_5981(self):
2068 """ run info-zip dir test0.zip """
2069 tmpdir = self.testdir()
2070 filename = self.zip_CVE_2017_5981
2071 file_url = self.url_CVE_2017_5981
2072 download_raw(file_url, filename, tmpdir)
2073 exe = self.bins("unzip")
2074 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2075 returncodes = [0, 3])
2076 self.assertIn(' missing 4 bytes in zipfile', run.errors)
2077 self.assertIn("zipfile corrupt", run.errors)
2078 self.assertLess(len(run.output), 80)
2079 self.assertLess(len(errors(run.errors)), 500)
2081 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
2083 self.assertLess(len(run.output), 90)
2084 self.assertLess(len(errors(run.errors)), 500)
2085 self.assertIn('zipfile corrupt.', run.errors)
2086 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2087 self.assertFalse(os.path.exists(tmpdir+"/test"))
2089 def test_59811_zzipdir_big_CVE_2017_5981(self):
2090 """ run info-zip -l $(CVE_2017_5981).zip """
2091 tmpdir = self.testdir()
2092 filename = self.zip_CVE_2017_5981
2093 file_url = self.url_CVE_2017_5981
2094 download_raw(file_url, filename, tmpdir)
2095 exe = self.bins("unzzip-big")
2096 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2098 self.assertLess(len(run.output), 1)
2099 self.assertLess(len(errors(run.errors)), 1)
2101 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2103 self.assertLess(len(run.output), 30)
2104 self.assertLess(len(errors(run.errors)), 1)
2105 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2106 self.assertFalse(os.path.exists(tmpdir+"/test"))
2108 def test_59812_zzipdir_mem_CVE_2017_5981(self):
2109 """ run unzzip-mem -l $(CVE_2017_5981).zip """
2110 tmpdir = self.testdir()
2111 filename = self.zip_CVE_2017_5981
2112 file_url = self.url_CVE_2017_5981
2113 download_raw(file_url, filename, tmpdir)
2114 exe = self.bins("unzzip-mem")
2115 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2117 self.assertLess(len(run.output), 1)
2118 self.assertLess(len(errors(run.errors)), 1)
2120 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2122 self.assertLess(len(run.output), 30)
2123 self.assertLess(len(errors(run.errors)), 10)
2124 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2125 self.assertFalse(os.path.exists(tmpdir+"/test"))
2127 def test_59813_zzipdir_mix_CVE_2017_5981(self):
2128 """ run unzzip-mix -l $(CVE_2017_5981).zip """
2129 tmpdir = self.testdir()
2130 filename = self.zip_CVE_2017_5981
2131 file_url = self.url_CVE_2017_5981
2132 download_raw(file_url, filename, tmpdir)
2133 exe = self.bins("unzzip-mix")
2134 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2135 returncodes = [0,2])
2136 self.assertLess(len(run.output), 1)
2137 self.assertTrue(greps(run.errors, "Invalid or"))
2139 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2140 returncodes = [0,2])
2141 self.assertLess(len(run.output), 30)
2142 self.assertLess(len(errors(run.errors)), 10)
2143 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2144 self.assertFalse(os.path.exists(tmpdir+"/test"))
2146 def test_59814_zzipdir_zap_CVE_2017_5981(self):
2147 """ run unzzip-zap -l $(CVE_2017_5981).zip """
2148 tmpdir = self.testdir()
2149 filename = self.zip_CVE_2017_5981
2150 file_url = self.url_CVE_2017_5981
2151 download_raw(file_url, filename, tmpdir)
2152 exe = self.bins("unzzip")
2153 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2154 returncodes = [0,3])
2155 self.assertLess(len(run.output), 1)
2156 self.assertLess(len(errors(run.errors)), 80)
2157 self.assertIn(": Success", run.errors)
2159 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2160 returncodes = [0,3])
2161 self.assertLess(len(run.output), 30)
2162 self.assertLess(len(errors(run.errors)), 10)
2163 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2164 self.assertFalse(os.path.exists(tmpdir+"/test"))
2166 def test_59819(self):
2167 """ check $(CVE).zip """
2168 tmpdir = self.testdir()
2169 filename = self.zip_CVE_2017_5981
2170 file_url = self.url_CVE_2017_5981
2171 download_raw(file_url, filename, tmpdir)
2172 shell("ls -l {tmpdir}/{filename}".format(**locals()))
2173 size = os.path.getsize(os.path.join(tmpdir, filename))
2174 self.assertEqual(size, 157)
2176 url_CVE_2018_10 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"
2177 zip_CVE_2018_10 = "zziplib_0-13-67_zzdir_invalid-memory-access_main.zip"
2178 def test_63010(self):
2179 """ info unzip -l $(CVE).zip """
2180 tmpdir = self.testdir()
2181 filename = self.zip_CVE_2018_10
2182 file_url = self.url_CVE_2018_10
2183 download_raw(file_url, filename, tmpdir)
2184 exe = self.bins("unzip")
2185 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2186 returncodes = [0, 9])
2187 self.assertIn("End-of-central-directory signature not found", run.errors)
2188 self.assertLess(len(run.output), 80)
2189 self.assertLess(len(errors(run.errors)), 600)
2191 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
2193 self.assertLess(len(run.output), 90)
2194 self.assertLess(len(errors(run.errors)), 600)
2195 self.assertIn('End-of-central-directory signature not found', run.errors)
2196 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2197 self.assertFalse(os.path.exists(tmpdir+"/test"))
2199 def test_63011(self):
2200 """ unzzip-big -l $(CVE).zip """
2201 tmpdir = self.testdir()
2202 filename = self.zip_CVE_2018_10
2203 file_url = self.url_CVE_2018_10
2204 download_raw(file_url, filename, tmpdir)
2205 exe = self.bins("unzzip-big")
2206 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2208 self.assertLess(len(run.output), 1)
2209 self.assertLess(len(errors(run.errors)), 1)
2211 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2213 self.assertLess(len(run.output), 30)
2214 self.assertLess(len(errors(run.errors)), 1)
2215 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2216 self.assertFalse(os.path.exists(tmpdir+"/test"))
2218 def test_63012(self):
2219 """ unzzip-mem -l $(CVE).zip """
2220 tmpdir = self.testdir()
2221 filename = self.zip_CVE_2018_10
2222 file_url = self.url_CVE_2018_10
2223 download_raw(file_url, filename, tmpdir)
2224 exe = self.bins("unzzip-mem")
2225 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2227 self.assertLess(len(run.output), 1)
2228 self.assertLess(len(errors(run.errors)), 1)
2230 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2232 self.assertLess(len(run.output), 30)
2233 self.assertLess(len(errors(run.errors)), 10)
2234 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2235 self.assertFalse(os.path.exists(tmpdir+"/test"))
2237 def test_63013(self):
2238 """ unzzip-mix -l $(CVE).zip """
2239 tmpdir = self.testdir()
2240 filename = self.zip_CVE_2018_10
2241 file_url = self.url_CVE_2018_10
2242 download_raw(file_url, filename, tmpdir)
2243 exe = self.bins("unzzip-mix")
2244 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2245 returncodes = [0,2])
2246 self.assertLess(len(run.output), 1)
2247 self.assertTrue(greps(run.errors, ".zip: No medium found"))
2249 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2250 returncodes = [0,2])
2251 self.assertLess(len(run.output), 30)
2252 self.assertLess(len(errors(run.errors)), 10)
2253 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2254 self.assertFalse(os.path.exists(tmpdir+"/test"))
2256 def test_63014(self):
2257 """ unzzip-zap -l $(CVE).zip """
2258 tmpdir = self.testdir()
2259 filename = self.zip_CVE_2018_10
2260 file_url = self.url_CVE_2018_10
2261 download_raw(file_url, filename, tmpdir)
2262 exe = self.bins("unzzip")
2263 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2264 returncodes = [0,3])
2265 self.assertLess(len(run.output), 1)
2266 self.assertLess(len(errors(run.errors)), 80)
2267 self.assertIn(": Success", run.errors)
2269 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2270 returncodes = [0,3])
2271 self.assertLess(len(run.output), 30)
2272 self.assertLess(len(errors(run.errors)), 10)
2273 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2274 self.assertFalse(os.path.exists(tmpdir+"/test"))
2276 def test_63018(self):
2277 """ zzdir on $(CVE).zip """
2278 tmpdir = self.testdir()
2279 filename = self.zip_CVE_2018_10
2280 file_url = self.url_CVE_2018_10
2281 download_raw(file_url, filename, tmpdir)
2282 exe = self.bins("zzdir")
2283 run = shell("{exe} {tmpdir}/{filename} ".format(**locals()),
2284 returncodes = [0,3])
2285 self.assertLess(len(run.output), 1)
2286 self.assertLess(len(errors(run.errors)), 80)
2287 self.assertIn(": Success", run.errors)
2288 def test_63019(self):
2289 """ check $(CVE).zip """
2290 tmpdir = self.testdir()
2291 filename = self.zip_CVE_2018_10
2292 file_url = self.url_CVE_2018_10
2293 download_raw(file_url, filename, tmpdir)
2294 shell("ls -l {tmpdir}/{filename}".format(**locals()))
2295 size = os.path.getsize(os.path.join(tmpdir, filename))
2296 self.assertEqual(size, 188)
2298 url_CVE_2018_11 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"
2299 zip_CVE_2018_11 = "zziplib_0-13-67_unzzip_infinite-loop_unzzip_cat_file.zip"
2300 def test_63110(self):
2301 """ info unzip -l $(CVE).zip """
2302 tmpdir = self.testdir()
2303 filename = self.zip_CVE_2018_11
2304 file_url = self.url_CVE_2018_11
2305 download_raw(file_url, filename, tmpdir)
2306 exe = self.bins("unzip")
2307 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2308 returncodes = [0, 9])
2309 self.assertIn("End-of-central-directory signature not found", run.errors)
2310 self.assertLess(len(run.output), 90)
2311 self.assertLess(len(errors(run.errors)), 600)
2313 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
2315 self.assertLess(len(run.output), 90)
2316 self.assertLess(len(errors(run.errors)), 600)
2317 self.assertIn('End-of-central-directory signature not found', run.errors)
2318 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2319 self.assertFalse(os.path.exists(tmpdir+"/test"))
2321 def test_63111(self):
2322 """ unzzip-big -l $(CVE).zip """
2323 tmpdir = self.testdir()
2324 filename = self.zip_CVE_2018_11
2325 file_url = self.url_CVE_2018_11
2326 download_raw(file_url, filename, tmpdir)
2327 exe = self.bins("unzzip-big")
2328 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2330 self.assertLess(len(run.output), 1)
2331 self.assertLess(len(errors(run.errors)), 1)
2333 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2335 self.assertLess(len(run.output), 30)
2336 self.assertLess(len(errors(run.errors)), 1)
2337 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2338 self.assertFalse(os.path.exists(tmpdir+"/test"))
2340 def test_63112(self):
2341 """ unzzip-mem -l $(CVE).zip """
2342 tmpdir = self.testdir()
2343 filename = self.zip_CVE_2018_11
2344 file_url = self.url_CVE_2018_11
2345 download_raw(file_url, filename, tmpdir)
2346 exe = self.bins("unzzip-mem")
2347 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2349 self.assertLess(len(run.output), 1)
2350 self.assertLess(len(errors(run.errors)), 1)
2352 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2354 self.assertLess(len(run.output), 30)
2355 self.assertLess(len(errors(run.errors)), 10)
2356 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2357 self.assertFalse(os.path.exists(tmpdir+"/test"))
2359 def test_63113(self):
2360 """ unzzip-mix -l $(CVE).zip """
2361 tmpdir = self.testdir()
2362 filename = self.zip_CVE_2018_11
2363 file_url = self.url_CVE_2018_11
2364 download_raw(file_url, filename, tmpdir)
2365 exe = self.bins("unzzip-mix")
2366 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2367 returncodes = [0,2])
2368 self.assertLess(len(run.output), 1)
2369 self.assertTrue(greps(run.errors, ".zip: No medium found"))
2371 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2372 returncodes = [0,2])
2373 self.assertLess(len(run.output), 30)
2374 self.assertLess(len(errors(run.errors)), 10)
2375 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2376 self.assertFalse(os.path.exists(tmpdir+"/test"))
2378 def test_63114(self):
2379 """ unzzip-zap -l $(CVE).zip """
2380 tmpdir = self.testdir()
2381 filename = self.zip_CVE_2018_11
2382 file_url = self.url_CVE_2018_11
2383 download_raw(file_url, filename, tmpdir)
2384 exe = self.bins("unzzip")
2385 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2386 returncodes = [0,3])
2387 self.assertLess(len(run.output), 1)
2388 self.assertLess(len(errors(run.errors)), 90)
2389 self.assertIn(": Success", run.errors)
2391 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2392 returncodes = [0,3])
2393 self.assertLess(len(run.output), 30)
2394 self.assertLess(len(errors(run.errors)), 10)
2395 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2396 self.assertFalse(os.path.exists(tmpdir+"/test"))
2398 run = shell("cd {tmpdir} && ../{exe} -p {filename} ".format(**locals()),
2399 returncodes = [0,3])
2401 def test_63119(self):
2402 """ check $(CVE).zip """
2403 tmpdir = self.testdir()
2404 filename = self.zip_CVE_2018_11
2405 file_url = self.url_CVE_2018_11
2406 download_raw(file_url, filename, tmpdir)
2407 shell("ls -l {tmpdir}/{filename}".format(**locals()))
2408 size = os.path.getsize(os.path.join(tmpdir, filename))
2409 self.assertEqual(size, 280)
2411 url_CVE_2018_12 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"
2412 zip_CVE_2018_12 = "zziplib_0-13-67_unzip-mem_buffer-access-with-incorrect-length-value_zzip_disk_fread.zip"
2413 def test_63810(self):
2414 """ info unzip -l $(CVE).zip """
2415 tmpdir = self.testdir()
2416 filename = self.zip_CVE_2018_12
2417 file_url = self.url_CVE_2018_12
2418 download_raw(file_url, filename, tmpdir)
2419 exe = self.bins("unzip")
2420 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2422 self.assertIn('reported length of central directory', run.errors)
2423 self.assertLess(len(run.output), 300)
2424 self.assertLess(len(errors(run.errors)), 800)
2426 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
2428 self.assertLess(len(run.output), 300)
2429 self.assertLess(len(errors(run.errors)), 800)
2430 self.assertIn('reported length of central directory', run.errors)
2431 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2432 self.assertFalse(os.path.exists(tmpdir+"/test"))
2434 def test_63811(self):
2435 """ unzzip-big -l $(CVE).zip """
2436 tmpdir = self.testdir()
2437 filename = self.zip_CVE_2018_12
2438 file_url = self.url_CVE_2018_12
2439 download_raw(file_url, filename, tmpdir)
2440 exe = self.bins("unzzip-big")
2441 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2443 self.assertLess(len(run.output), 20)
2444 self.assertLess(len(errors(run.errors)), 1)
2446 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2448 self.assertLess(len(run.output), 30)
2449 self.assertLess(len(errors(run.errors)), 1)
2450 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2451 self.assertFalse(os.path.exists(tmpdir+"/test"))
2453 def test_63812(self):
2454 """ unzzip-mem -l $(CVE).zip """
2455 tmpdir = self.testdir()
2456 filename = self.zip_CVE_2018_12
2457 file_url = self.url_CVE_2018_12
2458 download_raw(file_url, filename, tmpdir)
2459 exe = self.bins("unzzip-mem")
2460 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2462 self.assertLess(len(run.output), 1)
2463 self.assertLess(len(errors(run.errors)), 1)
2465 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2467 self.assertLess(len(run.output), 30)
2468 self.assertLess(len(errors(run.errors)), 10)
2469 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2470 self.assertFalse(os.path.exists(tmpdir+"/test"))
2472 def test_63813(self):
2473 """ unzzip-mix -l $(CVE).zip """
2474 tmpdir = self.testdir()
2475 filename = self.zip_CVE_2018_12
2476 file_url = self.url_CVE_2018_12
2477 download_raw(file_url, filename, tmpdir)
2478 exe = self.bins("unzzip-mix")
2479 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2480 returncodes = [0,2])
2481 self.assertLess(len(run.output), 1)
2482 self.assertTrue(grep(run.errors, "central directory not found"))
2484 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2485 returncodes = [0,2])
2486 self.assertLess(len(run.output), 30)
2487 self.assertLess(len(errors(run.errors)), 10)
2488 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2489 self.assertFalse(os.path.exists(tmpdir+"/test"))
2491 def test_63814(self):
2492 """ unzzip-zap -l $(CVE).zip """
2493 tmpdir = self.testdir()
2494 filename = self.zip_CVE_2018_12
2495 file_url = self.url_CVE_2018_12
2496 download_raw(file_url, filename, tmpdir)
2497 exe = self.bins("unzzip")
2498 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2499 returncodes = [0,3])
2500 self.assertLess(len(run.output), 1)
2501 self.assertLess(len(errors(run.errors)), 200)
2502 self.assertIn(": Success", run.errors)
2504 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2505 returncodes = [0,3])
2506 self.assertLess(len(run.output), 30)
2507 self.assertLess(len(errors(run.errors)), 10)
2508 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2509 self.assertFalse(os.path.exists(tmpdir+"/test"))
2511 def test_63819(self):
2512 """ check $(CVE).zip """
2513 tmpdir = self.testdir()
2514 filename = self.zip_CVE_2018_12
2515 file_url = self.url_CVE_2018_12
2516 download_raw(file_url, filename, tmpdir)
2517 shell("ls -l {tmpdir}/{filename}".format(**locals()))
2518 size = os.path.getsize(os.path.join(tmpdir, filename))
2519 self.assertEqual(size, 152)
2521 url_CVE_2018_14 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"
2522 zip_CVE_2018_14 = "zziplib_0-13-67_zzdir_memory-alignment-errors___zzip_fetch_disk_trailer.zip"
2523 def test_64840(self):
2524 """ info unzip -l $(CVE).zip """
2525 tmpdir = self.testdir()
2526 filename = self.zip_CVE_2018_14
2527 file_url = self.url_CVE_2018_14
2528 download_raw(file_url, filename, tmpdir)
2529 exe = self.bins("unzip")
2530 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2532 self.assertIn("attempt to seek before beginning of zipfile", run.errors)
2533 self.assertLess(len(run.output), 200)
2534 self.assertLess(len(errors(run.errors)), 800)
2536 exe = self.bins("unzip")
2537 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
2539 self.assertLess(len(run.output), 200)
2540 self.assertLess(len(errors(run.errors)), 800)
2541 self.assertIn('attempt to seek before beginning of zipfile', run.errors)
2542 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2543 self.assertFalse(os.path.exists(tmpdir+"/test"))
2545 def test_64841(self):
2546 """ unzzip-big -l $(CVE).zip """
2547 tmpdir = self.testdir()
2548 filename = self.zip_CVE_2018_14
2549 file_url = self.url_CVE_2018_14
2550 download_raw(file_url, filename, tmpdir)
2551 exe = self.bins("unzzip-big")
2552 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2554 self.assertLess(len(run.output), 1)
2555 self.assertLess(len(errors(run.errors)), 1)
2557 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2559 self.assertLess(len(run.output), 30)
2560 self.assertLess(len(errors(run.errors)), 1)
2561 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2562 self.assertFalse(os.path.exists(tmpdir+"/test"))
2564 def test_64842(self):
2565 """ unzzip-mem -l $(CVE).zip """
2566 tmpdir = self.testdir()
2567 filename = self.zip_CVE_2018_14
2568 file_url = self.url_CVE_2018_14
2569 download_raw(file_url, filename, tmpdir)
2570 exe = self.bins("unzzip-mem")
2571 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2573 self.assertLess(len(run.output), 1)
2575 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2577 self.assertLess(len(run.output), 30)
2578 self.assertLess(len(errors(run.errors)), 10)
2579 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2580 self.assertFalse(os.path.exists(tmpdir+"/test"))
2582 def test_64843(self):
2583 """ unzzip-mix -l $(CVE).zip """
2584 tmpdir = self.testdir()
2585 filename = self.zip_CVE_2018_14
2586 file_url = self.url_CVE_2018_14
2587 download_raw(file_url, filename, tmpdir)
2588 exe = self.bins("unzzip-mix")
2589 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2590 returncodes = [0, 2])
2591 self.assertLess(len(run.output), 1)
2592 self.assertTrue(greps(run.errors, "Invalid or"))
2594 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2595 returncodes = [0,2])
2596 self.assertLess(len(run.output), 30)
2597 self.assertLess(len(errors(run.errors)), 10)
2598 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2599 self.assertFalse(os.path.exists(tmpdir+"/test"))
2601 def test_64844(self):
2602 """ unzzip-zap -l $(CVE).zip """
2603 tmpdir = self.testdir()
2604 filename = self.zip_CVE_2018_14
2605 file_url = self.url_CVE_2018_14
2606 download_raw(file_url, filename, tmpdir)
2607 exe = self.bins("unzzip")
2608 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2609 returncodes = [0, 3])
2610 self.assertLess(len(run.output), 1)
2611 self.assertLess(len(errors(run.errors)), 200)
2612 self.assertIn(": Success", run.errors)
2614 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2615 returncodes = [0,3])
2616 self.assertLess(len(run.output), 30)
2617 self.assertLess(len(errors(run.errors)), 10)
2618 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2619 self.assertFalse(os.path.exists(tmpdir+"/test"))
2621 def test_64848(self):
2622 """ zzdir $(CVE).zip """
2623 tmpdir = self.testdir()
2624 filename = self.zip_CVE_2018_14
2625 file_url = self.url_CVE_2018_14
2626 download_raw(file_url, filename, tmpdir)
2627 exe = self.bins("zzdir")
2628 run = shell("{exe} {tmpdir}/{filename} ".format(**locals()),
2629 returncodes = [0, 3])
2630 self.assertLess(len(run.output), 1)
2631 self.assertLess(len(errors(run.errors)), 200)
2632 self.assertIn(": Success", run.errors)
2634 def test_64849(self):
2635 """ check $(CVE).zip """
2636 tmpdir = self.testdir()
2637 filename = self.zip_CVE_2018_14
2638 file_url = self.url_CVE_2018_14
2639 download_raw(file_url, filename, tmpdir)
2640 shell("ls -l {tmpdir}/{filename}".format(**locals()))
2641 size = os.path.getsize(os.path.join(tmpdir, filename))
2642 self.assertEqual(size, 56)
2644 url_CVE_2018_15 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"
2645 zip_CVE_2018_15 = "zziplib_0-13-67_unzip-mem_memory-alignment-errors_zzip_disk_findfirst.zip"
2646 def test_65400(self):
2647 """ info unzip -l $(CVE).zip """
2648 tmpdir = self.testdir()
2649 filename = self.zip_CVE_2018_15
2650 file_url = self.url_CVE_2018_15
2651 download_raw(file_url, filename, tmpdir)
2652 exe = self.bins("unzip")
2653 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2655 self.assertIn("reported length of central directory", run.errors)
2656 self.assertLess(len(run.output), 300)
2657 self.assertLess(len(errors(run.errors)), 800)
2659 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
2661 self.assertLess(len(run.output), 300)
2662 self.assertLess(len(errors(run.errors)), 800)
2663 self.assertIn('reported length of central directory', run.errors)
2664 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2665 self.assertFalse(os.path.exists(tmpdir+"/test"))
2667 def test_65401(self):
2668 """ unzzip-big -l $(CVE).zip """
2669 tmpdir = self.testdir()
2670 filename = self.zip_CVE_2018_15
2671 file_url = self.url_CVE_2018_15
2672 download_raw(file_url, filename, tmpdir)
2673 exe = self.bins("unzzip-big")
2674 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2676 self.assertLess(len(run.output), 15)
2677 self.assertLess(len(errors(run.errors)), 1)
2679 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2681 self.assertLess(len(run.output), 30)
2682 self.assertLess(len(errors(run.errors)), 1)
2683 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2684 self.assertFalse(os.path.exists(tmpdir+"/test"))
2686 @unittest.expectedFailure
2687 def test_65402(self):
2688 """ unzzip-mem -l $(CVE).zip """
2689 tmpdir = self.testdir()
2690 filename = self.zip_CVE_2018_15
2691 file_url = self.url_CVE_2018_15
2692 download_raw(file_url, filename, tmpdir)
2693 exe = self.bins("unzzip-mem")
2694 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2696 self.assertLess(len(run.output), 30)
2697 self.assertLess(len(errors(run.errors)), 1)
2699 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2701 self.assertLess(len(run.output), 30)
2702 self.assertLess(len(errors(run.errors)), 10)
2703 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2704 self.assertFalse(os.path.exists(tmpdir+"/test"))
2706 def test_65403(self):
2707 """ unzzip-mix -l $(CVE).zip """
2708 tmpdir = self.testdir()
2709 filename = self.zip_CVE_2018_15
2710 file_url = self.url_CVE_2018_15
2711 download_raw(file_url, filename, tmpdir)
2712 exe = self.bins("unzzip-mix")
2713 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2714 returncodes = [0,2])
2715 self.assertLess(len(run.output), 1)
2716 self.assertTrue(greps(run.errors, "Invalid or"))
2718 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2719 returncodes = [0,2])
2720 self.assertLess(len(run.output), 30)
2721 self.assertLess(len(errors(run.errors)), 10)
2722 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2723 self.assertFalse(os.path.exists(tmpdir+"/test"))
2725 def test_65404(self):
2726 """ unzzip-zap -l $(CVE).zip """
2727 tmpdir = self.testdir()
2728 filename = self.zip_CVE_2018_15
2729 file_url = self.url_CVE_2018_15
2730 download_raw(file_url, filename, tmpdir)
2731 exe = self.bins("unzzip")
2732 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2733 returncodes = [0, 3])
2734 self.assertLess(len(run.output), 1)
2735 self.assertLess(len(errors(run.errors)), 200)
2736 self.assertIn(": Success", run.errors)
2738 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2739 returncodes = [0,3])
2740 self.assertLess(len(run.output), 30)
2741 self.assertLess(len(errors(run.errors)), 10)
2742 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2743 self.assertFalse(os.path.exists(tmpdir+"/test"))
2745 def test_65409(self):
2746 """ check $(CVE).zip """
2747 tmpdir = self.testdir()
2748 filename = self.zip_CVE_2018_15
2749 file_url = self.url_CVE_2018_15
2750 download_raw(file_url, filename, tmpdir)
2751 shell("ls -l {tmpdir}/{filename}".format(**locals()))
2752 size = os.path.getsize(os.path.join(tmpdir, filename))
2753 self.assertEqual(size, 141)
2755 url_CVE_2018_16 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"
2756 zip_CVE_2018_16 = "zziplib_0-13-67_unzzip_memory-aligment-errors___zzip_fetch_disk_trailer.zip"
2757 def test_65410(self):
2758 """ info unzip -l $(CVE).zip """
2759 tmpdir = self.testdir()
2760 filename = self.zip_CVE_2018_16
2761 file_url = self.url_CVE_2018_16
2762 download_raw(file_url, filename, tmpdir)
2763 exe = self.bins("unzip")
2764 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2765 returncodes = [0, 9])
2766 self.assertIn("End-of-central-directory signature not found", run.errors)
2767 self.assertLess(len(run.output), 200)
2768 self.assertLess(len(errors(run.errors)), 800)
2770 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
2772 self.assertLess(len(run.output), 200)
2773 self.assertLess(len(errors(run.errors)), 800)
2774 self.assertIn('End-of-central-directory signature not found', run.errors)
2775 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2776 self.assertFalse(os.path.exists(tmpdir+"/test"))
2778 def test_65411(self):
2779 """ unzzip-big -l $(CVE).zip """
2780 tmpdir = self.testdir()
2781 filename = self.zip_CVE_2018_16
2782 file_url = self.url_CVE_2018_16
2783 download_raw(file_url, filename, tmpdir)
2784 exe = self.bins("unzzip-big")
2785 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2787 self.assertLess(len(run.output), 1)
2788 self.assertLess(len(errors(run.errors)), 1)
2790 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2792 self.assertLess(len(run.output), 30)
2793 self.assertLess(len(errors(run.errors)), 1)
2794 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2795 self.assertFalse(os.path.exists(tmpdir+"/test"))
2797 def test_65412(self):
2798 """ unzzip-mem -l $(CVE).zip """
2799 tmpdir = self.testdir()
2800 filename = self.zip_CVE_2018_16
2801 file_url = self.url_CVE_2018_16
2802 download_raw(file_url, filename, tmpdir)
2803 exe = self.bins("unzzip-mem")
2804 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2806 self.assertLess(len(run.output), 1)
2807 self.assertLess(len(errors(run.errors)), 1)
2809 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2811 self.assertLess(len(run.output), 30)
2812 self.assertLess(len(errors(run.errors)), 10)
2813 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2814 self.assertFalse(os.path.exists(tmpdir+"/test"))
2816 def test_65413(self):
2817 """ unzzip-mix -l $(CVE).zip """
2818 tmpdir = self.testdir()
2819 filename = self.zip_CVE_2018_16
2820 file_url = self.url_CVE_2018_16
2821 download_raw(file_url, filename, tmpdir)
2822 exe = self.bins("unzzip-mix")
2823 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2824 returncodes = [0,2])
2825 self.assertLess(len(run.output), 1)
2826 self.assertTrue(greps(run.errors, "Invalid or"))
2828 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2829 returncodes = [0,2])
2830 self.assertLess(len(run.output), 30)
2831 self.assertLess(len(errors(run.errors)), 10)
2832 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2833 self.assertFalse(os.path.exists(tmpdir+"/test"))
2835 def test_65414(self):
2836 """ unzzip-zap -l $(CVE).zip """
2837 tmpdir = self.testdir()
2838 filename = self.zip_CVE_2018_16
2839 file_url = self.url_CVE_2018_16
2840 download_raw(file_url, filename, tmpdir)
2841 exe = self.bins("unzzip")
2842 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2843 returncodes = [0, 3])
2844 self.assertLess(len(run.output), 1)
2845 self.assertLess(len(errors(run.errors)), 200)
2846 self.assertIn(": Success", run.errors)
2848 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2849 returncodes = [0,3])
2850 self.assertLess(len(run.output), 30)
2851 self.assertLess(len(errors(run.errors)), 10)
2852 self.assertTrue(greps(run.errors, "Zipfile corrupted"))
2853 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2854 self.assertFalse(os.path.exists(tmpdir+"/test"))
2856 run = shell("cd {tmpdir} && ../{exe} -p {filename} ".format(**locals()),
2857 returncodes = [0,3])
2858 self.assertTrue(greps(run.errors, "Zipfile corrupted"))
2860 def test_65419(self):
2861 """ check $(CVE).zip """
2862 tmpdir = self.testdir()
2863 filename = self.zip_CVE_2018_16
2864 file_url = self.url_CVE_2018_16
2865 download_raw(file_url, filename, tmpdir)
2866 shell("ls -l {tmpdir}/{filename}".format(**locals()))
2867 size = os.path.getsize(os.path.join(tmpdir, filename))
2868 self.assertEqual(size, 124)
2870 url_CVE_2018_17 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"
2871 zip_CVE_2018_17 = "zziplib_0-13-67_unzip-mem_memory-alignment-errors_zzip_disk_findfirst_64.zip"
2872 def test_65420(self):
2873 """ info unzip -l $(CVE).zip """
2874 tmpdir = self.testdir()
2875 filename = self.zip_CVE_2018_17
2876 file_url = self.url_CVE_2018_17
2877 download_raw(file_url, filename, tmpdir)
2878 exe = self.bins("unzip")
2879 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2880 returncodes = [0, 9])
2881 self.assertIn("End-of-central-directory signature not found", run.errors)
2882 self.assertLess(len(run.output), 200)
2883 self.assertLess(len(errors(run.errors)), 800)
2885 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),
2887 self.assertLess(len(run.output), 200)
2888 self.assertLess(len(errors(run.errors)), 800)
2889 self.assertIn('End-of-central-directory signature not found', run.errors)
2890 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2891 self.assertFalse(os.path.exists(tmpdir+"/test"))
2893 def test_65421(self):
2894 """ unzzip-big -l $(CVE).zip """
2895 tmpdir = self.testdir()
2896 filename = self.zip_CVE_2018_17
2897 file_url = self.url_CVE_2018_17
2898 download_raw(file_url, filename, tmpdir)
2899 exe = self.bins("unzzip-big")
2900 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2902 self.assertLess(len(run.output), 1)
2904 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2906 self.assertLess(len(run.output), 30)
2907 self.assertLess(len(errors(run.errors)), 1)
2908 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2909 self.assertFalse(os.path.exists(tmpdir+"/test"))
2911 @unittest.expectedFailure
2912 def test_65422(self):
2913 """ unzzip-mem -l $(CVE).zip """
2914 tmpdir = self.testdir()
2915 filename = self.zip_CVE_2018_17
2916 file_url = self.url_CVE_2018_17
2917 download_raw(file_url, filename, tmpdir)
2918 exe = self.bins("unzzip-mem")
2919 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2921 self.assertLess(len(run.output), 50)
2922 self.assertLess(len(errors(run.errors)), 1)
2924 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2926 self.assertLess(len(run.output), 30)
2927 self.assertLess(len(errors(run.errors)), 10)
2928 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2929 self.assertFalse(os.path.exists(tmpdir+"/test"))
2931 run = shell("cd {tmpdir} && ../{exe} -p {filename} ".format(**locals()),
2934 def test_65423(self):
2935 """ unzzip-mix -l $(CVE).zip """
2936 tmpdir = self.testdir()
2937 filename = self.zip_CVE_2018_17
2938 file_url = self.url_CVE_2018_17
2939 download_raw(file_url, filename, tmpdir)
2940 exe = self.bins("unzzip-mix")
2941 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2942 returncodes = [0,2])
2943 self.assertLess(len(run.output), 1)
2944 self.assertTrue(greps(run.errors, "Invalid or"))
2946 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2947 returncodes = [0,2])
2948 self.assertLess(len(run.output), 30)
2949 self.assertTrue(greps(run.errors, "Invalid or"))
2950 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2951 self.assertFalse(os.path.exists(tmpdir+"/test"))
2953 def test_65424(self):
2954 """ unzzip-zap -l $(CVE).zip """
2955 tmpdir = self.testdir()
2956 filename = self.zip_CVE_2018_17
2957 file_url = self.url_CVE_2018_17
2958 download_raw(file_url, filename, tmpdir)
2959 exe = self.bins("unzzip")
2960 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
2961 returncodes = [0, 3])
2962 self.assertLess(len(run.output), 1)
2963 self.assertLess(len(errors(run.errors)), 200)
2964 self.assertIn(": Success", run.errors)
2966 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
2967 returncodes = [0,3])
2968 self.assertLess(len(run.output), 30)
2969 self.assertTrue(greps(run.errors, "Zipfile corrupted"))
2970 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
2971 self.assertFalse(os.path.exists(tmpdir+"/test"))
2973 def test_65429(self):
2974 """ check $(CVE).zip """
2975 tmpdir = self.testdir()
2976 filename = self.zip_CVE_2018_17
2977 file_url = self.url_CVE_2018_17
2978 download_raw(file_url, filename, tmpdir)
2979 shell("ls -l {tmpdir}/{filename}".format(**locals()))
2980 size = os.path.getsize(os.path.join(tmpdir, filename))
2981 self.assertEqual(size, 360)
2984 def test_91000_zzshowme_check_sfx(self):
2985 """ create an *.exe that can extract its own zip content """
2986 exe=self.bins("mkzip")
2987 exefile = "tmp.zzshowme" + exeext
2988 libstub = ".libs/zzipself" + exeext
2989 txtfile_name = readme
2990 txtfile = self.src(readme)
2991 # add the extract-stub so we have reserved the size
2992 run = shell("{exe} -0 -j {exefile}.zip {libstub}".format(**locals()))
2993 self.assertFalse(run.returncode)
2994 # add the actual content which may now be compressed
2995 run = shell("{exe} -9 -j {exefile}.zip {txtfile}".format(**locals()))
2996 self.assertFalse(run.returncode)
2997 # rename .zip to .exe and put the extract-stub at the start
2998 shutil.copy(exefile+".zip", exefile)
2999 setstub="./zzipsetstub" + exeext
3000 run = shell("{setstub} {exefile} {libstub}".format(**locals()))
3001 self.assertFalse(run.returncode)
3002 os.chmod(exefile, 0755)
3003 # now ask the new .exe to show some of its own content
3004 run = shell("./{exefile} {txtfile_name}".format(**locals()))
3005 self.assertFalse(run.returncode)
3006 txt = open(txtfile).read()
3007 self.assertEqual(txt.split("\n"), run.output.split("\n"))
3009 def test_99000_make_test1w_zip(self):
3010 """ create a test1w.zip using zzip/write functions. """
3011 exe=self.bins("zzip")
3012 run = shell("{exe} --version".format(**locals()))
3013 if "- NO -" in run.output:
3014 self.skipTest("- NO -D_ZZIP_ENABLE_WRITE")
3016 zipfile=self.testzip()
3017 tmpdir=self.testdir()
3018 exe=self.bins("zzip")
3019 for i in [1,2,3,4,5,6,7,8,9]:
3020 filename = os.path.join(tmpdir,"file.%i" % i)
3021 filetext = "file-%i\n" % i
3022 self.mkfile(filename, filetext)
3023 filename = os.path.join(tmpdir,"README")
3024 filetext = self.readme()
3025 self.mkfile(filename, filetext)
3027 shell("../{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
3028 self.assertGreater(os.path.getsize(zipfile), 10)
3033 if __name__ == "__main__":
3035 _o = optparse.OptionParser("%prog [options] test_xxx")
3036 _o.add_option("-b", "--topsrcdir", metavar="DIR", default=topsrcdir,
3037 help="path to the top srcdir / unpack directory [%default]")
3038 _o.add_option("-t", "--testdatadir", metavar="DIR", default=testdatadir,
3039 help="path where temporary testdata is created [%default]")
3040 _o.add_option("-Z", "--mkzip", metavar="EXE", default=mkzip,
3041 help="name or path to zip.exe for *.zip creation [%default]")
3042 _o.add_option("-U", "--unzip", metavar="EXE", default=unzip,
3043 help="name or path to unzip.exe to unpack *.zip [%default]")
3044 _o.add_option("-E", "--exeext", metavar="EXT", default=exeext,
3045 help="the executable extension (automake $(EXEEXT)) [%default]")
3046 _o.add_option("--xmlresults", action="store_true", default=False,
3047 help="print output in junit xml testresult format [%default]")
3048 _o.add_option("-v", "--verbose", action="count", default=0,
3049 help="increase logging output [%default]")
3050 opt, args = _o.parse_args()
3051 logging.basicConfig(level = logging.WARNING - 10 * opt.verbose)
3052 topsrcdir = opt.topsrcdir
3053 testdatdir = opt.testdatadir
3057 if not args: args += [ "test_" ]
3058 suite = unittest.TestSuite()
3060 for classname in sorted(list(globals())):
3061 if not classname.endswith("Test"):
3063 testclass = globals()[classname]
3064 for method in sorted(dir(testclass)):
3065 if "*" not in arg: arg += "*"
3066 if arg.startswith("_"): arg = arg[1:]
3067 if matches(method, arg):
3068 suite.addTest(testclass(method))
3069 # TextTestRunner(verbosity=opt.verbose).run(suite)
3072 Runner = xmlrunner.XMLTestRunner
3073 Runner(xmlresults).run(suite)
3075 Runner = unittest.TextTestRunner
3076 Runner(verbosity=opt.verbose).run(suite)