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