1# Process this file with automake to produce Makefile.in 2 3NULL = 4EXTRA_DIST = 5CLEANFILES = 6DISTCLEANFILES = 7MAINTAINERCLEANFILES = 8 9if HAVE_GLIB 10AM_CPPFLAGS = -DSRCDIR="\"$(srcdir)\"" -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) 11LDADD = $(top_builddir)/src/libharfbuzz.la $(GLIB_LIBS) $(GTHREAD_LIBS) 12 13EXTRA_DIST += hb-test.h 14 15check_PROGRAMS = $(TEST_PROGS) 16noinst_PROGRAMS = $(TEST_PROGS) 17 18TEST_PROGS = \ 19 test-blob \ 20 test-buffer \ 21 test-common \ 22 test-font \ 23 test-object \ 24 test-set \ 25 test-shape \ 26 test-unicode \ 27 test-version \ 28 $(NULL) 29 30test_unicode_CPPFLAGS = $(AM_CPPFLAGS) 31if HAVE_GLIB 32test_unicode_CPPFLAGS += $(GLIB_CFLAGS) 33endif 34if HAVE_ICU 35test_unicode_CPPFLAGS += $(ICU_CFLAGS) 36endif 37 38 39if HAVE_OT 40TEST_PROGS += \ 41 test-ot-tag \ 42 $(NULL) 43endif 44 45# Tests for header compilation 46TEST_PROGS += \ 47 test-c \ 48 test-cplusplus \ 49 $(NULL) 50test_cplusplus_SOURCES = test-cplusplus.cc 51test_c_CPPFLAGS = $(AM_CPPFLAGS) 52test_cplusplus_CPPFLAGS = $(AM_CPPFLAGS) 53if HAVE_ICU 54test_c_CPPFLAGS += $(ICU_CFLAGS) 55test_cplusplus_CPPFLAGS += $(ICU_CFLAGS) 56endif 57if HAVE_FREETYPE 58test_c_CPPFLAGS += $(FREETYPE_CFLAGS) 59test_cplusplus_CPPFLAGS += $(FREETYPE_CFLAGS) 60endif 61 62# Default test running environment 63TESTS = $(TEST_PROGS) 64TESTS_ENVIRONMENT = \ 65 MALLOC_CHECK_=2 \ 66 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) \ 67 G_DEBUG=gc-friendly \ 68 G_SLICE=always-malloc \ 69 srcdir=$(srcdir) \ 70 $(NULL) 71 72 73# check-tool: Run tests under $(TOOL) 74check-tool: 75 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \ 76 TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute \ 77 env $(TOOL)' 78# check-tool-raw: Run tests under $(TOOL), but don't run under libtool 79check-tool-raw: 80 $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \ 81 TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) \ 82 env $(TOOL)' 83 84# check-gtester: Run tests under gtester 85GTESTER = gtester 86check-gtester: 87 $(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool-raw TOOL="$(GTESTER) --verbose --keep-going" 88 89 90# Check tests under valgrind. Saves log to log-valgrind.txt 91VALGRIND_FLAGS = \ 92 --tool=memcheck --suppressions=$(srcdir)/.valgrind-suppressions \ 93 --track-origins=yes \ 94 --leak-check=yes 95 $(EXTRA_VALGRIND_FLAGS) 96# Can't do for now: --show-reachable=yes 97CLEANFILES += log-valgrind.txt 98valgrind_verbose = $(valgrind_verbose_@AM_V@) 99valgrind_verbose_ = $(valgrind_verbose_@AM_DEFAULT_V@) 100valgrind_verbose_0 = | \ 101 grep '\(^[^=]\|ERROR SUMMARY\|definitely lost\|indirectly lost\)' | grep -v ': 0' 102# TODO: The following check does not fail if valgrind finds error. It should. 103check-valgrind: 104 $(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool TOOL="valgrind $(VALGRIND_FLAGS)" \ 105 2>&1 | tee log-valgrind.txt $(valgrind_verbose) 106 107 108# check-symbols: Finds untested API symbols 109symbols-tested.txt: $(TEST_PROGS) 110 $(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \ 111 | grep ' U hb_' | sed 's/.* U hb_/hb_/' \ 112 | sort | uniq > $@.tmp && mv $@.tmp $@ 113symbols-exported.txt: $(top_builddir)/src/.libs/libharfbuzz.so 114 $(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \ 115 | grep ' T ' | sed 's/.* T //' | grep -v '^\(_init\|_fini\)$$' \ 116 | sort | uniq > $@.tmp && mv $@.tmp $@ 117symbols-untested.txt: symbols-tested.txt symbols-exported.txt 118 $(AM_V_GEN)diff $^ > $@.tmp; mv $@.tmp $@ 119CLEANFILES += symbols-tested.txt symbols-exported.txt symbols-untested.txt 120check-symbols: symbols-untested.txt 121 @! cat $^ | grep . 122 123 124 125else 126check-am: err-glib 127err-glib: 128 @echo "You need to have glib support enabled to run the tests" 129 @exit 77 130endif 131 132.PHONY: check-symbols check-tool check-valgrind 133 134-include $(top_srcdir)/git.mk 135