[test] Switch to automake-based test-runner
[profile/ivi/org.tizen.video-player.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 = -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_LIBS = $(LDADD) $(FREETYPE_LIBS)
51 endif
52
53
54 # test-symbols: Finds untested API symbols
55 symbols-tested.txt: $(TEST_PROGS)
56         $(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
57         | grep ' U hb_' | sed 's/.* U hb_/hb_/' \
58         | sort | uniq > $@.tmp && mv $@.tmp $@
59 symbols-exported.txt: $(top_builddir)/src/.libs/libharfbuzz.so
60         $(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
61         | grep ' T ' | sed 's/.* T //' | grep -v '^\(_init\|_fini\)$$' \
62         | sort | uniq > $@.tmp && mv $@.tmp $@
63 symbols-untested.txt: symbols-tested.txt symbols-exported.txt
64         $(AM_V_GEN)diff $^ > $@.tmp; mv $@.tmp $@
65 CLEANFILES += symbols-tested.txt symbols-exported.txt symbols-untested.txt
66 test-symbols: symbols-untested.txt
67         @! cat $^ | grep .
68
69 TESTS = $(TEST_PROGS)
70 TESTS_ENVIRONMENT = \
71         MALLOC_CHECK_=2 \
72         MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) \
73         G_DEBUG=gc-friendly \
74         G_SLICE=always-malloc \
75         $(ENV)
76
77 # check-tool: Run tests under $(TOOL)
78 check-tool:
79         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
80         TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute \
81         env $(TOOL)'
82 # check-tool-raw: Run tests under $(TOOL), but don't run under libtool
83 check-tool-raw:
84         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
85         TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) \
86         env $(TOOL)'
87
88 # check-gtester: Run tests under gtester
89 GTESTER = gtester
90 check-gtester:
91         $(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool-raw TOOL="$(GTESTER) --verbose"
92
93 # Check tests under valgrind.  Saves log to valgrind-log
94 VALGRIND_FLAGS = \
95         --tool=memcheck --suppressions=$(srcdir)/.valgrind-suppressions \
96         --track-origins=yes \
97         --leak-check=yes
98         $(EXTRA_VALGRIND_FLAGS)
99 #       Can't do for now: --show-reachable=yes
100 CLEANFILES +=  valgrind-log
101 valgrind_verbose = $(valgrind_verbose_$(V))
102 valgrind_verbose_ = $(valgrind_verbose_$(AM_DEFAULT_VERBOSITY))
103 valgrind_verbose_0 = | \
104         grep '\(^[^=]\|ERROR SUMMARY\|definitely lost\|indirectly lost\)' | grep -v ': 0'
105
106 check-valgrind:
107         $(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool TOOL="valgrind $(VALGRIND_FLAGS)" \
108         2>&1 | tee valgrind-log $(valgrind_verbose)
109
110
111 else
112 check-am:
113         @echo "You need to have glib support enabled to run the tests"
114         @exit 77
115 endif
116
117 .PHONY: test-symbols check-tool check-valgrind
118
119 -include $(top_srcdir)/git.mk