run-shape-fuzzer-tests.py 983 字节
Newer Older
1 2
#!/usr/bin/env python

3 4
from __future__ import print_function, division, absolute_import

5 6 7 8 9
import sys, os, subprocess

srcdir = os.environ.get ("srcdir", ".")
EXEEXT = os.environ.get ("EXEEXT", "")
top_builddir = os.environ.get ("top_builddir", ".")
10
hb_shape_fuzzer = os.path.join (top_builddir, "hb-shape-fuzzer" + EXEEXT)
11

12
if not os.path.exists (hb_shape_fuzzer):
13
	if len (sys.argv) == 1 or not os.path.exists (sys.argv[1]):
14
		print ("""Failed to find hb-shape-fuzzer binary automatically,
15 16 17
please provide it as the first argument to the tool""")
		sys.exit (1)

18
	hb_shape_fuzzer = sys.argv[1]
19

20
print ('hb_shape_fuzzer:', hb_shape_fuzzer)
21 22
fails = 0

23 24 25
parent_path = os.path.join (srcdir, "fonts")
for file in os.listdir (parent_path):
        path = os.path.join(parent_path, file)
26

27
	p = subprocess.Popen ([hb_shape_fuzzer, path])
28 29

	if p.wait () != 0:
30
		print ('failure on %s', font)
31 32 33
		fails = fails + 1

if fails:
34
	print ("%i shape fuzzer related tests failed." % fails)
35
	sys.exit (1)