[HarfBuzz] harfbuzz: Branch 'master' - 11 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Dec 14 18:39:11 UTC 2017


 .ci/deploy-docs.sh                 |    2 
 .ci/run-coveralls.sh               |   14 ++++
 .circleci/config.yml               |   19 +++++-
 .travis.yml                        |   69 +++++++++++++---------
 CMakeLists.txt                     |    5 +
 appveyor.yml                       |   28 ++++++---
 src/hb-ot-layout-common-private.hh |    4 -
 src/hb-set-digest-private.hh       |   12 +++
 src/hb-set-private.hh              |    6 +
 test/CMakeLists.txt                |    1 
 test/api/CMakeLists.txt            |   39 ++++++++++++
 test/api/Makefile.am               |   12 +--
 test/api/hb-test.h                 |    2 
 test/api/test-c.c                  |    2 
 test/shaping/Makefile.am           |    4 -
 test/shaping/run-tests.py          |  115 +++++++++++++++++++++++++++++++++++++
 test/shaping/run-tests.sh          |   65 --------------------
 17 files changed, 286 insertions(+), 113 deletions(-)

New commits:
commit 0fe62c1f333200523e10663f47a58b82e3f22154
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Dec 13 13:12:20 2017 -0800

    [set] Add add_array()
    
    To be used to optimize adding a whole bunch of (sorted) items at the same time,
    as in CoverageFormat1.

diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index 86a74ccb..82ace31b 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -716,9 +716,7 @@ struct CoverageFormat1
 
   template <typename set_t>
   inline void add_coverage (set_t *glyphs) const {
-    unsigned int count = glyphArray.len;
-    for (unsigned int i = 0; i < count; i++)
-      glyphs->add (glyphArray[i]);
+    glyphs->add_array (glyphArray.array, glyphArray.len);
   }
 
   public:
diff --git a/src/hb-set-digest-private.hh b/src/hb-set-digest-private.hh
index 9135136c..75087085 100644
--- a/src/hb-set-digest-private.hh
+++ b/src/hb-set-digest-private.hh
@@ -80,6 +80,12 @@ struct hb_set_digest_lowest_bits_t
       mask |= mb + (mb - ma) - (mb < ma);
     }
   }
+  template <typename T>
+  inline void add_array (const T *array, unsigned int count)
+  {
+    for (unsigned int i = 0; i < count; i++)
+      add (array[i]);
+  }
 
   inline bool may_have (hb_codepoint_t g) const {
     return !!(mask & mask_for (g));
@@ -112,6 +118,12 @@ struct hb_set_digest_combiner_t
     head.add_range (a, b);
     tail.add_range (a, b);
   }
+  template <typename T>
+  inline void add_array (const T *array, unsigned int count)
+  {
+    head.add_array (array, count);
+    tail.add_array (array, count);
+  }
 
   inline bool may_have (hb_codepoint_t g) const {
     return head.may_have (g) && tail.may_have (g);
diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index 5971e9b7..e3048657 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -248,6 +248,12 @@ struct hb_set_t
       page->add_range (major_start (mb), b);
     }
   }
+  template <typename T>
+  inline void add_array (const T *array, unsigned int count)
+  {
+    for (unsigned int i = 0; i < count; i++)
+      add (array[i]);
+  }
   inline void del (hb_codepoint_t g)
   {
     if (unlikely (in_error)) return;
commit 20e69c950d431391f92335f8845e5d4291aca8f3
Author: ebraminio <ebrahim at gnu.org>
Date:   Thu Dec 7 12:24:12 2017 +0330

    [test] print commented line, like the original script (#649)

diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py
index a9aec0c6..ebba75aa 100755
--- a/test/shaping/run-tests.py
+++ b/test/shaping/run-tests.py
@@ -62,13 +62,13 @@ for f in args:
 		f = open (f)
 
 	for line in f:
+		fontfile, options, unicodes, glyphs_expected = line.split (":")
+
 		if line.startswith ("#"):
+			if not reference:
+				print ("# hb-shape %s --unicodes %s" % (fontfile, unicodes))
 			continue
 
-		fontfile, options, unicodes, glyphs_expected = line.split (":")
-		if not reference:
-			print ("# hb-shape %s --unicodes %s" % (fontfile, unicodes))
-
 		if not reference:
 			print ("hb-shape %s %s %s --unicodes %s" %
 					 (fontfile, extra_options, options, unicodes))
commit 71ad2777c52aeb0842038881899499a49cb895f2
Author: ebraminio <ebrahim at gnu.org>
Date:   Thu Dec 7 11:35:36 2017 +0330

    [ci] Add an after distribution test runner (#648)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 27738635..2824bfdb 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -49,6 +49,15 @@ jobs:
       - run: ninja -Cbuild test
       - run: ninja -Cbuild install
 
+  distdir:
+    docker:
+      - image: dockcross/base
+    steps:
+      - checkout
+      - run: apt update && apt install -y pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev
+      - run: ./autogen.sh && make distdir
+      - run: cd harfbuzz-* && ./configure && make && make check && make install
+
   psvita:
     docker:
       - image: dockcross/base
@@ -107,6 +116,7 @@ workflows:
       - archlinux
       - freebsd9
       - base
+      - distdir
       - psvita
       - android-arm
       - browser-asmjs
commit 5f061d27d5289c7608a6579dca668b1f5be7f4e8
Author: ebraminio <ebrahim at gnu.org>
Date:   Thu Dec 7 11:22:55 2017 +0330

    Rewrite run-tests in python (#647)

diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am
index 592754b2..4cf55749 100644
--- a/test/shaping/Makefile.am
+++ b/test/shaping/Makefile.am
@@ -26,7 +26,7 @@ EXTRA_DIST += \
 	hb-unicode-encode \
 	hb-unicode-prettyname \
 	record-test.sh \
-	run-tests.sh \
+	run-tests.py \
 	texts/in-tree \
 	fonts/sha1sum \
 	$(TESTS) \
@@ -104,7 +104,7 @@ TESTS_ENVIRONMENT = \
 	$(NULL)
 endif
 
-TESTS_LOG_COMPILER = sh $(srcdir)/run-tests.sh
+TESTS_LOG_COMPILER = python $(srcdir)/run-tests.py
 
 .PHONY: manifests
 
diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py
new file mode 100755
index 00000000..a9aec0c6
--- /dev/null
+++ b/test/shaping/run-tests.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import sys, os, subprocess
+
+
+try:
+	input = raw_input
+except NameError:
+	pass
+
+
+def cmd(command):
+	p = subprocess.Popen (
+		command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+	p.wait ()
+	print (p.stderr.read (), file=sys.stderr)
+	return p.stdout.read ().decode ("utf-8"), p.returncode
+
+
+srcdir = os.environ.get ("srcdir", ".")
+builddir = os.environ.get ("builddir", ".")
+top_builddir = os.environ.get ("top_builddir",
+	os.path.normpath (os.path.join (os.getcwd (), "..", "..")))
+EXEEXT = os.environ.get ("EXEEXT", "")
+
+extra_options = "--verify"
+hb_shape = os.path.join (top_builddir, "util", "hb-shape" + EXEEXT)
+
+fails = 0
+args = sys.argv[1:]
+
+reference = False
+if len (args) and args[0] == "--reference":
+	reference = True
+	args = args[1:]
+
+if not len (args):
+	args = [sys.stdin]
+
+for f in args:
+	if not reference:
+		if f == sys.stdin:
+			print ("Running tests from standard input")
+		else:
+			print ("Running tests in " + f)
+
+	if f == sys.stdin:
+		def f():
+			while True:
+				try:
+					line = input ()
+				except EOFError:
+					break
+
+				if len (line):
+					yield line
+				else:
+					break
+		f = f()
+	else:
+		f = open (f)
+
+	for line in f:
+		if line.startswith ("#"):
+			continue
+
+		fontfile, options, unicodes, glyphs_expected = line.split (":")
+		if not reference:
+			print ("# hb-shape %s --unicodes %s" % (fontfile, unicodes))
+
+		if not reference:
+			print ("hb-shape %s %s %s --unicodes %s" %
+					 (fontfile, extra_options, options, unicodes))
+
+		glyphs1, returncode = cmd ([hb_shape, "--font-funcs=ft",
+			os.path.join (srcdir, fontfile), extra_options, "--unicodes",
+			unicodes] + (options.split (' ') if len(options) else []))
+
+		if returncode:
+			print ("hb-shape --font-funcs=ft failed.", file=sys.stderr)
+			fails = fails + 1
+			#continue
+
+		glyphs2, returncode = cmd ([hb_shape, "--font-funcs=ot",
+			os.path.join (srcdir, fontfile), extra_options, "--unicodes",
+			unicodes] + (options.split (' ') if len(options) else []))
+
+		if returncode:
+			print ("hb-shape --font-funcs=ot failed.", file=sys.stderr)
+			fails = fails + 1
+			#continue
+
+		if glyphs1 != glyphs2:
+			print ("FT funcs: " + glyphs1, file=sys.stderr)
+			print ("OT funcs: " + glyphs2, file=sys.stderr)
+			fails = fails + 1
+
+		if reference:
+			print (":".join ([fontfile, options, unicodes, glyphs1]))
+			continue
+
+		if glyphs1.strip() != glyphs_expected.strip():
+			print ("Actual:   " + glyphs1, file=sys.stderr)
+			print ("Expected: " + glyphs_expected, file=sys.stderr)
+			fails = fails + 1
+
+if fails != 0:
+	if not reference:
+		print (str (fails) + " tests failed.")
+	sys.exit (1)
+
+else:
+	if not reference:
+		print ("All tests passed.")
diff --git a/test/shaping/run-tests.sh b/test/shaping/run-tests.sh
deleted file mode 100755
index 5fa8017c..00000000
--- a/test/shaping/run-tests.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-
-test "x$srcdir" = x && srcdir=.
-test "x$builddir" = x && builddir=.
-test "x$top_builddir" = x && top_builddir=../..
-
-extra_options="--verify"
-hb_shape="$top_builddir/util/hb-shape$EXEEXT"
-#hb_shape="$top_builddir/util/hb-shape$EXEEXT"
-
-fails=0
-
-reference=false
-if test "x$1" = x--reference; then
-	reference=true
-	shift
-fi
-
-if test $# = 0; then
-	set /dev/stdin
-fi
-
-for f in "$@"; do
-	$reference || echo "Running tests in $f"
-	while IFS=: read fontfile options unicodes glyphs_expected; do
-		if echo "$fontfile" | grep -q '^#'; then
-			$reference || echo "# hb-shape $fontfile --unicodes $unicodes"
-			continue
-		fi
-		$reference || echo "hb-shape $fontfile $extra_options $options --unicodes $unicodes"
-		glyphs1=`$hb_shape --font-funcs=ft "$srcdir/$fontfile" $extra_options $options --unicodes "$unicodes"`
-		if test $? != 0; then
-			echo "hb-shape --font-funcs=ft failed." >&2
-			fails=$((fails+1))
-			#continue
-		fi
-		glyphs2=`$hb_shape --font-funcs=ot "$srcdir/$fontfile" $extra_options $options --unicodes "$unicodes"`
-		if test $? != 0; then
-			echo "hb-shape --font-funcs=ot failed." >&2
-			fails=$((fails+1))
-			#continue
-		fi
-		if ! test "x$glyphs1" = "x$glyphs2"; then
-			echo "FT funcs: $glyphs1" >&2
-			echo "OT funcs: $glyphs2" >&2
-			fails=$((fails+1))
-		fi
-		if $reference; then
-			echo "$fontfile:$options:$unicodes:$glyphs1"
-			continue
-		fi
-		if ! test "x$glyphs1" = "x$glyphs_expected"; then
-			echo "Actual:   $glyphs1" >&2
-			echo "Expected: $glyphs_expected" >&2
-			fails=$((fails+1))
-		fi
-	done < "$f"
-done
-
-if test $fails != 0; then
-	$reference || echo "$fails tests failed."
-	exit 1
-else
-	$reference || echo "All tests passed."
-fi
commit 3ce6c7bd96296a44950110e84ade76c7c1df06e4
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Wed Dec 6 21:08:20 2017 +0200

    [ci] Sort out Travis configuration
    
    Use a matrix to avoid a gazillion if's.

diff --git a/.ci/deploy-docs.sh b/.ci/deploy-docs.sh
index 086982b3..a8a85233 100755
--- a/.ci/deploy-docs.sh
+++ b/.ci/deploy-docs.sh
@@ -3,6 +3,8 @@
 set -x
 set -o errexit -o nounset
 
+if test "x$TRAVIS_SECURE_ENV_VARS" != xtrue; then exit; fi
+
 BRANCH="$TRAVIS_BRANCH"
 if test "x$BRANCH" != xmaster; then exit; fi
 
diff --git a/.ci/run-coveralls.sh b/.ci/run-coveralls.sh
new file mode 100755
index 00000000..58b83114
--- /dev/null
+++ b/.ci/run-coveralls.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -x
+set -o errexit -o nounset
+
+if test "x$TRAVIS_SLUG" != x"harfbuzz/harfbuzz"; then exit; fi
+
+pip install --user nose
+pip install --user cpp-coveralls
+export PATH=$HOME/.local/bin:$PATH
+
+rm -f src/.libs/NONE.gcov
+touch src/NONE
+coveralls -e docs
diff --git a/.travis.yml b/.travis.yml
index 315e5ce4..5b5ae0e7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,39 +1,54 @@
 # Build Configuration for Travis
-sudo: required # For Trusty beta
-os:
-  - linux
-  - osx
 dist: trusty
+
 language: cpp
-compiler:
-  - clang
-  - gcc
+
 env:
   global:
     - CPPFLAGS=""
     - CFLAGS="-Werror --coverage"
     - CXXFLAGS="-Werror -Wno-deprecated-register --coverage" # glib uses register and clang raises a warning
     - LDFLAGS="--coverage"
-install:
-  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then pip install --user nose; fi
-  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then pip install --user cpp-coveralls; fi # for coveralls.io code coverage tracking
-  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH=$HOME/.local/bin:$PATH; fi # Make sure we can find the above Python packages
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"; fi; # https://github.com/harfbuzz/harfbuzz/issues/345
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi;
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew uninstall libtool && brew install libtool; fi # Workaround Travis/brew bug
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install ragel freetype glib gobject-introspection cairo icu4c graphite2; fi
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew link --force icu4c; fi # icu4c is keg-only
-script:
-  - NOCONFIGURE=1 ./autogen.sh
-  - export CONFIGURE_OPTS="--with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2"
-  - if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" == "gcc" ]; then export CONFIGURE_OPTS="$CONFIGURE_OPTS  --enable-gtk-doc"; fi
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export CONFIGURE_OPTS="$CONFIGURE_OPTS --with-coretext"; fi
-  - ./configure $CONFIGURE_OPTS
-  - make
-  - make check || (cat */test-suite.log test/*/test-suite.log && false)
-  - if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" == "gcc" -a "$TRAVIS_SLUG" == "harfbuzz/harfbuzz" ]; then rm -f src/.libs/NONE.gcov; touch src/NONE; coveralls -e docs; fi
-after_success:
-  - if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" == "gcc" -a "$TRAVIS_SECURE_ENV_VARS" == "true" ]; then bash .ci/deploy-docs.sh; fi
+    - CONFIGURE_OPTS="--with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2"
+    - NOCONFIGURE=1
+
+matrix:
+  include:
+    - os: linux
+      compiler: gcc
+      script:
+        - ./autogen.sh
+        - ./configure $CONFIGURE_OPTS --enable-gtk-doc
+        - make
+        - make check || (cat */test-suite.log test/*/test-suite.log && false)
+      after_success:
+        - bash .ci/run-coveralls.sh # for coveralls.io code coverage tracking
+        - bash .ci/deploy-docs.sh
+
+    - os: linux
+      compiler: clang
+      script:
+        - ./autogen.sh
+        - ./configure $CONFIGURE_OPTS
+        - make
+        - make check || (cat */test-suite.log test/*/test-suite.log && false)
+
+    - os: osx
+      compiler: clang
+      install:
+          # https://github.com/harfbuzz/harfbuzz/issues/345
+        - export CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
+        - brew update;
+          # Workaround Travis/brew bug
+        - brew uninstall libtool && brew install libtool
+        - brew install ragel freetype glib gobject-introspection cairo icu4c graphite2
+        - brew link --force icu4c # icu4c is keg-only
+      script:
+        - ./autogen.sh
+        - ./configure $CONFIGURE_OPTS --with-coretext
+        - make
+        - make check || (cat */test-suite.log test/*/test-suite.log && false)
+
 notifications:
   irc: "irc.freenode.org#harfbuzz"
   email: harfbuzz at lists.freedesktop.org
commit 5a6d2b986a02fc47fa9dcbb330e6949af8e375ff
Author: ebraminio <ebrahim at gnu.org>
Date:   Wed Dec 6 18:27:27 2017 +0330

    [ci] minor improvements (#644)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 63ce2911..27738635 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -11,6 +11,8 @@ jobs:
       - run: wget http://$ODSUSER:$ODSPASS@behdad.org/harfbuzz-private/OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2 && tar xf OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2 --owner root --group root --no-same-owner
       - run: CC=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/suncc CXX=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/sunCC cmake -DHB_HAVE_GRAPHITE2=ON -DHB_BUILTIN_UCDN=ON -DHB_HAVE_GLIB=ON -DHB_HAVE_ICU=ON -DHB_HAVE_FREETYPE=ON -Bbuild -H.
       - run: make -Cbuild
+      - run: make -Cbuild test
+      - run: make -Cbuild install
 
   fedora:
     docker:
@@ -45,6 +47,7 @@ jobs:
       - run: cmake -DHB_HAVE_FREETYPE=ON -DHB_HAVE_GRAPHITE2=ON -DHB_BUILTIN_UCDN=ON -DHB_HAVE_GLIB=ON -DHB_HAVE_ICU=ON -DHB_BUILD_UTILS=ON -Bbuild -H. -GNinja
       - run: ninja -Cbuild
       - run: ninja -Cbuild test
+      - run: ninja -Cbuild install
 
   psvita:
     docker:
diff --git a/appveyor.yml b/appveyor.yml
index 926b50d2..9a34052b 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -41,7 +41,7 @@ build_script:
   - 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" cmake -DHB_HAVE_UNISCRIBE=ON -DHB_HAVE_DIRECTWRITE=ON -DHB_HAVE_GLIB=ON -DHB_HAVE_FREETYPE=ON -G "%generator%" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake ../'
 
   - 'if "%compiler%"=="msvc" msbuild harfbuzz.sln /p:Configuration=%configuration% /p:Platform=%platform%'
-  - 'if "%compiler%"=="msvc" ctest'
+  - 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" ctest'
 
   - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config}"'
   - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || (cat */test-suite.log test/*/test-suite.log && false)"'
commit 840a32e3f3ed0a85bfa84e69efaeb504d92d1aa7
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Wed Dec 6 00:49:25 2017 +0200

    Run cmake tests on CI builds

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 370252a9..63ce2911 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -41,8 +41,10 @@ jobs:
       - image: dockcross/base
     steps:
       - checkout
-      - run: apt update && apt install ragel
-      - run: cmake -Bbuild -H. -GNinja && ninja -Cbuild
+      - run: apt update && apt install -y pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev
+      - run: cmake -DHB_HAVE_FREETYPE=ON -DHB_HAVE_GRAPHITE2=ON -DHB_BUILTIN_UCDN=ON -DHB_HAVE_GLIB=ON -DHB_HAVE_ICU=ON -DHB_BUILD_UTILS=ON -Bbuild -H. -GNinja
+      - run: ninja -Cbuild
+      - run: ninja -Cbuild test
 
   psvita:
     docker:
diff --git a/appveyor.yml b/appveyor.yml
index 9bcdb58d..926b50d2 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -41,7 +41,7 @@ build_script:
   - 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" cmake -DHB_HAVE_UNISCRIBE=ON -DHB_HAVE_DIRECTWRITE=ON -DHB_HAVE_GLIB=ON -DHB_HAVE_FREETYPE=ON -G "%generator%" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake ../'
 
   - 'if "%compiler%"=="msvc" msbuild harfbuzz.sln /p:Configuration=%configuration% /p:Platform=%platform%'
-
+  - 'if "%compiler%"=="msvc" ctest'
 
   - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config}"'
   - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || (cat */test-suite.log test/*/test-suite.log && false)"'
commit c8609551485cfca6f9629c565b9dd5f02aa14f3e
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Wed Dec 6 00:43:28 2017 +0200

    Add API tests to cmake build

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 23576099..24ccb6fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,7 @@
 cmake_minimum_required(VERSION 2.8.0)
 project(harfbuzz)
 
+enable_testing()
 
 ## Limit framework build to Xcode generator
 if (BUILD_FRAMEWORK)
@@ -683,3 +684,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
     endif ()
   endif ()
 endif ()
+
+# Needs to come last so that variables defined above are passed to
+# subdirectories.
+add_subdirectory(test)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 00000000..53d257b0
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(api)
diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt
new file mode 100644
index 00000000..4e786ba6
--- /dev/null
+++ b/test/api/CMakeLists.txt
@@ -0,0 +1,39 @@
+macro (_add_tests)
+  foreach(test_name ${ARGV})
+    if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.c)
+      add_executable (${test_name} ${test_name}.c)
+    elseif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.cc)
+      add_executable (${test_name} ${test_name}.cc)
+    else ()
+      message(FATAL_ERROR "No source file found for test ${test_name}")
+    endif ()
+    target_link_libraries (${test_name} harfbuzz)
+    add_test (${test_name} ${test_name})
+  endforeach ()
+  set_tests_properties (${ARGV} PROPERTIES ENVIRONMENT
+    "G_TEST_SRCDIR=${CMAKE_CURRENT_SOURCE_DIR};G_TEST_BUILDDIR=${CMAKE_CURRENT_BINARY_DIR}"
+    )
+endmacro ()
+
+if (HB_HAVE_GLIB)
+  _add_tests (
+    test-blob
+    test-buffer
+    test-common
+    test-font
+    test-object
+    test-set
+    test-shape
+    test-unicode
+    test-version
+    test-ot-tag
+    test-c
+    test-cplusplus
+    )
+
+  if (HB_HAVE_FREETYPE)
+    _add_tests (
+      test-ot-math
+      )
+  endif (HB_HAVE_FREETYPE)
+endif (HB_HAVE_GLIB)
diff --git a/test/api/hb-test.h b/test/api/hb-test.h
index 4d41218b..040f0c21 100644
--- a/test/api/hb-test.h
+++ b/test/api/hb-test.h
@@ -27,7 +27,9 @@
 #ifndef HB_TEST_H
 #define HB_TEST_H
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <hb-glib.h>
 
diff --git a/test/api/test-c.c b/test/api/test-c.c
index 6e8602f7..4b43b837 100644
--- a/test/api/test-c.c
+++ b/test/api/test-c.c
@@ -27,7 +27,9 @@
 /* This file tests that all headers can be included from .c files */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <hb.h>
 
commit f19126dd35b03f6e05a67cbc406b3ce4a3e35022
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Tue Dec 5 22:52:54 2017 +0200

    We are already inside “if HAVE_GLIB” check

diff --git a/test/api/Makefile.am b/test/api/Makefile.am
index 530bf3ed..231ec22d 100644
--- a/test/api/Makefile.am
+++ b/test/api/Makefile.am
@@ -31,11 +31,11 @@ TEST_PROGS = \
 	test-version \
 	$(NULL)
 
-test_unicode_CPPFLAGS = $(AM_CPPFLAGS)
+test_unicode_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	$(GLIB_CFLAGS) \
+	$(NULL)
 test_unicode_LDADD = $(LDADD)
-if HAVE_GLIB
-test_unicode_CPPFLAGS += $(GLIB_CFLAGS)
-endif
 if HAVE_ICU
 test_unicode_CPPFLAGS += $(ICU_CFLAGS)
 test_unicode_LDADD += $(top_builddir)/src/libharfbuzz-icu.la $(ICU_LIBS)
@@ -149,12 +149,12 @@ check-symbols: symbols-untested.txt
 
 
 
-else
+else # !HAVE_GLIB
 check-am: err-glib
 err-glib:
 	@echo "You need to have glib support enabled to run the tests"
 	@exit 77
-endif
+endif # HAVE_GLIB
 
 .PHONY: check-symbols check-tool check-valgrind
 
commit 7af48a3f37abac0aa1a1ad79c98399a9a71bd903
Author: ebraminio <ebrahim at gnu.org>
Date:   Wed Dec 6 14:22:19 2017 +0330

    [ci] Don't cache msys2 folder

diff --git a/appveyor.yml b/appveyor.yml
index 9857cef9..9bcdb58d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -48,7 +48,6 @@ build_script:
 
 cache:
   - c:\tools\vcpkg\installed\
-  - c:\msys64\
 
 # disable automatic tests
 test: off
commit b6f505c7164e302d2990cf056b73e918a641e976
Author: ebraminio <ebrahim at gnu.org>
Date:   Wed Dec 6 13:51:04 2017 +0330

    [ci] Enable glib and freetype on appveyor cmake (#643)

diff --git a/appveyor.yml b/appveyor.yml
index c27a899f..9857cef9 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -2,19 +2,23 @@ platform: x64
 
 environment:
   matrix:
-    - compiler: cmake
+    - compiler: msvc
       generator: Visual Studio 14
       platform: Win32
       configuration: Debug
-    - compiler: cmake
+      triplet: x86-windows
+    - compiler: msvc
       generator: Visual Studio 14 Win64
       platform: x64
       configuration: Debug
-    - compiler: cmake
+      triplet: x64-windows
+
+    - compiler: msvc
       generator: Visual Studio 14 ARM
       platform: ARM
       configuration: Debug
 
+
     - compiler: msys2
       MINGW_PREFIX: /c/msys2/mingw64/
       MINGW_CHOST: x86_64-w64-mingw32
@@ -28,14 +32,23 @@ install:
   - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-ragel"
 
 build_script:
-  - 'if "%compiler%"=="cmake" md build'
-  - 'if "%compiler%"=="cmake" cd build'
-  - 'if "%compiler%"=="cmake" set PATH=%PATH%;C:\Program Files (x86)\MSBuild\14.0\Bin;c:\msys64\mingw64\bin' # msys2 is added just for having "ragel" on PATH
-  - 'if "%compiler%"=="cmake" cmake -DHB_HAVE_UNISCRIBE=ON -DHB_HAVE_DIRECTWRITE=ON -G "%generator%" ../'
-  - 'if "%compiler%"=="cmake" msbuild harfbuzz.sln /p:Configuration=%configuration% /p:Platform=%platform%'
+  - 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" vcpkg install glib:%triplet% freetype:%triplet%'
+  - 'if "%compiler%"=="msvc" md build'
+  - 'if "%compiler%"=="msvc" cd build'
+  - 'if "%compiler%"=="msvc" set PATH=%PATH%;C:\Program Files (x86)\MSBuild\14.0\Bin;c:\msys64\mingw64\bin' # msys2 is added just for having "ragel" on PATH
+
+  - 'if "%compiler%"=="msvc" if "%platform%"=="ARM" cmake -DHB_HAVE_UNISCRIBE=ON -DHB_HAVE_DIRECTWRITE=ON -G "%generator%" ../'
+  - 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" cmake -DHB_HAVE_UNISCRIBE=ON -DHB_HAVE_DIRECTWRITE=ON -DHB_HAVE_GLIB=ON -DHB_HAVE_FREETYPE=ON -G "%generator%" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake ../'
+
+  - 'if "%compiler%"=="msvc" msbuild harfbuzz.sln /p:Configuration=%configuration% /p:Platform=%platform%'
+
 
   - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config}"'
   - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || (cat */test-suite.log test/*/test-suite.log && false)"'
 
+cache:
+  - c:\tools\vcpkg\installed\
+  - c:\msys64\
+
 # disable automatic tests
 test: off


More information about the HarfBuzz mailing list