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