1#!/usr/bin/env python 2 3from __future__ import print_function, division, absolute_import 4 5import sys, os, subprocess 6 7srcdir = os.environ.get ("srcdir", ".") 8EXEEXT = os.environ.get ("EXEEXT", "") 9top_builddir = os.environ.get ("top_builddir", ".") 10hb_subset_fuzzer = os.path.join (top_builddir, "hb-subset-fuzzer" + EXEEXT) 11 12if not os.path.exists (hb_subset_fuzzer): 13 if len (sys.argv) < 2 or not os.path.exists (sys.argv[1]): 14 print ("""Failed to find hb-subset-fuzzer binary automatically, 15please provide it as the first argument to the tool""") 16 sys.exit (1) 17 18 hb_subset_fuzzer = sys.argv[1] 19 20print ('hb_subset_fuzzer:', hb_subset_fuzzer) 21fails = 0 22 23def run_dir (parent_path): 24 global fails 25 for file in os.listdir (parent_path): 26 path = os.path.join(parent_path, file) 27 28 print ("running subset fuzzer against %s" % path) 29 p = subprocess.Popen ([hb_subset_fuzzer, path]) 30 31 if p.wait () != 0: 32 print ("failed for %s" % path) 33 fails = fails + 1 34 35 if p.wait () != 0: 36 print ("failed for %s" % path) 37 fails = fails + 1 38 39run_dir (os.path.join (srcdir, "..", "subset", "data", "fonts")) 40# TODO running these tests very slow tests. Fix and re-enable 41#run_dir (os.path.join (srcdir, "fonts")) 42 43if fails: 44 print ("%i subset fuzzer related tests failed." % fails) 45 sys.exit (1) 46