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