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