run-shape-fuzzer-tests.py 959 字节
Newer Older
1 2 3 4 5 6 7 8
#!/usr/bin/env python

from __future__ import print_function
import sys, os, subprocess

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

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

17
	hb_shape_fuzzer = sys.argv[1]
18

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

B
Behdad Esfahbod 已提交
22
for line in open (os.path.join (srcdir, "..", "shaping", "data", "in-house", "tests", "fuzzed.tests")):
23 24
	font = line.split (":")[0]

25
	p = subprocess.Popen ([hb_shape_fuzzer, os.path.join (srcdir, "..", "shaping", font)])
26 27 28 29 30 31 32

	if p.wait () != 0:
		fails = fails + 1

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