2017-12-29 19:43:29 +00:00
|
|
|
#!/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", ".")
|
2018-01-01 07:47:51 +00:00
|
|
|
hb_fuzzer = os.path.join (top_builddir, "hb-fuzzer" + EXEEXT)
|
|
|
|
|
|
|
|
if not os.path.exists (hb_fuzzer):
|
2018-01-02 20:22:12 +00:00
|
|
|
if len (sys.argv) == 1 or not os.path.exists (sys.argv[1]):
|
|
|
|
print ("""Failed to find hb-fuzzer binary automatically,
|
|
|
|
please provide it as the first argument to the tool""")
|
|
|
|
sys.exit (1)
|
|
|
|
|
2018-01-01 07:47:51 +00:00
|
|
|
hb_fuzzer = sys.argv[1]
|
|
|
|
|
|
|
|
print ('hb_fuzzer:', hb_fuzzer)
|
2017-12-29 19:43:29 +00:00
|
|
|
fails = 0
|
|
|
|
|
2018-01-09 20:58:57 +00:00
|
|
|
for line in open (os.path.join (srcdir, "..", "shaping", "data", "in-house", "tests", "fuzzed.tests")):
|
2017-12-29 19:43:29 +00:00
|
|
|
font = line.split (":")[0]
|
|
|
|
|
|
|
|
p = subprocess.Popen (
|
|
|
|
[hb_fuzzer, os.path.join (srcdir, "..", "shaping", font)],
|
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|
|
|
|
|
if p.wait () != 0:
|
|
|
|
fails = fails + 1
|
|
|
|
|
|
|
|
print ((p.stdout.read () + p.stderr.read ()).decode ("utf-8").strip ())
|
|
|
|
|
|
|
|
if fails:
|
|
|
|
print ("%i fuzzer related tests failed." % fails)
|
|
|
|
sys.exit (1)
|