[build] Change how platform shaper tests are enable

Run the tests unconditionally and skip if the shaper is not available.
This fixes distcheck (https://github.com/harfbuzz/harfbuzz/pull/3504)
and shows SKIP for these tests instead of ignoring them.
This commit is contained in:
Khaled Hosny 2022-03-24 06:23:22 +02:00
parent 38575c9042
commit f76ffa8374
5 changed files with 37 additions and 38 deletions

View File

@ -14,10 +14,18 @@ EXTRA_DIST = \
$(NULL)
TEST_EXTENSIONS = .tests
TESTS_ENVIRONMENT =
if HAVE_FREETYPE
TESTS_ENVIRONMENT = HAVE_FREETYPE=1
else
TESTS_ENVIRONMENT = HAVE_FREETYPE=0
TESTS_ENVIRONMENT += HAVE_FREETYPE=1
endif
if HAVE_CORETEXT
TESTS_ENVIRONMENT += HAVE_CORETEXT=1
endif
if HAVE_DIRECTWRITE
TESTS_ENVIRONMENT += HAVE_DIRECTWRITE=1
endif
if HAVE_UNISCRIBE
TESTS_ENVIRONMENT += HAVE_UNISCRIBE=1
endif
TESTS_LOG_COMPILER = $(srcdir)/../../run-tests.py $(top_builddir)/util/hb-shape$(EXEEXT)

View File

@ -13,9 +13,11 @@ TESTS = \
tests/collections.tests \
tests/color-fonts.tests \
tests/context-matching.tests \
tests/coretext.tests \
tests/cursive-positioning.tests \
tests/default-ignorables.tests \
tests/digits.tests \
tests/directwrite.tests \
tests/emoji.tests \
tests/emoji-clusters.tests \
tests/fallback-positioning.tests \
@ -59,6 +61,7 @@ TESTS = \
tests/tibetan-contractions-2.tests \
tests/tibetan-vowels.tests \
tests/tt-kern-gpos.tests \
tests/uniscribe.tests \
tests/unsafe-to-concat.tests \
tests/use-indic3.tests \
tests/use-marchen.tests \
@ -71,15 +74,5 @@ TESTS = \
tests/zero-width-marks.tests \
$(NULL)
if HAVE_CORETEXT
TESTS += tests/coretext.tests
endif
if HAVE_DIRECTWRITE
TESTS += tests/directwrite.tests
endif
if HAVE_UNISCRIBE
TESTS += tests/uniscribe.tests
endif
DISABLED_TESTS = \
$(NULL)

View File

@ -1,4 +1,4 @@
in_house_tests_base = [
in_house_tests = [
'aat-morx.tests',
'aat-trak.tests',
'arabic-fallback-shaping.tests',
@ -13,9 +13,11 @@ in_house_tests_base = [
'collections.tests',
'color-fonts.tests',
'context-matching.tests',
'coretext.tests',
'cursive-positioning.tests',
'default-ignorables.tests',
'digits.tests',
'directwrite.tests',
'emoji.tests',
'emoji-clusters.tests',
'fallback-positioning.tests',
@ -59,6 +61,7 @@ in_house_tests_base = [
'tibetan-contractions-2.tests',
'tibetan-vowels.tests',
'tt-kern-gpos.tests',
'uniscribe.tests',
'unsafe-to-concat.tests',
'use-indic3.tests',
'use-marchen.tests',
@ -70,15 +73,3 @@ in_house_tests_base = [
'vertical.tests',
'zero-width-marks.tests',
]
in_house_tests_coretext = [
'coretext.tests',
]
in_house_tests_uniscribe = [
'uniscribe.tests',
]
in_house_tests_directwrite = [
'directwrite.tests',
]

View File

@ -7,17 +7,9 @@ shape_run_tests_py = find_program('run-tests.py')
env = environment()
env.set('HAVE_FREETYPE', '@0@'.format(conf.get('HAVE_FREETYPE', 0)))
in_house_tests = in_house_tests_base
if conf.get('HAVE_CORETEXT', 0) == 1
in_house_tests += in_house_tests_coretext
endif
if conf.get('HAVE_UNISCRIBE', 0) == 1
in_house_tests += in_house_tests_uniscribe
endif
if conf.get('HAVE_DIRECTWRITE', 0) == 1
in_house_tests += in_house_tests_directwrite
endif
env.set('HAVE_CORETEXT', '@0@'.format(conf.get('HAVE_CORETEXT', 0)))
env.set('HAVE_DIRECTWRITE', '@0@'.format(conf.get('HAVE_DIRECTWRITE', 0)))
env.set('HAVE_UNISCRIBE', '@0@'.format(conf.get('HAVE_UNISCRIBE', 0)))
foreach file_name : in_house_tests
test_name = file_name.split('.')[0]

View File

@ -11,7 +11,10 @@ def shape_cmd(command):
args = sys.argv[1:]
have_freetype = bool(int(os.getenv ('HAVE_FREETYPE', '1')))
have_freetype = int(os.getenv ('HAVE_FREETYPE', 1))
have_coretext = int(os.getenv ('HAVE_CORETEXT', 0))
have_directwrite = int(os.getenv ('HAVE_DIRECTWRITE', 0))
have_uniscribe = int(os.getenv ('HAVE_UNISCRIBE', 0))
if not args or args[0].find('hb-shape') == -1 or not os.path.exists (args[0]):
sys.exit ("""First argument does not seem to point to usable hb-shape.""")
@ -91,6 +94,18 @@ for filename in args:
skips += 1
continue
if "--shaper=coretext" in options and not have_coretext:
skips += 1
continue
if "--shaper=directwrite" in options and not have_directwrite:
skips += 1
continue
if "--shaper=uniscribe" in options and not have_uniscribe:
skips += 1
continue
if "--font-funcs=ot" in options or not have_freetype:
glyphs1 = shape_cmd ([fontfile, "--font-funcs=ot"] + extra_options + ["--unicodes", unicodes] + options)
else: