From f76ffa8374799b5acb16a0e25d72ae80d4d3f964 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Thu, 24 Mar 2022 06:23:22 +0200 Subject: [PATCH] [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. --- test/shape/data/in-house/Makefile.am | 14 +++++++++++--- test/shape/data/in-house/Makefile.sources | 13 +++---------- test/shape/data/in-house/meson.build | 17 ++++------------- test/shape/meson.build | 14 +++----------- test/shape/run-tests.py | 17 ++++++++++++++++- 5 files changed, 37 insertions(+), 38 deletions(-) diff --git a/test/shape/data/in-house/Makefile.am b/test/shape/data/in-house/Makefile.am index a2845785e..2ecf1fb29 100644 --- a/test/shape/data/in-house/Makefile.am +++ b/test/shape/data/in-house/Makefile.am @@ -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) diff --git a/test/shape/data/in-house/Makefile.sources b/test/shape/data/in-house/Makefile.sources index a04528fa0..0145f1913 100644 --- a/test/shape/data/in-house/Makefile.sources +++ b/test/shape/data/in-house/Makefile.sources @@ -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) diff --git a/test/shape/data/in-house/meson.build b/test/shape/data/in-house/meson.build index 2da9dab14..53b81dac8 100644 --- a/test/shape/data/in-house/meson.build +++ b/test/shape/data/in-house/meson.build @@ -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', -] diff --git a/test/shape/meson.build b/test/shape/meson.build index be72dda76..beb6cd2c5 100644 --- a/test/shape/meson.build +++ b/test/shape/meson.build @@ -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] diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index 83f1fec2e..478f2a913 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -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: