1 # GLIB - Library of useful C routines
3 #GTESTER = gtester # for non-GLIB packages
4 #GTESTER_REPORT = gtester-report # for non-GLIB packages
5 GTESTER
= $(top_builddir
)/glib
/gtester
# for the GLIB package
6 GTESTER_REPORT
= $(top_builddir
)/glib
/gtester-report
# for the GLIB package
9 # initialize variables for unconditional += appending
12 CLEANFILES
= *.log
*.trs
14 MAINTAINERCLEANFILES
=
18 installed_test_LTLIBRARIES
=
19 installed_test_PROGRAMS
=
20 installed_test_SCRIPTS
=
21 nobase_installed_test_DATA
=
35 # test-nonrecursive: run tests only in cwd
37 test-nonrecursive
: ${TEST_PROGS}
38 @
test -z
"${TEST_PROGS}" || G_TEST_SRCDIR
="$(abs_srcdir)" G_TEST_BUILDDIR
="$(abs_builddir)" G_DEBUG
=gc-friendly MALLOC_CHECK_
=2 MALLOC_PERTURB_
=$$(($${RANDOM
:-256} % 256)) ${GTESTER} --verbose
${TEST_PROGS}
43 .PHONY
: test-nonrecursive
45 .PHONY
: lcov genlcov lcov-clean
46 # use recursive makes in order to ignore errors during check
48 -$(MAKE
) $(AM_MAKEFLAGS
) -k
check
49 $(MAKE
) $(AM_MAKEFLAGS
) genlcov
51 # we have to massage the lcov.info file slightly to hide the effect of libtool
52 # placing the objects files in the .libs/ directory separate from the *.c
53 # we also have to delete tests/.libs/libmoduletestplugin_*.gcda
55 rm -f
$(top_builddir
)/tests
/.libs
/libmoduletestplugin_
*.gcda
56 $(LTP
) --directory
$(top_builddir
) --capture
--output-file glib-lcov.
info --test-name GLIB_PERF
--no-checksum
--compat-libtool
57 LANG
=C
$(LTP_GENHTML
) --prefix $(top_builddir
) --output-directory glib-lcov
--title
"GLib Code Coverage" --legend
--frames
--show-details glib-lcov.
info
58 @echo
"file://$(abs_top_builddir)/glib-lcov/index.html"
61 -$(LTP
) --directory
$(top_builddir
) -z
62 -rm -rf glib-lcov.
info glib-lcov
63 -find
-name
'*.gcda' -print | xargs
rm
65 # run tests in cwd as part of make check
66 check-local
: test-nonrecursive
68 # We support a fairly large range of possible variables. It is expected that all types of files in a test suite
69 # will belong in exactly one of the following variables.
71 # First, we support the usual automake suffixes, but in lowercase, with the customary meaning:
73 # test_programs, test_scripts, test_data, test_ltlibraries
75 # The above are used to list files that are involved in both uninstalled and installed testing. The
76 # test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite.
77 # Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is
78 # installed in the same way as it appears in the package layout.
80 # In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled',
83 # installed_test_programs, uninstalled_test_programs
84 # installed_test_scripts, uninstalled_test_scripts
85 # installed_test_data, uninstalled_test_data
86 # installed_test_ltlibraries, uninstalled_test_ltlibraries
88 # Additionally, we support 'extra' infixes for programs and scripts. This is used for support programs/scripts
89 # that should not themselves be run as testcases (but exist to be used from other testcases):
91 # test_extra_programs, installed_test_extra_programs, uninstalled_test_extra_programs
92 # test_extra_scripts, installed_test_extra_scripts, uninstalled_test_extra_scripts
94 # Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data
95 # file automatically end up in the tarball.
97 # dist_test_scripts, dist_test_data, dist_test_extra_scripts
98 # dist_installed_test_scripts, dist_installed_test_data, dist_installed_test_extra_scripts
99 # dist_uninstalled_test_scripts, dist_uninstalled_test_data, dist_uninstalled_test_extra_scripts
101 # Note that no file is automatically disted unless it appears in one of the dist_ variables. This follows the
102 # standard automake convention of not disting programs scripts or data by default.
104 # test_programs, test_scripts, uninstalled_test_programs and uninstalled_test_scripts (as well as their disted
105 # variants) will be run as part of the in-tree 'make check'. These are all assumed to be runnable under
106 # gtester. That's a bit strange for scripts, but it's possible.
108 # we use test -z "$(TEST_PROGS)" above, so make sure we have no extra whitespace...
109 TEST_PROGS
+= $(strip $(test_programs
) $(test_scripts
) $(uninstalled_test_programs
) $(uninstalled_test_scripts
) \
110 $(dist_test_scripts
) $(dist_uninstalled_test_scripts
))
113 TESTS
+= $(test_programs
) $(test_scripts
) $(uninstalled_test_programs
) $(uninstalled_test_scripts
) \
114 $(dist_test_scripts
) $(dist_uninstalled_test_scripts
)
117 # Note: build even the installed-only targets during 'make check' to ensure that they still work.
118 # We need to do a bit of trickery here and manage disting via EXTRA_DIST instead of using dist_ prefixes to
119 # prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were
120 # filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'.
121 all_test_programs
= $(test_programs
) $(uninstalled_test_programs
) $(installed_test_programs
) \
122 $(test_extra_programs
) $(uninstalled_test_extra_programs
) $(installed_test_extra_programs
)
123 all_test_scripts
= $(test_scripts
) $(uninstalled_test_scripts
) $(installed_test_scripts
) \
124 $(test_extra_scripts
) $(uninstalled_test_extra_scripts
) $(installed_test_extra_scripts
)
125 all_dist_test_scripts
= $(dist_test_scripts
) $(dist_uninstalled_test_scripts
) $(dist_installed_test_scripts
) \
126 $(dist_test_extra_scripts
) $(dist_uninstalled_test_extra_scripts
) $(dist_installed_test_extra_scripts
)
127 all_test_scripts
+= $(all_dist_test_scripts
)
128 EXTRA_DIST
+= $(all_dist_test_scripts
)
129 all_test_data
= $(test_data
) $(uninstalled_test_data
) $(installed_test_data
)
130 all_dist_test_data
= $(dist_test_data
) $(dist_uninstalled_test_data
) $(dist_installed_test_data
)
131 all_test_data
+= $(all_dist_test_data
)
132 EXTRA_DIST
+= $(all_dist_test_data
)
133 all_test_ltlibs
= $(test_ltlibraries
) $(uninstalled_test_ltlibraries
) $(installed_test_ltlibraries
)
135 if ENABLE_ALWAYS_BUILD_TESTS
136 noinst_LTLIBRARIES
+= $(all_test_ltlibs
)
137 noinst_PROGRAMS
+= $(all_test_programs
)
138 noinst_SCRIPTS
+= $(all_test_scripts
)
139 noinst_DATA
+= $(all_test_data
)
141 check_LTLIBRARIES
+= $(all_test_ltlibs
)
142 check_PROGRAMS
+= $(all_test_programs
)
143 check_SCRIPTS
+= $(all_test_scripts
)
144 check_DATA
+= $(all_test_data
)
147 if ENABLE_INSTALLED_TESTS
148 installed_test_PROGRAMS
+= $(test_programs
) $(installed_test_programs
) \
149 $(test_extra_programs
) $(installed_test_extra_programs
)
150 installed_test_SCRIPTS
+= $(test_scripts
) $(installed_test_scripts
) \
151 $(test_extra_scripts
) $(test_installed_extra_scripts
)
152 installed_test_SCRIPTS
+= $(dist_test_scripts
) $(dist_test_extra_scripts
) \
153 $(dist_installed_test_scripts
) $(dist_installed_test_extra_scripts
)
154 nobase_installed_test_DATA
+= $(test_data
) $(installed_test_data
)
155 nobase_installed_test_DATA
+= $(dist_test_data
) $(dist_installed_test_data
)
156 installed_test_LTLIBRARIES
+= $(test_ltlibraries
) $(installed_test_ltlibraries
)
157 installed_testcases
= $(test_programs
) $(installed_test_programs
) \
158 $(test_scripts
) $(installed_test_scripts
) \
159 $(dist_test_scripts
) $(dist_installed_test_scripts
)
161 installed_test_meta_DATA
= $(installed_testcases
:=.
test)
163 %.
test: %$(EXEEXT
) Makefile
164 $(AM_V_GEN
) (echo
'[Test]' > $@.tmp
; \
165 echo
'Type=session' >> $@.tmp
; \
166 echo
'Exec=$(installed_testdir)/$<' >> $@.tmp
; \
169 CLEANFILES
+= $(installed_test_meta_DATA
)