[aat] Improve unsafe-to-break logic

Reduces false-positives.  See comments for new logic.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2860

Adjusts run-tests.sh to allow unhashed absolute filenames.
This commit is contained in:
Behdad Esfahbod committed 2021-02-19 16:23:22 -07:00
1 parent cf203936d7
commit d8ea552d10
3 files changed
+80 -29

No files matched your search

@@ -1,3 +1,6 @@
# https://github.com/harfbuzz/harfbuzz/pull/2871
/System/Library/Fonts/LucidaGrande.ttc:--font-funcs ot --show-flags:U+0041,U+0042,U+0043,U+0044:[A=0+1413|B=1+1178|C=2+1417|D=3+1534]
# 10.12.6 https://gist.github.com/ebraminio/1704341fa16b06979e605aafd88198cf
/System/Library/Fonts/Helvetica.dfont@c7bec2785a4c402b7809b5e35337c3d24c18e281:--font-funcs ot:U+006D,U+0300:[m=0+1706|gravecmb=0@-284,10+0]
/System/Library/Fonts/LucidaGrande.ttc@d89a9d7e57767bfe3b5a4cfd22bb1e9dbe03a062:--font-funcs ot:U+006D,U+0300:[mgrave=0+1912]
+9 -8
View File
@@ -67,17 +67,18 @@ for filename in args:
if os.name == 'nt': # Skip on Windows
continue
fontfile, expected_hash = fontfile.split('@')
fontfile, expected_hash = (fontfile.split('@') + [''])[:2]
try:
with open (fontfile, 'rb') as ff:
actual_hash = hashlib.sha1 (ff.read()).hexdigest ().strip ()
if actual_hash != expected_hash:
print ('different version of %s found; Expected hash %s, got %s; skipping.' %
(fontfile, expected_hash, actual_hash))
skips += 1
continue
except:
if expected_hash:
actual_hash = hashlib.sha1 (ff.read()).hexdigest ().strip ()
if actual_hash != expected_hash:
print ('different version of %s found; Expected hash %s, got %s; skipping.' %
(fontfile, expected_hash, actual_hash))
skips += 1
continue
except IOError:
print ('%s not found, skip.' % fontfile)
skips += 1
continue