[fuzz] Don't fail when blob is empty

And enable more tests able to trig the issue.
This commit is contained in:
Ebrahim Byagowi 2019-07-11 14:31:55 +04:30 committed by GitHub
parent 7a9d643c29
commit b65bad18aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -42,7 +42,7 @@ trySubset (hb_face_t *face,
unsigned int bytes_count = 0; unsigned int bytes_count = 0;
for (unsigned int i = 0; i < length; ++i) for (unsigned int i = 0; i < length; ++i)
if (data[i]) ++bytes_count; if (data[i]) ++bytes_count;
assert (bytes_count); assert (bytes_count || !length);
hb_blob_destroy (blob); hb_blob_destroy (blob);
} }

View File

@ -33,7 +33,7 @@ def cmd(command):
def timeout(p, is_killed): def timeout(p, is_killed):
is_killed['value'] = True is_killed['value'] = True
p.kill() p.kill()
timer = threading.Timer (2, timeout, [p, is_killed]) timer = threading.Timer (5, timeout, [p, is_killed])
try: try:
timer.start() timer.start()
@ -82,6 +82,8 @@ def run_dir (parent_path):
global fails global fails
for file in os.listdir (parent_path): for file in os.listdir (parent_path):
path = os.path.join(parent_path, file) path = os.path.join(parent_path, file)
# TODO: Run on all the fonts not just subset related ones
if "subset" not in path: continue
print ("running subset fuzzer against %s" % path) print ("running subset fuzzer against %s" % path)
if valgrind: if valgrind:
@ -91,7 +93,7 @@ def run_dir (parent_path):
if 'error' in text: if 'error' in text:
returncode = 1 returncode = 1
if not valgrind and text.strip (): if (not valgrind or returncode) and text.strip ():
print (text) print (text)
if returncode != 0: if returncode != 0:
@ -100,8 +102,7 @@ def run_dir (parent_path):
run_dir (os.path.join (srcdir, "..", "subset", "data", "fonts")) run_dir (os.path.join (srcdir, "..", "subset", "data", "fonts"))
# TODO running these tests very slow tests. Fix and re-enable run_dir (os.path.join (srcdir, "fonts"))
#run_dir (os.path.join (srcdir, "fonts"))
if fails: if fails:
print ("%i subset fuzzer related tests failed." % fails) print ("%i subset fuzzer related tests failed." % fails)