import shutil
import random
import re
+import errno
from fnmatch import fnmatchcase as matches
from cStringIO import StringIO
return topsrcdir
def src(self, name):
return os.path.join(self.s, name)
+ def assertErrorMessage(self, errors, errno):
+ self.assertIn(': ' + os.strerror(errno), errors)
def readme(self):
f = open(self.src(readme))
text = f.read()
returncodes = [0,2])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 180)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 30)
self.assertLess(len(errors(run.errors)), 300)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
self.assertFalse(os.path.exists(tmpdir+"/test"))
# self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)
self.rm_testdir()
returncodes = [0,2])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 180)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 30)
self.assertLess(len(errors(run.errors)), 200)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
self.assertFalse(os.path.exists(tmpdir+"/test"))
self.rm_testdir()
def test_59754_zzipdir_zap_CVE_2017_5975(self):
returncodes = [0,3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 180)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
returncodes = [2])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 180)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [2])
returncodes = [3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 180)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [3]) # TODO
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 1)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
returncodes = [0,3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 80)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 1)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
returncodes = [0,3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 80)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
returncodes = [1])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 80)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
def test_63019(self):
""" check $(CVE).zip """
tmpdir = self.testdir()
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 1)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
returncodes = [0,3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 90)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
returncodes = [0,3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 200)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0, 2])
self.assertLess(len(run.output), 1)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
returncodes = [0, 3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 200)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
returncodes = [1])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 200)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
self.rm_testdir()
def test_64849(self):
""" check $(CVE).zip """
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 1)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
returncodes = [0, 3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 200)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 1)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
returncodes = [0, 3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 200)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 1)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 30)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
# self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
self.assertFalse(os.path.exists(tmpdir+"/test"))
self.rm_testdir()
returncodes = [0, 3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 200)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 1)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 30)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
# self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
self.assertFalse(os.path.exists(tmpdir+"/test"))
self.rm_testdir()
returncodes = [0, 3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 200)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])
run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 1)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,2])
self.assertLess(len(run.output), 30)
- self.assertTrue(greps(run.errors, "Invalid or"))
+ self.assertErrorMessage(run.errors, errno.EILSEQ)
# self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)
self.assertFalse(os.path.exists(tmpdir+"/test"))
self.rm_testdir()
returncodes = [0, 3])
self.assertLess(len(run.output), 1)
self.assertLess(len(errors(run.errors)), 200)
- self.assertIn(": Success", run.errors)
+ self.assertErrorMessage(run.errors, 0)
#
run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),
returncodes = [0,3])