2017-12-29 20:43:29 +01: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-03-15 21:04:31 +01:00
|
|
|
hb_shape_fuzzer = os.path.join (top_builddir, "hb-shape-fuzzer" + EXEEXT)
|
2018-01-01 08:47:51 +01:00
|
|
|
|
2018-03-15 21:04:31 +01:00
|
|
|
if not os.path.exists (hb_shape_fuzzer):
|
2018-01-02 21:22:12 +01:00
|
|
|
if len (sys.argv) == 1 or not os.path.exists (sys.argv[1]):
|
2018-03-15 21:04:31 +01:00
|
|
|
print ("""Failed to find hb-shape-fuzzer binary automatically,
|
2018-01-02 21:22:12 +01:00
|
|
|
please provide it as the first argument to the tool""")
|
|
|
|
sys.exit (1)
|
|
|
|
|
2018-03-15 21:04:31 +01:00
|
|
|
hb_shape_fuzzer = sys.argv[1]
|
2018-01-01 08:47:51 +01:00
|
|
|
|
2018-03-15 21:04:31 +01:00
|
|
|
print ('hb_shape_fuzzer:', hb_shape_fuzzer)
|
2017-12-29 20:43:29 +01:00
|
|
|
fails = 0
|
|
|
|
|
2018-03-16 00:12:00 +01:00
|
|
|
parent_path = os.path.join (srcdir, "..", "shaping", "data", "in-house", "tests")
|
|
|
|
for line in open (os.path.join (parent_path, "fuzzed.tests")):
|
2017-12-29 20:43:29 +01:00
|
|
|
font = line.split (":")[0]
|
2018-03-16 00:12:00 +01:00
|
|
|
font_path = os.path.join (parent_path, font)
|
2017-12-29 20:43:29 +01:00
|
|
|
|
2018-03-16 00:12:00 +01:00
|
|
|
p = subprocess.Popen ([hb_shape_fuzzer, font_path])
|
2017-12-29 20:43:29 +01:00
|
|
|
|
|
|
|
if p.wait () != 0:
|
|
|
|
fails = fails + 1
|
|
|
|
|
|
|
|
if fails:
|
2018-03-15 23:41:08 +01:00
|
|
|
print ("%i shape fuzzer related tests failed." % fails)
|
2017-12-29 20:43:29 +01:00
|
|
|
sys.exit (1)
|